atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [1/2] incubator-atlas git commit: ATLAS-1425: Integrate Discovery/Search API in Atlas UI ATLAS-1482: UI update in assigning a tag to multiple entities using single API call
Date Wed, 25 Jan 2017 15:27:23 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 6679c8eed -> c9c26d741


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c9c26d74/dashboardv2/public/js/views/graph/LineageLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/graph/LineageLayoutView.js b/dashboardv2/public/js/views/graph/LineageLayoutView.js
index 7dae6d8..853b0bd 100644
--- a/dashboardv2/public/js/views/graph/LineageLayoutView.js
+++ b/dashboardv2/public/js/views/graph/LineageLayoutView.js
@@ -102,8 +102,7 @@ define(['require',
                     },
                     cust_error: function(model, response) {
                         that.noLineage();
-                    },
-                    complete: function() {}
+                    }
                 })
             },
             noLineage: function() {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c9c26d74/dashboardv2/public/js/views/schema/SchemaLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/schema/SchemaLayoutView.js b/dashboardv2/public/js/views/schema/SchemaLayoutView.js
index 8d7dfe4..483b36c 100644
--- a/dashboardv2/public/js/views/schema/SchemaLayoutView.js
+++ b/dashboardv2/public/js/views/schema/SchemaLayoutView.js
@@ -123,9 +123,14 @@ define(['require',
                     this.schemaCollection.find(function(item) {
                         if (item.get('isEnable')) {
                             var term = [];
+                            var obj = {}
+                            obj['displayText'] = item.get("name") || item.get("qualifiedName")
+                            obj['status'] = item.get("$id$").state;
+                            obj['classificationNames'] = _.keys(item.get('$traits$'));
+                            obj['guid'] = item.get("$id$").id || item.get("$id$");
                             that.arr.push({
-                                id: item.get("$id$"),
-                                model: item
+                                id: item.get("$id$").id || item.get("$id$"),
+                                model: obj
                             });
                         }
                     });
@@ -164,6 +169,7 @@ define(['require',
                 var that = this;
                 this.$('.fontLoader').show();
                 this.schemaCollection.fetch({
+                    skipDefaultError: true,
                     success: function() {
                         that.schemaCollection.sortByKey('position');
                         that.renderTableLayoutView();
@@ -173,6 +179,9 @@ define(['require',
                     silent: true
                 });
             },
+            hideLoader: function(argument) {
+                this.$('.fontLoader').hide();
+            },
             renderTableLayoutView: function() {
                 var that = this,
                     count = 5;
@@ -318,7 +327,12 @@ define(['require',
                     className: 'searchTag',
                     formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                         fromRaw: function(rawValue, model) {
-                            return CommonViewFunction.tagForTable(model);
+                            return CommonViewFunction.tagForTable({
+                                classificationNames: _.keys(model.get('$traits$')),
+                                guid: model.get('$id$').id || model.get('$id$') || model.get('guid'),
+                                displayText: model.get('name'),
+                                status: model.get('$id$').state
+                            });
                         }
                     })
                 };
@@ -332,7 +346,12 @@ define(['require',
                         className: 'searchTerm',
                         formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                             fromRaw: function(rawValue, model) {
-                                var returnObject = CommonViewFunction.termTableBreadcrumbMaker(model,
"schema");
+                                var returnObject = CommonViewFunction.termTableBreadcrumbMaker({
+                                    classificationNames: _.keys(model.get('$traits$')),
+                                    guid: model.get('$id$').id || model.get('$id$') || model.get('guid'),
+                                    displayText: model.get('name'),
+                                    status: model.get('$id$').state
+                                });
                                 if (returnObject.object) {
                                     that.bradCrumbList.push(returnObject.object);
                                 }
@@ -379,7 +398,8 @@ define(['require',
                         showLoader: function() {
                             that.$('.fontLoader').show();
                             that.$('.searchTable').hide();
-                        }
+                        },
+                        hideLoader: that.hideLoader.bind(that)
                     });
                     // view.saveTagData = function() {
                     //override saveTagData function 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c9c26d74/dashboardv2/public/js/views/search/SearchResultLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
index 23d74a5..cbfe08e 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -154,9 +154,14 @@ define(['require',
                     this.searchCollection.find(function(item) {
                         if (item.get('isEnable')) {
                             var term = [];
+                            if (that.searchCollection.queryType == "DSL") {
+                                var obj = item.toJSON();
+                            } else {
+                                var obj = item.get('entity');
+                            }
                             that.arr.push({
-                                id: item.get("$id$"),
-                                model: item
+                                id: obj.guid,
+                                model: obj
                             });
                         }
                     });
@@ -170,16 +175,6 @@ define(['require',
                 });
                 this.listenTo(this.searchCollection, "error", function(value, responseData)
{
                     this.$('.fontLoader').hide();
-                    var message = "Invalid expression";
-                    if (this.value && this.value.query) {
-                        message += " : " + this.value.query;
-                    }
-                    if (responseData.responseText) {
-                        message = JSON.parse(responseData.responseText).error;
-                    }
-                    Utils.notifyError({
-                        content: message
-                    });
                 }, this);
             },
             onRender: function() {
@@ -254,7 +249,7 @@ define(['require',
                             that.checkTableFetch();
                             that.offset = that.offset - that.limit;
                             if (that.firstFetch) {
-                                that.startRenderTableProcess();
+                                that.renderTableLayoutView();
                             }
                         }
                         if (that.firstFetch) {
@@ -265,7 +260,7 @@ define(['require',
                         }
                         // checking length for not rendering the table
                         if (that.searchCollection.models.length) {
-                            that.startRenderTableProcess();
+                            that.renderTableLayoutView();
                         }
                         var resultData = 'Results for <b>' + _.escape(that.searchCollection.queryParams.query)
+ '</b>';
                         var multiAssignDataTag = '<a href="javascript:void(0)" class="inputAssignTag
multiSelectTag assignTag" style="display:none" data-id="addAssignTag"><i class="fa fa-plus"></i>'
+ " " + 'Assign Tag</a>';
@@ -281,14 +276,11 @@ define(['require',
                     reset: true
                 });
             },
-            startRenderTableProcess: function() {
-                this.getEntityTableColumns();
-            },
             renderTableLayoutView: function(col) {
                 var that = this,
                     count = 5;
                 require(['utils/TableLayout'], function(TableLayout) {
-                    var columns = new Backgrid.Columns(col);
+                    var columns = new Backgrid.Columns(that.getFixedDslColumn());
                     that.REntityTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions,
{
                         globalVent: that.globalVent,
                         columns: columns
@@ -313,198 +305,85 @@ define(['require',
                     this.hideLoader();
                 }
             },
-            getEntityTableColumns: function() {
-                var that = this,
-                    col = {};
-                var responseData = this.searchCollection.responseData;
-                if (this.searchCollection.responseData) {
-                    if (responseData.dataType && responseData.dataType.typeName.indexOf('_temp')
== -1) {
-                        that.renderTableLayoutView(that.getFixedDslColumn());
-                    } else {
-                        var idFound = false,
-                            fetchResultCount = 0;
-                        _.each(this.searchCollection.models, function(model) {
-                            var modelJSON = model.toJSON();
-                            var guid = "";
-                            _.each(modelJSON, function(val, key) {
-                                if (_.isObject(val)) {
-                                    if (val.id) {
-                                        model.set('id', val.id);
-                                        guid = val.id;
-                                    } else if (val.guid) {
-                                        model.set('id', val.guid);
-                                        guid = val.guid;
-                                    }
-                                } else if (key === "id") {
-                                    model.set('id', val);
-                                    guid = val;
-                                } else if (key === "guid") {
-                                    model.set('id', val);
-                                    guid = val;
-                                }
-                            });
-                            if (guid.length) {
-                                idFound = true;
-                                ++that.asyncFetchCounter;
-                                model.getEntity(guid, {
-                                    success: function(data) {
-                                        if (data.attributes) {
-                                            if (data.guid && data.attributes) {
-                                                var id = "";
-                                                id = data.guid;
-                                                if (that.searchCollection.get(id)) {
-                                                    that.searchCollection.get(id).set(data.attributes);
-                                                    that.searchCollection.get(id).set({
-                                                        '$id$': data.guid,
-                                                        '$traits$': data.classifications
-                                                    });
-                                                }
-                                            }
-                                        }
-                                    },
-                                    complete: function() {
-                                        --that.asyncFetchCounter;
-                                        if (that.asyncFetchCounter === 0) {
-                                            that.renderTableLayoutView(that.getFixedDslColumn());
-                                        }
-                                    }
-                                });
-                            }
-                        });
-                        if (idFound === false) {
-                            that.renderTableLayoutView(this.getDaynamicColumn());
-                        }
-                    }
-                }
-            },
-            getDaynamicColumn: function() {
-                var that = this,
-                    modelJSON = "",
-                    col = {};
-                modelJSON = this.searchCollection.toJSON()[0];
-                _.keys(modelJSON).map(function(key) {
-                    if (key.indexOf("$") == -1) {
-                        col[key] = {
-                            cell: 'Html',
-                            editable: false,
-                            sortable: false,
-                            orderable: true,
-                            formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-                                fromRaw: function(rawValue, model) {
-                                    return CommonViewFunction.propertyTable({ 'notUsedKey':
rawValue }, that, true);
-                                }
-                            })
-                        };
-                    }
-                });
-                that.checkTableFetch();
-                return this.searchCollection.constructor.getTableCols(col, this.searchCollection);
-            },
             getFixedDslColumn: function() {
                 var that = this,
                     nameCheck = 0,
                     col = {};
-                for (var i = 0; i < this.searchCollection.models.length; i++) {
-                    var model = this.searchCollection.models[i];
-                    if (model && (model.get('name') || model.get('qualifiedName')))
{
-                        ++nameCheck;
-                    }
-                    if (model && model.get('$id$') === undefined) {
-                        i = i > 0 ? (i - 1) : i;
-                        that.searchCollection.remove(model);
-                    }
-                }
                 col['Check'] = {
                     name: "selected",
                     label: "",
                     cell: "select-row",
                     headerCell: "select-all"
                 };
-                if (nameCheck > 0) {
-                    col['name'] = {
-                        label: "Name",
-                        cell: "html",
-                        editable: false,
-                        sortable: false,
-                        className: "searchTableName",
-                        formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-                            fromRaw: function(rawValue, model) {
-                                var nameHtml = "";
-                                if (rawValue === undefined) {
-                                    if (model.get('qualifiedName')) {
-                                        rawValue = model.get('qualifiedName');
-                                    } else if (model.get('$id$') && model.get('$id$').qualifiedName)
{
-                                        rawValue = model.get('$id$').qualifiedName;
-                                    } else {
-                                        return "";
-                                    }
-                                }
-                                if (model.get('$id$')) {
-                                    nameHtml = '<a href="#!/detailPage/' + (model.get('$id$').id
|| model.get('$id$')) + '">' + _.escape(rawValue) + '</a>';
-                                } else {
-                                    nameHtml = '<a>' + _.escape(rawValue) + '</a>';
-                                }
-                                if (model.get('$id$') && model.get('$id$').state
&& Enums.entityStateReadOnly[model.get('$id$').state]) {
-                                    nameHtml += '<button type="button" title="Deleted"
class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
-                                    return '<div class="readOnly readOnlyLink">' +
nameHtml + '</div>';
-                                } else {
-                                    if (Globals.entityUpdate) {
-                                        nameHtml += '<button title="Edit" data-id="editEntityButton"
 data-giud= "' + (model.get('$id$').id || model.get('$id$')) + '" class="btn btn-atlasAction
btn-atlas editBtn"><i class="fa fa-pencil"></i></button>'
-                                    }
-                                    return nameHtml;
-                                }
+
+                col['displayText'] = {
+                    label: "Name",
+                    cell: "html",
+                    editable: false,
+                    sortable: false,
+                    className: "searchTableName",
+                    formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+                        fromRaw: function(rawValue, model) {
+                            if (that.searchCollection.queryType == "DSL") {
+                                var obj = model.toJSON();
+                            } else {
+                                var obj = model.get('entity');
                             }
-                        })
-                    };
-                }
-                if (nameCheck === 0) {
-                    col['typeName'] = {
-                        label: "Type Name",
-                        cell: "html",
-                        editable: false,
-                        sortable: false,
-                        formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-                            fromRaw: function(rawValue, model) {
-                                var nameHtml = "";
-                                if (rawValue === undefined) {
-                                    if (model.get('$id$') && model.get('$id$')['$typeName$'])
{
-                                        rawValue = model.get('$id$')['$typeName$'];
-                                    } else if (model.get('$typeName$')) {
-                                        rawValue = model.get('$typeName$');
-                                    } else if (model.get('typeName')) {
-                                        rawValue = model.get('typeName');
-                                    } else {
-                                        return "";
-                                    }
-                                }
-                                if (model.get('$id$')) {
-                                    nameHtml = '<a href="#!/detailPage/' + (model.get('$id$').id
|| model.get('$id$')) + '">' + rawValue + '</a>';
-                                } else {
-                                    nameHtml = '<a>' + rawValue + '</a>';
-                                }
-                                if (model.get('$id$') && model.get('$id$').state
&& Enums.entityStateReadOnly[model.get('$id$').state]) {
-                                    nameHtml += '<button type="button" title="Deleted"
class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
-                                    return '<div class="readOnly readOnlyLink">' +
nameHtml + '</div>';
-                                } else {
-                                    nameHtml += '<button title="Edit" data-giud= "' +
(model.get('$id$').id || model.get('$id$')) + '" class="btn btn-atlasAction btn-atlas editBtn"><i
class="fa fa-pencil"></i></button>'
-                                    return nameHtml;
+                            var nameHtml = "";
+                            var name = (_.escape(obj.attributes && obj.attributes.name
? obj.attributes.name : null) || _.escape(obj.displayText) || obj.guid)
+                            if (obj.guid) {
+                                nameHtml = '<a title="' + name + '" href="#!/detailPage/'
+ obj.guid + '">' + name + '</a>';
+                            } else {
+                                nameHtml = '<a title="' + name + '">' + name + '</a>';
+                            }
+                            if (obj.status && Enums.entityStateReadOnly[obj.status])
{
+                                nameHtml += '<button type="button" title="Deleted" class="btn
btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
+                                return '<div class="readOnly readOnlyLink">' + nameHtml
+ '</div>';
+                            } else {
+                                if (Globals.entityUpdate) {
+                                    nameHtml += '<button title="Edit" data-id="editEntityButton"
 data-giud= "' + obj.guid + '" class="btn btn-atlasAction btn-atlas editBtn"><i class="fa
fa-pencil"></i></button>'
                                 }
+                                return nameHtml;
                             }
-                        })
-                    };
-                }
+                        }
+                    })
+                };
 
                 col['description'] = {
                     label: "Description",
                     cell: "String",
                     editable: false,
-                    sortable: false
+                    sortable: false,
+                    formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+                        fromRaw: function(rawValue, model) {
+                            if (that.searchCollection.queryType == "DSL") {
+                                var obj = model.toJSON();
+                            } else {
+                                var obj = model.get('entity');
+                            }
+                            if (obj && obj.attributes && obj.attributes.description)
{
+                                return obj.attributes.description;
+                            }
+                        }
+                    })
                 };
                 col['owner'] = {
                     label: "Owner",
                     cell: "String",
                     editable: false,
-                    sortable: false
+                    sortable: false,
+                    formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+                        fromRaw: function(rawValue, model) {
+                            if (that.searchCollection.queryType == "DSL") {
+                                var obj = model.toJSON();
+                            } else {
+                                var obj = model.get('entity');
+                            }
+                            if (obj && obj.attributes && obj.attributes.owner)
{
+                                return obj.attributes.owner;
+                            }
+                        }
+                    })
                 };
                 col['tag'] = {
                     label: "Tags",
@@ -515,10 +394,15 @@ define(['require',
                     className: 'searchTag',
                     formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                         fromRaw: function(rawValue, model) {
-                            if (model.get('$id$') && model.get('$id$').state &&
Enums.entityStateReadOnly[model.get('$id$').state]) {
-                                return '<div class="readOnly">' + CommonViewFunction.tagForTable(model);
+ '</div>';
+                            if (that.searchCollection.queryType == "DSL") {
+                                var obj = model.toJSON();
                             } else {
-                                return CommonViewFunction.tagForTable(model);
+                                var obj = model.get('entity');
+                            }
+                            if (obj.status && Enums.entityStateReadOnly[obj.status])
{
+                                return '<div class="readOnly">' + CommonViewFunction.tagForTable(obj);
+ '</div>';
+                            } else {
+                                return CommonViewFunction.tagForTable(obj);
                             }
 
                         }
@@ -534,11 +418,16 @@ define(['require',
                         className: 'searchTerm',
                         formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                             fromRaw: function(rawValue, model) {
-                                var returnObject = CommonViewFunction.termTableBreadcrumbMaker(model);
+                                if (that.searchCollection.queryType == "DSL") {
+                                    var obj = model.toJSON();
+                                } else {
+                                    var obj = model.get('entity');
+                                }
+                                var returnObject = CommonViewFunction.termTableBreadcrumbMaker(obj);
                                 if (returnObject.object) {
                                     that.bradCrumbList.push(returnObject.object);
                                 }
-                                if (model.get('$id$') && model.get('$id$').state
&& Enums.entityStateReadOnly[model.get('$id$').state]) {
+                                if (obj.status && Enums.entityStateReadOnly[obj.status])
{
                                     return '<div class="readOnly">' + returnObject.html
+ '</div>';
                                 } else {
                                     return returnObject.html;
@@ -560,14 +449,40 @@ define(['require',
                             that.fetchCollection();
                             that.arr = [];
                         },
+                        tagList: that.getTagList(guid, multiple),
                         showLoader: that.showLoader.bind(that),
                         hideLoader: that.hideLoader.bind(that)
                     });
-                    // view.saveTagData = function() {
-                    //override saveTagData function 
-                    // }
                 });
             },
+            getTagList: function(guid, multiple) {
+                var that = this;
+                if (!multiple || multiple.length === 0) {
+                    var modal = this.searchCollection.find(function(item) {
+                        if (that.searchCollection.queryType == "DSL") {
+                            var obj = item.toJSON();
+                        } else {
+                            var obj = item.get('entity');
+                        }
+                        if (obj.guid === guid) {
+                            return true;
+                        }
+                    });
+                    if (modal) {
+                        if (that.searchCollection.queryType == "DSL") {
+                            var obj = modal.toJSON();
+                        } else {
+                            var obj = modal.get('entity');
+                        }
+                    } else {
+                        return [];
+                    }
+                    return obj.classificationNames;
+                } else {
+                    return [];
+                }
+
+            },
             showLoader: function() {
                 this.$('.fontLoader').show();
                 this.$('.searchTable').hide();

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c9c26d74/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
index 24e1e24..3cba566 100644
--- a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
@@ -174,12 +174,20 @@ define(['require',
                         });
                         that.modal.on('ok', function() {
                             var newAttributeList = view.collection.toJSON();
-                            var saveJSON = JSON.parse(JSON.stringify(that.model.toJSON()));
-                            var oldAttributeList = saveJSON.attributeDefs;
+                            try {
+                                var saveJSON = JSON.parse(JSON.stringify(that.model.toJSON()));
+                            } catch (err) {
+                                Utils.serverErrorHandler();
+                            }
+                            if (saveJSON) {
+                                var oldAttributeList = saveJSON.attributeDefs;
+                            }
                             _.each(newAttributeList, function(obj) {
                                 oldAttributeList.push(obj);
                             });
-                            that.onSaveButton(saveJSON, Messages.addAttributeSuccessMessage);
+                            if (saveJSON) {
+                                that.onSaveButton(saveJSON, Messages.addAttributeSuccessMessage);
+                            }
                         });
                         that.modal.on('closeModal', function() {
                             that.modal.trigger('cancel');

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c9c26d74/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 dcefc5a..7317a95 100644
--- a/dashboardv2/public/js/views/tag/addTagModalView.js
+++ b/dashboardv2/public/js/views/tag/addTagModalView.js
@@ -48,7 +48,7 @@ define(['require',
          */
         initialize: function(options) {
             var that = this;
-            _.extend(this, _.pick(options, 'vent', 'modalCollection', 'guid', 'callback',
'multiple', 'showLoader', 'hideLoader'));
+            _.extend(this, _.pick(options, 'vent', 'modalCollection', 'guid', 'callback',
'multiple', 'showLoader', 'hideLoader', 'tagList'));
             this.collection = new VTagList();
             this.commonCollection = new VTagList();
             this.asyncAttrFetchCounter = 0;
@@ -68,38 +68,97 @@ define(['require',
                     var selection = $(item).data("key");
                     tagAttributes[selection] = $(item).val();
                 });
-
+                var obj = {
+                    tagName: tagName,
+                    tagAttributes: tagAttributes,
+                    guid: [],
+                    skipEntity: [],
+                    deletedEntity: []
+                }
                 if (that.multiple) {
-                    that.asyncFetchCounter = 0;
-                    for (var i = 0; i < that.multiple.length; i++) {
-                        if (i == 0) {
-                            that.showLoader();
+                    _.each(that.multiple, function(entity, i) {
+                        var name = (_.escape(entity.model.attributes && entity.model.attributes.name
? entity.model.attributes.name : null) || _.escape(entity.model.displayText) || entity.model.guid)
+                        if (Enums.entityStateReadOnly[entity.model.status]) {
+                            obj.deletedEntity.push(name);
+                        } else {
+                            if (_.indexOf(entity.model.classificationNames, tagName) ===
-1) {
+                                obj.guid.push(entity.model.guid)
+                            } else {
+                                obj.skipEntity.push(name);
+                            }
+
                         }
-                        var obj = {
-                            tagName: tagName,
-                            tagAttributes: tagAttributes,
-                            guid: (_.isObject(that.multiple[i].id) ? that.multiple[i].id.id
: that.multiple[i].id),
-                            deletedEntity: Enums.entityStateReadOnly[that.multiple[i].id.state],
-                            entityName: that.multiple[i].model.get('name')
+                    });
+                    if (obj.deletedEntity.length) {
+                        Utils.notifyError({
+                            html: true,
+                            content: "<b>" + obj.deletedEntity.join(', ') +
+                                "</b> " + (obj.deletedEntity.length === 1 ? "entity
" : "entities ") +
+                                Messages.assignDeletedEntity
+                        });
+                    }
+                    if (obj.skipEntity.length) {
+                        var text = "<b>" + obj.skipEntity.join(', ') +
+                            "</b> <br/> entities selected have already been associated
with <b>" + tagName +
+                            "</b> tag, Do you want to associate the tag with other
entities ?",
+                            removeCancelButton = false;
+                        if ((obj.skipEntity.length + obj.deletedEntity.length) === that.multiple.length)
{
+                            text = (obj.skipEntity.length > 1 ? "All selected" : "Selected")
+ " entities have already been associated with <b>" + tagName + "</b> tag";
+                            removeCancelButton = true;
                         }
-                        if (obj.deletedEntity) {
-                            Utils.notifyError({
-                                content: obj.entityName + Messages.assignDeletedEntity
-                            });
-                            if (that.multiple.length === 1 || (that.multiple.length == (i
+ 1) && that.asyncFetchCounter == 0)) {
+                        var notifyObj = {
+                            text: text,
+                            ok: function(argument) {
+                                if (obj.guid.length) {
+                                    that.saveTagData(obj);
+                                } else {
+                                    that.hideLoader();
+                                }
+                            },
+                            cancel: function(argument) {
                                 that.hideLoader();
+                                obj = {
+                                    tagName: tagName,
+                                    tagAttributes: tagAttributes,
+                                    guid: [],
+                                    skipEntity: [],
+                                    deletedEntity: []
+                                }
                             }
-                        } else {
+                        }
+                        if (removeCancelButton) {
+                            notifyObj['confirm'] = {
+                                confirm: true,
+                                buttons: [{
+                                        text: 'Ok',
+                                        addClass: 'btn-primary',
+                                        click: function(notice) {
+                                            notice.remove();
+                                            obj = {
+                                                tagName: tagName,
+                                                tagAttributes: tagAttributes,
+                                                guid: [],
+                                                skipEntity: [],
+                                                deletedEntity: []
+                                            }
+                                        }
+                                    },
+                                    null
+                                ]
+                            }
+                        }
+
+                        Utils.notifyConfirm(notifyObj)
+                    } else {
+                        if (obj.guid.length) {
                             that.saveTagData(obj);
+                        } else {
+                            that.hideLoader();
                         }
                     }
                 } else {
-                    that.asyncFetchCounter = 0;
-                    that.saveTagData({
-                        tagName: tagName,
-                        tagAttributes: tagAttributes,
-                        guid: that.guid
-                    });
+                    obj.guid.push(that.guid);
+                    that.saveTagData(obj);
                 }
             });
             this.on('closeModal', function() {
@@ -126,13 +185,16 @@ define(['require',
             }, this);
         },
         tagsCollection: function() {
+            var that = this;
             this.collection.fullCollection.comparator = function(model) {
                 return model.get('name').toLowerCase();
             }
 
             var str = '<option selected="selected" disabled="disabled">-- Select a
tag from the dropdown list --</option>';
             this.collection.fullCollection.sort().each(function(obj, key) {
-                str += '<option>' + _.escape(obj.get('name')) + '</option>';
+                if (_.indexOf(that.tagList, obj.get('name')) === -1) {
+                    str += '<option>' + _.escape(obj.get('name')) + '</option>';
+                }
             });
             this.ui.addTagOptions.html(str);
             this.ui.addTagOptions.select2({
@@ -198,26 +260,35 @@ define(['require',
         },
         saveTagData: function(options) {
             var that = this;
-            ++this.asyncFetchCounter;
             this.entityModel = new VEntity();
             var tagName = options.tagName,
                 tagAttributes = options.tagAttributes,
-                json = [{
-                    "typeName": tagName,
-                    "attributes": tagAttributes
-                }];
-            this.entityModel.saveEntity(options.guid, {
+                json = {
+                    "classification": {
+                        "typeName": tagName,
+                        "attributes": tagAttributes
+                    },
+                    "entityGuids": options.guid
+                };
+            if (this.showLoader) {
+                this.showLoader();
+            }
+            this.entityModel.saveTraitsEntity({
                 skipDefaultError: true,
                 data: JSON.stringify(json),
                 success: function(data) {
                     Utils.notifySuccess({
-                        content: "Tag " + tagName + " has been added to entity"
+                        content: "Tag " + tagName + " has been added to " + (that.multiple
? "entities" : "entity")
                     });
                     if (options.modalCollection) {
                         options.modalCollection.fetch({ reset: true });
                     }
+                    if (that.callback) {
+                        that.callback();
+                    }
+
                 },
-                    cust_error: function(model, response) {
+                cust_error: function(model, response) {
                     var message = "Tag " + tagName + " could not be added";
                     if (response && response.responseJSON) {
                         message = response.responseJSON.errorMessage;
@@ -225,12 +296,10 @@ define(['require',
                     Utils.notifyError({
                         content: message
                     });
-                },
-                complete: function() {
-                    --that.asyncFetchCounter;
-                    if (that.callback && that.asyncFetchCounter === 0) {
-                        that.callback();
+                    if (that.hideLoader) {
+                        that.hideLoader();
                     }
+
                 }
             });
         },

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c9c26d74/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index dc7d12e..5ca51a8 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -9,6 +9,8 @@ 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-1425 Integrate Discovery/Search API in Atlas UI (kevalbhatt via mneethiraj)
+ATLAS-1482 UI update in assigning a tag to multiple entities using single API call (kevalbhatt
via mneethiraj)
 ATLAS-1486 UI updates to handle errors from V2 APIs (Kalyanikashikar via mneethiraj)
 ATLAS-1436 Metrics collection using gremlin (apoorvnaik via mneethiraj)
 ATLAS-1489 Show create/edit entity button based on role (Kalyanikashikar via kevalbhatt)



Mime
View raw message