This is an automated email from the ASF dual-hosted git repository. ppawar pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new 87c0e430c ATLAS-4778: BusinessMetadata string attribute value persists </p> as prefix and suffix 87c0e430c is described below commit 87c0e430c7001c1678376b8dee328200c7a453b4 Author: Farhan Khan <farhan.k...@freestoneinfotech.com> AuthorDate: Tue Aug 22 09:30:28 2023 +0530 ATLAS-4778: BusinessMetadata string attribute value persists </p> as prefix and suffix Signed-off-by: Prasad Pawar <prasad.pa...@cloudera.com> --- dashboardv2/public/js/utils/CommonViewFunction.js | 3 +- .../js/views/search/SearchResultLayoutView.js | 37 ++++++++++++++++++++++ dashboardv3/public/js/utils/CommonViewFunction.js | 3 +- .../js/views/search/SearchResultLayoutView.js | 37 ++++++++++++++++++++++ 4 files changed, 78 insertions(+), 2 deletions(-) diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js index bb545057d..727dc2c6b 100644 --- a/dashboardv2/public/js/utils/CommonViewFunction.js +++ b/dashboardv2/public/js/utils/CommonViewFunction.js @@ -127,7 +127,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum newVal = numberFormat(newVal); } } - return getHighlightedString(_.escape(newVal)); + newVal = (options && options.isEditorValue) ? newVal : _.escape(newVal); + return getHighlightedString(newVal); } } else { return getEmptyString(key); diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js index 282ca55ba..03b9d5947 100644 --- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js @@ -195,6 +195,7 @@ define(['require', if (platform.name === "IE") { this.isTableDropDisable = true; } + this.businessMetadataAttributes = []; }, bindEvents: function() { var that = this; @@ -581,6 +582,7 @@ define(['require', } } this.downloadSearchResultsParams.searchParameters = apiObj.data; + this.generateBusinessMetadataAttrList(); }, tableRender: function(options) { var that = this, @@ -693,6 +695,39 @@ define(['require', params.attributeLabelMap = {}; } }, + generateBusinessMetadataAttrList: function() { + var def = this.entityDefCollection.fullCollection.find({ + name: this.value.type, + }), + businessAttributeDefs, + that = this; + businessAttributeDefs = def.get('businessAttributeDefs'); + if (businessAttributeDefs) { + _.each( + businessAttributeDefs, + function(businessMetadata, businessMetadataName) { + _.each(businessMetadata, function(attr, index) { + that.businessMetadataAttributes.push({ + name: businessMetadataName + '.' + attr.name, + type: attr.typeName + }); + }); + } + ); + } + }, + checkIsEditorValue: function(key) { + var isEditorKey = false; + if (this.businessMetadataAttributes.length) { + _.each(this.businessMetadataAttributes, function(attr) { + if (attr.name === key && attr.type === "string") { + isEditorKey = true; + return; + }; + }); + } + return isEditorKey; + }, getColumnOrder: function(arr) { var obj = {}; for (var i = 0; i < arr.length; ++i) { @@ -985,6 +1020,7 @@ define(['require', } } tempObj.valueObject[key] = modelObj.attributes[key]; + tempObj['isEditorValue'] = that.checkIsEditorValue(key); var tablecolumn = CommonViewFunction.propertyTable(tempObj); if (_.isArray(modelObj.attributes[key])) { var column = $("<div>" + tablecolumn + "</div>") @@ -1057,6 +1093,7 @@ define(['require', 'valueObject': {}, 'isTable': false }; + tempObj['isEditorValue'] = that.checkIsEditorValue(key); tempObj.valueObject[key] = modelObj[key]; return CommonViewFunction.propertyTable(tempObj); } diff --git a/dashboardv3/public/js/utils/CommonViewFunction.js b/dashboardv3/public/js/utils/CommonViewFunction.js index 452595d7f..a66937ff0 100644 --- a/dashboardv3/public/js/utils/CommonViewFunction.js +++ b/dashboardv3/public/js/utils/CommonViewFunction.js @@ -127,7 +127,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum newVal = numberFormat(newVal); } } - return getHighlightedString(_.escape(newVal)); + newVal = (options && options.isEditorValue) ? newVal : _.escape(newVal); + return getHighlightedString(newVal); } } else { return getEmptyString(key); diff --git a/dashboardv3/public/js/views/search/SearchResultLayoutView.js b/dashboardv3/public/js/views/search/SearchResultLayoutView.js index 5189f08d8..2d3d212a1 100644 --- a/dashboardv3/public/js/views/search/SearchResultLayoutView.js +++ b/dashboardv3/public/js/views/search/SearchResultLayoutView.js @@ -202,6 +202,7 @@ define(['require', if (platform.name === "IE") { this.isTableDropDisable = true; } + this.businessMetadataAttributes = []; }, bindEvents: function() { var that = this; @@ -596,6 +597,7 @@ define(['require', } } this.downloadSearchResultsParams.searchParameters = apiObj.data; + this.generateBusinessMetadataAttrList(); }, tableRender: function(options) { var that = this, @@ -705,6 +707,39 @@ define(['require', params.attributeLabelMap = {}; } }, + generateBusinessMetadataAttrList: function() { + var def = this.entityDefCollection.fullCollection.find({ + name: this.value.type, + }), + businessAttributeDefs, + that = this; + businessAttributeDefs = def.get('businessAttributeDefs'); + if (businessAttributeDefs) { + _.each( + businessAttributeDefs, + function(businessMetadata, businessMetadataName) { + _.each(businessMetadata, function(attr, index) { + that.businessMetadataAttributes.push({ + name: businessMetadataName + '.' + attr.name, + type: attr.typeName + }); + }); + } + ); + } + }, + checkIsEditorValue: function(key) { + var isEditorKey = false; + if (this.businessMetadataAttributes.length) { + _.each(this.businessMetadataAttributes, function(attr) { + if (attr.name === key && attr.type === "string") { + isEditorKey = true; + return; + }; + }); + } + return isEditorKey; + }, getColumnOrder: function(arr) { var obj = {}; for (var i = 0; i < arr.length; ++i) { @@ -996,6 +1031,7 @@ define(['require', } } tempObj.valueObject[key] = modelObj.attributes[key]; + tempObj['isEditorValue'] = that.checkIsEditorValue(key); var tablecolumn = CommonViewFunction.propertyTable(tempObj); if (_.isArray(modelObj.attributes[key])) { var column = $("<div>" + tablecolumn + "</div>") @@ -1068,6 +1104,7 @@ define(['require', 'valueObject': {}, 'isTable': false }; + tempObj['isEditorValue'] = that.checkIsEditorValue(key); tempObj.valueObject[key] = modelObj[key]; return CommonViewFunction.propertyTable(tempObj); }