atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ni...@apache.org
Subject [3/5] incubator-atlas git commit: ATLAS-1809 : UI : Update button in Edit tag attributes window should be enabled only when any update is done
Date Fri, 26 May 2017 10:20:29 GMT
ATLAS-1809 : UI : Update button in Edit tag attributes window should be enabled only when any
update is done

Signed-off-by: nixonrodrigues <nixon@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/bd69a4f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/bd69a4f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/bd69a4f1

Branch: refs/heads/master
Commit: bd69a4f1c6012c4b1a61594b91458990d5b9a26a
Parents: 363b88c
Author: Kalyani <kalyani.kashikar@freestoneinfotech.com>
Authored: Fri May 19 19:19:51 2017 +0530
Committer: nixonrodrigues <nixon@apache.org>
Committed: Fri May 26 15:47:47 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/bd69a4f1/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/bd69a4f1/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>');


Mime
View raw message