ATLAS-1809 : UI : Update button in Edit tag attributes window should be enabled only when any update is done
Signed-off-by: nixonrodrigues <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/eff4ee1b Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/eff4ee1b Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/eff4ee1b Branch: refs/heads/0.8-incubating Commit: eff4ee1b0f13ab0be458fd14901efdee97586f0f Parents: aa9ea96 Author: Kalyani <[email protected]> Authored: Fri May 19 19:19:51 2017 +0530 Committer: nixonrodrigues <[email protected]> Committed: Sun May 28 10:57:55 2017 +0530 ---------------------------------------------------------------------- .../js/views/entity/CreateEntityLayoutView.js | 24 +++++++++++++------- .../public/js/views/tag/addTagModalView.js | 13 +++++++---- 2 files changed, 25 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/eff4ee1b/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js b/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js index 12edab6..d31a122 100644 --- a/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js +++ b/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js @@ -115,6 +115,17 @@ define(['require', this.listenTo(this.collection, 'error', function() { this.hideLoader(); }, this); + }, + onRender: function() { + this.bindEvents(); + if (!this.guid) { + this.bindRequiredField(); + } + this.showLoader(); + this.fetchCollections(); + }, + bindRequiredField: function() { + var that = this; this.ui.entityInputData.on("keyup change", "textarea", function(e) { var value = this.value; if (!value.length && $(this).hasClass('false')) { @@ -158,11 +169,6 @@ define(['require', } }); }, - onRender: function() { - this.bindEvents(); - this.showLoader(); - this.fetchCollections(); - }, bindNonRequiredField: function() { var that = this; this.ui.entityInputData.off('keyup change dp.change', 'input.false,select.false').on('keyup change dp.change', 'input.false,select.false', function(e) { @@ -332,9 +338,6 @@ define(['require', }); } }); - if (this.guid) { - this.bindNonRequiredField(); - } this.initializeValidation(); if (this.ui.entityInputData.find('fieldset').length > 0 && this.ui.entityInputData.find('select.true,input.true').length === 0) { this.requiredAllToggle(this.ui.entityInputData.find('select.true,input.true').length === 0); @@ -723,7 +726,12 @@ define(['require', if (selectedValue) { $this.val(selectedValue).trigger("change"); } + }); + if (this.guid) { + this.bindRequiredField(); + this.bindNonRequiredField(); + } this.hideLoader(); } }); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/eff4ee1b/dashboardv2/public/js/views/tag/addTagModalView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/addTagModalView.js b/dashboardv2/public/js/views/tag/addTagModalView.js index a7cb7b5..7eaf23c 100644 --- a/dashboardv2/public/js/views/tag/addTagModalView.js +++ b/dashboardv2/public/js/views/tag/addTagModalView.js @@ -62,14 +62,13 @@ define(['require', okText: 'Add', cancelText: "Cancel", allowCancel: true, - }, - state = this.tagModel ? false : true; + }; if (this.tagModel) { modalObj.title = 'Edit Tag'; modalObj.okText = 'Update'; } this.modal = new Modal(modalObj).open(); - this.modal.$el.find('button.ok').attr("disabled", state); + this.modal.$el.find('button.ok').attr("disabled", true); this.on('ok', function() { var tagName = this.tagModel ? this.tagModel.typeName : this.ui.addTagOptions.val(), tagAttributes = {}, @@ -242,11 +241,17 @@ define(['require', this.subAttributeData(attributeDefs); }, showAttributeBox: function() { + var that = this; this.$('.attrLoader').hide(); this.$('.form-group.hide').removeClass('hide'); if (this.ui.tagAttribute.children().length !== 0) { this.ui.tagAttribute.parent().show(); } + this.ui.tagAttribute.find('input,select').on("keyup change", function(e) { + if (e.keyCode != 32) { + that.modal.$el.find('button.ok').attr("disabled", false); + } + }); }, hideAttributeBox: function() { this.ui.tagAttribute.children().empty(); @@ -264,7 +269,7 @@ define(['require', var str = "<option disabled='disabled'" + (!that.tagModel ? 'selected' : '') + ">-- Select " + typeName + " --</option>"; var enumValue = typeNameValue.get('elementDefs'); _.each(enumValue, function(key, value) { - str += '<option ' + (that.tagModel && key.value === _.values(that.tagModel.attributes)[0] ? 'selected' : '') + '>' + key.value + '</option>'; + str += '<option ' + (that.tagModel && key.value === that.tagModel.attributes[name] ? 'selected' : '') + '>' + key.value + '</option>'; }) that.ui.tagAttribute.append('<div class="form-group"><label>' + name + '</label>' + '<select class="form-control attributeInputVal attrName" data-key="' + name + '">' + str + '</select></div>');
