Commit 6d51ddec by kevalbhatt Committed by Madhan Neethiraj

ATLAS-2600: Glossary UI update for add/update/remove of classifications to terms

parent 2237a895
...@@ -372,6 +372,21 @@ div.columnmanager-dropdown-container { ...@@ -372,6 +372,21 @@ div.columnmanager-dropdown-container {
} }
.stack-modal[aria-role="alertdialog"] { .stack-modal[aria-role="alertdialog"] {
&.width-600 {
width: 600px !important;
left: calc(50% - 250px) !important;
margin-left: 0 !important;
}
&.width-500 {
width: 500px !important;
left: calc(50% - 216px) !important;
margin-left: 0 !important;
}
&.width-400 {
width: 400px !important;
left: calc(50% - 183px);
margin-left: 0 !important;
}
.alert.ui-pnotify-container { .alert.ui-pnotify-container {
color: $color_ironside_gray_approx; color: $color_ironside_gray_approx;
background-color: $white; background-color: $white;
...@@ -430,6 +445,7 @@ div.columnmanager-dropdown-container { ...@@ -430,6 +445,7 @@ div.columnmanager-dropdown-container {
.fa-color { .fa-color {
color: $color_keppel_approx color: $color_keppel_approx
} }
.w30{
.w30 {
width: 30% !important; width: 30% !important;
} }
\ No newline at end of file
...@@ -47,7 +47,11 @@ define([ ...@@ -47,7 +47,11 @@ define([
this.bindCommonEvents(); this.bindCommonEvents();
this.listenTo(this, 'route', this.postRouteExecute, this); this.listenTo(this, 'route', this.postRouteExecute, this);
this.searchVent = new Backbone.Wreqr.EventAggregator(); this.searchVent = new Backbone.Wreqr.EventAggregator();
this.glossaryCollection = new VGlossaryList([], {}); this.glossaryCollection = new VGlossaryList([], {
comparator: function(item) {
return item.get("displayName");
}
});
this.preFetchedCollectionLists = { this.preFetchedCollectionLists = {
'entityDefCollection': this.entityDefCollection, 'entityDefCollection': this.entityDefCollection,
'typeHeaders': this.typeHeaders, 'typeHeaders': this.typeHeaders,
...@@ -221,7 +225,7 @@ define([ ...@@ -221,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({}, paramObj)); App.rSideNav.currentView.RGlossaryLayoutView.currentView.manualRender(_.extend({ isTrigger: true }, paramObj));
} }
} }
...@@ -263,7 +267,7 @@ define([ ...@@ -263,7 +267,7 @@ define([
} }
App.rSideNav.currentView.selectTab(); App.rSideNav.currentView.selectTab();
if (paramObj) { if (paramObj) {
isinitialView = (paramObj.type || (paramObj.dslChecked == "true" ? "" : paramObj.tag) || (paramObj.query ? paramObj.query.trim() : "")).length === 0; isinitialView = (paramObj.type || (paramObj.dslChecked == "true" ? "" : (paramObj.tag || paramObj.term)) || (paramObj.query ? paramObj.query.trim() : "")).length === 0;
} }
App.rNContent.show(new SearchDetailLayoutView( App.rNContent.show(new SearchDetailLayoutView(
_.extend({ _.extend({
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</button> </button>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group termBox">
<span class="control-label-sm-pr pull-left">Term:</span> <span class="control-label-sm-pr pull-left">Term:</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">
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2 {{#if create}}required{{/if}}" for="name">Name</label> <label class="control-label col-sm-2 {{#if create}}required{{/if}}" for="name">Name</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input class="form-control" name="displayName" value="{{displayName}}" data-id="displayName" placeholder="Display Name(required)" autofocus/> <input class="form-control" name="displayName" value="{{displayName}}" data-id="displayName" placeholder="Name(required)" autofocus/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
......
...@@ -35,6 +35,14 @@ ...@@ -35,6 +35,14 @@
</div> </div>
{{#if isTermView}} {{#if isTermView}}
<div class="form-group clearfix"> <div class="form-group clearfix">
<span class="control-label-sm-pr pull-left">Classifications:</span>
<div class="pull-left" data-id="tagList">
<button class="btn btn-action btn-sm" title="Add Classification" data-id="addTag">
<i class="fa fa-plus"> </i>
</button>
</div>
</div>
<div class="form-group clearfix">
<span class="control-label-sm-pr pull-left">Categories:</span> <span class="control-label-sm-pr pull-left">Categories:</span>
<div class="pull-left" data-id="categoryList"> <div class="pull-left" data-id="categoryList">
<button class="btn btn-action btn-sm" title="Add Category" data-id="addCategory"> <button class="btn btn-action btn-sm" title="Add Category" data-id="addCategory">
...@@ -51,17 +59,35 @@ ...@@ -51,17 +59,35 @@
</button> </button>
</div> </div>
</div> </div>
{{/if}} {{#if isTermView}}
<div class="row">
<div class="col-sm-12 default-tab">
<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="classification"><a href="#tab-tagTable" aria-controls="tab-tagTable" role="tab" data-toggle="tab">Classifications</a></li>
</ul>
</div>
</div>
{{/if}} {{/if}}
</div> </div>
</div> </div>
<div class="container-fluid gray-bg"> <div class="container-fluid gray-bg">
<div class="row"> {{#if isTermView}}
<div class="col-sm-custom"> <div class="tab-content">
<div id="tab-entities" role="entities" class="tab-pane active animated fadeIn">
<div id="r_searchResultLayoutView"> <div id="r_searchResultLayoutView">
<div class="fontLoader" style="display: block;min-height: 50px;position:relative;margin-top: 25px;"> <div class="fontLoader-relative">
<i class="fa fa-refresh fa-spin-custom"></i> <i class="fa fa-refresh fa-spin-custom"></i>
</div> </div>
</div> </div>
</div> </div>
<div id="tab-tagTable" role="classification" class="tab-pane animated fadeIn">
<div id="r_tagTableLayoutView">
<div class="fontLoader-relative">
<i class="fa fa-refresh fa-spin-custom"></i>
</div>
</div> </div>
</div>
</div>
{{/if}}
</div> </div>
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
--> -->
<div class="col-sm-12 add-seperator"> <div class="col-sm-12 {{#unless isAssignView}}add-seperator{{/unless}}">
<div class="row"> <div class="row">
{{#unless isAssignView}} {{#unless isAssignView}}
<div class="col-sm-8 no-padding" style="margin-top: 5px;"> <div class="col-sm-8 no-padding" style="margin-top: 5px;">
......
...@@ -36,10 +36,10 @@ ...@@ -36,10 +36,10 @@
<div class="srchType clearfix"> <div class="srchType clearfix">
<span class="srchTitle">Search By Type</span> <span class="srchTitle">Search By Type</span>
<div class=""> <div class="">
<div class="col-sm-10 no-padding temFilter"> <div class="col-sm-10 no-padding typeFilter">
<select data-id="typeLOV"></select> <select data-id="typeLOV"></select>
</div> </div>
<div class="col-sm-2 no-padding temFilterBtn"> <div class="col-sm-2 no-padding typeFilterBtn">
<button type="button" class="btn btn-action btn-md pull-right typeLOV active" title="Entity Attribute Filter" data-id="typeAttrFilter"><i class="fa fa-filter"></i></button> <button type="button" class="btn btn-action btn-md pull-right typeLOV active" title="Entity Attribute Filter" data-id="typeAttrFilter"><i class="fa fa-filter"></i></button>
</div> </div>
</div> </div>
...@@ -55,6 +55,14 @@ ...@@ -55,6 +55,14 @@
</div> </div>
</div> </div>
</div> </div>
<div class="srchType termBox clearfix">
<span class="srchTitle">Search By Term</span>
<div class="">
<div class="col-sm-12 no-padding">
<select data-id="termLOV"></select>
</div>
</div>
</div>
<div class="srchType"> <div class="srchType">
<span class="srchTitle searchText">Search By Text</span> <span class="srchTitle searchText">Search By Text</span>
<input type="text" class="form-control" data-id="searchInput" placeholder="Search by text" style="margin: 5px 0px;"> <input type="text" class="form-control" data-id="searchInput" placeholder="Search by text" style="margin: 5px 0px;">
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
--> -->
<div class=""> <div class="position-relative">
<div class="tableOverlay"></div> <div class="tableOverlay"></div>
<!-- Not for table Loader its only for initial loading --> <!-- Not for table Loader its only for initial loading -->
<div class="fontLoader" style="z-index:999"> <div class="fontLoader" style="z-index:999">
...@@ -32,21 +32,18 @@ ...@@ -32,21 +32,18 @@
<div class="inline" data-id="colManager"></div> <div class="inline" data-id="colManager"></div>
<div class="inline" data-id="containerCheckBox" style="display: none;"> <div class="inline" data-id="containerCheckBox" style="display: none;">
<label class="checkbox-inline btn" for="historicalentities"> <label class="checkbox-inline btn" for="historicalentities">
<input type="checkbox" data-id="checkDeletedEntity" data-value="includeDE" <input type="checkbox" data-id="checkDeletedEntity" data-value="includeDE" id="historicalentities" />
id="historicalentities"/>
<b>Show historical entities</b></label> <b>Show historical entities</b></label>
</div> </div>
{{#ifCond fromView '!==' "glossary"}}
<div class="inline" data-id="containerCheckBox" style="display: none;"> <div class="inline" data-id="containerCheckBox" style="display: none;">
<label class="checkbox-inline btn" for="subclassifications"> <label class="checkbox-inline btn" for="subclassifications">
<input type="checkbox" data-id="checkSubClassification" data-value="excludeSC" id="subclassifications"/> <input type="checkbox" data-id="checkSubClassification" data-value="excludeSC" id="subclassifications" />
<b>Exclude sub-classifications</b></label> <b>Exclude sub-classifications</b></label>
</div> </div>
{{/ifCond}}
{{#ifCond fromView '!==' "classification"}} {{#ifCond fromView '!==' "classification"}}
<div class="inline" data-id="containerCheckBox" style="display: none;"> <div class="inline" data-id="containerCheckBox" style="display: none;">
<label class="checkbox-inline btn" for="subtypes"> <label class="checkbox-inline btn" for="subtypes">
<input type="checkbox" data-id="checkSubType" data-value="excludeST" id="subtypes"/> <input type="checkbox" data-id="checkSubType" data-value="excludeST" id="subtypes" />
<b>Exclude sub-types</b></label> <b>Exclude sub-types</b></label>
</div> </div>
{{/ifCond}} {{/ifCond}}
......
...@@ -20,22 +20,16 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -20,22 +20,16 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
'use strict'; 'use strict';
var CommonViewFunction = {}; var CommonViewFunction = {};
CommonViewFunction.deleteTagModel = function(options) {
var modal = new Modal({
title: options.titleMessage,
okText: options.buttonText,
htmlContent: options.msg,
cancelText: "Cancel",
allowCancel: true,
okCloses: true,
showFooter: true,
}).open();
return modal;
};
CommonViewFunction.deleteTag = function(options) { CommonViewFunction.deleteTag = function(options) {
require(['models/VTag'], function(VTag) { require(['models/VTag'], function(VTag) {
var tagModel = new VTag();
if (options && options.guid && options.tagName) { if (options && options.guid && options.tagName) {
var tagModel = new VTag(),
notifyObj = {
modal: true,
text: options.msg,
title: options.titleMessage,
okText: options.okText,
ok: function(argument) {
if (options.showLoader) { if (options.showLoader) {
options.showLoader(); options.showLoader();
} }
...@@ -66,6 +60,14 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -66,6 +60,14 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
}); });
} }
}); });
},
cancel: function(argument) {
if (options.hideLoader) {
options.hideLoader();
}
}
};
Utils.notifyConfirm(notifyObj);
} }
}); });
}; };
...@@ -331,6 +333,10 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -331,6 +333,10 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
} }
queryArray.push(tagKeyValue); queryArray.push(tagKeyValue);
} }
if (value.term) {
var tagKeyValue = '<span class="key">Term:</span>&nbsp<span class="value">' + _.escape(value.term) + '</span>';
queryArray.push(tagKeyValue);
}
if (value.query) { if (value.query) {
queryArray.push('<span class="key">Query:</span>&nbsp<span class="value">' + _.trim(_.escape(value.query)) + '</span>&nbsp'); queryArray.push('<span class="key">Query:</span>&nbsp<span class="value">' + _.trim(_.escape(value.query)) + '</span>&nbsp');
} }
...@@ -600,9 +606,24 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -600,9 +606,24 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
"okText": model ? "Update" : "Create", "okText": model ? "Update" : "Create",
"allowCancel": true "allowCancel": true
}).open(); }).open();
modal.$el.find('button.ok').attr("disabled", "true");
if (model) {
view.$('input,textarea').on('keyup', function(e) {
modal.$el.find('button.ok').attr("disabled", false);
});
} else {
view.ui.displayName.on('keyup', function(e) {
modal.$el.find('button.ok').attr("disabled", false);
});
}
view.ui.displayName.on('keyup', function(e) {
if ((e.keyCode == 8 || e.keyCode == 32 || e.keyCode == 46) && e.currentTarget.value.trim() == "") {
modal.$el.find('button.ok').attr("disabled", true);
}
});
modal.on('ok', function() { modal.on('ok', function() {
if (isGlossaryView) { if (isGlossaryView) {
modal.$el.find('button.ok').attr("disabled", "true"); modal.$el.find('button.ok').attr("disabled", true);
} }
CommonViewFunction.createEditGlossaryCategoryTermSubmit(_.extend({ "ref": view, "modal": modal }, options)); CommonViewFunction.createEditGlossaryCategoryTermSubmit(_.extend({ "ref": view, "modal": modal }, options));
}); });
...@@ -637,19 +658,29 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -637,19 +658,29 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
messageType = "Category "; messageType = "Category ";
} }
var ajaxOptions = { var ajaxOptions = {
silent: true,
success: function(rModel, response) { success: function(rModel, response) {
Utils.notifySuccess({ Utils.notifySuccess({
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) {
options.callback(response); var obj = rModel;
if (isGlossaryView) {
obj = _.omit((rModel && rModel.toJSON ? rModel.toJSON() : rModel), 'terms', 'categories');
}
options.callback(obj);
} }
modal.trigger('closeModal'); modal.trigger('closeModal');
},
cust_error: function() {
if (isGlossaryView) {
modal.$el.find('button.ok').attr("disabled", false);
}
} }
} }
if (model) { if (model) {
if (isGlossaryView) { if (isGlossaryView) {
model.set(data).save(null, ajaxOptions) model.clone().set(data, { silent: true }).save(null, ajaxOptions)
} else { } else {
newModel[isTermView ? "createEditTerm" : "createEditCategory"](_.extend(ajaxOptions, { newModel[isTermView ? "createEditTerm" : "createEditCategory"](_.extend(ajaxOptions, {
guid: model.guid, guid: model.guid,
...@@ -694,12 +725,11 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -694,12 +725,11 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
ajaxOptions = { ajaxOptions = {
success: function(rModel, response) { success: function(rModel, response) {
Utils.notifySuccess({ Utils.notifySuccess({
content: ((isCategoryView ? "Term" : "Category") + " association is removed successfully") content: ((isCategoryView || isEntityView ? "Term" : "Category") + " association is removed successfully")
}); });
if (options.callback) { if (options.callback) {
options.callback(); options.callback();
} }
modal.trigger('closeModal');
}, },
cust_error: function() { cust_error: function() {
if (options.hideLoader) { if (options.hideLoader) {
...@@ -707,16 +737,12 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -707,16 +737,12 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
} }
} }
}, },
modal = new Modal({ notifyObj = {
modal: true,
text: options.msg,
title: options.titleMessage, title: options.titleMessage,
okText: options.buttonText, okText: options.buttonText,
htmlContent: options.msg, ok: function(argument) {
cancelText: "Cancel",
allowCancel: true,
okCloses: true,
showFooter: true,
}).open();
modal.on('ok', function() {
if (options.showLoader) { if (options.showLoader) {
options.showLoader(); options.showLoader();
} }
...@@ -738,13 +764,10 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -738,13 +764,10 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
data: JSON.stringify(_.extend({}, model, data)), data: JSON.stringify(_.extend({}, model, data)),
})); }));
} }
}); },
modal.on('closeModal', function() { cancel: function(argument) {}
modal.trigger('cancel'); };
if (options.onModalClose) { Utils.notifyConfirm(notifyObj);
options.onModalClose()
}
});
} }
} }
CommonViewFunction.addRestCsrfCustomHeader = function(xhr, settings) { CommonViewFunction.addRestCsrfCustomHeader = function(xhr, settings) {
......
...@@ -66,7 +66,7 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq ...@@ -66,7 +66,7 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq
var getPopoverEl = function(e) { var getPopoverEl = function(e) {
return $(e.target).parent().data("bs.popover") || $(e.target).data("bs.popover") || $(e.target).parents('.popover').length; return $(e.target).parent().data("bs.popover") || $(e.target).data("bs.popover") || $(e.target).parents('.popover').length;
} }
$('body').on('click DOMMouseScroll mousewheel', function(e) { $(document).on('click DOMMouseScroll mousewheel', function(e) {
if (e.originalEvent) { if (e.originalEvent) {
// Do action if it is triggered by a human. // Do action if it is triggered by a human.
//e.isImmediatePropagationStopped(); //e.isImmediatePropagationStopped();
......
...@@ -124,7 +124,7 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -124,7 +124,7 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
var modal = {}; var modal = {};
if (options && options.modal) { if (options && options.modal) {
var myStack = { "dir1": "down", "dir2": "right", "push": "top", 'modal': true }; var myStack = { "dir1": "down", "dir2": "right", "push": "top", 'modal': true };
modal['addclass'] = 'stack-modal'; modal['addclass'] = 'stack-modal ' + (options.modalClass ? modalClass : 'width-500');
modal['stack'] = myStack; modal['stack'] = myStack;
} }
notify(_.extend({ notify(_.extend({
...@@ -133,7 +133,7 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -133,7 +133,7 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
confirm: { confirm: {
confirm: true, confirm: true,
buttons: [{ buttons: [{
text: 'cancel', text: options.cancelText || 'Cancel',
addClass: 'btn-action btn-md', addClass: 'btn-action btn-md',
click: function(notice) { click: function(notice) {
options.cancel(notice); options.cancel(notice);
...@@ -141,7 +141,7 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -141,7 +141,7 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
} }
}, },
{ {
text: 'Ok', text: options.okText || 'Ok',
addClass: 'btn-atlas btn-md', addClass: 'btn-atlas btn-md',
click: function(notice) { click: function(notice) {
options.ok(notice); options.ok(notice);
...@@ -439,19 +439,19 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -439,19 +439,19 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
return returnObj; return returnObj;
} }
Utils.showTitleLoader = function(loaderEl, titleBoxEl) { Utils.showTitleLoader = function(loaderEl, titleBoxEl) {
loaderEl.css({ loaderEl.css ? loaderEl.css({
'display': 'block', 'display': 'block',
'position': 'relative', 'position': 'relative',
'height': '85px', 'height': '85px',
'marginTop': '85px', 'marginTop': '85px',
'marginLeft': '50%', 'marginLeft': '50%',
'left': '0%' 'left': '0%'
}); }) : null;
titleBoxEl.hide(); titleBoxEl.hide ? titleBoxEl.hide() : null;
} }
Utils.hideTitleLoader = function(loaderEl, titleBoxEl) { Utils.hideTitleLoader = function(loaderEl, titleBoxEl) {
loaderEl.hide(); loaderEl.hide ? loaderEl.hide() : null;
titleBoxEl.fadeIn(); titleBoxEl.fadeIn ? titleBoxEl.fadeIn() : null;
} }
Utils.findAndMergeRefEntity = function(attributeObject, referredEntities) { Utils.findAndMergeRefEntity = function(attributeObject, referredEntities) {
var mergeObject = function(obj) { var mergeObject = function(obj) {
...@@ -477,6 +477,28 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -477,6 +477,28 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
}); });
} }
} }
Utils.getNestedSuperTypes = function(options) {
var data = options.data,
collection = options.collection,
superTypes = [];
var getData = function(data, collection) {
superTypes = superTypes.concat(data.superTypes);
if (data.superTypes && data.superTypes.length) {
_.each(data.superTypes, function(superTypeName) {
if (collection.fullCollection) {
var collectionData = collection.fullCollection.findWhere({ name: superTypeName }).toJSON();
} else {
var collectionData = collection.findWhere({ name: superTypeName }).toJSON();
}
return getData(collectionData, collection);
});
}
}
getData(data, collection);
return _.uniq(superTypes);
}
Utils.getNestedSuperTypeObj = function(options) { Utils.getNestedSuperTypeObj = function(options) {
var flag = 0, var flag = 0,
data = options.data, data = options.data,
...@@ -513,7 +535,7 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -513,7 +535,7 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
} }
} }
getData(data, collection); getData(data, collection);
return attributeDefs return attributeDefs;
} }
Utils.getProfileTabType = function(profileData, skipData) { Utils.getProfileTabType = function(profileData, skipData) {
......
...@@ -90,7 +90,7 @@ define(['require', ...@@ -90,7 +90,7 @@ define(['require',
Utils.setUrl({ Utils.setUrl({
url: '#!/glossary/' + $(e.currentTarget).find('i').data('guid'), url: '#!/glossary/' + $(e.currentTarget).find('i').data('guid'),
mergeBrowserUrl: false, mergeBrowserUrl: false,
urlParams: { gType: "term" }, urlParams: { gType: "term", viewType: "term", fromView: "entity" },
trigger: true trigger: true
}); });
} }
...@@ -118,7 +118,6 @@ define(['require', ...@@ -118,7 +118,6 @@ define(['require',
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'value', 'collection', 'id', 'entityDefCollection', 'typeHeaders', 'enumDefCollection', 'classificationDefCollection', 'glossaryCollection')); _.extend(this, _.pick(options, 'value', 'collection', 'id', 'entityDefCollection', 'typeHeaders', 'enumDefCollection', 'classificationDefCollection', 'glossaryCollection'));
this.bindEvents();
$('body').addClass("detail-page"); $('body').addClass("detail-page");
}, },
bindEvents: function() { bindEvents: function() {
...@@ -126,6 +125,10 @@ define(['require', ...@@ -126,6 +125,10 @@ define(['require',
this.listenTo(this.collection, 'reset', function() { this.listenTo(this.collection, 'reset', function() {
this.entityObject = this.collection.first().toJSON(); this.entityObject = this.collection.first().toJSON();
var collectionJSON = this.entityObject.entity; var collectionJSON = this.entityObject.entity;
if (collectionJSON && collectionJSON.typeName.startsWith("__AtlasGlossary")) {
this.$(".termBox").hide();
}
// MergerRefEntity. // MergerRefEntity.
Utils.findAndMergeRefEntity(collectionJSON.attributes, this.entityObject.referredEntities); Utils.findAndMergeRefEntity(collectionJSON.attributes, this.entityObject.referredEntities);
...@@ -200,6 +203,7 @@ define(['require', ...@@ -200,6 +203,7 @@ define(['require',
fetchCollection: this.fetchCollection.bind(that), fetchCollection: this.fetchCollection.bind(that),
enumDefCollection: this.enumDefCollection, enumDefCollection: this.enumDefCollection,
classificationDefCollection: this.classificationDefCollection, classificationDefCollection: this.classificationDefCollection,
glossaryCollection: this.glossaryCollection,
attributeDefs: (function() { attributeDefs: (function() {
return that.getEntityDef(collectionJSON); return that.getEntityDef(collectionJSON);
})() })()
...@@ -208,6 +212,8 @@ define(['require', ...@@ -208,6 +212,8 @@ define(['require',
this.renderRelationshipLayoutView(obj); this.renderRelationshipLayoutView(obj);
this.renderAuditTableLayoutView(obj); this.renderAuditTableLayoutView(obj);
this.renderTagTableLayoutView(obj); this.renderTagTableLayoutView(obj);
// To render profile tab check for attribute "profileData" or typeName = "hive_db","hbase_namespace"
if (collectionJSON && (!_.isUndefined(collectionJSON.attributes['profileData']) || collectionJSON.typeName === "hive_db" || collectionJSON.typeName === "hbase_namespace")) { if (collectionJSON && (!_.isUndefined(collectionJSON.attributes['profileData']) || collectionJSON.typeName === "hive_db" || collectionJSON.typeName === "hbase_namespace")) {
if (collectionJSON.typeName === "hive_db" || collectionJSON.typeName === "hbase_namespace") { if (collectionJSON.typeName === "hive_db" || collectionJSON.typeName === "hbase_namespace") {
this.$('.profileTab a').text("Tables") this.$('.profileTab a').text("Tables")
...@@ -221,6 +227,7 @@ define(['require', ...@@ -221,6 +227,7 @@ define(['require',
})); }));
} }
if (this.activeEntityDef) {
// To render Schema check attribute "schemaElementsAttribute" // To render Schema check attribute "schemaElementsAttribute"
var schemaOptions = this.activeEntityDef.get('options'); var schemaOptions = this.activeEntityDef.get('options');
if (schemaOptions && schemaOptions.hasOwnProperty('schemaElementsAttribute') && schemaOptions.schemaElementsAttribute !== "") { if (schemaOptions && schemaOptions.hasOwnProperty('schemaElementsAttribute') && schemaOptions.schemaElementsAttribute !== "") {
...@@ -237,7 +244,8 @@ define(['require', ...@@ -237,7 +244,8 @@ define(['require',
updateTabState: true updateTabState: true
}); });
} }
if (this.activeEntityDef && _.contains(this.activeEntityDef.get('superTypes'), "DataSet")) {
if (_.contains(Utils.getNestedSuperTypes({ data: this.activeEntityDef.toJSON(), collection: this.entityDefCollection }), "DataSet")) {
this.$('.lineageGraph').show(); this.$('.lineageGraph').show();
this.renderLineageLayoutView({ this.renderLineageLayoutView({
guid: this.id, guid: this.id,
...@@ -263,6 +271,9 @@ define(['require', ...@@ -263,6 +271,9 @@ define(['require',
updateTabState: true updateTabState: true
}); });
} }
}
}, this); }, this);
this.listenTo(this.collection, 'error', function(model, response) { this.listenTo(this.collection, 'error', function(model, response) {
this.$('.fontLoader-relative').removeClass('show'); this.$('.fontLoader-relative').removeClass('show');
...@@ -275,31 +286,9 @@ define(['require', ...@@ -275,31 +286,9 @@ define(['require',
}, },
onRender: function() { onRender: function() {
var that = this; var that = this;
this.bindEvents();
Utils.showTitleLoader(this.$('.page-title .fontLoader'), this.$('.entityDetail')); Utils.showTitleLoader(this.$('.page-title .fontLoader'), this.$('.entityDetail'));
this.$('.fontLoader-relative').addClass('show'); // to show tab loader this.$('.fontLoader-relative').addClass('show'); // to show tab loader
// this.ui.fullscreenPanel.on('fullscreen_done', function(e, panel) {
// var svgEl = panel.find('.panel-body svg'),
// scaleEl = svgEl.find('>g'),
// zoom = that.RLineageLayoutView.currentView.zoom,
// svg = that.RLineageLayoutView.currentView.svg,
// viewThis = that.RLineageLayoutView.currentView,
// setGraphZoomPositionCal = that.RLineageLayoutView.currentView.setGraphZoomPositionCal,
// zoomed = that.RLineageLayoutView.currentView.zoomed;;
// if (zoom) {
// setGraphZoomPositionCal.call(viewThis);
// zoomed.call(viewThis);
// if ($(e.currentTarget).find('i').hasClass('fa fa-compress')) {
// svg.call(zoom)
// .on("dblclick.zoom", null);
// } else {
// svg.call(zoom)
// .on("wheel.zoom", null)
// .on("dblclick.zoom", null);
// }
// }
// })
}, },
onShow: function() { onShow: function() {
if (this.value && this.value.tabActive) { if (this.value && this.value.tabActive) {
...@@ -330,32 +319,16 @@ define(['require', ...@@ -330,32 +319,16 @@ define(['require',
} }
}, },
onClickTagCross: function(e) { onClickTagCross: function(e) {
var tagName = $(e.currentTarget).parent().text(), var that = this,
that = this; tagName = $(e.currentTarget).parent().text();
var modal = CommonViewFunction.deleteTagModel({ CommonViewFunction.deleteTag(_.extend({}, {
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.name + "?</b></div>", msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.name + "?</b></div>",
titleMessage: Messages.removeTag, titleMessage: Messages.removeTag,
buttonText: "Remove" okText: "Remove",
}); showLoader: that.showLoader.bind(that),
if (modal) {
modal.on('ok', function() {
that.deleteTagData({
'tagName': tagName,
'guid': that.id,
'el': $(e.currentTarget)
});
});
modal.on('closeModal', function() {
modal.trigger('cancel');
});
}
},
deleteTagData: function(options) {
var that = this,
tagName = options.el.text();
Utils.showTitleLoader(this.$('.page-title .fontLoader'), this.$('.entityDetail'));
CommonViewFunction.deleteTag(_.extend({}, options, {
hideLoader: that.hideLoader.bind(that), hideLoader: that.hideLoader.bind(that),
tagName: tagName,
guid: that.id,
callback: function() { callback: function() {
that.fetchCollection(); that.fetchCollection();
} }
......
...@@ -102,7 +102,7 @@ define(['require', ...@@ -102,7 +102,7 @@ define(['require',
ajaxOptions = { ajaxOptions = {
success: function(rModel, response) { success: function(rModel, response) {
Utils.notifySuccess({ Utils.notifySuccess({
content: (that.isCategoryView ? "Term" : "Category") + " is associated successfully " content: (that.isCategoryView || that.isEntityView ? "Term" : "Category") + " is associated successfully "
}); });
that.modal.trigger('closeModal'); that.modal.trigger('closeModal');
if (that.callback) { if (that.callback) {
......
...@@ -41,7 +41,6 @@ define(['require', ...@@ -41,7 +41,6 @@ define(['require',
/** ui selector cache */ /** ui selector cache */
ui: { ui: {
"qualifiedName": "[data-id='qualifiedName']",
"displayName": "[data-id='displayName']", "displayName": "[data-id='displayName']",
"shortDescription": "[data-id='shortDescription']", "shortDescription": "[data-id='shortDescription']",
"longDescription": "[data-id='longDescription']", "longDescription": "[data-id='longDescription']",
......
...@@ -36,6 +36,7 @@ define(['require', ...@@ -36,6 +36,7 @@ define(['require',
/** Layout sub regions */ /** Layout sub regions */
regions: { regions: {
RSearchResultLayoutView: "#r_searchResultLayoutView", RSearchResultLayoutView: "#r_searchResultLayoutView",
RTagTableLayoutView: "#r_tagTableLayoutView"
}, },
templateHelpers: function() { templateHelpers: function() {
return { return {
...@@ -51,14 +52,21 @@ define(['require', ...@@ -51,14 +52,21 @@ define(['require',
title: "[data-id='title']", title: "[data-id='title']",
shortDescription: "[data-id='shortDescription']", shortDescription: "[data-id='shortDescription']",
longDescription: "[data-id='longDescription']", longDescription: "[data-id='longDescription']",
categoryList: "[data-id='categoryList']", categoryList: "[data-id='categoryList']",
removeCategory: "[data-id='removeCategory']", removeCategory: "[data-id='removeCategory']",
categoryClick: "[data-id='categoryClick']", categoryClick: "[data-id='categoryClick']",
addCategory: "[data-id='addCategory']", addCategory: "[data-id='addCategory']",
termList: "[data-id='termList']", termList: "[data-id='termList']",
removeTerm: "[data-id='removeTerm']", removeTerm: "[data-id='removeTerm']",
termClick: "[data-id='termClick']", termClick: "[data-id='termClick']",
addTerm: "[data-id='addTerm']" addTerm: "[data-id='addTerm']",
tagList: "[data-id='tagList']",
removeTag: '[data-id="removeTag"]',
tagClick: '[data-id="tagClick"]',
addTag: '[data-id="addTag"]',
}, },
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
...@@ -73,7 +81,7 @@ define(['require', ...@@ -73,7 +81,7 @@ define(['require',
Utils.setUrl({ Utils.setUrl({
url: '#!/glossary/' + guid, url: '#!/glossary/' + guid,
mergeBrowserUrl: false, mergeBrowserUrl: false,
urlParams: { gType: "category" }, urlParams: { gType: "category", viewType: "category", fromView: "glossary" },
trigger: true, trigger: true,
updateTabState: true updateTabState: true
}); });
...@@ -89,12 +97,23 @@ define(['require', ...@@ -89,12 +97,23 @@ define(['require',
Utils.setUrl({ Utils.setUrl({
url: '#!/glossary/' + guid, url: '#!/glossary/' + guid,
mergeBrowserUrl: false, mergeBrowserUrl: false,
urlParams: { gType: "term" }, urlParams: { gType: "term", viewType: "term", fromView: "glossary" },
trigger: true, trigger: true,
updateTabState: true updateTabState: true
}); });
} }
}; };
events["click " + this.ui.tagClick] = function(e) {
if (e.target.nodeName.toLocaleLowerCase() == "i") {
this.onClickTagCross(e);
} else {
Utils.setUrl({
url: '#!/tag/tagAttribute/' + e.currentTarget.textContent,
mergeBrowserUrl: false,
trigger: true
});
}
};
events["click " + this.ui.editButton] = function(e) { events["click " + this.ui.editButton] = function(e) {
var that = this, var that = this,
model = this.glossaryCollection.fullCollection.get(this.guid); model = this.glossaryCollection.fullCollection.get(this.guid);
...@@ -103,11 +122,11 @@ define(['require', ...@@ -103,11 +122,11 @@ define(['require',
"model": model, "model": model,
"isGlossaryView": this.isGlossaryView, "isGlossaryView": this.isGlossaryView,
"collection": this.glossaryCollection, "collection": this.glossaryCollection,
"callback": function(newModel) { "callback": function(data) {
that.data = newModel; model.set(_.extend({}, model.toJSON(), data), { silent: true });
model.set(newModel); that.data = data;
that.renderDetails(that.data); that.renderDetails(that.data);
//that.glossaryCollection.trigger("update:details"); that.glossaryCollection.trigger("update:details", { isGlossaryUpdate: true });
} }
}); });
} else { } else {
...@@ -116,15 +135,33 @@ define(['require', ...@@ -116,15 +135,33 @@ define(['require',
"isCategoryView": this.isCategoryView, "isCategoryView": this.isCategoryView,
"model": this.data, "model": this.data,
"collection": this.glossaryCollection, "collection": this.glossaryCollection,
"callback": function() { "callback": function(data) {
that.getData(); if (data.displayName != that.data.displayName) {
that.glossaryCollection.trigger("update:details"); var glossary = that.glossaryCollection.fullCollection.get(data.anchor.glossaryGuid);
if (that.isTermView) {
_.find(glossary.get('terms'), function(obj) {
if (obj.termGuid == data.guid) {
obj.displayText = data.displayName
}
});
} else if (!data.parentCategory) {
_.find(glossary.get('categories'), function(obj) {
if (obj.categoryGuid == data.guid) {
obj.displayText = data.displayName
}
});
}
that.glossaryCollection.trigger("update:details", { data: that.data });
}
that.data = data;
that.renderDetails(that.data);
} }
}); });
} }
}; };
events["click " + this.ui.addTerm] = 'onClickAddTermBtn'; events["click " + this.ui.addTerm] = 'onClickAddTermBtn';
events["click " + this.ui.addCategory] = 'onClickAddCategoryBtn'; events["click " + this.ui.addCategory] = 'onClickAddCategoryBtn';
events["click " + this.ui.addTag] = 'onClickAddTagBtn';
return events; return events;
}, },
/** /**
...@@ -144,6 +181,7 @@ define(['require', ...@@ -144,6 +181,7 @@ define(['require',
} }
}, },
onRender: function() { onRender: function() {
this.$('.fontLoader-relative').show();
this.getData(); this.getData();
this.bindEvents(); this.bindEvents();
}, },
...@@ -165,8 +203,20 @@ define(['require', ...@@ -165,8 +203,20 @@ define(['require',
"guid": this.guid, "guid": this.guid,
"ajaxOptions": { "ajaxOptions": {
success: function(data) { success: function(data) {
if (that.isDestroyed) {
return;
}
if (that.isTermView) { if (that.isTermView) {
that.renderSearchResultLayoutView(); var obj = {
"guid": that.guid,
"entityDefCollection": that.entityDefCollection,
"typeHeaders": that.typeHeaders,
"tagCollection": that.collection,
"enumDefCollection": that.enumDefCollection,
"classificationDefCollection": that.classificationDefCollection
}
that.renderSearchResultLayoutView(obj);
that.renderTagTableLayoutView(obj);
} }
that.data = data; that.data = data;
that.glossary.selectedItem.model = data; that.glossary.selectedItem.model = data;
...@@ -185,7 +235,7 @@ define(['require', ...@@ -185,7 +235,7 @@ define(['require',
this.ui.longDescription.text(data.longDescription); this.ui.longDescription.text(data.longDescription);
this.generateCategories(data.categories); this.generateCategories(data.categories);
this.generateTerm(data.terms); this.generateTerm(data.terms);
this.generateTag(data.classifications);
}, },
generateCategories: function(data) { generateCategories: function(data) {
var that = this, var that = this,
...@@ -208,6 +258,15 @@ define(['require', ...@@ -208,6 +258,15 @@ define(['require',
this.ui.termList.prepend(terms); this.ui.termList.prepend(terms);
}, },
generateTag: function(tagObject) {
var that = this,
tagData = "";
_.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>';
});
this.ui.tagList.find("span.btn").remove();
this.ui.tagList.prepend(tagData);
},
onClickAddTermBtn: function(e) { onClickAddTermBtn: function(e) {
var that = this; var that = this;
require(['views/glossary/AssignTermLayoutView'], function(AssignTermLayoutView) { require(['views/glossary/AssignTermLayoutView'], function(AssignTermLayoutView) {
...@@ -240,6 +299,45 @@ define(['require', ...@@ -240,6 +299,45 @@ define(['require',
}); });
}); });
}, },
onClickAddTagBtn: function(e) {
var that = this;
require(['views/tag/AddTagModalView'], function(AddTagModalView) {
var tagList = [];
_.map(that.data.classifications, function(obj) {
if (obj.entityGuid === that.guid) {
tagList.push(obj.typeName);
}
});
var view = new AddTagModalView({
guid: that.guid,
tagList: tagList,
callback: function() {
that.getData();
},
showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that),
collection: that.classificationDefCollection,
enumDefCollection: that.enumDefCollection
});
});
},
onClickTagCross: function(e) {
var that = this,
tagName = $(e.currentTarget).text(),
termName = this.data.displayName;
CommonViewFunction.deleteTag(_.extend({}, {
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + termName + "?</b></div>",
titleMessage: Messages.removeTag,
okText: "Remove",
showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that),
tagName: tagName,
guid: that.guid,
callback: function() {
that.getData();
}
}));
},
onClickRemoveAssociationBtn: function(e) { onClickRemoveAssociationBtn: function(e) {
var $el = $(e.currentTarget), var $el = $(e.currentTarget),
guid = $el.data('guid'), guid = $el.data('guid'),
...@@ -267,7 +365,17 @@ define(['require', ...@@ -267,7 +365,17 @@ define(['require',
hideLoader: function() { hideLoader: function() {
Utils.hideTitleLoader(this.$('.page-title .fontLoader'), this.ui.details); Utils.hideTitleLoader(this.$('.page-title .fontLoader'), this.ui.details);
}, },
renderSearchResultLayoutView: function() { renderTagTableLayoutView: function(options) {
var that = this;
require(['views/tag/TagDetailTableLayoutView'], function(TagDetailTableLayoutView) {
that.RTagTableLayoutView.show(new TagDetailTableLayoutView(_.extend({}, options, {
"entityName": that.ui.title.text(),
"fetchCollection": that.getData.bind(that),
"entity": that.data
})));
});
},
renderSearchResultLayoutView: function(options) {
var that = this; var that = this;
require(['views/search/SearchResultLayoutView'], function(SearchResultLayoutView) { require(['views/search/SearchResultLayoutView'], function(SearchResultLayoutView) {
var value = { var value = {
...@@ -275,17 +383,10 @@ define(['require', ...@@ -275,17 +383,10 @@ define(['require',
'searchType': 'basic' 'searchType': 'basic'
}; };
if (that.RSearchResultLayoutView) { if (that.RSearchResultLayoutView) {
that.RSearchResultLayoutView.show(new SearchResultLayoutView({ that.RSearchResultLayoutView.show(new SearchResultLayoutView(_.extend({}, options, {
"value": _.extend({}, that.value, { "searchType": "basic" }), "value": { "searchType": "basic", "term": that.data.qualifiedName },
"termName": that.data.qualifiedName,
"guid": that.guid,
"entityDefCollection": that.entityDefCollection,
"typeHeaders": that.typeHeaders,
"tagCollection": that.collection,
"enumDefCollection": that.enumDefCollection,
"classificationDefCollection": that.classificationDefCollection,
"fromView": "glossary" "fromView": "glossary"
})); })));
} }
}); });
}, },
......
...@@ -92,26 +92,42 @@ define(['require', ...@@ -92,26 +92,42 @@ define(['require',
this.isAssignView = this.isAssignTermView || this.isAssignCategoryView || this.isAssignEntityView; this.isAssignView = this.isAssignTermView || this.isAssignCategoryView || this.isAssignEntityView;
this.bindEvents(); this.bindEvents();
this.query = { this.query = {
term: { term: {},
url: null category: {}
},
category: {
url: null
}
}; };
if (Utils.getUrlState.isGlossaryTab() && this.value && this.value.viewType) {
this.viewType = this.value.viewType;
}
this.query[this.viewType] = _.extend({}, this.value, { "guid": this.guid });
}, },
bindEvents: function() { bindEvents: function() {
var that = this; var that = this;
this.listenTo(this.glossaryCollection.fullCollection, "reset add remove change", function() { this.listenTo(this.glossaryCollection.fullCollection, "reset add change", function(skip) {
this.generateTree(); this.generateTree();
this.setValues();
}, this); }, this);
this.listenTo(this.glossaryCollection, "update:details", function() { this.listenTo(this.glossaryCollection, "update:details", function(options) {
this.getGlossary(); var isGlossaryUpdate = options.isGlossaryUpdate;
if (isGlossaryUpdate) {
if (this.ui.termTree.jstree(true).refresh) {
this.ui.termTree.jstree(true).refresh();
}
if (this.ui.categoryTree.jstree(true).refresh) {
this.ui.categoryTree.jstree(true).refresh();
}
} else {
var $tree = this.ui[this.viewType == "term" ? "termTree" : "categoryTree"];
if ($tree.jstree(true).refresh) {
$tree.jstree(true).refresh();
}
}
}, this); }, this);
if (!this.isAssignView) {
$('body').on('click', '.termPopoverOptions li, .categoryPopoverOptions li', function(e) { $('body').on('click', '.termPopoverOptions li, .categoryPopoverOptions li', function(e) {
that.$('.termPopover,.categoryPopover').popover('hide'); that.$('.termPopover,.categoryPopover').popover('hide');
that[$(this).find('a').data('fn')](e) that[$(this).find('a').data('fn')](e)
}); });
}
}, },
onRender: function() { onRender: function() {
if (this.isAssignCategoryView) { if (this.isAssignCategoryView) {
...@@ -124,7 +140,19 @@ define(['require', ...@@ -124,7 +140,19 @@ define(['require',
this.getGlossary(); this.getGlossary();
} }
}, },
setValues: function() {
if (this.viewType == "category") {
if (!this.ui.glossaryView.prop("checked")) {
this.ui.glossaryView.prop("checked", true).trigger("change");
}
} else {
if (this.ui.glossaryView.prop("checked")) {
this.ui.glossaryView.prop("checked", false).trigger("change");
}
}
},
glossaryViewToggle: function(e) { glossaryViewToggle: function(e) {
var that = this;
if (e.currentTarget.checked) { if (e.currentTarget.checked) {
this.$('.category-view').show(); this.$('.category-view').show();
this.$('.term-view').hide(); this.$('.term-view').hide();
...@@ -134,18 +162,45 @@ define(['require', ...@@ -134,18 +162,45 @@ define(['require',
this.$('.category-view').hide(); this.$('.category-view').hide();
this.viewType = "term"; this.viewType = "term";
} }
var setDefaultSelector = function() {
var model = null;
if (that.value.gId) {
model = that.glossaryCollection.fullCollection.get(that.value.gId);
} else {
model = that.glossaryCollection.fullCollection.first();
}
model = model.toJSON ? model.toJSON() : model;
that.glossary.selectedItem = {
type: "Glossary",
guid: model.guid,
id: model.guid,
model: model,
gType: "glossary"
}
}
if (Utils.getUrlState.isGlossaryTab()) { if (Utils.getUrlState.isGlossaryTab()) {
// var name = this.query[this.viewType].url; var obj = this.query[this.viewType],
// var guid = this.glossary.selectedItem.guid; $tree = this.ui[(this.viewType == "term" ? "termTree" : "categoryTree")]
// Utils.setUrl({ if (obj.guid) {
// url: '#!/glossary/' + guid, var node = $tree.jstree(true).get_node(obj.guid);
// urlParams: { if (node) {
// viewType: this.viewType, $tree.jstree('activate_node', obj.guid);
// }, this.glossary.selectedItem = node.original;
// mergeBrowserUrl: false, } else {
// trigger: true, setDefaultSelector();
// updateTabState: true }
// }); } else {
setDefaultSelector();
$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 });
Utils.setUrl({
url: '#!/glossary/' + this.glossary.selectedItem.guid,
urlParams: _.extend({}, _.omit(obj, 'guid', 'model', 'type', 'isNodeNotFoundAtLoad')),
mergeBrowserUrl: false,
trigger: false,
updateTabState: true
});
} }
}, },
getGlossary: function() { getGlossary: function() {
...@@ -162,6 +217,7 @@ define(['require', ...@@ -162,6 +217,7 @@ define(['require',
"glossaryName": options.node.glossaryName, "glossaryName": options.node.glossaryName,
"model": obj, "model": obj,
"type": "GlossaryCategory", "type": "GlossaryCategory",
"gType": "category",
"children": true "children": true
} }
}); });
...@@ -188,19 +244,26 @@ define(['require', ...@@ -188,19 +244,26 @@ define(['require',
generateData: function(opt) { generateData: function(opt) {
var that = this, var that = this,
type = opt.type; type = opt.type;
if (opt.type == this.viewType) {
this.query[opt.type].isNodeNotFoundAtLoad = true;
}
var getSelectedState = function(options) { var getSelectedState = function(options) {
var objGuid = options.objGuid, var objGuid = options.objGuid,
node = options.node, node = options.node,
index = options.index; index = options.index;
if (!that.guid) { if (!that.guid) {
that.query[that.viewType].isNodeNotFoundAtLoad = false;
var selectedItem = { var selectedItem = {
"type": "Glossary", "type": "Glossary",
"model": that.glossaryCollection.first().toJSON() "gType": "glossary",
"model": that.glossaryCollection.fullCollection.first().toJSON()
}; };
selectedItem.text = selectedItem.model.displayName; selectedItem.text = selectedItem.model.displayName;
selectedItem.guid = selectedItem.model.guid; selectedItem.guid = selectedItem.model.guid;
if (index == 0 && selectedItem.guid == objGuid) { if (index == 0 && selectedItem.guid == objGuid) {
that.glossary.selectedItem = selectedItem; that.glossary.selectedItem = selectedItem;
that.query[that.viewType].model = selectedItem.model;
that.query[that.viewType].type = selectedItem.gType;
return { return {
'opened': true, 'opened': true,
'selected': true 'selected': true
...@@ -208,7 +271,10 @@ define(['require', ...@@ -208,7 +271,10 @@ define(['require',
} }
} else { } else {
if (that.guid == objGuid) { if (that.guid == objGuid) {
that.query[that.viewType].isNodeNotFoundAtLoad = false;
that.glossary.selectedItem = node that.glossary.selectedItem = node
that.query[that.viewType].model = node.model;
that.query[that.viewType].type = node.gType;
return { return {
'opened': true, 'opened': true,
'selected': true 'selected': true
...@@ -225,6 +291,7 @@ define(['require', ...@@ -225,6 +291,7 @@ define(['require',
"id": obj.guid, "id": obj.guid,
"model": obj, "model": obj,
"type": obj.typeName ? obj.typeName : "Glossary", "type": obj.typeName ? obj.typeName : "Glossary",
"gType": "glossary",
"children": [] "children": []
} }
parent.state = getSelectedState({ parent.state = getSelectedState({
...@@ -238,11 +305,12 @@ define(['require', ...@@ -238,11 +305,12 @@ define(['require',
if (category.parentCategoryGuid) { if (category.parentCategoryGuid) {
return; return;
} }
var type = category.typeName || "GlossaryCategory", var typeName = category.typeName || "GlossaryCategory",
guid = category.categoryGuid, guid = category.categoryGuid,
categoryObj = { categoryObj = {
"text": category.displayText, "text": category.displayText,
"type": type, "type": typeName,
"gType": "category",
"guid": guid, "guid": guid,
"id": guid, "id": guid,
"parent": obj, "parent": obj,
...@@ -262,11 +330,12 @@ define(['require', ...@@ -262,11 +330,12 @@ define(['require',
} }
if (type == "term" && obj.terms) { if (type == "term" && obj.terms) {
_.each(obj.terms, function(term) { _.each(obj.terms, function(term) {
var type = term.typeName || "GlossaryTerm", var typeName = term.typeName || "GlossaryTerm",
guid = term.termGuid, guid = term.termGuid,
termObj = { termObj = {
"text": term.displayText, "text": term.displayText,
"type": type, "type": typeName,
"gType": "term",
"guid": guid, "guid": guid,
"id": guid, "id": guid,
"parent": obj, "parent": obj,
...@@ -287,8 +356,32 @@ define(['require', ...@@ -287,8 +356,32 @@ define(['require',
}); });
}, },
manualRender: function(options) { manualRender: function(options) {
_.extend(this, options); _.extend(this, _.omit(options, 'isTrigger'));
if (this.value && this.value.viewType) {
this.viewType = this.value.viewType;
}
this.setValues();
if (this.guid && this.value && ((this.value.fromView && this.value.fromView) || (this.value.updateView))) {
var $tree = this.ui[this.viewType == "term" ? "termTree" : "categoryTree"],
node = $tree.jstree(true).get_node(this.guid);
if (node) {
$tree.jstree('activate_node', this.guid);
delete this.value.fromView;
delete this.value.updateView;
this.glossary.selectedItem = node.original;
Utils.setUrl({
url: '#!/glossary/' + this.guid,
urlParams: this.value,
mergeBrowserUrl: false,
trigger: false,
updateTabState: true
});
this.glossaryCollection.trigger("update:details", { isGlossaryUpdate: this.value.gType == "glossary" });
}
}
if (options.isTrigger) {
this.triggerUrl(); this.triggerUrl();
}
}, },
generateTree: function() { generateTree: function() {
var $termTree = this.ui.termTree, var $termTree = this.ui.termTree,
...@@ -298,10 +391,14 @@ define(['require', ...@@ -298,10 +391,14 @@ define(['require',
return { return {
"plugins": ["search", "themes", "core", "wholerow", "sort", "conditionalselect"], "plugins": ["search", "themes", "core", "wholerow", "sort", "conditionalselect"],
"conditionalselect": function(node) { "conditionalselect": function(node) {
var obj = node && node.original && node.original.type;
if (!obj) {
return;
}
if (that.isAssignView) { if (that.isAssignView) {
return node.original.type != "Glossary" ? true : false; return obj != "Glossary" ? true : false;
} else { } else {
return node.original.type != "NoAction" ? true : false; return obj != "NoAction" ? true : false;
} }
}, },
"core": { "core": {
...@@ -319,12 +416,10 @@ define(['require', ...@@ -319,12 +416,10 @@ define(['require',
} }
} }
}, },
treeLoaded = function() { treeLoaded = function(options) {
if (that.selectFirstNodeManually) { if (that.query[options.type].isNodeNotFoundAtLoad == true) {
that.selectFirstNodeManually = false;
var id = that.glossary.selectedItem.guid; var id = that.glossary.selectedItem.guid;
$treeEl.jstree('select_node', '#' + id + '_anchor'); options.$el.jstree('activate_node', id);
$treeEl.jstree('open_node', '#' + id + '_anchor');
} }
}, },
createAction = function(options) { createAction = function(options) {
...@@ -355,10 +450,25 @@ define(['require', ...@@ -355,10 +450,25 @@ define(['require',
}) })
.on("select_node.jstree", function(e, data) { .on("select_node.jstree", function(e, data) {
that.glossary.selectedItem = data.node.original; that.glossary.selectedItem = data.node.original;
//$("." + popoverClassName).popover('hide'); var popoverClassName = (type == "term" ? '.termPopover' : '.categoryPopover'),
currentClickedPopoverEl = "";
if (data.event) {
if ($(data.event.currentTarget).parent().hasClass('jstree-leaf')) {
currentClickedPopoverEl = $(data.event.currentTarget).parent().find(popoverClassName);
} else {
currentClickedPopoverEl = $(data.event.currentTarget).parent().find(">div " + popoverClassName);
}
$(popoverClassName).not(currentClickedPopoverEl).popover('hide');
}
if (that.query[type].isNodeNotFoundAtLoad == true) {
that.query[type].isNodeNotFoundAtLoad = false;
} else if (type == that.viewType) {
that.triggerUrl(); that.triggerUrl();
}
}).bind('loaded.jstree', function(e, data) { }).bind('loaded.jstree', function(e, data) {
treeLoaded(); if (that.query[type].isNodeNotFoundAtLoad == true) {
treeLoaded({ "$el": $el, "type": type });
}
}); });
}, },
initializeTermTree = function() { initializeTermTree = function() {
...@@ -374,6 +484,7 @@ define(['require', ...@@ -374,6 +484,7 @@ define(['require',
}, },
initializeCategoryTree = function() { initializeCategoryTree = function() {
if ($categoryTree.data('jstree')) { if ($categoryTree.data('jstree')) {
$('.categoryPopover').popover('destroy');
$categoryTree.jstree(true).refresh(); $categoryTree.jstree(true).refresh();
} else { } else {
initializeTree({ initializeTree({
...@@ -409,7 +520,7 @@ define(['require', ...@@ -409,7 +520,7 @@ define(['require',
var node = that.glossary.selectedItem, var node = that.glossary.selectedItem,
liString = ""; liString = "";
if (node.type == "Glossary") { if (node.type == "Glossary") {
liString = "<li data-type=" + node.type + " class='listTerm'><i class='fa fa-plus'></i> <a href='javascript:void(0)' data-fn='createSubNode'>Create Sub-Term</a></li>" + liString = "<li data-type=" + node.type + " class='listTerm'><i class='fa fa-plus'></i> <a href='javascript:void(0)' data-fn='createSubNode'>Create Term</a></li>" +
"<li data-type=" + node.type + " class='listTerm'><i class='fa fa-trash-o'></i><a href='javascript:void(0)' data-fn='deleteNode'>Delete Glossary</a></li>" "<li data-type=" + node.type + " class='listTerm'><i class='fa fa-trash-o'></i><a href='javascript:void(0)' data-fn='deleteNode'>Delete Glossary</a></li>"
} else { } else {
liString = "<li data-type=" + node.type + " class='listTerm'><i class='fa fa-trash-o'></i><a href='javascript:void(0)' data-fn='deleteNode'>Delete Term</a></li>" liString = "<li data-type=" + node.type + " class='listTerm'><i class='fa fa-trash-o'></i><a href='javascript:void(0)' data-fn='deleteNode'>Delete Term</a></li>"
...@@ -429,7 +540,7 @@ define(['require', ...@@ -429,7 +540,7 @@ define(['require',
var node = that.glossary.selectedItem, var node = that.glossary.selectedItem,
liString = ""; liString = "";
if (node.type == "Glossary") { if (node.type == "Glossary") {
liString = "<li data-type=" + node.type + " class='listTerm'><i class='fa fa-plus'></i> <a href='javascript:void(0)' data-fn='createSubNode'>Create Sub-Category</a></li>" + liString = "<li data-type=" + node.type + " class='listTerm'><i class='fa fa-plus'></i> <a href='javascript:void(0)' data-fn='createSubNode'>Create Category</a></li>" +
"<li data-type=" + node.type + " class='listTerm'><i class='fa fa-trash-o'></i><a href='javascript:void(0)' data-fn='deleteNode'>Delete Glossary</a></li>" "<li data-type=" + node.type + " class='listTerm'><i class='fa fa-trash-o'></i><a href='javascript:void(0)' data-fn='deleteNode'>Delete Glossary</a></li>"
} else { } else {
liString = "<li data-type=" + node.type + " class='listTerm'><i class='fa fa-plus'></i> <a href='javascript:void(0)' data-fn='createSubNode'>Create Sub-Category</a></li>" + liString = "<li data-type=" + node.type + " class='listTerm'><i class='fa fa-plus'></i> <a href='javascript:void(0)' data-fn='createSubNode'>Create Sub-Category</a></li>" +
...@@ -466,59 +577,101 @@ define(['require', ...@@ -466,59 +577,101 @@ define(['require',
deleteNode: function(opt) { deleteNode: function(opt) {
var that = this, var that = this,
messageType = "", messageType = "",
type = this.glossary.selectedItem.type,
guid = this.glossary.selectedItem.guid,
gId = this.glossary.selectedItem.glossaryId,
options = { options = {
success: function(rModel, response) { success: function(rModel, response) {
if (!gId) {
gId = guid;
}
var glossary = that.glossaryCollection.fullCollection.get(gId);
if (that.value) {
if (that.value.gType == "term") {
glossary.set('terms', _.reject(glossary.get('terms'), function(obj) {
return obj.termGuid == guid;
}), { silent: true });
} else if (that.value.gType == "category") {
glossary.set('categories', _.reject(glossary.get('categories'), function(obj) {
return obj.categoryGuid == guid;
}), { silent: true });
} else {
glossary = that.glossaryCollection.fullCollection.first();
if (glossary) {
gId = glossary.get('guid');
} else {
gId = null
}
}
}
Utils.notifySuccess({ Utils.notifySuccess({
content: messageType + Messages.deleteSuccessMessage content: messageType + Messages.deleteSuccessMessage
}); });
that.getGlossary(); var url = gId ? '#!/glossary/' + gId : '#!/glossary/';
Utils.setUrl({
url: '#!/glossary/' + gId,
mergeBrowserUrl: false,
trigger: true,
urlParams: gId ? _.extend({}, that.value, {
gType: 'glossary',
updateView: true,
gId: null
}) : null,
updateTabState: true
});
} }
}, },
type = this.glossary.selectedItem.type, notifyObj = {
guid = this.glossary.selectedItem.guid modal: true,
ok: function(argument) {
if (type == "Glossary") {
that.glossaryCollection.fullCollection.get(guid).destroy(options, { silent: true, reset: false });
} else if (type == "GlossaryCategory") {
new that.glossaryCollection.model().deleteCategory(guid, options);
} else if (type == "GlossaryTerm") {
new that.glossaryCollection.model().deleteTerm(guid, options);
}
},
cancel: function(argument) {}
};
if (type == "Glossary") { if (type == "Glossary") {
messageType = "Glossary"; messageType = "Glossary";
this.glossaryCollection.fullCollection.get(guid).destroy(options);
} else if (type == "GlossaryCategory") { } else if (type == "GlossaryCategory") {
messageType = "Category" messageType = "Category"
new this.glossaryCollection.model().deleteCategory(guid, options);
} else if (type == "GlossaryTerm") { } else if (type == "GlossaryTerm") {
messageType = "Term"; messageType = "Term";
new this.glossaryCollection.model().deleteTerm(guid, options);
} }
notifyObj['text'] = "Are you sure you want to delete the " + messageType;;
Utils.notifyConfirm(notifyObj);
}, },
triggerUrl: function() { triggerUrl: function(options) {
if (this.isAssignView) { if (this.isAssignView) {
return; return;
} }
var selectedItem = this.glossary.selectedItem; var selectedItem = this.glossary.selectedItem;
if (this.glossaryCollection.length && _.isEmpty(selectedItem)) { if (this.glossaryCollection.length && (_.isEmpty(selectedItem) || this.query[this.viewType].isNodeNotFoundAtLoad)) {
selectedItem = { "model": this.glossaryCollection.first().toJSON() }; selectedItem = { "model": this.glossaryCollection.first().toJSON() };
selectedItem.guid = selectedItem.model.guid; selectedItem.guid = selectedItem.model.guid;
selectedItem.type = "glossary"; selectedItem.type = "Glossary";
this.glossary.selectedItem = selectedItem; this.glossary.selectedItem = selectedItem;
this.selectFirstNodeManually = true; this.query[this.viewType].model = selectedItem.model;
this.query[this.viewType].gType = "glossary"
delete this.query[this.viewType].gId;
} }
if (_.isEmpty(selectedItem)) { if (_.isEmpty(selectedItem)) {
return; return;
} }
var type = selectedItem.type;
if (Utils.getUrlState.isGlossaryTab() || Utils.getUrlState.isDetailPage()) { if (Utils.getUrlState.isGlossaryTab() || Utils.getUrlState.isDetailPage()) {
var urlParams = { gType: "glossary" }, var obj = {};
guid = selectedItem.guid;
if (type === "GlossaryTerm") {
urlParams.gType = "term";
} else if (type === "GlossaryCategory") {
urlParams.gType = "category";
}
if (selectedItem.glossaryId) { if (selectedItem.glossaryId) {
urlParams["gId"] = selectedItem.glossaryId; obj["gId"] = selectedItem.glossaryId;
} }
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 });
Utils.setUrl({ Utils.setUrl({
url: '#!/glossary/' + guid, url: '#!/glossary/' + obj.guid,
mergeBrowserUrl: false, mergeBrowserUrl: false,
trigger: true, trigger: true,
urlParams: urlParams, urlParams: _.omit(obj, 'model', 'guid', 'type', 'isNodeNotFoundAtLoad'),
updateTabState: true updateTabState: true
}); });
} }
......
...@@ -155,6 +155,8 @@ define(['require', ...@@ -155,6 +155,8 @@ define(['require',
.links(data.links) .links(data.links)
.size([width, height]) .size([width, height])
.linkDistance(200) .linkDistance(200)
.gravity(0.0)
.friction(0.1)
.charge(function(d) { .charge(function(d) {
var charge = -500; var charge = -500;
if (d.index === 0) charge = 100 if (d.index === 0) charge = 100
...@@ -390,12 +392,10 @@ define(['require', ...@@ -390,12 +392,10 @@ define(['require',
}); });
node.attr("transform", function(d) { node.attr("transform", function(d) {
// if (d && d.value && d.value.guid == that.guid) { if (d && d.value && d.value.guid == that.guid) {
// Center fixed node d.x = (width / 2)
// var damper = 0.1; d.y = (height / 2)
// d.x = (width / 2) }
// d.y = (height / 2)
// }
return "translate(" + d.x + "," + d.y + ")"; return "translate(" + d.x + "," + d.y + ")";
}); });
} }
......
...@@ -57,7 +57,7 @@ define(['require', ...@@ -57,7 +57,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'profileData', 'guid', 'value', 'typeName', 'entityDetail', 'typeHeaders', 'entityDefCollection', 'enumDefCollection', 'classificationDefCollection')); _.extend(this, _.pick(options, 'profileData', 'guid', 'value', 'typeName', 'entityDetail', 'typeHeaders', 'entityDefCollection', 'enumDefCollection', 'classificationDefCollection', 'glossaryCollection'));
if (this.typeName === "hive_db" || this.typeName === "hbase_namespace") { if (this.typeName === "hive_db" || this.typeName === "hbase_namespace") {
this.profileData = { attributes: true }; this.profileData = { attributes: true };
} }
...@@ -80,7 +80,7 @@ define(['require', ...@@ -80,7 +80,7 @@ define(['require',
var value = _.extend({}, that.value, { var value = _.extend({}, that.value, {
'guid': that.guid, 'guid': that.guid,
'searchType': 'relationship', 'searchType': 'relationship',
'profileDBView' : true, 'profileDBView': true,
'typeName': that.typeName 'typeName': that.typeName
}); });
that.RProfileTableOrColumnLayoutView.show(new SearchResultLayoutView({ that.RProfileTableOrColumnLayoutView.show(new SearchResultLayoutView({
...@@ -89,6 +89,7 @@ define(['require', ...@@ -89,6 +89,7 @@ define(['require',
'entityDefCollection': that.entityDefCollection, 'entityDefCollection': that.entityDefCollection,
'enumDefCollection': that.enumDefCollection, 'enumDefCollection': that.enumDefCollection,
'isDisable': true, 'isDisable': true,
'glossaryCollection': that.glossaryCollection,
'classificationDefCollection': that.classificationDefCollection 'classificationDefCollection': that.classificationDefCollection
})); }));
}); });
......
...@@ -283,34 +283,19 @@ define(['require', ...@@ -283,34 +283,19 @@ define(['require',
var that = this, var that = this,
tagName = $(e.target).data("name"), tagName = $(e.target).data("name"),
guid = $(e.target).data("guid"), guid = $(e.target).data("guid"),
assetName = $(e.target).data("assetname"), assetName = $(e.target).data("assetname");
modal = CommonViewFunction.deleteTagModel({ CommonViewFunction.deleteTag({
tagName: tagName,
guid: guid,
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>", msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
titleMessage: Messages.removeTag, titleMessage: Messages.removeTag,
buttonText: "Remove" okText: "Remove",
});
if (modal) {
modal.on('ok', function() {
that.deleteTagData({
'tagName': tagName,
'guid': guid
});
});
modal.on('closeModal', function() {
modal.trigger('cancel');
});
}
},
deleteTagData: function(options) {
var that = this;
CommonViewFunction.deleteTag(_.extend({}, options, {
showLoader: that.showLoader.bind(that), showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that), hideLoader: that.hideLoader.bind(that),
callback: function() { callback: function() {
that.fetchCollection(); that.fetchCollection();
} }
})); });
}, },
onCheckDeletedEntity: function(e) { onCheckDeletedEntity: function(e) {
if (e.target.checked) { if (e.target.checked) {
......
...@@ -48,6 +48,7 @@ define(['require', ...@@ -48,6 +48,7 @@ define(['require',
clearSearch: '[data-id="clearSearch"]', clearSearch: '[data-id="clearSearch"]',
typeLov: '[data-id="typeLOV"]', typeLov: '[data-id="typeLOV"]',
tagLov: '[data-id="tagLOV"]', tagLov: '[data-id="tagLOV"]',
termLov: '[data-id="termLOV"]',
refreshBtn: '[data-id="refreshBtn"]', refreshBtn: '[data-id="refreshBtn"]',
advancedInfoBtn: '[data-id="advancedInfo"]', advancedInfoBtn: '[data-id="advancedInfo"]',
typeAttrFilter: '[data-id="typeAttrFilter"]', typeAttrFilter: '[data-id="typeAttrFilter"]',
...@@ -71,6 +72,7 @@ define(['require', ...@@ -71,6 +72,7 @@ define(['require',
events["click " + this.ui.clearSearch] = 'clearSearchData'; events["click " + this.ui.clearSearch] = 'clearSearchData';
events["change " + this.ui.typeLov] = 'checkForButtonVisiblity'; events["change " + this.ui.typeLov] = 'checkForButtonVisiblity';
events["change " + this.ui.tagLov] = 'checkForButtonVisiblity'; events["change " + this.ui.tagLov] = 'checkForButtonVisiblity';
events["change " + this.ui.termLov] = 'checkForButtonVisiblity';
events["click " + this.ui.refreshBtn] = 'onRefreshButton'; events["click " + this.ui.refreshBtn] = 'onRefreshButton';
events["click " + this.ui.advancedInfoBtn] = 'advancedInfo'; events["click " + this.ui.advancedInfoBtn] = 'advancedInfo';
events["click " + this.ui.typeAttrFilter] = function() { events["click " + this.ui.typeAttrFilter] = function() {
...@@ -100,6 +102,7 @@ define(['require', ...@@ -100,6 +102,7 @@ define(['require',
query: null, query: null,
type: null, type: null,
tag: null, tag: null,
term: null,
attributes: null, attributes: null,
tagFilters: null, tagFilters: null,
pageOffset: null, pageOffset: null,
...@@ -156,6 +159,7 @@ define(['require', ...@@ -156,6 +159,7 @@ define(['require',
'tagFilters': tagObj ? tagObj[queryObj.tag] : null, 'tagFilters': tagObj ? tagObj[queryObj.tag] : null,
'type': queryObj.type, 'type': queryObj.type,
'query': queryObj.query, 'query': queryObj.query,
'term': queryObj.term,
'tag': queryObj.tag 'tag': queryObj.tag
}) })
}, },
...@@ -195,6 +199,7 @@ define(['require', ...@@ -195,6 +199,7 @@ define(['require',
}, },
initializeValues: function() { initializeValues: function() {
this.renderTypeTagList(); this.renderTypeTagList();
this.renderTermList();
this.setValues(); this.setValues();
this.checkForButtonVisiblity(); this.checkForButtonVisiblity();
this.renderSaveSearch(); this.renderSaveSearch();
...@@ -248,12 +253,18 @@ define(['require', ...@@ -248,12 +253,18 @@ define(['require',
checkForButtonVisiblity: function(e, options) { checkForButtonVisiblity: function(e, options) {
if (this.type == "basic" && e && e.currentTarget) { if (this.type == "basic" && e && e.currentTarget) {
var $el = $(e.currentTarget), var $el = $(e.currentTarget),
isTagEl = $el.data('id') == "tagLOV" ? true : false; isTagEl = $el.data('id') == "tagLOV",
isTermEl = $el.data('id') == "termLOV",
isTypeEl = $el.data('id') == "typeLOV";
if (e.type == "change" && $el.select2('data')) { if (e.type == "change" && $el.select2('data')) {
var value = $el.val(), var value = $el.val(),
key = (isTagEl ? 'tag' : 'type'), key = "tag",
filterType = (isTagEl ? 'tagFilters' : 'entityFilters'), filterType = 'tagFilters',
value = value.length ? value : null; value = value && value.length ? value : null;
if (!isTagEl) {
key = (isTermEl ? "term" : "type");
filterType = (isTypeEl ? "entityFilters" : null);
}
if (this.value) { if (this.value) {
//On Change handle //On Change handle
if (this.value[key] !== value || (!value && !this.value[key])) { if (this.value[key] !== value || (!value && !this.value[key])) {
...@@ -267,10 +278,13 @@ define(['require', ...@@ -267,10 +278,13 @@ define(['require',
_.extend(this.query[this.type], temp); _.extend(this.query[this.type], temp);
} else { } else {
// Initial loading handle. // Initial loading handle.
if (filterType) {
var filterObj = this.searchTableFilters[filterType]; var filterObj = this.searchTableFilters[filterType];
if (filterObj && this.value[key]) { if (filterObj && this.value[key]) {
this.searchTableFilters[filterType][this.value[key]] = this.value[filterType] ? this.value[filterType] : null; this.searchTableFilters[filterType][this.value[key]] = this.value[filterType] ? this.value[filterType] : null;
} }
}
if (this.value.type) { if (this.value.type) {
if (this.value.attributes) { if (this.value.attributes) {
var attributes = _.sortBy(this.value.attributes.split(',')), var attributes = _.sortBy(this.value.attributes.split(',')),
...@@ -285,7 +299,9 @@ define(['require', ...@@ -285,7 +299,9 @@ define(['require',
} }
} }
} }
if (filterType) {
this.makeFilterButtonActive(filterType); this.makeFilterButtonActive(filterType);
}
} else { } else {
this.ui.tagAttrFilter.prop('disabled', true); this.ui.tagAttrFilter.prop('disabled', true);
this.ui.typeAttrFilter.prop('disabled', true); this.ui.typeAttrFilter.prop('disabled', true);
...@@ -295,7 +311,7 @@ define(['require', ...@@ -295,7 +311,7 @@ define(['require',
var that = this, var that = this,
value = this.ui.searchInput.val() || this.ui.typeLov.val(); value = this.ui.searchInput.val() || this.ui.typeLov.val();
if (!this.dsl && !value) { if (!this.dsl && !value) {
value = this.ui.tagLov.val(); value = this.ui.tagLov.val() || this.ui.termLov.val();
} }
if (value && value.length) { if (value && value.length) {
this.ui.searchBtn.removeAttr("disabled"); this.ui.searchBtn.removeAttr("disabled");
...@@ -324,6 +340,7 @@ define(['require', ...@@ -324,6 +340,7 @@ define(['require',
query: null, query: null,
type: null, type: null,
tag: null, tag: null,
term: null,
attributes: null, attributes: null,
tagFilters: null, tagFilters: null,
pageOffset: null, pageOffset: null,
...@@ -436,14 +453,64 @@ define(['require', ...@@ -436,14 +453,64 @@ define(['require',
that.ui.typeLov.html(typeStr); that.ui.typeLov.html(typeStr);
that.ui.tagLov.html(tagStr); that.ui.tagLov.html(tagStr);
this.ui.typeLov.select2({ this.ui.typeLov.select2({
placeholder: "Select", placeholder: "Select Type",
allowClear: true allowClear: true
}); });
this.ui.tagLov.select2({ this.ui.tagLov.select2({
placeholder: "Select", placeholder: "Select Classification",
allowClear: true allowClear: true
}); });
}, },
renderTermList: function() {
var getTypeAheadData = function(data, params) {
var dataList = data.entities,
foundOptions = [];
_.each(dataList, function(obj) {
if (obj) {
if (obj.guid) {
obj['id'] = Utils.getName(obj, 'qualifiedName');
}
foundOptions.push(obj);
}
});
return foundOptions;
}
this.ui.termLov.select2({
placeholder: "Search Term",
allowClear: true,
ajax: {
url: UrlLinks.searchApiUrl('attribute'),
dataType: 'json',
delay: 250,
data: function(params) {
return {
attrValuePrefix: params.term, // search term
typeName: "__AtlasGlossaryTerm",
limit: 10,
offset: 0
};
},
processResults: function(data, params) {
return {
results: getTypeAheadData(data, params)
};
},
cache: true
},
templateResult: function(option) {
var name = Utils.getName(option, 'qualifiedName');
return name === "-" ? option.text : name;
},
templateSelection: function(option) {
var name = Utils.getName(option, 'qualifiedName');
return name === "-" ? option.text : name;
},
escapeMarkup: function(markup) {
return markup;
},
minimumInputLength: 1
});
},
setValues: function(paramObj) { setValues: function(paramObj) {
var arr = [], var arr = [],
that = this; that = this;
...@@ -482,6 +549,16 @@ define(['require', ...@@ -482,6 +549,16 @@ define(['require',
this.ui.tagLov.trigger("change", { 'manual': true }); this.ui.tagLov.trigger("change", { 'manual': true });
} }
} }
this.ui.termLov.append('<option value="' + this.value.term + '" selected="selected">' + this.value.term + '</option>');
if (this.ui.termLov.data('select2')) {
if (this.ui.termLov.val() !== this.value.term) {
this.value.term = null;
this.ui.termLov.val("").trigger("change", { 'manual': true });
} else {
this.ui.termLov.trigger("change", { 'manual': true });
}
}
} }
setTimeout(function() { setTimeout(function() {
that.ui.searchInput.focus(); that.ui.searchInput.focus();
...@@ -501,6 +578,7 @@ define(['require', ...@@ -501,6 +578,7 @@ define(['require',
params['type'] = this.ui.typeLov.select2('val') || null; params['type'] = this.ui.typeLov.select2('val') || null;
if (!this.dsl) { if (!this.dsl) {
params['tag'] = this.ui.tagLov.select2('val') || null; params['tag'] = this.ui.tagLov.select2('val') || null;
params['term'] = this.ui.termLov.select2('val') || null;
var entityFilterObj = this.searchTableFilters['entityFilters'], var entityFilterObj = this.searchTableFilters['entityFilters'],
tagFilterObj = this.searchTableFilters['tagFilters']; tagFilterObj = this.searchTableFilters['tagFilters'];
if (this.value.tag) { if (this.value.tag) {
...@@ -545,20 +623,16 @@ define(['require', ...@@ -545,20 +623,16 @@ define(['require',
if (e.currentTarget.checked) { if (e.currentTarget.checked) {
this.type = "dsl"; this.type = "dsl";
this.dsl = true; this.dsl = true;
this.$('.tagBox').hide(); this.$('.typeFilterBtn,.tagBox,.termBox,.basicSaveSearch').hide();
this.$('.temFilterBtn').hide(); this.$('.typeFilter').addClass('col-sm-12');
this.$('.temFilter').addClass('col-sm-12'); this.$('.typeFilter').removeClass('col-sm-10');
this.$('.temFilter').removeClass('col-sm-10');
this.$('.basicSaveSearch').hide();
this.$('.advanceSaveSearch').show(); this.$('.advanceSaveSearch').show();
this.$('.searchText').text('Search By Query'); this.$('.searchText').text('Search By Query');
this.ui.searchInput.attr("placeholder", 'Search By Query eg. where name="sales_fact"'); this.ui.searchInput.attr("placeholder", 'Search By Query eg. where name="sales_fact"');
} else { } else {
this.$('.temFilter').addClass('col-sm-10'); this.$('.typeFilter').addClass('col-sm-10');
this.$('.temFilter').removeClass('col-sm-12'); this.$('.typeFilter').removeClass('col-sm-12');
this.$('.temFilterBtn').show(); this.$('.typeFilterBtn,.tagBox,.termBox,.basicSaveSearch').show();
this.$('.tagBox').show();
this.$('.basicSaveSearch').show();
this.$('.advanceSaveSearch').hide(); this.$('.advanceSaveSearch').hide();
this.dsl = false; this.dsl = false;
this.type = "basic"; this.type = "basic";
......
...@@ -103,7 +103,7 @@ define(['require', ...@@ -103,7 +103,7 @@ define(['require',
} else { } else {
this.triggerUrl({ this.triggerUrl({
url: '#!/glossary/' + scope.find('i').data('termguid'), url: '#!/glossary/' + scope.find('i').data('termguid'),
urlParams: { gType: "term" }, urlParams: { gType: "term", viewType: "term", fromView: "entity" },
mergeBrowserUrl: false, mergeBrowserUrl: false,
trigger: true, trigger: true,
updateTabState: null updateTabState: null
...@@ -476,7 +476,7 @@ define(['require', ...@@ -476,7 +476,7 @@ define(['require',
if (value.searchType) { if (value.searchType) {
this.searchCollection.url = UrlLinks.searchApiUrl(value.searchType); this.searchCollection.url = UrlLinks.searchApiUrl(value.searchType);
} }
_.extend(this.searchCollection.queryParams, { 'limit': this.limit, 'offset': this.offset, 'query': _.trim(value.query), 'typeName': value.type || null, 'classification': value.tag || null, 'termName': that.termName || null }); _.extend(this.searchCollection.queryParams, { 'limit': this.limit, 'offset': this.offset, 'query': _.trim(value.query), 'typeName': value.type || null, 'classification': value.tag || null, 'termName': value.term || null });
if (value.profileDBView && value.typeName && value.guid) { if (value.profileDBView && value.typeName && value.guid) {
var profileParam = {}; var profileParam = {};
profileParam['guid'] = value.guid; profileParam['guid'] = value.guid;
...@@ -851,12 +851,13 @@ define(['require', ...@@ -851,12 +851,13 @@ 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.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 {
return CommonViewFunction.termForTable(obj); return CommonViewFunction.termForTable(obj);
} }
}
} }
}) })
}; };
...@@ -936,23 +937,20 @@ define(['require', ...@@ -936,23 +937,20 @@ define(['require',
var that = this, var that = this,
tagName = $(e.target).data("name"), tagName = $(e.target).data("name"),
guid = $(e.target).data("guid"), guid = $(e.target).data("guid"),
assetName = $(e.target).data("assetname"), assetName = $(e.target).data("assetname");
modal = CommonViewFunction.deleteTagModel({ CommonViewFunction.deleteTag({
tagName: tagName,
guid: guid,
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>", msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
titleMessage: Messages.removeTag, titleMessage: Messages.removeTag,
buttonText: "Remove" okText: "Remove",
}); showLoader: that.showLoader.bind(that),
if (modal) { hideLoader: that.hideLoader.bind(that),
modal.on('ok', function() { callback: function() {
that.deleteTagData({ that.fetchCollection();
'tagName': tagName,
'guid': guid
});
});
modal.on('closeModal', function() {
modal.trigger('cancel');
});
} }
});
}, },
onClickTermCross: function(e) { onClickTermCross: function(e) {
var $el = $(e.target), var $el = $(e.target),
...@@ -979,16 +977,6 @@ define(['require', ...@@ -979,16 +977,6 @@ define(['require',
} }
}); });
}, },
deleteTagData: function(options) {
var that = this;
CommonViewFunction.deleteTag(_.extend({}, options, {
showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that),
callback: function() {
that.fetchCollection();
}
}));
},
onClicknextData: function() { onClicknextData: function() {
this.offset = this.offset + this.limit; this.offset = this.offset + this.limit;
_.extend(this.searchCollection.queryParams, { _.extend(this.searchCollection.queryParams, {
......
...@@ -44,7 +44,7 @@ define(['require', ...@@ -44,7 +44,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'tag', 'value', 'classificationDefCollection', 'entityDefCollection', 'typeHeaders', 'enumDefCollection')); _.extend(this, _.pick(options, 'tag', 'value', 'glossaryCollection', 'classificationDefCollection', 'entityDefCollection', 'typeHeaders', 'enumDefCollection'));
this.collection = this.classificationDefCollection; this.collection = this.classificationDefCollection;
}, },
bindEvents: function() {}, bindEvents: function() {},
...@@ -67,6 +67,7 @@ define(['require', ...@@ -67,6 +67,7 @@ define(['require',
tagCollection: that.collection, tagCollection: that.collection,
enumDefCollection: that.enumDefCollection, enumDefCollection: that.enumDefCollection,
classificationDefCollection: that.classificationDefCollection, classificationDefCollection: that.classificationDefCollection,
glossaryCollection: that.glossaryCollection,
fromView: "classification" fromView: "classification"
})); }));
} }
......
...@@ -54,7 +54,7 @@ define(['require', ...@@ -54,7 +54,7 @@ define(['require',
this.addModalView(e); this.addModalView(e);
}; };
events["click " + this.ui.deleteTag] = function(e) { events["click " + this.ui.deleteTag] = function(e) {
this.deleteTagDataModal(e); this.onClickTagCross(e);
}; };
events["click " + this.ui.editTag] = function(e) { events["click " + this.ui.editTag] = function(e) {
this.editTagDataModal(e); this.editTagDataModal(e);
...@@ -79,7 +79,7 @@ define(['require', ...@@ -79,7 +79,7 @@ define(['require',
this.tagCollection = new VTagList(); this.tagCollection = new VTagList();
var that = this, var that = this,
tags = _.toArray(this.collectionObject.classifications); tags = _.toArray(this.collectionObject.classifications);
this.tagCollection.set(tags); this.tagCollection.fullCollection.reset(tags);
this.commonTableOptions = { this.commonTableOptions = {
collection: this.tagCollection, collection: this.tagCollection,
includeFilter: false, includeFilter: false,
...@@ -191,28 +191,15 @@ define(['require', ...@@ -191,28 +191,15 @@ define(['require',
}); });
}); });
}, },
deleteTagDataModal: function(e) { onClickTagCross: function(e) {
var that = this, var that = this,
tagName = $(e.currentTarget).data("name"), tagName = $(e.currentTarget).data("name");
modal = CommonViewFunction.deleteTagModel({ CommonViewFunction.deleteTag({
tagName: tagName,
guid: that.guid,
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.entityName + "?</b></div>", msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.entityName + "?</b></div>",
titleMessage: Messages.removeTag, titleMessage: Messages.removeTag,
buttonText: "Remove", okText: "Remove",
});
modal.on('ok', function() {
that.deleteTagData({
'tagName': tagName,
'guid': that.guid
});
});
modal.on('closeModal', function() {
modal.trigger('cancel');
});
},
deleteTagData: function(options) {
var that = this;
CommonViewFunction.deleteTag(_.extend({}, options, {
showLoader: function() { showLoader: function() {
that.$('.fontLoader').show(); that.$('.fontLoader').show();
that.$('.tableOverlay').show(); that.$('.tableOverlay').show();
...@@ -226,9 +213,8 @@ define(['require', ...@@ -226,9 +213,8 @@ define(['require',
if (that.fetchCollection) { if (that.fetchCollection) {
that.fetchCollection(); that.fetchCollection();
} }
} }
})); });
}, },
editTagDataModal: function(e) { editTagDataModal: function(e) {
var that = this, var that = this,
...@@ -256,12 +242,12 @@ define(['require', ...@@ -256,12 +242,12 @@ define(['require',
unPropagatedTags = []; unPropagatedTags = [];
e.stopPropagation(); e.stopPropagation();
if (e.target.checked) { if (e.target.checked) {
that.tagCollection.reset(tags); that.tagCollection.fullCollection.reset(tags);
} else { } else {
unPropagatedTags = _.filter(tags, function(val) { unPropagatedTags = _.filter(tags, function(val) {
return that.guid === val.entityGuid; return that.guid === val.entityGuid;
}); });
that.tagCollection.reset(unPropagatedTags); that.tagCollection.fullCollection.reset(unPropagatedTags);
} }
} }
}); });
......
...@@ -76,7 +76,7 @@ define(['require', ...@@ -76,7 +76,7 @@ define(['require',
tagName: null tagName: null
} }
}; };
if (this.value && this.value.viewType) { if (Utils.getUrlState.isTagTab() && this.value && this.value.viewType) {
this.viewType = this.value.viewType; this.viewType = this.value.viewType;
} }
this.query[this.viewType].tagName = this.tag; this.query[this.viewType].tagName = this.tag;
......
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