You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ni...@apache.org on 2021/05/27 13:56:16 UTC

[atlas] 02/04: ATLAS-4309:Atlas UI: After deleting the sub-classifications from Atlas UI, they still appear in UI, fixed

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

nixon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit aa001dbf7c08c9de2bb9eae27ac0581b09b5c403
Author: prasad pawar <pr...@freestoneinfotech.com>
AuthorDate: Wed May 26 18:49:47 2021 +0530

    ATLAS-4309:Atlas UI: After deleting the sub-classifications from Atlas UI, they still appear in UI, fixed
    
    Signed-off-by: nixonrodrigues <ni...@apache.org>
---
 dashboardv2/public/js/views/tag/TagLayoutView.js          | 12 +++++++++++-
 .../js/views/search/tree/ClassificationTreeLayoutView.js  | 15 ++++++++++++---
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/dashboardv2/public/js/views/tag/TagLayoutView.js b/dashboardv2/public/js/views/tag/TagLayoutView.js
index bde61b8..f408469 100644
--- a/dashboardv2/public/js/views/tag/TagLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagLayoutView.js
@@ -616,13 +616,23 @@ define(['require',
             },
             onNotifyOk: function(data) {
                 var that = this,
-                    deleteTagData = this.collection.fullCollection.findWhere({ name: this.tag });
+                    deleteTagData = this.collection.fullCollection.findWhere({ name: this.tag }),
+                    superTypeOfDeleteTag = deleteTagData.get('superTypes'),
+                    superTypeObj = superTypeOfDeleteTag ? this.collection.fullCollection.findWhere({ name: superTypeOfDeleteTag[0] }) : null;
+
                 deleteTagData.deleteTag({
                     typeName: that.tag,
                     success: function() {
                         Utils.notifySuccess({
                             content: "Classification " + that.tag + Messages.getAbbreviationMsg(false, 'deleteSuccessMessage')
                         });
+                        //delete current classification from subTypes list of parent classification if any
+                        if (superTypeObj) {
+                            var parentSubTypeUpdate = _.reject(superTypeObj.get('subTypes'), function(subtype) {
+                                return subtype === that.tag;
+                            });
+                            superTypeObj.set('subTypes', parentSubTypeUpdate);
+                        }
                         // if deleted tag is prviously searched then remove that tag url from save state of tab.
                         var searchUrl = Globals.saveApplicationState.tabState.searchUrl;
                         var urlObj = Utils.getUrlState.getQueryParams(searchUrl);
diff --git a/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js b/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js
index b64b101..75e53cd 100644
--- a/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js
+++ b/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js
@@ -865,16 +865,25 @@ define([
             if (this.tagId) {
                 var deleteTagData = this.classificationDefCollection.fullCollection.findWhere({ guid: this.tagId });
                 if (deleteTagData) {
-                    var tagName = deleteTagData.get("name");
+                    var tagName = deleteTagData.get("name"),
+                        superTypeOfDeleteTag = deleteTagData.get('superTypes'),
+                        superTypeObj = superTypeOfDeleteTag ? this.classificationDefCollection.fullCollection.findWhere({ name: superTypeOfDeleteTag[0] }) : null;
                     deleteTagData.deleteTag({
                         typeName: tagName,
                         success: function() {
                             Utils.notifySuccess({
                                 content: "Classification " + tagName + Messages.getAbbreviationMsg(false, 'deleteSuccessMessage')
                             });
+                            //delete current classification from subTypes list of parent classification if any
+                            if (superTypeObj) {
+                                var parentSubTypeUpdate = _.reject(superTypeObj.get('subTypes'), function(subtype) {
+                                    return subtype === tagName;
+                                });
+                                superTypeObj.set('subTypes', parentSubTypeUpdate);
+                            }
                             // if deleted tag is prviously searched then remove that tag url from save state of tab.
-                            var searchUrl = Globals.saveApplicationState.tabState.searchUrl;
-                            var urlObj = Utils.getUrlState.getQueryParams(searchUrl);
+                            var searchUrl = Globals.saveApplicationState.tabState.searchUrl,
+                                urlObj = Utils.getUrlState.getQueryParams(searchUrl);
                             that.classificationDefCollection.fullCollection.remove(deleteTagData);
                             // to update tag list of search tab fetch typeHeaders.
                             //that.typeHeaders.fetch({ reset: true });