This is an automated email from the ASF dual-hosted git repository.

pinal pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 13f1d81  ATLAS-4426:UI:#1 In search results page, user should not be 
able to access the option for applying term or classification for historical 
entity, fixed
13f1d81 is described below

commit 13f1d81ac930a40000f2aaac46b6557756b8092d
Author: prasad pawar <prasad.pa...@freestoneinfotech.com>
AuthorDate: Fri Sep 17 11:55:49 2021 +0530

    ATLAS-4426:UI:#1 In search results page, user should not be able to access 
the option for applying term or classification for historical entity, fixed
    
    Signed-off-by: Pinal Shah <pinal.s...@freestoneinfotech.com>
---
 .../js/views/glossary/AssignTermLayoutView.js      | 10 +++++++---
 .../js/views/search/SearchResultLayoutView.js      | 22 ++++++++++++++--------
 dashboardv2/public/js/views/tag/AddTagModalView.js |  9 ++++++---
 .../js/views/glossary/AssignTermLayoutView.js      | 11 +++++++----
 .../js/views/search/SearchResultLayoutView.js      | 22 ++++++++++++++--------
 dashboardv3/public/js/views/tag/AddTagModalView.js |  9 ++++++---
 6 files changed, 54 insertions(+), 29 deletions(-)

diff --git a/dashboardv2/public/js/views/glossary/AssignTermLayoutView.js 
b/dashboardv2/public/js/views/glossary/AssignTermLayoutView.js
index e9c4a71..b4e6a48 100644
--- a/dashboardv2/public/js/views/glossary/AssignTermLayoutView.js
+++ b/dashboardv2/public/js/views/glossary/AssignTermLayoutView.js
@@ -138,9 +138,9 @@ define(['require',
                         },
                         onFinished: function(event, currentIndex) {
                             var $assignBtn = $(this).find('a[href="#finish"]');
-                            if(!$assignBtn.attr('disabled')){
+                            if (!$assignBtn.attr('disabled')) {
                                 $assignBtn.attr('disabled', 
true).showButtonLoader();
-                                
$assignBtn.parent().attr('aria-disabled','true').addClass('disabled');
+                                $assignBtn.parent().attr('aria-disabled', 
'true').addClass('disabled');
                                 that.assignTerm();
                             }
                         },
@@ -171,8 +171,11 @@ define(['require',
                         cust_error: function() {
                             var $assignBtn = 
that.$el.find('a[href="#finish"]');
                             
$assignBtn.removeAttr('disabled').hideButtonLoader();
-                            
$assignBtn.parent().attr('aria-disabled','false').removeClass('disabled');
+                            $assignBtn.parent().attr('aria-disabled', 
'false').removeClass('disabled');
                             that.assignTermError = true;
+                        },
+                        complete: function() {
+                            that.modal.trigger('closeModal');
                         }
                     },
                     model = new this.glossaryCollection.model();
@@ -228,6 +231,7 @@ define(['require',
                                     "</b> " + (deletedEntity.length === 1 ? 
"entity " : "entities ") +
                                     Messages.assignTermDeletedEntity
                             });
+                            that.modal.close();
                         }
                     } else {
                         data.push({ "guid": that.guid });
diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js 
b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
index 74dc58d..04e6856 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -154,6 +154,7 @@ define(['require',
                 this.offset = 0;
                 this.bindEvents();
                 this.multiSelectEntity = [];
+                this.activeEntityCountSelected = 0;
                 this.searchType = 'Basic Search';
                 this.columnOrder = null;
                 this.defaultColumns = ["selected", "name", "description", 
"typeName", "owner", "tag", "term"];
@@ -189,6 +190,7 @@ define(['require',
                 this.onClickLoadMore();
                 this.listenTo(this.searchCollection, 'backgrid:selected', 
function(model, checked) {
                     this.multiSelectEntity = [];
+                    that.activeEntityCountSelected = 0;
                     if (checked === true) {
                         model.set("isEnable", true);
                     } else {
@@ -197,6 +199,9 @@ define(['require',
                     this.searchCollection.find(function(item) {
                         if (item.get('isEnable')) {
                             var obj = item.toJSON();
+                            if (item.get('status') === 'ACTIVE') {
+                                that.activeEntityCountSelected++;
+                            }
                             that.multiSelectEntity.push({
                                 id: obj.guid,
                                 model: obj
@@ -342,10 +347,11 @@ define(['require',
                 }, options));
             },
             updateMultiSelect: function() {
-                if (this.multiSelectEntity.length > 0) {
-                    this.$('.multiSelectTag,.multiSelectTerm').show();
+                var addTermTagButton = 
this.$('.multiSelectTag,.multiSelectTerm');
+                if (this.activeEntityCountSelected > 0) {
+                    addTermTagButton.show();
                 } else {
-                    this.$('.multiSelectTag,.multiSelectTerm').hide();
+                    addTermTagButton.hide();
                 }
             },
             updateColumnList: function(updatedList) {
@@ -372,6 +378,8 @@ define(['require',
                     isSearchTab = Utils.getUrlState.isSearchTab(),
                     tagFilters = null,
                     entityFilters = null;
+                that.activeEntityCountSelected = 0;
+                that.updateMultiSelect();
                 if (isSearchTab) {
                     tagFilters = 
CommonViewFunction.attributeFilter.generateAPIObj(this.value.tagFilters);
                     entityFilters = 
CommonViewFunction.attributeFilter.generateAPIObj(this.value.entityFilters);
@@ -485,7 +493,6 @@ define(['require',
                         that.ui.activePage.text(that.activePage);
                         that.renderTableLayoutView();
                         that.multiSelectEntity = [];
-                        that.updateMultiSelect();
 
                         if (dataLength > 0) {
                             that.$('.searchTable').removeClass('noData')
@@ -1057,15 +1064,15 @@ define(['require',
                     };
                 }
             },
-            addTagModalView: function(guid, multiple) {
+            addTagModalView: function(guid, multiple, entityCount) {
                 var that = this;
                 require(['views/tag/AddTagModalView'], 
function(AddTagModalView) {
                     var view = new AddTagModalView({
                         guid: guid,
                         multiple: multiple,
+                        entityCount: entityCount,
                         callback: function() {
                             that.multiSelectEntity = [];
-                            that.$('.multiSelectTag,.multiSelectTerm').hide();
                             that.fetchCollection();
                             if (that.searchVent) {
                                 that.searchVent.trigger('entityList:refresh');
@@ -1116,7 +1123,7 @@ define(['require',
                     that = this,
                     isTagMultiSelect = 
$(e.currentTarget).hasClass('multiSelectTag');
                 if (isTagMultiSelect && this.multiSelectEntity && 
this.multiSelectEntity.length) {
-                    that.addTagModalView(guid, this.multiSelectEntity);
+                    that.addTagModalView(guid, this.multiSelectEntity, 
this.activeEntityCountSelected);
                 } else {
                     guid = that.$(e.currentTarget).data("guid");
                     that.addTagModalView(guid);
@@ -1139,7 +1146,6 @@ define(['require',
                             associatedTerms: obj.associatedTerms,
                             callback: function() {
                                 that.multiSelectEntity = [];
-                                
that.$('.multiSelectTag,.multiSelectTerm').hide();
                                 that.fetchCollection();
                             },
                             glossaryCollection: glossaryCollection,
diff --git a/dashboardv2/public/js/views/tag/AddTagModalView.js 
b/dashboardv2/public/js/views/tag/AddTagModalView.js
index 5c5581b..da70dc4 100644
--- a/dashboardv2/public/js/views/tag/AddTagModalView.js
+++ b/dashboardv2/public/js/views/tag/AddTagModalView.js
@@ -110,7 +110,7 @@ define(['require',
          * @constructs
          */
         initialize: function(options) {
-            _.extend(this, _.pick(options, 'modalCollection', 'guid', 
'callback', 'multiple', 'showLoader', 'hideLoader', 'tagList', 'tagModel', 
'enumDefCollection'));
+            _.extend(this, _.pick(options, 'modalCollection', 'guid', 
'callback', 'multiple', 'entityCount', 'showLoader', 'hideLoader', 'tagList', 
'tagModel', 'enumDefCollection'));
             this.commonCollection = new VTagList();
             if (this.tagModel) {
                 this.collection = new 
Backbone.Collection(this.tagModel.validityPeriods);
@@ -185,6 +185,7 @@ define(['require',
                                 "</b> " + (obj.deletedEntity.length === 1 ? 
"entity " : "entities ") +
                                 Messages.assignDeletedEntity
                         });
+                        that.modal.close();
                     }
                     if (obj.skipEntity.length) {
                         var text = "<b>" + obj.skipEntity.length + " of " + 
that.multiple.length +
@@ -486,7 +487,7 @@ define(['require',
                 success: function(data) {
                     var addupdatetext = that.tagModel ? 'updated successfully 
to ' : 'added to ';
                     Utils.notifySuccess({
-                        content: "Classification " + tagName + " has been " + 
addupdatetext + (that.multiple ? "entities" : "entity")
+                        content: "Classification " + tagName + " has been " + 
addupdatetext + (that.entityCount > 1 ? "entities" : "entity")
                     });
                     if (options.modalCollection) {
                         options.modalCollection.fetch({ reset: true });
@@ -494,13 +495,15 @@ define(['require',
                     if (that.callback) {
                         that.callback();
                     }
-                    that.modal.close();
                 },
                 cust_error: function(model, response) {
                     that.modal.$el.find('button.ok').hideButtonLoader();
                     if (that.hideLoader) {
                         that.hideLoader();
                     }
+                },
+                complete: function() {
+                    that.modal.close();
                 }
             });
         },
diff --git a/dashboardv3/public/js/views/glossary/AssignTermLayoutView.js 
b/dashboardv3/public/js/views/glossary/AssignTermLayoutView.js
index e9c4a71..a88b57c 100644
--- a/dashboardv3/public/js/views/glossary/AssignTermLayoutView.js
+++ b/dashboardv3/public/js/views/glossary/AssignTermLayoutView.js
@@ -138,9 +138,9 @@ define(['require',
                         },
                         onFinished: function(event, currentIndex) {
                             var $assignBtn = $(this).find('a[href="#finish"]');
-                            if(!$assignBtn.attr('disabled')){
+                            if (!$assignBtn.attr('disabled')) {
                                 $assignBtn.attr('disabled', 
true).showButtonLoader();
-                                
$assignBtn.parent().attr('aria-disabled','true').addClass('disabled');
+                                $assignBtn.parent().attr('aria-disabled', 
'true').addClass('disabled');
                                 that.assignTerm();
                             }
                         },
@@ -163,7 +163,6 @@ define(['require',
                             Utils.notifySuccess({
                                 content: (that.isCategoryView || 
that.isEntityView || that.isAttributeRelationView ? "Term" : "Category") + " is 
associated successfully "
                             });
-                            that.modal.trigger('closeModal');
                             if (that.callback) {
                                 that.callback();
                             }
@@ -171,8 +170,11 @@ define(['require',
                         cust_error: function() {
                             var $assignBtn = 
that.$el.find('a[href="#finish"]');
                             
$assignBtn.removeAttr('disabled').hideButtonLoader();
-                            
$assignBtn.parent().attr('aria-disabled','false').removeClass('disabled');
+                            $assignBtn.parent().attr('aria-disabled', 
'false').removeClass('disabled');
                             that.assignTermError = true;
+                        },
+                        complete: function() {
+                            that.modal.trigger('closeModal');
                         }
                     },
                     model = new this.glossaryCollection.model();
@@ -228,6 +230,7 @@ define(['require',
                                     "</b> " + (deletedEntity.length === 1 ? 
"entity " : "entities ") +
                                     Messages.assignTermDeletedEntity
                             });
+                            that.modal.close();
                         }
                     } else {
                         data.push({ "guid": that.guid });
diff --git a/dashboardv3/public/js/views/search/SearchResultLayoutView.js 
b/dashboardv3/public/js/views/search/SearchResultLayoutView.js
index 26bd969..c31db48 100644
--- a/dashboardv3/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv3/public/js/views/search/SearchResultLayoutView.js
@@ -161,6 +161,7 @@ define(['require',
                 this.offset = 0;
                 this.bindEvents();
                 this.multiSelectEntity = [];
+                this.activeEntityCountSelected = 0;
                 this.searchType = 'Basic Search';
                 this.columnOrder = null;
                 this.defaultColumns = ["selected", "name", "description", 
"typeName", "owner", "tag", "term"];
@@ -196,6 +197,7 @@ define(['require',
                 this.onClickLoadMore();
                 this.listenTo(this.searchCollection, 'backgrid:selected', 
function(model, checked) {
                     this.multiSelectEntity = [];
+                    that.activeEntityCountSelected = 0;
                     if (checked === true) {
                         model.set("isEnable", true);
                     } else {
@@ -204,6 +206,9 @@ define(['require',
                     this.searchCollection.find(function(item) {
                         if (item.get('isEnable')) {
                             var obj = item.toJSON();
+                            if (item.get('status') === 'ACTIVE') {
+                                that.activeEntityCountSelected++;
+                            }
                             that.multiSelectEntity.push({
                                 id: obj.guid,
                                 model: obj
@@ -356,10 +361,11 @@ define(['require',
                 }, options));
             },
             updateMultiSelect: function() {
-                if (this.multiSelectEntity.length > 0) {
-                    this.$('.multiSelectTag,.multiSelectTerm').show();
+                var addTermTagButton = 
this.$('.multiSelectTag,.multiSelectTerm');
+                if (this.activeEntityCountSelected > 0) {
+                    addTermTagButton.show();
                 } else {
-                    this.$('.multiSelectTag,.multiSelectTerm').hide();
+                    addTermTagButton.hide();
                 }
             },
             updateColumnList: function(updatedList) {
@@ -386,6 +392,8 @@ define(['require',
                     isSearchTab = Utils.getUrlState.isSearchTab(),
                     tagFilters = null,
                     entityFilters = null;
+                that.activeEntityCountSelected = 0;
+                that.updateMultiSelect();
                 if (isSearchTab) {
                     tagFilters = 
CommonViewFunction.attributeFilter.generateAPIObj(this.value.tagFilters);
                     entityFilters = 
CommonViewFunction.attributeFilter.generateAPIObj(this.value.entityFilters);
@@ -499,7 +507,6 @@ define(['require',
                         that.ui.activePage.text(that.activePage);
                         that.renderTableLayoutView();
                         that.multiSelectEntity = [];
-                        that.updateMultiSelect();
 
                         if (dataLength > 0) {
                             that.$('.searchTable').removeClass('noData')
@@ -1072,18 +1079,18 @@ define(['require',
                     };
                 }
             },
-            addTagModalView: function(guid, multiple) {
+            addTagModalView: function(guid, multiple, entityCount) {
                 var that = this;
                 require(['views/tag/AddTagModalView'], 
function(AddTagModalView) {
                     var view = new AddTagModalView({
                         guid: guid,
                         multiple: multiple,
+                        entityCount: entityCount,
                         callback: function() {
                             if (that.searchVent) {
                                 
that.searchVent.trigger("Classification:Count:Update");
                             }
                             that.multiSelectEntity = [];
-                            that.$('.multiSelectTag,.multiSelectTerm').hide();
                             that.fetchCollection();
                         },
                         tagList: that.getTagList(guid, multiple),
@@ -1132,7 +1139,7 @@ define(['require',
                     that = this,
                     isTagMultiSelect = 
$(e.currentTarget).hasClass('multiSelectTag');
                 if (isTagMultiSelect && this.multiSelectEntity && 
this.multiSelectEntity.length) {
-                    that.addTagModalView(guid, this.multiSelectEntity);
+                    that.addTagModalView(guid, this.multiSelectEntity, 
this.activeEntityCountSelected);
                 } else {
                     guid = that.$(e.currentTarget).data("guid");
                     that.addTagModalView(guid);
@@ -1155,7 +1162,6 @@ define(['require',
                             associatedTerms: obj.associatedTerms,
                             callback: function() {
                                 that.multiSelectEntity = [];
-                                
that.$('.multiSelectTag,.multiSelectTerm').hide();
                                 that.fetchCollection();
                             },
                             glossaryCollection: glossaryCollection,
diff --git a/dashboardv3/public/js/views/tag/AddTagModalView.js 
b/dashboardv3/public/js/views/tag/AddTagModalView.js
index 5c5581b..da70dc4 100644
--- a/dashboardv3/public/js/views/tag/AddTagModalView.js
+++ b/dashboardv3/public/js/views/tag/AddTagModalView.js
@@ -110,7 +110,7 @@ define(['require',
          * @constructs
          */
         initialize: function(options) {
-            _.extend(this, _.pick(options, 'modalCollection', 'guid', 
'callback', 'multiple', 'showLoader', 'hideLoader', 'tagList', 'tagModel', 
'enumDefCollection'));
+            _.extend(this, _.pick(options, 'modalCollection', 'guid', 
'callback', 'multiple', 'entityCount', 'showLoader', 'hideLoader', 'tagList', 
'tagModel', 'enumDefCollection'));
             this.commonCollection = new VTagList();
             if (this.tagModel) {
                 this.collection = new 
Backbone.Collection(this.tagModel.validityPeriods);
@@ -185,6 +185,7 @@ define(['require',
                                 "</b> " + (obj.deletedEntity.length === 1 ? 
"entity " : "entities ") +
                                 Messages.assignDeletedEntity
                         });
+                        that.modal.close();
                     }
                     if (obj.skipEntity.length) {
                         var text = "<b>" + obj.skipEntity.length + " of " + 
that.multiple.length +
@@ -486,7 +487,7 @@ define(['require',
                 success: function(data) {
                     var addupdatetext = that.tagModel ? 'updated successfully 
to ' : 'added to ';
                     Utils.notifySuccess({
-                        content: "Classification " + tagName + " has been " + 
addupdatetext + (that.multiple ? "entities" : "entity")
+                        content: "Classification " + tagName + " has been " + 
addupdatetext + (that.entityCount > 1 ? "entities" : "entity")
                     });
                     if (options.modalCollection) {
                         options.modalCollection.fetch({ reset: true });
@@ -494,13 +495,15 @@ define(['require',
                     if (that.callback) {
                         that.callback();
                     }
-                    that.modal.close();
                 },
                 cust_error: function(model, response) {
                     that.modal.$el.find('button.ok').hideButtonLoader();
                     if (that.hideLoader) {
                         that.hideLoader();
                     }
+                },
+                complete: function() {
+                    that.modal.close();
                 }
             });
         },

Reply via email to