Repository: atlas Updated Branches: refs/heads/master 2237a895b -> 6d51ddec5
http://git-wip-us.apache.org/repos/asf/atlas/blob/6d51ddec/dashboardv2/public/js/views/graph/RelationshipLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/graph/RelationshipLayoutView.js b/dashboardv2/public/js/views/graph/RelationshipLayoutView.js index 397deed..7a51796e 100644 --- a/dashboardv2/public/js/views/graph/RelationshipLayoutView.js +++ b/dashboardv2/public/js/views/graph/RelationshipLayoutView.js @@ -155,6 +155,8 @@ define(['require', .links(data.links) .size([width, height]) .linkDistance(200) + .gravity(0.0) + .friction(0.1) .charge(function(d) { var charge = -500; if (d.index === 0) charge = 100 @@ -390,12 +392,10 @@ define(['require', }); node.attr("transform", function(d) { - // if (d && d.value && d.value.guid == that.guid) { - // Center fixed node - // var damper = 0.1; - // d.x = (width / 2) - // d.y = (height / 2) - // } + if (d && d.value && d.value.guid == that.guid) { + d.x = (width / 2) + d.y = (height / 2) + } return "translate(" + d.x + "," + d.y + ")"; }); } http://git-wip-us.apache.org/repos/asf/atlas/blob/6d51ddec/dashboardv2/public/js/views/profile/ProfileLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/profile/ProfileLayoutView.js b/dashboardv2/public/js/views/profile/ProfileLayoutView.js index d807f41..106c339 100644 --- a/dashboardv2/public/js/views/profile/ProfileLayoutView.js +++ b/dashboardv2/public/js/views/profile/ProfileLayoutView.js @@ -57,7 +57,7 @@ define(['require', * @constructs */ 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") { this.profileData = { attributes: true }; } @@ -80,7 +80,7 @@ define(['require', var value = _.extend({}, that.value, { 'guid': that.guid, 'searchType': 'relationship', - 'profileDBView' : true, + 'profileDBView': true, 'typeName': that.typeName }); that.RProfileTableOrColumnLayoutView.show(new SearchResultLayoutView({ @@ -89,6 +89,7 @@ define(['require', 'entityDefCollection': that.entityDefCollection, 'enumDefCollection': that.enumDefCollection, 'isDisable': true, + 'glossaryCollection': that.glossaryCollection, 'classificationDefCollection': that.classificationDefCollection })); }); http://git-wip-us.apache.org/repos/asf/atlas/blob/6d51ddec/dashboardv2/public/js/views/schema/SchemaLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/schema/SchemaLayoutView.js b/dashboardv2/public/js/views/schema/SchemaLayoutView.js index 4bee673..231f118 100644 --- a/dashboardv2/public/js/views/schema/SchemaLayoutView.js +++ b/dashboardv2/public/js/views/schema/SchemaLayoutView.js @@ -283,34 +283,19 @@ define(['require', var that = this, tagName = $(e.target).data("name"), guid = $(e.target).data("guid"), - assetName = $(e.target).data("assetname"), - modal = CommonViewFunction.deleteTagModel({ - msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>", - titleMessage: Messages.removeTag, - buttonText: "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, { + assetName = $(e.target).data("assetname"); + CommonViewFunction.deleteTag({ + tagName: tagName, + guid: guid, + msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>", + titleMessage: Messages.removeTag, + okText: "Remove", showLoader: that.showLoader.bind(that), hideLoader: that.hideLoader.bind(that), callback: function() { that.fetchCollection(); } - })); + }); }, onCheckDeletedEntity: function(e) { if (e.target.checked) { http://git-wip-us.apache.org/repos/asf/atlas/blob/6d51ddec/dashboardv2/public/js/views/search/SearchLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/search/SearchLayoutView.js b/dashboardv2/public/js/views/search/SearchLayoutView.js index e8405ee..8f0e694 100644 --- a/dashboardv2/public/js/views/search/SearchLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchLayoutView.js @@ -48,6 +48,7 @@ define(['require', clearSearch: '[data-id="clearSearch"]', typeLov: '[data-id="typeLOV"]', tagLov: '[data-id="tagLOV"]', + termLov: '[data-id="termLOV"]', refreshBtn: '[data-id="refreshBtn"]', advancedInfoBtn: '[data-id="advancedInfo"]', typeAttrFilter: '[data-id="typeAttrFilter"]', @@ -71,6 +72,7 @@ define(['require', events["click " + this.ui.clearSearch] = 'clearSearchData'; events["change " + this.ui.typeLov] = 'checkForButtonVisiblity'; events["change " + this.ui.tagLov] = 'checkForButtonVisiblity'; + events["change " + this.ui.termLov] = 'checkForButtonVisiblity'; events["click " + this.ui.refreshBtn] = 'onRefreshButton'; events["click " + this.ui.advancedInfoBtn] = 'advancedInfo'; events["click " + this.ui.typeAttrFilter] = function() { @@ -100,6 +102,7 @@ define(['require', query: null, type: null, tag: null, + term: null, attributes: null, tagFilters: null, pageOffset: null, @@ -156,6 +159,7 @@ define(['require', 'tagFilters': tagObj ? tagObj[queryObj.tag] : null, 'type': queryObj.type, 'query': queryObj.query, + 'term': queryObj.term, 'tag': queryObj.tag }) }, @@ -195,6 +199,7 @@ define(['require', }, initializeValues: function() { this.renderTypeTagList(); + this.renderTermList(); this.setValues(); this.checkForButtonVisiblity(); this.renderSaveSearch(); @@ -248,12 +253,18 @@ define(['require', checkForButtonVisiblity: function(e, options) { if (this.type == "basic" && e && 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')) { var value = $el.val(), - key = (isTagEl ? 'tag' : 'type'), - filterType = (isTagEl ? 'tagFilters' : 'entityFilters'), - value = value.length ? value : null; + key = "tag", + filterType = 'tagFilters', + value = value && value.length ? value : null; + if (!isTagEl) { + key = (isTermEl ? "term" : "type"); + filterType = (isTypeEl ? "entityFilters" : null); + } if (this.value) { //On Change handle if (this.value[key] !== value || (!value && !this.value[key])) { @@ -267,10 +278,13 @@ define(['require', _.extend(this.query[this.type], temp); } else { // Initial loading handle. - var filterObj = this.searchTableFilters[filterType]; - if (filterObj && this.value[key]) { - this.searchTableFilters[filterType][this.value[key]] = this.value[filterType] ? this.value[filterType] : null; + if (filterType) { + var filterObj = this.searchTableFilters[filterType]; + if (filterObj && this.value[key]) { + this.searchTableFilters[filterType][this.value[key]] = this.value[filterType] ? this.value[filterType] : null; + } } + if (this.value.type) { if (this.value.attributes) { var attributes = _.sortBy(this.value.attributes.split(',')), @@ -285,7 +299,9 @@ define(['require', } } } - this.makeFilterButtonActive(filterType); + if (filterType) { + this.makeFilterButtonActive(filterType); + } } else { this.ui.tagAttrFilter.prop('disabled', true); this.ui.typeAttrFilter.prop('disabled', true); @@ -295,7 +311,7 @@ define(['require', var that = this, value = this.ui.searchInput.val() || this.ui.typeLov.val(); if (!this.dsl && !value) { - value = this.ui.tagLov.val(); + value = this.ui.tagLov.val() || this.ui.termLov.val(); } if (value && value.length) { this.ui.searchBtn.removeAttr("disabled"); @@ -324,6 +340,7 @@ define(['require', query: null, type: null, tag: null, + term: null, attributes: null, tagFilters: null, pageOffset: null, @@ -436,14 +453,64 @@ define(['require', that.ui.typeLov.html(typeStr); that.ui.tagLov.html(tagStr); this.ui.typeLov.select2({ - placeholder: "Select", + placeholder: "Select Type", allowClear: true }); this.ui.tagLov.select2({ - placeholder: "Select", + placeholder: "Select Classification", 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) { var arr = [], that = this; @@ -482,6 +549,16 @@ define(['require', 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() { that.ui.searchInput.focus(); @@ -501,6 +578,7 @@ define(['require', params['type'] = this.ui.typeLov.select2('val') || null; if (!this.dsl) { params['tag'] = this.ui.tagLov.select2('val') || null; + params['term'] = this.ui.termLov.select2('val') || null; var entityFilterObj = this.searchTableFilters['entityFilters'], tagFilterObj = this.searchTableFilters['tagFilters']; if (this.value.tag) { @@ -545,20 +623,16 @@ define(['require', if (e.currentTarget.checked) { this.type = "dsl"; this.dsl = true; - this.$('.tagBox').hide(); - this.$('.temFilterBtn').hide(); - this.$('.temFilter').addClass('col-sm-12'); - this.$('.temFilter').removeClass('col-sm-10'); - this.$('.basicSaveSearch').hide(); + this.$('.typeFilterBtn,.tagBox,.termBox,.basicSaveSearch').hide(); + this.$('.typeFilter').addClass('col-sm-12'); + this.$('.typeFilter').removeClass('col-sm-10'); this.$('.advanceSaveSearch').show(); this.$('.searchText').text('Search By Query'); this.ui.searchInput.attr("placeholder", 'Search By Query eg. where name="sales_fact"'); } else { - this.$('.temFilter').addClass('col-sm-10'); - this.$('.temFilter').removeClass('col-sm-12'); - this.$('.temFilterBtn').show(); - this.$('.tagBox').show(); - this.$('.basicSaveSearch').show(); + this.$('.typeFilter').addClass('col-sm-10'); + this.$('.typeFilter').removeClass('col-sm-12'); + this.$('.typeFilterBtn,.tagBox,.termBox,.basicSaveSearch').show(); this.$('.advanceSaveSearch').hide(); this.dsl = false; this.type = "basic"; http://git-wip-us.apache.org/repos/asf/atlas/blob/6d51ddec/dashboardv2/public/js/views/search/SearchResultLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js index 0318c32..6df9c14 100644 --- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js @@ -103,7 +103,7 @@ define(['require', } else { this.triggerUrl({ url: '#!/glossary/' + scope.find('i').data('termguid'), - urlParams: { gType: "term" }, + urlParams: { gType: "term", viewType: "term", fromView: "entity" }, mergeBrowserUrl: false, trigger: true, updateTabState: null @@ -476,7 +476,7 @@ define(['require', if (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) { var profileParam = {}; profileParam['guid'] = value.guid; @@ -851,12 +851,13 @@ define(['require', formatter: _.extend({}, Backgrid.CellFormatter.prototype, { fromRaw: function(rawValue, model) { var obj = model.toJSON(); - if (obj.status && Enums.entityStateReadOnly[obj.status]) { - return '<div class="readOnly">' + CommonViewFunction.termForTable(obj); + '</div>'; - } else { - return CommonViewFunction.termForTable(obj); + if (!(obj.typeName.startsWith("__AtlasGlossary"))) { + if (obj.status && Enums.entityStateReadOnly[obj.status]) { + return '<div class="readOnly">' + CommonViewFunction.termForTable(obj); + '</div>'; + } else { + return CommonViewFunction.termForTable(obj); + } } - } }) }; @@ -936,23 +937,20 @@ define(['require', var that = this, tagName = $(e.target).data("name"), guid = $(e.target).data("guid"), - assetName = $(e.target).data("assetname"), - modal = CommonViewFunction.deleteTagModel({ - msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>", - titleMessage: Messages.removeTag, - buttonText: "Remove" - }); - if (modal) { - modal.on('ok', function() { - that.deleteTagData({ - 'tagName': tagName, - 'guid': guid - }); - }); - modal.on('closeModal', function() { - modal.trigger('cancel'); - }); - } + assetName = $(e.target).data("assetname"); + CommonViewFunction.deleteTag({ + tagName: tagName, + guid: guid, + msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>", + titleMessage: Messages.removeTag, + okText: "Remove", + showLoader: that.showLoader.bind(that), + hideLoader: that.hideLoader.bind(that), + callback: function() { + that.fetchCollection(); + } + }); + }, onClickTermCross: function(e) { var $el = $(e.target), @@ -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() { this.offset = this.offset + this.limit; _.extend(this.searchCollection.queryParams, { http://git-wip-us.apache.org/repos/asf/atlas/blob/6d51ddec/dashboardv2/public/js/views/tag/TagDetailLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/TagDetailLayoutView.js b/dashboardv2/public/js/views/tag/TagDetailLayoutView.js index d7f26e3..b4ce59b 100644 --- a/dashboardv2/public/js/views/tag/TagDetailLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagDetailLayoutView.js @@ -44,7 +44,7 @@ define(['require', * @constructs */ 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; }, bindEvents: function() {}, @@ -67,6 +67,7 @@ define(['require', tagCollection: that.collection, enumDefCollection: that.enumDefCollection, classificationDefCollection: that.classificationDefCollection, + glossaryCollection: that.glossaryCollection, fromView: "classification" })); } http://git-wip-us.apache.org/repos/asf/atlas/blob/6d51ddec/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js b/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js index 9125fc8..bc2fc42 100644 --- a/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js @@ -54,7 +54,7 @@ define(['require', this.addModalView(e); }; events["click " + this.ui.deleteTag] = function(e) { - this.deleteTagDataModal(e); + this.onClickTagCross(e); }; events["click " + this.ui.editTag] = function(e) { this.editTagDataModal(e); @@ -79,7 +79,7 @@ define(['require', this.tagCollection = new VTagList(); var that = this, tags = _.toArray(this.collectionObject.classifications); - this.tagCollection.set(tags); + this.tagCollection.fullCollection.reset(tags); this.commonTableOptions = { collection: this.tagCollection, includeFilter: false, @@ -191,28 +191,15 @@ define(['require', }); }); }, - deleteTagDataModal: function(e) { + onClickTagCross: function(e) { var that = this, - tagName = $(e.currentTarget).data("name"), - modal = CommonViewFunction.deleteTagModel({ - msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.entityName + "?</b></div>", - titleMessage: Messages.removeTag, - buttonText: "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, { + tagName = $(e.currentTarget).data("name"); + CommonViewFunction.deleteTag({ + tagName: tagName, + guid: that.guid, + msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.entityName + "?</b></div>", + titleMessage: Messages.removeTag, + okText: "Remove", showLoader: function() { that.$('.fontLoader').show(); that.$('.tableOverlay').show(); @@ -226,9 +213,8 @@ define(['require', if (that.fetchCollection) { that.fetchCollection(); } - } - })); + }); }, editTagDataModal: function(e) { var that = this, @@ -256,12 +242,12 @@ define(['require', unPropagatedTags = []; e.stopPropagation(); if (e.target.checked) { - that.tagCollection.reset(tags); + that.tagCollection.fullCollection.reset(tags); } else { unPropagatedTags = _.filter(tags, function(val) { return that.guid === val.entityGuid; }); - that.tagCollection.reset(unPropagatedTags); + that.tagCollection.fullCollection.reset(unPropagatedTags); } } }); http://git-wip-us.apache.org/repos/asf/atlas/blob/6d51ddec/dashboardv2/public/js/views/tag/TagLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/TagLayoutView.js b/dashboardv2/public/js/views/tag/TagLayoutView.js index 7969041..c7a5edb 100644 --- a/dashboardv2/public/js/views/tag/TagLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagLayoutView.js @@ -76,7 +76,7 @@ define(['require', tagName: null } }; - if (this.value && this.value.viewType) { + if (Utils.getUrlState.isTagTab() && this.value && this.value.viewType) { this.viewType = this.value.viewType; } this.query[this.viewType].tagName = this.tag;
