ATLAS-4778: BusinessMetadata string attribute value persists </p> as prefix and suffix
Signed-off-by: Prasad Pawar <prasad.pawar@cloudera.com>
diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js
index bb54505..727dc2c 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -127,7 +127,8 @@
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 282ca55..03b9d59 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -195,6 +195,7 @@
if (platform.name === "IE") {
this.isTableDropDisable = true;
}
+ this.businessMetadataAttributes = [];
},
bindEvents: function() {
var that = this;
@@ -581,6 +582,7 @@
}
}
this.downloadSearchResultsParams.searchParameters = apiObj.data;
+ this.generateBusinessMetadataAttrList();
},
tableRender: function(options) {
var that = this,
@@ -693,6 +695,39 @@
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 @@
}
}
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 @@
'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 452595d..a66937f 100644
--- a/dashboardv3/public/js/utils/CommonViewFunction.js
+++ b/dashboardv3/public/js/utils/CommonViewFunction.js
@@ -127,7 +127,8 @@
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 5189f08..2d3d212 100644
--- a/dashboardv3/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv3/public/js/views/search/SearchResultLayoutView.js
@@ -202,6 +202,7 @@
if (platform.name === "IE") {
this.isTableDropDisable = true;
}
+ this.businessMetadataAttributes = [];
},
bindEvents: function() {
var that = this;
@@ -596,6 +597,7 @@
}
}
this.downloadSearchResultsParams.searchParameters = apiObj.data;
+ this.generateBusinessMetadataAttrList();
},
tableRender: function(options) {
var that = this,
@@ -705,6 +707,39 @@
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 @@
}
}
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 @@
'valueObject': {},
'isTable': false
};
+ tempObj['isEditorValue'] = that.checkIsEditorValue(key);
tempObj.valueObject[key] = modelObj[key];
return CommonViewFunction.propertyTable(tempObj);
}