Commit a8fab3e7 by kevalbhatt Committed by Madhan Neethiraj

ATLAS-2663: Glossary UI updates for related term association

parent 570f2423
...@@ -57,7 +57,7 @@ define(['require', ...@@ -57,7 +57,7 @@ define(['require',
this.dynamicTable = false; this.dynamicTable = false;
return resp.entities ? resp.entities : []; return resp.entities ? resp.entities : [];
} else { } else {
return resp ? resp : []; return [];
} }
}, },
getBasicRearchResult: function(options) { getBasicRearchResult: function(options) {
......
...@@ -100,5 +100,15 @@ define(['require', ...@@ -100,5 +100,15 @@ define(['require',
return (obj[field] ? obj[field] : (defaulValue ? defaulValue : "")); return (obj[field] ? obj[field] : (defaulValue ? defaulValue : ""));
}); });
Handlebars.registerHelper('eachlookup', function(obj, field, options) {
return Handlebars.helpers.each((obj[field] ? obj[field] : null), options);
});
Handlebars.registerHelper('callmyfunction', function(functionObj, param, options) {
var argumentObj = _.extend([], arguments);
argumentObj.shift();
return functionObj.apply(this, argumentObj);
});
return HHelpers; return HHelpers;
}); });
\ No newline at end of file
...@@ -225,7 +225,7 @@ define([ ...@@ -225,7 +225,7 @@ define([
if (Utils.getUrlState.isTagTab()) { if (Utils.getUrlState.isTagTab()) {
App.rSideNav.currentView.RTagLayoutView.currentView.manualRender(); App.rSideNav.currentView.RTagLayoutView.currentView.manualRender();
} else if (Utils.getUrlState.isGlossaryTab()) { } else if (Utils.getUrlState.isGlossaryTab()) {
App.rSideNav.currentView.RGlossaryLayoutView.currentView.manualRender(_.extend({ isTrigger: true }, paramObj)); App.rSideNav.currentView.RGlossaryLayoutView.currentView.manualRender(_.extend({ "isTrigger": true }, { "value": paramObj }));
} }
} }
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
</h4> </h4>
</div> </div>
{{/if}} {{#if contentWithFooter}} {{else}} {{/if}} {{#if contentWithFooter}} {{else}}
<div class="modal-body">{{content}}</div> <div class="modal-body">{{#if contentHtml}} {{{contentHtm}}} {{else}} {{content}} {{/if}}
</div>
{{#if showFooter}} {{#if showFooter}}
<div class="modal-footer"> <div class="modal-footer">
{{#if buttons}} {{#each buttons}} {{#if buttons}} {{#each buttons}}
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</div> </div>
{{/if}} {{#if isCategoryView}} {{/if}} {{#if isCategoryView}}
<div class="form-group clearfix"> <div class="form-group clearfix">
<span class="control-label-sm-pr pull-left">Term:</span> <span class="control-label-sm-pr pull-left">Terms:</span>
<div class="pull-left" data-id="termList"> <div class="pull-left" data-id="termList">
<button class="btn btn-action btn-sm" title="Add Term" data-id="addTerm"> <button class="btn btn-action btn-sm" title="Add Term" data-id="addTerm">
<i class="fa fa-plus"> </i> <i class="fa fa-plus"> </i>
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
<ul class="nav nav-tabs" data-id="tab-list"> <ul class="nav nav-tabs" data-id="tab-list">
<li role="entities" class="tab active"><a href="#tab-entities" aria-controls="tab-entities" role="tab" data-toggle="tab">Entities</a></li> <li role="entities" class="tab active"><a href="#tab-entities" aria-controls="tab-entities" role="tab" data-toggle="tab">Entities</a></li>
<li role="classification"><a href="#tab-tagTable" aria-controls="tab-tagTable" role="tab" data-toggle="tab">Classifications</a></li> <li role="classification"><a href="#tab-tagTable" aria-controls="tab-tagTable" role="tab" data-toggle="tab">Classifications</a></li>
<li role="properties"><a href="#tab-properties" aria-controls="tab-properties" role="tab" data-toggle="tab">Properties</a></li> <li role="relatedTerm"><a href="#tab-relatedTerm" aria-controls="tab-relatedTerm" role="tab" data-toggle="tab">Related Terms</a></li>
</ul> </ul>
</div> </div>
</div> </div>
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
</div> </div>
</div> </div>
</div> </div>
<div id="tab-properties" role="properties" class="tab-pane animated fadeIn"> <div id="tab-relatedTerm" role="relatedTerm" class="tab-pane animated fadeIn">
<div id="r_relationLayoutView"> <div id="r_relationLayoutView">
<div class="fontLoader-relative"> <div class="fontLoader-relative">
<i class="fa fa-refresh fa-spin-custom"></i> <i class="fa fa-refresh fa-spin-custom"></i>
......
...@@ -16,17 +16,17 @@ ...@@ -16,17 +16,17 @@
--> -->
<div> <div>
<div class="row form-group"> <div class="row form-group">
<div class="col-md-6"> <!-- <div class="col-md-6">
<select data-id="termAttributeSelect"> <select data-id="termAttributeSelect">
{{#each attributeList}} {{#each attributeList}}
<option value="{{@key}}">{{@key}}</option>{{/each}} <option value="{{@key}}">{{@key}}</option>{{/each}}
</select> </select>
</div> </div> -->
<div class="col-md-6"> <!-- <div class="col-md-6">
<button type="button" class="btn btn-action btn-md" data-id="addTermRelation"> <button type="button" class="btn btn-action btn-md" data-id="addTermRelation">
<i class="fa fa-plus"></i> <span>Assign Term</span> <i class="fa fa-plus"></i> <span>Assign Term</span>
</button> </button>
</div> </div> -->
</div> </div>
<div data-id="termAttributeTable"></div> <div data-id="termAttributeTable"></div>
</div> </div>
\ No newline at end of file
...@@ -17,13 +17,19 @@ ...@@ -17,13 +17,19 @@
<table class="table table-hover table-quickMenu"> <table class="table table-hover table-quickMenu">
<thead> <thead>
<tr> <tr>
<th>Term</th> <th>{{#if relationTypeTable}}Relation Types{{else}}Term{{/if}}</th>
<th>Attribute</th> <th>{{#if relationTypeTable}}Related Terms{{else}}Attribute{{/if}}</th>
<th>Action</th> {{#if relationTypeTable}}
<th>Attributes</th>{{/if}}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{#if attributeValue}} {{#each attributeValue}} {{#if relationTypeTable}} {{#each attributes}}
<tr>
<td>{{@key}}</td>
{{{callmyfunction ../getTerms @key}}}
</tr>
{{/each}} {{else}} {{#if attributeValue}} {{#each attributeValue}}
<tr> <tr>
<td>{{this.displayText}}</td> <td>{{this.displayText}}</td>
<td> <td>
...@@ -39,22 +45,22 @@ ...@@ -39,22 +45,22 @@
{{#each ../attributes}} {{#each ../attributes}}
<tr> <tr>
<td>{{@key}}</td> <td>{{@key}}</td>
<td>{{lookup ../this @key "-"}}</td> {{#if ../../editMode}}
<td>
<input data-id="attributeUpdate" class="form-control" type="text" data-name="{{@key}}" data-termguid="{{../../this.termGuid}}" " value="{{lookup ../../this @key ''}} ">
</td>{{else}}
<td>{{lookup ../../this @key "- "}}</td>
{{/if}}
</tr> </tr>
{{/each}} {{/each}}
</tbody> </tbody>
</table> </table>
</div> </div>
</td> </td>
<td>
<div class="btn-inline">
<button title="Delete" data-termguid="{{this.termGuid}}" class="btn btn-action btn-sm" data-id="deleteAttribute" data-name="Dimension"><i class="fa fa-trash"></i></button>
</div>
</td>
</tr> </tr>
{{/each}}{{else}} {{/each}}{{else}}
<tr class="empty text-center"> <tr class="empty text-center ">
<td colspan="3"><span>No records found!</span></td> <td colspan="3 "><span>No records found!</span></td>
</tr>{{/if}} </tr>{{/if}} {{/if}}
</tbody> </tbody>
</table> </table>
\ No newline at end of file
...@@ -280,8 +280,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -280,8 +280,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if (terms) { if (terms) {
terms.map(function(term) { terms.map(function(term) {
var className = "btn btn-action btn-sm btn-blue btn-icon", var className = "btn btn-action btn-sm btn-blue btn-icon",
deleteIcon = '<i class="fa fa-times" data-id="delete" data-assetname="' + entityName + '"data-name="' + term.typeName + '" data-type="tag" data-guid="' + obj.guid + '" data-termGuid="' + term.termGuid + '" ></i>', deleteIcon = '<i class="fa fa-times" data-id="delete" data-assetname="' + entityName + '"data-name="' + term.displayText + '" data-type="term" data-guid="' + obj.guid + '" data-termGuid="' + term.termGuid + '" ></i>',
termString = '<a class="' + className + '" data-id="termClick"><span title="' + term.typeName + '">' + term.displayText + '</span>' + deleteIcon + '</a>'; termString = '<a class="' + className + '" data-id="termClick"><span title="' + term.displayText + '">' + term.displayText + '</span>' + deleteIcon + '</a>';
if (count >= 1) { if (count >= 1) {
popTerm += termString; popTerm += termString;
} else { } else {
......
...@@ -105,6 +105,12 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq ...@@ -105,6 +105,12 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq
return false; return false;
} }
}); });
$("body").on('click', '.dropdown-menu.dropdown-changetitle li a', function() {
$(this).parents('li').find(".btn:first-child").html($(this).text() + ' <span class="caret"></span>');
});
$("body").on('click', '.btn', function() {
$(this).blur();
});
// For placeholder support // For placeholder support
if (!('placeholder' in HTMLInputElement.prototype)) { if (!('placeholder' in HTMLInputElement.prototype)) {
...@@ -144,8 +150,24 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq ...@@ -144,8 +150,24 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq
var that = this; var that = this;
Backgrid.HeaderRow.__super__.render.apply(this, arguments); Backgrid.HeaderRow.__super__.render.apply(this, arguments);
_.each(this.columns.models, function(modelValue) { _.each(this.columns.models, function(modelValue) {
if (modelValue.get('width')) that.$el.find('.' + modelValue.get('name')).css('min-width', modelValue.get('width') + 'px') var elAttr = modelValue.get('elAttr'),
if (modelValue.get('toolTip')) that.$el.find('.' + modelValue.get('name')).attr('title', modelValue.get('toolTip')) elAttrObj = null;
if (elAttr) {
if (_.isFunction(elAttr)) {
elAttrObj = elAttr(modelValue);
} else if (_.isObject(elAttr)) {
if (!_.isArray(elAttr)) {
elAttrObj = [elAttr];
} else {
elAttrObj = elAttr;
}
}
_.each(elAttrObj, function(val) {
that.$el.find('.' + modelValue.get('name')).data(val);
});
}
if (modelValue.get('width')) that.$el.find('.' + modelValue.get('name')).css('min-width', modelValue.get('width') + 'px');
if (modelValue.get('toolTip')) that.$el.find('.' + modelValue.get('name')).attr('title', modelValue.get('toolTip'));
}); });
return this; return this;
} }
......
...@@ -305,21 +305,38 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -305,21 +305,38 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
lastValue: hashValue.split('/')[hashValue.split('/').length - 1] lastValue: hashValue.split('/')[hashValue.split('/').length - 1]
} }
}, },
checkTabUrl: function(options) {
var url = options && options.url,
matchString = options && options.matchString,
quey = this.getQueryUrl(url);
return quey.firstValue == matchString || quey.queyParams[0] == "#!/" + matchString;
},
isInitial: function() { isInitial: function() {
return this.getQueryUrl().firstValue == undefined; return this.getQueryUrl().firstValue == undefined;
}, },
isTagTab: function(url) { isTagTab: function(url) {
var quey = this.getQueryUrl(url); return this.checkTabUrl({
return quey.firstValue == "tag" || quey.queyParams[0] == "#!/tag"; url: url,
matchString: "tag"
});
}, },
isSearchTab: function(url) { isSearchTab: function(url) {
return this.getQueryUrl(url).firstValue == "search"; return this.checkTabUrl({
url: url,
matchString: "search"
});
}, },
isGlossaryTab: function(url) { isGlossaryTab: function(url) {
return this.getQueryUrl(url).firstValue == "glossary"; return this.checkTabUrl({
url: url,
matchString: "glossary"
});
}, },
isDetailPage: function(url) { isDetailPage: function(url) {
return this.getQueryUrl(url).firstValue == "detailPage"; return this.checkTabUrl({
url: url,
matchString: "detailPage"
});
}, },
getLastValue: function() { getLastValue: function() {
return this.getQueryUrl().lastValue; return this.getQueryUrl().lastValue;
...@@ -640,6 +657,7 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -640,6 +657,7 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
} }
} }
} }
Utils.isUrl = function(url) { Utils.isUrl = function(url) {
var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/ var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
return regexp.test(url); return regexp.test(url);
......
...@@ -195,11 +195,13 @@ define(['require', ...@@ -195,11 +195,13 @@ define(['require',
if (this.isGlossaryView) { if (this.isGlossaryView) {
if (this.glossaryCollection.fullCollection.length) { if (this.glossaryCollection.fullCollection.length) {
this.data = this.glossaryCollection.fullCollection.get(this.guid).toJSON(); this.data = this.glossaryCollection.fullCollection.get(this.guid).toJSON();
this.glossaryCollection.trigger("data:updated", $.extend(true, {}, this.data));
this.renderDetails(this.data); this.renderDetails(this.data);
} else { } else {
this.listenTo(this.glossaryCollection.fullCollection, "reset ", function(skip) { this.listenTo(this.glossaryCollection.fullCollection, "reset ", function(skip) {
var foundGlossary = this.glossaryCollection.fullCollection.get(this.guid); var foundGlossary = this.glossaryCollection.fullCollection.get(this.guid);
this.data = foundGlossary ? foundGlossary.toJSON() : null; this.data = foundGlossary ? foundGlossary.toJSON() : null;
this.glossaryCollection.trigger("data:updated", $.extend(true, {}, this.data));
if (this.data == null) { if (this.data == null) {
this.glossary.selectedItem = {}; this.glossary.selectedItem = {};
Utils.setUrl({ Utils.setUrl({
...@@ -248,6 +250,7 @@ define(['require', ...@@ -248,6 +250,7 @@ define(['require',
that.renderRelationLayoutView(obj); that.renderRelationLayoutView(obj);
} }
that.data = data; that.data = data;
that.glossaryCollection.trigger("data:updated", $.extend(true, {}, data));
that.glossary.selectedItem.model = data; that.glossary.selectedItem.model = data;
that.glossary.selectedItem.guid = data.guid; that.glossary.selectedItem.guid = data.guid;
that.renderDetails(data) that.renderDetails(data)
......
...@@ -98,8 +98,8 @@ define(['require', ...@@ -98,8 +98,8 @@ define(['require',
}; };
if (Utils.getUrlState.isGlossaryTab() && this.value && this.value.viewType) { if (Utils.getUrlState.isGlossaryTab() && this.value && this.value.viewType) {
this.viewType = this.value.viewType; this.viewType = this.value.viewType;
}
this.query[this.viewType] = _.extend({}, this.value, { "guid": this.guid }); this.query[this.viewType] = _.extend({}, this.value, { "guid": this.guid });
}
}, },
bindEvents: function() { bindEvents: function() {
var that = this; var that = this;
...@@ -164,6 +164,9 @@ define(['require', ...@@ -164,6 +164,9 @@ define(['require',
this.viewType = "term"; this.viewType = "term";
} }
var setDefaultSelector = function() { var setDefaultSelector = function() {
if (!that.value) {
return;
}
var model = null; var model = null;
if (that.value.gId) { if (that.value.gId) {
model = that.glossaryCollection.fullCollection.get(that.value.gId); model = that.glossaryCollection.fullCollection.get(that.value.gId);
...@@ -195,12 +198,13 @@ define(['require', ...@@ -195,12 +198,13 @@ define(['require',
$tree.jstree('activate_node', that.glossary.selectedItem.guid); $tree.jstree('activate_node', that.glossary.selectedItem.guid);
} }
this.query[this.viewType] = _.extend(obj, _.pick(this.glossary.selectedItem, 'model', 'guid', 'gType'), { "viewType": this.viewType, "isNodeNotFoundAtLoad": this.query[this.viewType].isNodeNotFoundAtLoad }); this.query[this.viewType] = _.extend(obj, _.pick(this.glossary.selectedItem, 'model', 'guid', 'gType'), { "viewType": this.viewType, "isNodeNotFoundAtLoad": this.query[this.viewType].isNodeNotFoundAtLoad });
var url = _.isEmpty(this.glossary.selectedItem) ? '#!/glossary' : '#!/glossary/' + this.glossary.selectedItem.guid;
Utils.setUrl({ Utils.setUrl({
url: '#!/glossary/' + this.glossary.selectedItem.guid, "url": url,
urlParams: _.extend({}, _.omit(obj, 'guid', 'model', 'type', 'isNodeNotFoundAtLoad')), "urlParams": _.extend({}, _.omit(obj, 'guid', 'model', 'type', 'isNodeNotFoundAtLoad')),
mergeBrowserUrl: false, "mergeBrowserUrl": false,
trigger: false, "trigger": false,
updateTabState: true "updateTabState": true
}); });
} }
}, },
...@@ -615,6 +619,11 @@ define(['require', ...@@ -615,6 +619,11 @@ define(['require',
var url = gId ? '#!/glossary/' + gId : '#!/glossary'; var url = gId ? '#!/glossary/' + gId : '#!/glossary';
if (gId == null) { if (gId == null) {
that.glossary.selectedItem = {}; that.glossary.selectedItem = {};
that.value = null;
that.query = {
term: {},
category: {}
};
that.ui.categoryTree.jstree(true).refresh(); that.ui.categoryTree.jstree(true).refresh();
that.ui.termTree.jstree(true).refresh(); that.ui.termTree.jstree(true).refresh();
} }
......
...@@ -713,7 +713,7 @@ define(['require', ...@@ -713,7 +713,7 @@ define(['require',
}) })
}; };
this.getTagCol({ 'col': col, 'columnToShow': columnToShow }); this.getTagCol({ 'col': col, 'columnToShow': columnToShow });
if (this.fromView != "glossary") { if ((!_.contains(["classification", "glossary"], this.fromView))) {
this.getTermCol({ 'col': col, 'columnToShow': columnToShow }); this.getTermCol({ 'col': col, 'columnToShow': columnToShow });
} }
...@@ -851,7 +851,7 @@ define(['require', ...@@ -851,7 +851,7 @@ define(['require',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
var obj = model.toJSON(); var obj = model.toJSON();
if (!(obj.typeName.startsWith("AtlasGlossary"))) { if (obj.typeName && !(obj.typeName.startsWith("AtlasGlossary"))) {
if (obj.status && Enums.entityStateReadOnly[obj.status]) { if (obj.status && Enums.entityStateReadOnly[obj.status]) {
return '<div class="readOnly">' + CommonViewFunction.termForTable(obj); + '</div>'; return '<div class="readOnly">' + CommonViewFunction.termForTable(obj); + '</div>';
} else { } else {
......
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