You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by kb...@apache.org on 2017/02/15 12:37:37 UTC

incubator-atlas git commit: ATLAS-1477, ATLAS-1556 : Edit entity button not working from search table of tag detail page.

Repository: incubator-atlas
Updated Branches:
  refs/heads/master 58bbee4ce -> 9b8a5ddcb


 ATLAS-1477, ATLAS-1556 : Edit entity button not working from search table of tag detail page.


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

Branch: refs/heads/master
Commit: 9b8a5ddcb1582140ba9722a6dcfba8dffbe82e1f
Parents: 58bbee4
Author: kevalbhatt <kb...@apache.org>
Authored: Wed Feb 15 11:54:19 2017 +0530
Committer: kevalbhatt <kb...@apache.org>
Committed: Wed Feb 15 18:06:14 2017 +0530

----------------------------------------------------------------------
 dashboardv2/public/js/router/Router.js          |  1 +
 .../js/views/entity/CreateEntityLayoutView.js   | 42 ++++++++++++++------
 .../public/js/views/tag/TagDetailLayoutView.js  |  3 +-
 release-log.txt                                 |  1 +
 4 files changed, 34 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/9b8a5ddc/dashboardv2/public/js/router/Router.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/router/Router.js b/dashboardv2/public/js/router/Router.js
index 5fbd656..ee3cd56 100644
--- a/dashboardv2/public/js/router/Router.js
+++ b/dashboardv2/public/js/router/Router.js
@@ -174,6 +174,7 @@ define([
                 if (tagName) {
                     App.rNContent.show(new TagDetailLayoutView({
                         'tag': tagName,
+                        'entityDefCollection': that.entityDefCollection,
                         'collection': that.tagCollection
                     }));
                 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/9b8a5ddc/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 1b465c2..44bcf83 100644
--- a/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js
+++ b/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js
@@ -112,9 +112,7 @@ define(['require',
                         }
                     }
                 }).open();
-
                 this.modal.$el.find('button.ok').attr("disabled", true);
-                this.ui.entityList.val("");
                 this.modal.on('ok', function(e) {
                     that.okButton();
                 });
@@ -154,23 +152,37 @@ define(['require',
                         if (value && value.length) {
                             JSON.parse(value);
                             $(this).removeClass('errorClass');
+                            that.modal.$el.find('button.ok').prop("disabled", false);
                         }
                     } catch (err) {
                         $(this).addClass('errorClass');
+                        that.modal.$el.find('button.ok').prop("disabled", true);
                     }
                 });
+
+                if (this.guid) {
+                    this.bindNonRequiredField();
+                }
                 this.ui.entityInputData.on('keyup change dp.change', 'input.true,select.true', function(e) {
                     if (this.value !== "") {
                         if ($(this).data('select2')) {
-                            $(this).data('select2').$container.find('.select2-selection').removeClass("errorClass")
+                            $(this).data('select2').$container.find('.select2-selection').removeClass("errorClass");
+                            if (that.ui.entityInputData.find('.errorClass').length === 0) {
+                                that.modal.$el.find('button.ok').prop("disabled", false);
+                            }
                         } else {
                             $(this).removeClass('errorClass');
+                            if (that.ui.entityInputData.find('.errorClass').length === 0) {
+                                that.modal.$el.find('button.ok').prop("disabled", false);
+                            }
                         }
                     } else {
                         if ($(this).data('select2')) {
-                            $(this).data('select2').$container.find('.select2-selection').addClass("errorClass")
+                            $(this).data('select2').$container.find('.select2-selection').addClass("errorClass");
+                            that.modal.$el.find('button.ok').prop("disabled", true);
                         } else {
                             $(this).addClass('errorClass');
+                            that.modal.$el.find('button.ok').prop("disabled", true);
                         }
                     }
                 });
@@ -179,6 +191,14 @@ define(['require',
                 this.bindEvents();
                 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) {
+                    if (that.modal.$el.find('button.ok').prop('disabled') && that.ui.entityInputData.find('.errorClass').length === 0) {
+                        that.modal.$el.find('button.ok').prop("disabled", false);
+                    }
+                });
+            },
             decrementCounter: function(counter) {
                 if (this[counter] > 0) {
                     --this[counter];
@@ -205,7 +225,7 @@ define(['require',
                     this.ui.assetName.html(name);
                     this.onEntityChange(null, this.entityData);
                 } else {
-                    var str = '<option selected="selected" disabled="disabled">--Select entity-type--</option>';
+                    var str = '<option disabled="disabled" selected>--Select entity-type--</option>';
                     this.entityDefCollection.fullCollection.comparator = function(model) {
                         return model.get('name');
                     }
@@ -245,7 +265,6 @@ define(['require',
 
             },
             onEntityChange: function(e, value) {
-                this.modal.$el.find('button.ok').prop("disabled", false);
                 var that = this,
                     typeName = value && value.get('entity') ? value.get('entity').typeName : null;
                 this.showLoader();
@@ -325,6 +344,9 @@ define(['require',
 
                     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);
+                        if (!this.guid) {
+                            this.bindNonRequiredField();
+                        }
                         this.ui.toggleRequired.prop('checked', true);
                     } else {
                         this.ui.entityInputData.find('fieldset').each(function() {
@@ -579,8 +601,8 @@ define(['require',
                             if (that.guid && that.callback) {
                                 that.callback();
                             } else {
-                                if (model.entitiesMutated && (model.entitiesMutated.CREATE || model.entitiesMutated.UPDATE)) {
-                                    that.setUrl('#!/detailPage/' + (model.entitiesMutated.CREATE ? model.entitiesMutated.CREATE[0].guid : model.entitiesMutated.UPDATE[0].guid), true);
+                                if (model.createdEntities && _.isArray(model.createdEntities) && model.createdEntities[0] && model.createdEntities[0].guid) {
+                                    that.setUrl('#!/detailPage/' + (model.createdEntities[0].guid), true);
                                 }
                             }
                         },
@@ -619,7 +641,6 @@ define(['require',
                     var that = this,
                         queryText,
                         str = '';
-
                     // Add oprions in select
                     if (this.selectStoreCollection.length) {
                         var appendOption = function(optionValue) {
@@ -654,9 +675,6 @@ define(['require',
                         if (that.guid) {
                             var dataValue = that.entityData.get("entity").attributes[keyData];
                             var selectedValue = [];
-                            // if (that.selectStoreCollection.length) {
-                            //     var selectedValue = [];
-                            // }
                             var setValue = function(selectValue) {
                                 var obj = selectValue.toJSON();
                                 if (dataValue !== null && _.isArray(dataValue)) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/9b8a5ddc/dashboardv2/public/js/views/tag/TagDetailLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/tag/TagDetailLayoutView.js b/dashboardv2/public/js/views/tag/TagDetailLayoutView.js
index 6bdaf39..cebc104 100644
--- a/dashboardv2/public/js/views/tag/TagDetailLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagDetailLayoutView.js
@@ -44,7 +44,7 @@ define(['require',
              * @constructs
              */
             initialize: function(options) {
-                _.extend(this, _.pick(options, 'tag', 'collection'));
+                _.extend(this, _.pick(options, 'tag', 'collection', 'entityDefCollection'));
             },
             bindEvents: function() {},
             onRender: function() {
@@ -60,6 +60,7 @@ define(['require',
                     };
                     that.RSearchResultLayoutView.show(new SearchResultLayoutView({
                         value: value,
+                        entityDefCollection: that.entityDefCollection,
                         tag: that.tag
                     }));
                 });

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/9b8a5ddc/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 38b85fb..007e235 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
 ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
 
 ALL CHANGES:
+ATLAS-1556 Edit entity button not working from search table of tag detail page. (kevalbhatt)
 ATLAS-1559 Regression - If a new tag is created then the earlier tags doesn't render properly (kevalbhatt)
 ATLAS-1508 Make AtlasADAuthenticationProvider like Ranger ADLdap Methods (gss2002 via mneethiraj)
 ATLAS-1547 Add tests for DeleteHandlerV1 (sumasai via mneethiraj)