Commit 95923fba by kevalbhatt

ATLAS-3706 : UI: Audit change for Business metadata/labels/user-define property

parent 2fbfb557
...@@ -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.
--> -->
<h4 style="word-break: break-word;">Name: <span data-id="name"></span></h4> <h4 style="word-break: break-word;" data-id="name"></h4>
<div class="panel-group server-stats-container statsContainer " id="accordion"> <div class="panel-group server-stats-container statsContainer " id="accordion">
<div class="panel panel-default custom-panel expand_collapse_panel-icon hide" data-id="detailsAttribute"> <div class="panel panel-default custom-panel expand_collapse_panel-icon hide" data-id="detailsAttribute">
<div class="panel-heading" data-toggle="collapse" href="#detailAttributeTableCollapse" aria-expanded="true"> <div class="panel-heading" data-toggle="collapse" href="#detailAttributeTableCollapse" aria-expanded="true">
......
...@@ -38,7 +38,9 @@ define(['require'], function(require) { ...@@ -38,7 +38,9 @@ define(['require'], function(require) {
TERM_DELETE: "Term Deleted", TERM_DELETE: "Term Deleted",
LABEL_ADD: "Label(s) Added", LABEL_ADD: "Label(s) Added",
LABEL_DELETE: "Label(s) Deleted", LABEL_DELETE: "Label(s) Deleted",
ENTITY_PURGE: "Entity Purged" ENTITY_PURGE: "Entity Purged",
BUSINESS_ATTRIBUTE_ADD: "Business Attribute(s) Added",
BUSINESS_ATTRIBUTE_DELETE: "Business Attribute(s) Deleted"
} }
Enums.entityStateReadOnly = { Enums.entityStateReadOnly = {
......
...@@ -82,7 +82,7 @@ define(['require', ...@@ -82,7 +82,7 @@ define(['require',
}, },
updateName: function(name) { updateName: function(name) {
this.ui.name.text(name); this.ui.name.html("<span>Name: </span><span>" + name + "</span>");
}, },
noDetailsShow: function() { noDetailsShow: function() {
this.ui.noData.removeClass('hide'); this.ui.noData.removeClass('hide');
...@@ -91,12 +91,23 @@ define(['require', ...@@ -91,12 +91,23 @@ define(['require',
var that = this, var that = this,
table = ""; table = "";
var detailObj = this.entityModel.get('details'); var detailObj = this.entityModel.get('details');
if (detailObj && detailObj.search(':') >= 0) { if (detailObj) {
var parseDetailsObject = detailObj.split(':'); if (detailObj.search(':') >= 0) {
var parseDetailsObject = detailObj.split(':'),
type = "",
auditData = "";
if (parseDetailsObject.length > 1) { if (parseDetailsObject.length > 1) {
type = parseDetailsObject[0];
parseDetailsObject.shift(); parseDetailsObject.shift();
var auditData = parseDetailsObject.join(":"); auditData = parseDetailsObject.join(":");
} }
if (auditData.search('{') === -1) {
if (type.trim() === "Added labels" || type.trim() === "Deleted labels") {
this.updateName(auditData.trim().split(" ").join(","));
} else {
this.updateName(auditData);
}
} else {
try { try {
parseDetailsObject = JSON.parse(auditData); parseDetailsObject = JSON.parse(auditData);
var skipAttribute = parseDetailsObject.typeName ? "guid" : null, var skipAttribute = parseDetailsObject.typeName ? "guid" : null,
...@@ -155,9 +166,10 @@ define(['require', ...@@ -155,9 +166,10 @@ define(['require',
that.updateName(name); that.updateName(name);
that.noDetailsShow(); that.noDetailsShow();
} }
}
} else if (detailObj == "Deleted entity") { } else if (detailObj == "Deleted entity" || detailObj == "Purged entity") {
that.updateName(this.entityName); this.entityName ? this.updateName(this.entityName) : (this.ui.name.hide() && this.ui.noData.removeClass("hide"));
}
} }
} }
}); });
......
...@@ -170,6 +170,9 @@ define(['require', ...@@ -170,6 +170,9 @@ define(['require',
if (collectionJSON) { if (collectionJSON) {
this.name = Utils.getName(collectionJSON); this.name = Utils.getName(collectionJSON);
if (collectionJSON.attributes) { if (collectionJSON.attributes) {
if (collectionJSON.typeName) {
collectionJSON.attributes.typeName = _.escape(collectionJSON.typeName);
}
if (this.name && collectionJSON.typeName) { if (this.name && collectionJSON.typeName) {
this.name = this.name + ' (' + _.escape(collectionJSON.typeName) + ')'; this.name = this.name + ' (' + _.escape(collectionJSON.typeName) + ')';
} }
...@@ -244,6 +247,9 @@ define(['require', ...@@ -244,6 +247,9 @@ define(['require',
})(), })(),
editEntity: this.editEntity || false editEntity: this.editEntity || false
} }
obj["renderAuditTableLayoutView"] = function() {
that.renderAuditTableLayoutView(obj);
};
this.renderEntityDetailTableLayoutView(obj); this.renderEntityDetailTableLayoutView(obj);
this.renderEntityUserDefineView(obj); this.renderEntityUserDefineView(obj);
this.renderEntityLabelDefineView(obj); this.renderEntityLabelDefineView(obj);
......
...@@ -55,7 +55,7 @@ define(['require', ...@@ -55,7 +55,7 @@ define(['require',
}, },
initialize: function(options) { initialize: function(options) {
var self = this; var self = this;
_.extend(this, _.pick(options, 'entity', 'customFilter')); _.extend(this, _.pick(options, 'entity', 'customFilter', 'renderAuditTableLayoutView'));
this.swapItem = false, this.saveLabels = false; this.swapItem = false, this.saveLabels = false;
this.readOnlyEntity = this.customFilter === undefined ? Enums.entityStateReadOnly[this.entity.status] : this.customFilter; this.readOnlyEntity = this.customFilter === undefined ? Enums.entityStateReadOnly[this.entity.status] : this.customFilter;
this.entityModel = new VEntity(this.entity); this.entityModel = new VEntity(this.entity);
...@@ -164,6 +164,9 @@ define(['require', ...@@ -164,6 +164,9 @@ define(['require',
that.swapItem = false; that.swapItem = false;
that.saveLabels = false; that.saveLabels = false;
that.render(); that.render();
if (that.renderAuditTableLayoutView) {
that.renderAuditTableLayoutView();
}
}, },
error: function(e) { error: function(e) {
that.ui.saveLabels && that.ui.saveLabels.length > 0 && that.ui.saveLabels[0].setAttribute("disabled", false); that.ui.saveLabels && that.ui.saveLabels.length > 0 && that.ui.saveLabels[0].setAttribute("disabled", false);
......
...@@ -53,7 +53,7 @@ define(['require', ...@@ -53,7 +53,7 @@ define(['require',
return events; return events;
}, },
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'entity', 'customFilter')); _.extend(this, _.pick(options, 'entity', 'customFilter', 'renderAuditTableLayoutView'));
this.userDefineAttr = this.entity && this.entity.customAttributes || []; this.userDefineAttr = this.entity && this.entity.customAttributes || [];
this.initialCall = false; this.initialCall = false;
this.swapItem = false, this.saveAttrItems = false; this.swapItem = false, this.saveAttrItems = false;
...@@ -136,6 +136,9 @@ define(['require', ...@@ -136,6 +136,9 @@ define(['require',
that.swapItem = false; that.swapItem = false;
that.saveAttrItems = false; that.saveAttrItems = false;
that.render(); that.render();
if (that.renderAuditTableLayoutView) {
that.renderAuditTableLayoutView();
}
}, },
error: function(e) { error: function(e) {
that.initialCall = false; that.initialCall = false;
......
...@@ -254,6 +254,7 @@ td { ...@@ -254,6 +254,7 @@ td {
.auditStatusContainer { .auditStatusContainer {
display: flex; display: flex;
flex-wrap: wrap;
justify-content: center; justify-content: center;
} }
......
...@@ -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.
--> -->
<h4 class="entity-name" style="word-break: break-word;" data-id="nameContainer">Name: <span data-id="name"></span></h4> <h4 style="word-break: break-word;" data-id="name"></h4>
<div class="panel-group server-stats-container auditStatusContainer clearfix" id="accordion"> <div class="panel-group server-stats-container auditStatusContainer clearfix" id="accordion">
<div class="panel panel-default custom-panel expand_collapse_panel-icon hide col-sm-5" data-id="detailsAttribute"> <div class="panel panel-default custom-panel expand_collapse_panel-icon hide col-sm-5" data-id="detailsAttribute">
<div class="panel-heading" data-toggle="collapse" href="#detailAttributeTableCollapse" aria-expanded="true"> <div class="panel-heading" data-toggle="collapse" href="#detailAttributeTableCollapse" aria-expanded="true">
......
...@@ -38,7 +38,9 @@ define(['require'], function(require) { ...@@ -38,7 +38,9 @@ define(['require'], function(require) {
TERM_DELETE: "Term Deleted", TERM_DELETE: "Term Deleted",
LABEL_ADD: "Label(s) Added", LABEL_ADD: "Label(s) Added",
LABEL_DELETE: "Label(s) Deleted", LABEL_DELETE: "Label(s) Deleted",
ENTITY_PURGE: "Entity Purged" ENTITY_PURGE: "Entity Purged",
BUSINESS_ATTRIBUTE_ADD: "Business Attribute(s) Added",
BUSINESS_ATTRIBUTE_DELETE: "Business Attribute(s) Deleted"
} }
Enums.entityStateReadOnly = { Enums.entityStateReadOnly = {
......
...@@ -39,7 +39,6 @@ define(['require', ...@@ -39,7 +39,6 @@ define(['require',
ui: { ui: {
auditValue: "[data-id='auditValue']", auditValue: "[data-id='auditValue']",
name: "[data-id='name']", name: "[data-id='name']",
nameContainer: "[data-id='nameContainer']",
noData: "[data-id='noData']", noData: "[data-id='noData']",
tableAudit: "[data-id='tableAudit']", tableAudit: "[data-id='tableAudit']",
auditHeaderValue: "[data-id='auditHeaderValue']", auditHeaderValue: "[data-id='auditHeaderValue']",
...@@ -83,7 +82,7 @@ define(['require', ...@@ -83,7 +82,7 @@ define(['require',
}, },
updateName: function(name) { updateName: function(name) {
this.ui.name.text(name); this.ui.name.html("<span>Name: </span><span>" + name + "</span>");
}, },
noDetailsShow: function() { noDetailsShow: function() {
this.ui.noData.removeClass('hide'); this.ui.noData.removeClass('hide');
...@@ -92,12 +91,23 @@ define(['require', ...@@ -92,12 +91,23 @@ define(['require',
var that = this, var that = this,
table = ""; table = "";
var detailObj = this.entityModel.get('details'); var detailObj = this.entityModel.get('details');
if (detailObj && detailObj.search(':') >= 0) { if (detailObj) {
var parseDetailsObject = detailObj.split(':'); if (detailObj.search(':') >= 0) {
var parseDetailsObject = detailObj.split(':'),
type = "",
auditData = "";
if (parseDetailsObject.length > 1) { if (parseDetailsObject.length > 1) {
type = parseDetailsObject[0];
parseDetailsObject.shift(); parseDetailsObject.shift();
var auditData = parseDetailsObject.join(":"); auditData = parseDetailsObject.join(":");
} }
if (auditData.search('{') === -1) {
if (type.trim() === "Added labels" || type.trim() === "Deleted labels") {
this.updateName(auditData.trim().split(" ").join(","));
} else {
this.updateName(auditData);
}
} else {
try { try {
parseDetailsObject = JSON.parse(auditData); parseDetailsObject = JSON.parse(auditData);
var skipAttribute = parseDetailsObject.typeName ? "guid" : null, var skipAttribute = parseDetailsObject.typeName ? "guid" : null,
...@@ -156,9 +166,10 @@ define(['require', ...@@ -156,9 +166,10 @@ define(['require',
that.updateName(name); that.updateName(name);
that.noDetailsShow(); that.noDetailsShow();
} }
}
} else if (detailObj == "Deleted entity" || detailObj == "Purged entity") { } else if (detailObj == "Deleted entity" || detailObj == "Purged entity") {
this.entityName ? that.updateName(this.entityName) : this.ui.nameContainer.empty().append("<h4 class='text-center'><i>No Records Found!</i></h4>"); this.entityName ? this.updateName(this.entityName) : (this.ui.name.hide() && this.ui.noData.removeClass("hide"));
}
} }
} }
}); });
......
...@@ -176,6 +176,9 @@ define(['require', ...@@ -176,6 +176,9 @@ define(['require',
if (collectionJSON) { if (collectionJSON) {
this.name = Utils.getName(collectionJSON); this.name = Utils.getName(collectionJSON);
if (collectionJSON.attributes) { if (collectionJSON.attributes) {
if (collectionJSON.typeName) {
collectionJSON.attributes.typeName = _.escape(collectionJSON.typeName);
}
if (this.name && collectionJSON.typeName) { if (this.name && collectionJSON.typeName) {
this.name = this.name + ' (' + _.escape(collectionJSON.typeName) + ')'; this.name = this.name + ' (' + _.escape(collectionJSON.typeName) + ')';
} }
...@@ -252,6 +255,9 @@ define(['require', ...@@ -252,6 +255,9 @@ define(['require',
})(), })(),
editEntity: this.editEntity || false editEntity: this.editEntity || false
} }
obj["renderAuditTableLayoutView"] = function() {
that.renderAuditTableLayoutView(obj);
};
this.renderEntityDetailTableLayoutView(obj); this.renderEntityDetailTableLayoutView(obj);
this.renderEntityUserDefineView(obj); this.renderEntityUserDefineView(obj);
this.renderEntityLabelDefineView(obj); this.renderEntityLabelDefineView(obj);
......
...@@ -55,7 +55,7 @@ define(['require', ...@@ -55,7 +55,7 @@ define(['require',
}, },
initialize: function(options) { initialize: function(options) {
var self = this; var self = this;
_.extend(this, _.pick(options, 'entity', 'customFilter')); _.extend(this, _.pick(options, 'entity', 'customFilter', 'renderAuditTableLayoutView'));
this.swapItem = false, this.saveLabels = false; this.swapItem = false, this.saveLabels = false;
this.readOnlyEntity = this.customFilter === undefined ? Enums.entityStateReadOnly[this.entity.status] : this.customFilter; this.readOnlyEntity = this.customFilter === undefined ? Enums.entityStateReadOnly[this.entity.status] : this.customFilter;
this.entityModel = new VEntity(this.entity); this.entityModel = new VEntity(this.entity);
...@@ -164,6 +164,9 @@ define(['require', ...@@ -164,6 +164,9 @@ define(['require',
that.swapItem = false; that.swapItem = false;
that.saveLabels = false; that.saveLabels = false;
that.render(); that.render();
if (that.renderAuditTableLayoutView) {
that.renderAuditTableLayoutView();
}
}, },
error: function(e) { error: function(e) {
that.ui.saveLabels.attr("disabled", false); that.ui.saveLabels.attr("disabled", false);
......
...@@ -53,7 +53,7 @@ define(['require', ...@@ -53,7 +53,7 @@ define(['require',
return events; return events;
}, },
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'entity', 'customFilter')); _.extend(this, _.pick(options, 'entity', 'customFilter', 'renderAuditTableLayoutView'));
this.userDefineAttr = this.entity && this.entity.customAttributes || []; this.userDefineAttr = this.entity && this.entity.customAttributes || [];
this.initialCall = false; this.initialCall = false;
this.swapItem = false, this.saveAttrItems = false; this.swapItem = false, this.saveAttrItems = false;
...@@ -136,6 +136,9 @@ define(['require', ...@@ -136,6 +136,9 @@ define(['require',
that.swapItem = false; that.swapItem = false;
that.saveAttrItems = false; that.saveAttrItems = false;
that.render(); that.render();
if (that.renderAuditTableLayoutView) {
that.renderAuditTableLayoutView();
}
}, },
error: function(e) { error: function(e) {
that.initialCall = false; that.initialCall = false;
......
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