Commit 08c49867 by kevalbhatt Committed by Madhan Neethiraj

ATLAS-2639: UI: Associating a classification to entity from term page results in…

ATLAS-2639: UI: Associating a classification to entity from term page results in adding tag to term rather than entity Signed-off-by: 's avatarMadhan Neethiraj <madhan@apache.org>
parent 3a002db4
...@@ -22,6 +22,14 @@ ...@@ -22,6 +22,14 @@
.jstree-default-dark { .jstree-default-dark {
background: transparent !important; background: transparent !important;
.jstree-anchor {
width: calc(100% - 50px);
overflow: hidden;
text-overflow: ellipsis;
}
.jstree-children {
max-width: 500px;
}
.jstree-clicked, .jstree-clicked,
.jstree-wholerow-clicked { .jstree-wholerow-clicked {
background: $color_jungle_green_approx !important; background: $color_jungle_green_approx !important;
...@@ -43,11 +51,12 @@ ...@@ -43,11 +51,12 @@
} }
.tools { .tools {
display: none; display: none;
position: relative; position: absolute;
width: 9%; width: 30px;
float: right;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
top: 0;
right: 0;
} }
} }
} }
\ No newline at end of file
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
{{#if isTermView}} {{#if isTermView}}
<div class="form-group clearfix"> <div class="form-group clearfix">
<span class="control-label-sm-pr pull-left">Classifications:</span> <span class="control-label-sm-pr pull-left">Classifications:</span>
<div class="pull-left" data-id="tagList"> <div class="pull-left" data-id="tagListTerm">
<button class="btn btn-action btn-sm" title="Add Classification" data-id="addTag"> <button class="btn btn-action btn-sm" title="Add Classification" data-id="addTagTerm">
<i class="fa fa-plus"> </i> <i class="fa fa-plus"> </i>
</button> </button>
</div> </div>
......
...@@ -38,14 +38,14 @@ ...@@ -38,14 +38,14 @@
<div> <div>
<input type="text" class="form-control" data-id="searchTerm" placeholder="{{#if isAssignView}}Search Term{{else}}Search Glossary, Term{{/if}}"> <input type="text" class="form-control" data-id="searchTerm" placeholder="{{#if isAssignView}}Search Term{{else}}Search Glossary, Term{{/if}}">
</div> </div>
<div data-id="termTree" style="margin-top: 5px;"> <div data-id="termTree" style="margin-top: 5px;overflow-x: auto;">
</div> </div>
</div> </div>
<div class="col-sm-12 no-padding category-view" style="display: none;"> <div class="col-sm-12 no-padding category-view" style="display: none;">
<div> <div>
<input type="text" class="form-control" data-id="searchCategory" placeholder="{{#if isAssignView}}Search Catalog{{else}}Search Glossary, Category{{/if}}"> <input type="text" class="form-control" data-id="searchCategory" placeholder="{{#if isAssignView}}Search Catalog{{else}}Search Glossary, Category{{/if}}">
</div> </div>
<div data-id="categoryTree" style="margin-top: 5px;"> <div data-id="categoryTree" style="margin-top: 5px;overflow-x: auto;">
</div> </div>
</div> </div>
</div> </div>
......
...@@ -664,11 +664,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -664,11 +664,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
content: messageType + ref.ui.displayName.val() + Messages[model ? "editSuccessMessage" : "addSuccessMessage"] content: messageType + ref.ui.displayName.val() + Messages[model ? "editSuccessMessage" : "addSuccessMessage"]
}); });
if (options.callback) { if (options.callback) {
var obj = rModel; options.callback(rModel);
if (isGlossaryView) {
obj = _.omit((rModel && rModel.toJSON ? rModel.toJSON() : rModel), 'terms', 'categories');
}
options.callback(obj);
} }
modal.trigger('closeModal'); modal.trigger('closeModal');
}, },
......
...@@ -386,6 +386,11 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -386,6 +386,11 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
returnObj.key = 'name'; returnObj.key = 'name';
return returnObj; return returnObj;
} }
if (collectionJSON.attributes.displayName) {
returnObj.name = _.escape(collectionJSON.attributes.displayName);
returnObj.key = 'displayName';
return returnObj;
}
if (collectionJSON.attributes.qualifiedName) { if (collectionJSON.attributes.qualifiedName) {
returnObj.name = _.escape(collectionJSON.attributes.qualifiedName); returnObj.name = _.escape(collectionJSON.attributes.qualifiedName);
returnObj.key = 'qualifiedName'; returnObj.key = 'qualifiedName';
...@@ -408,6 +413,11 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -408,6 +413,11 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
returnObj.key = 'name'; returnObj.key = 'name';
return returnObj; return returnObj;
} }
if (collectionJSON.displayName) {
returnObj.name = _.escape(collectionJSON.displayName);
returnObj.key = 'displayName';
return returnObj;
}
if (collectionJSON.qualifiedName) { if (collectionJSON.qualifiedName) {
returnObj.name = _.escape(collectionJSON.qualifiedName); returnObj.name = _.escape(collectionJSON.qualifiedName);
returnObj.key = 'qualifiedName'; returnObj.key = 'qualifiedName';
...@@ -526,11 +536,16 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -526,11 +536,16 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
if (data.superTypes && data.superTypes.length) { if (data.superTypes && data.superTypes.length) {
_.each(data.superTypes, function(superTypeName) { _.each(data.superTypes, function(superTypeName) {
if (collection.fullCollection) { if (collection.fullCollection) {
var collectionData = collection.fullCollection.findWhere({ name: superTypeName }).toJSON(); var collectionData = collection.fullCollection.findWhere({ name: superTypeName });
} else { } else {
var collectionData = collection.findWhere({ name: superTypeName }).toJSON(); var collectionData = collection.findWhere({ name: superTypeName });
} }
collectionData = collectionData && collectionData.toJSON ? collectionData.toJSON() : collectionData;
if (collectionData) {
return getData(collectionData, collection); return getData(collectionData, collection);
} else {
return;
}
}); });
} }
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
define(['require', define(['require',
'backbone', 'backbone',
'hbs!tmpl/glossary/AssignTermLayoutViewTmpl', 'hbs!tmpl/glossary/AssignTermLayoutView_tmpl',
'utils/Utils', 'utils/Utils',
'utils/UrlLinks', 'utils/UrlLinks',
'modules/Modal' 'modules/Modal'
......
...@@ -63,10 +63,10 @@ define(['require', ...@@ -63,10 +63,10 @@ define(['require',
termClick: "[data-id='termClick']", termClick: "[data-id='termClick']",
addTerm: "[data-id='addTerm']", addTerm: "[data-id='addTerm']",
tagList: "[data-id='tagList']", tagList: "[data-id='tagListTerm']",
removeTag: '[data-id="removeTag"]', removeTag: '[data-id="removeTagTerm"]',
tagClick: '[data-id="tagClick"]', tagClick: '[data-id="tagClickTerm"]',
addTag: '[data-id="addTag"]', addTag: '[data-id="addTagTerm"]',
}, },
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
...@@ -122,8 +122,9 @@ define(['require', ...@@ -122,8 +122,9 @@ define(['require',
"model": model, "model": model,
"isGlossaryView": this.isGlossaryView, "isGlossaryView": this.isGlossaryView,
"collection": this.glossaryCollection, "collection": this.glossaryCollection,
"callback": function(data) { "callback": function(sModel) {
model.set(_.extend({}, model.toJSON(), data), { silent: true }); var data = sModel.toJSON();
model.set(data, { silent: true }); // update glossaryCollection
that.data = data; that.data = data;
that.renderDetails(that.data); that.renderDetails(that.data);
that.glossaryCollection.trigger("update:details", { isGlossaryUpdate: true }); that.glossaryCollection.trigger("update:details", { isGlossaryUpdate: true });
...@@ -189,9 +190,16 @@ define(['require', ...@@ -189,9 +190,16 @@ define(['require',
var that = this; var that = this;
}, },
getData: function() { getData: function() {
if (this.glossaryCollection.fullCollection.length && this.isGlossaryView) { if (this.isGlossaryView) {
if (this.glossaryCollection.fullCollection.length) {
this.data = this.glossaryCollection.fullCollection.get(this.guid).toJSON();
this.renderDetails(this.data);
} else {
this.listenTo(this.glossaryCollection.fullCollection, "reset ", function(skip) {
this.data = this.glossaryCollection.fullCollection.get(this.guid).toJSON(); this.data = this.glossaryCollection.fullCollection.get(this.guid).toJSON();
this.renderDetails(this.data); this.renderDetails(this.data);
}, this);
}
} else { } else {
Utils.showTitleLoader(this.$('.page-title .fontLoader'), this.ui.details); Utils.showTitleLoader(this.$('.page-title .fontLoader'), this.ui.details);
var getApiFunctionKey = "getCategory", var getApiFunctionKey = "getCategory",
...@@ -262,7 +270,7 @@ define(['require', ...@@ -262,7 +270,7 @@ define(['require',
var that = this, var that = this,
tagData = ""; tagData = "";
_.each(tagObject, function(val) { _.each(tagObject, function(val) {
tagData += '<span class="btn btn-action btn-sm btn-icon btn-blue" title=' + val.typeName + ' data-id="tagClick"><span>' + val.typeName + '</span><i class="fa fa-close" data-id="removeTag" data-type="tag" title="Remove Tag"></i></span>'; tagData += '<span class="btn btn-action btn-sm btn-icon btn-blue" title=' + val.typeName + ' data-id="tagClickTerm"><span>' + val.typeName + '</span><i class="fa fa-close" data-id="removeTagTerm" data-type="tag" title="Remove Tag"></i></span>';
}); });
this.ui.tagList.find("span.btn").remove(); this.ui.tagList.find("span.btn").remove();
this.ui.tagList.prepend(tagData); this.ui.tagList.prepend(tagData);
......
...@@ -559,7 +559,11 @@ define(['require', ...@@ -559,7 +559,11 @@ define(['require',
"isCategoryView": true, "isCategoryView": true,
"collection": that.glossaryCollection, "collection": that.glossaryCollection,
"callback": function() { "callback": function() {
if (that.value.gType == "glossary") {
that.getGlossary(); that.getGlossary();
} else {
that.ui.categoryTree.jstree(true).refresh();
}
}, },
"node": this.glossary.selectedItem "node": this.glossary.selectedItem
}) })
...@@ -665,8 +669,10 @@ define(['require', ...@@ -665,8 +669,10 @@ define(['require',
var obj = {}; var obj = {};
if (selectedItem.glossaryId) { if (selectedItem.glossaryId) {
obj["gId"] = selectedItem.glossaryId; obj["gId"] = selectedItem.glossaryId;
} else if (selectedItem.type == "Glossary") {
obj["gId"] = selectedItem.guid;
} }
this.query[this.viewType] = _.extend(obj, this.value, _.pick(this.glossary.selectedItem, 'model', 'type', 'gType', 'guid'), { "viewType": this.viewType, "isNodeNotFoundAtLoad": this.query[this.viewType].isNodeNotFoundAtLoad }); this.query[this.viewType] = _.extend(obj, _.omit(this.value, 'gId'), _.pick(this.glossary.selectedItem, 'model', 'type', 'gType', 'guid'), { "viewType": this.viewType, "isNodeNotFoundAtLoad": this.query[this.viewType].isNodeNotFoundAtLoad });
Utils.setUrl({ Utils.setUrl({
url: '#!/glossary/' + obj.guid, url: '#!/glossary/' + obj.guid,
mergeBrowserUrl: false, mergeBrowserUrl: false,
......
...@@ -895,7 +895,11 @@ define(['require', ...@@ -895,7 +895,11 @@ define(['require',
} else { } else {
return []; return [];
} }
return obj.classificationNames; return _.compact(_.map(obj.classifications, function(val) {
if (val.entityGuid == guid) {
return val.typeName
}
}));
} else { } else {
return []; return [];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment