This is an automated email from the ASF dual-hosted git repository. kbhatt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/atlas.git
commit 21e9f2f9f43edfdbb3ce1b550a81e721f6453ccd Author: kevalbhatt <[email protected]> AuthorDate: Wed Apr 22 17:27:54 2020 +0530 ATLAS-3696 : [Business Metadata] No option to check/uncheck Business Metadata attributes in search results --- .../detail_page/DetailPageLayoutView_tmpl.html | 2 +- .../entity/EntityDetailTableLayoutView_tmpl.html | 2 +- dashboardv3/public/css/scss/table.scss | 4 ++ .../detail_page/DetailPageLayoutView_tmpl.html | 2 +- .../entity/EntityDetailTableLayoutView_tmpl.html | 2 +- dashboardv3/public/js/utils/Overrides.js | 1 + .../js/views/entity/EntityDetailTableLayoutView.js | 3 + .../js/views/search/SearchDefaultLayoutView.js | 8 +-- .../js/views/search/SearchResultLayoutView.js | 78 +++++++++------------- 9 files changed, 46 insertions(+), 56 deletions(-) diff --git a/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html b/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html index 8e269b4..afff90d 100644 --- a/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html @@ -34,7 +34,7 @@ </div> </div> <div class="form-group termBox"> - <span class="control-label-sm-pr pull-left">Term:</span> + <span class="control-label-sm-pr pull-left">Terms:</span> <div class="pull-left" data-id="termList"> <button class="btn btn-action btn-sm" title="Add Term" data-id="addTerm"> <i class="fa fa-plus"> </i> diff --git a/dashboardv2/public/js/templates/entity/EntityDetailTableLayoutView_tmpl.html b/dashboardv2/public/js/templates/entity/EntityDetailTableLayoutView_tmpl.html index 1ca4949..cdceb77 100644 --- a/dashboardv2/public/js/templates/entity/EntityDetailTableLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/entity/EntityDetailTableLayoutView_tmpl.html @@ -26,7 +26,7 @@ </div> <div class="panel-actions"> <div class="pretty p-switch p-fill" style="margin-right: 20px"> - <input type="checkbox" data-id="noValueToggle" title="Show Empty Values" /> + <input type="checkbox" data-id="noValueToggle" title="Show empty values" /> <div class="state p-primary"> <label></label> </div> diff --git a/dashboardv3/public/css/scss/table.scss b/dashboardv3/public/css/scss/table.scss index a294102..bed6eef 100644 --- a/dashboardv3/public/css/scss/table.scss +++ b/dashboardv3/public/css/scss/table.scss @@ -199,6 +199,10 @@ tr.empty { font-size: 14px; letter-spacing: 0.25px; color: #6a6a6a; + + &.no-capitalize { + text-transform: none !important; + } } >td { diff --git a/dashboardv3/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html b/dashboardv3/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html index acdcbc5..0e838f5 100644 --- a/dashboardv3/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html +++ b/dashboardv3/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html @@ -37,7 +37,7 @@ </div> </div> <div class="form-group termBox col-md-12"> - <span class="control-label-sm-pr pull-left">Term:</span> + <span class="control-label-sm-pr pull-left">Terms:</span> <div class="pull-left" data-id="termList"> <button class="btn btn-action btn-sm" title="Add Term" data-id="addTerm"> <i class="fa fa-plus"> </i> diff --git a/dashboardv3/public/js/templates/entity/EntityDetailTableLayoutView_tmpl.html b/dashboardv3/public/js/templates/entity/EntityDetailTableLayoutView_tmpl.html index 09c0496..cdceb77 100644 --- a/dashboardv3/public/js/templates/entity/EntityDetailTableLayoutView_tmpl.html +++ b/dashboardv3/public/js/templates/entity/EntityDetailTableLayoutView_tmpl.html @@ -26,7 +26,7 @@ </div> <div class="panel-actions"> <div class="pretty p-switch p-fill" style="margin-right: 20px"> - <input type="checkbox" data-id="noValueToggle" /> + <input type="checkbox" data-id="noValueToggle" title="Show empty values" /> <div class="state p-primary"> <label></label> </div> diff --git a/dashboardv3/public/js/utils/Overrides.js b/dashboardv3/public/js/utils/Overrides.js index 44ed62b..33328f0 100644 --- a/dashboardv3/public/js/utils/Overrides.js +++ b/dashboardv3/public/js/utils/Overrides.js @@ -98,6 +98,7 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq if (modelValue.get('width')) that.$el.find('.' + modelValue.get('name')).css('min-width', modelValue.get('width') + 'px'); if (modelValue.get('fixWidth')) that.$el.find('.' + modelValue.get('name')).css('width', modelValue.get('fixWidth') + 'px'); if (modelValue.get('toolTip')) that.$el.find('.' + modelValue.get('name')).attr('title', modelValue.get('toolTip')); + if (modelValue.get('headerClassName')) that.$el.find('.' + modelValue.get('name').replace(".", "\\.")).addClass(modelValue.get('headerClassName')); }); return this; } diff --git a/dashboardv3/public/js/views/entity/EntityDetailTableLayoutView.js b/dashboardv3/public/js/views/entity/EntityDetailTableLayoutView.js index 9a40593..0a7d51a 100644 --- a/dashboardv3/public/js/views/entity/EntityDetailTableLayoutView.js +++ b/dashboardv3/public/js/views/entity/EntityDetailTableLayoutView.js @@ -51,6 +51,8 @@ define(['require', events: function() { var events = {}; events["click " + this.ui.noValueToggle] = function() { + this.showAllProperties = !this.showAllProperties; + this.ui.noValueToggle.attr("data-original-title", (this.showAllProperties ? "Hide" : "Show") + " empty values"); Utils.togglePropertyRelationshipTableEmptyValues({ "inputType": this.ui.noValueToggle, "tableEl": this.ui.detailValue @@ -66,6 +68,7 @@ define(['require', initialize: function(options) { _.extend(this, _.pick(options, 'entity', 'typeHeaders', 'attributeDefs', 'attributes', 'editEntity', 'guid', 'entityDefCollection', 'searchVent', 'fetchCollection')); this.entityModel = new VEntity({}); + this.showAllProperties = false; }, bindEvents: function() {}, onRender: function() { diff --git a/dashboardv3/public/js/views/search/SearchDefaultLayoutView.js b/dashboardv3/public/js/views/search/SearchDefaultLayoutView.js index d0946c4..21b1f55 100644 --- a/dashboardv3/public/js/views/search/SearchDefaultLayoutView.js +++ b/dashboardv3/public/js/views/search/SearchDefaultLayoutView.js @@ -365,11 +365,7 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa if (_.has(obj, "condition")) { return that.getIdFromRuleObj(obj); } else { - if ((obj && obj.data && obj.data.entityType === "businessMetadata") || obj.id.indexOf(".") > -1) { - return col.add("businessMetadata"); - } else { - return col.add(obj.id); - } + return col.add(obj.id); } }); return Array.from(col); @@ -382,7 +378,7 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa if (!this.options.searchTableColumns[this.options.value.type]) { this.options.searchTableColumns[this.options.value.type] = ["selected", "name", "description", "typeName", "owner", "tag", "term"]; } - this.options.searchTableColumns[this.options.value.type] = _.sortBy(_.union(_.without(this.options.searchTableColumns[this.options.value.type], "businessMetadata"), this.getIdFromRuleObj(rule))); + this.options.searchTableColumns[this.options.value.type] = _.sortBy(_.union(_.without(this.options.searchTableColumns[this.options.value.type]), this.getIdFromRuleObj(rule))); } }, renderQueryBuilder: function(obj, rQueryBuilder) { diff --git a/dashboardv3/public/js/views/search/SearchResultLayoutView.js b/dashboardv3/public/js/views/search/SearchResultLayoutView.js index 4a24c9d..d2eadfb 100644 --- a/dashboardv3/public/js/views/search/SearchResultLayoutView.js +++ b/dashboardv3/public/js/views/search/SearchResultLayoutView.js @@ -153,7 +153,7 @@ define(['require', * @constructs */ initialize: function(options) { - _.extend(this, _.pick(options, 'value', 'guid', 'initialView', 'isTypeTagNotExists', 'classificationDefCollection', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'tagCollection', 'searchTableColumns', 'isTableDropDisable', 'fromView', 'glossaryCollection', 'termName')); + _.extend(this, _.pick(options, 'value', 'guid', 'initialView', 'isTypeTagNotExists', 'classificationDefCollection', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'tagCollection', 'searchTableColumns', 'isTableDropDisable', 'fromView', 'glossaryCollection', 'termName', 'businessMetadataDefCollection')); this.entityModel = new VEntity(); this.searchCollection = new VSearchList(); this.limit = 25; @@ -368,7 +368,7 @@ define(['require', this.searchTableColumns[this.value.type] = listOfColumns.length ? listOfColumns : null; } } else if (this.value && this.value.type && this.searchTableColumns && this.value.attributes) { - this.searchTableColumns[this.value.type] = this.value.entityFilters ? this.value.attributes.split(",") : this.value.attributes.replace("businessMetadata,", "").split(","); + this.searchTableColumns[this.value.type] = this.value.attributes.split(","); } }, fetchCollection: function(value, options) { @@ -740,8 +740,6 @@ define(['require', } }) }; - - if (this.value && this.value.profileDBView) { col['createTime'] = { label: "Date Created", @@ -760,7 +758,6 @@ define(['require', } } if (this.value && !this.value.profileDBView) { - col['description'] = { label: "Description", cell: "String", @@ -777,8 +774,6 @@ define(['require', } }) }; - - col['typeName'] = { label: "Type", cell: "Html", @@ -795,43 +790,6 @@ define(['require', } }) }; - col['businessMetadata'] = { - label: "Business Metadata", - cell: "Html", - editable: false, - resizeable: true, - orderable: true, - alwaysVisible: true, //Backgrid.ColumnManager.js -> render() to hide the name in dropdownlist - renderable: _.contains(columnToShow, 'businessMetadata'), - formatter: _.extend({}, Backgrid.CellFormatter.prototype, { - fromRaw: function(rawValue, model) { - var obj = model.toJSON(), - businessMetadataStr = ''; - if (obj && obj.attributes) { - _.each(obj.attributes, function(businessMetadataValue, attributeName) { - if (attributeName.indexOf('.') != -1) { - var isDate = false, - businessMetadata = that.options.businessMetadataDefCollection.fullCollection.find({ "name": attributeName.split('.')[0] }); - if (businessMetadata) { - var getAttributes = businessMetadata.get('attributeDefs'); - getAttributes.every(function(attrTypeCheck) { - if (attributeName.split('.')[1] === attrTypeCheck.name && attrTypeCheck.typeName.indexOf("date") > -1) { - isDate = true; - } - return !isDate; - }); - } - if (isDate) { - businessMetadataValue = moment(businessMetadataValue).format("MM/DD/YYYY") - } - businessMetadataStr += '<label class="btn btn-action btn-xs btn-blue no-pointer">' + attributeName + ': ' + businessMetadataValue + '</label>'; - } - }) - return businessMetadataStr; - } - } - }) - }; this.getTagCol({ 'col': col, 'columnToShow': columnToShow }); if ((!_.contains(["glossary"], this.fromView))) { this.getTermCol({ 'col': col, 'columnToShow': columnToShow }); @@ -839,7 +797,23 @@ define(['require', if (this.value && this.value.searchType === "basic") { var def = this.entityDefCollection.fullCollection.find({ name: this.value.type }), - systemAttr = []; + systemAttr = [], + businessMetadataAttr = [], + businessAttributes = {}; + if (this.value.type == "_ALL_ENTITY_TYPES") { + this.businessMetadataDefCollection.each(function(model) { + var sortedAttributes = model.get('attributeDefs') || null, + name = model.get('name'); + if (sortedAttributes) { + sortedAttributes = _.sortBy(sortedAttributes, function(obj) { + return obj.name; + }); + businessAttributes[name] = $.extend(true, {}, sortedAttributes); + } + }) + } else { + businessAttributes = def ? ($.extend(true, {}, def.get('businessAttributeDefs')) || null) : null; + } if (def || Globals[this.value.type] || ( this.value.tag ? Globals[this.value.tag] ? @@ -854,6 +828,17 @@ define(['require', systemAttr = (Globals[this.value.tag] || Globals[Enums.addOnClassification[0]]).attributeDefs; } attrObj = attrObj.concat(systemAttr); + if (businessAttributes) { + _.each(businessAttributes, function(businessMetadata, businessMetadataName) { + _.each(businessMetadata, function(attr, index) { + var attribute = attr; + attribute.isBusinessAttributes = true; + attribute.name = businessMetadataName + '.' + attribute.name; + businessMetadataAttr.push(attribute); + }) + }) + } + attrObj = attrObj.concat(businessMetadataAttr); _.each(attrObj, function(obj, key) { var key = obj.name, isRenderable = _.contains(columnToShow, key), @@ -868,7 +853,7 @@ define(['require', return; } col[obj.name] = { - label: Enums.systemAttributes[obj.name] ? Enums.systemAttributes[obj.name] : _.escape(obj.name).capitalize(), + label: Enums.systemAttributes[obj.name] ? Enums.systemAttributes[obj.name] : (_.escape(obj.isBusinessAttributes ? obj.name : obj.name.capitalize())), cell: "Html", headerCell: Backgrid.HeaderHTMLDecodeCell, editable: false, @@ -876,6 +861,7 @@ define(['require', orderable: true, sortable: isSortable, renderable: isRenderable, + headerClassName: obj.isBusinessAttributes ? "no-capitalize" : "", formatter: _.extend({}, Backgrid.CellFormatter.prototype, { fromRaw: function(rawValue, model) { var modelObj = model.toJSON();
