Commit 2fbfb557 by kevalbhatt

ATLAS-3710 : [Business Metadata] Missing Business Metadata attribute info in list view

parent 6ece28fd
......@@ -172,4 +172,28 @@
.select2-results__option[aria-selected=true] {
display: none;
}
}
.business-metadata-detail-attr {
margin-bottom: 0px;
box-shadow: none;
.panel-heading {
color: #686868 !important;
font-size: 13px;
padding: 0;
.panel-title {
font-size: 14px;
a:hover {
color: #686868 !important;
opacity: 1 !important;
}
}
}
.btn-group>button {
color: #686868 !important;
}
}
\ No newline at end of file
......@@ -163,7 +163,7 @@ define(['require',
editable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) {
return model.get('name');
return _.escape(model.get('name'));
}
})
},
......@@ -177,6 +177,39 @@ define(['require',
}
})
},
searchWeight: {
label: "Search Weight",
cell: "String",
editable: false
},
enableMultipleValue: {
label: "Enable Multivalues",
cell: "html",
editable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) {
var enableMultipleValue = '';
if (model.get('typeName').indexOf('array<') > -1) {
enableMultipleValue = 'checked';
}
return '<input type="checkbox" class="form-check-input multi-value-select" data-id="multiValueSelectStatus" ' + enableMultipleValue + ' disabled="disabled">';
}
})
},
maxStrLength: {
label: "Max Length",
cell: "html",
editable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) {
var maxString = "NA";
if (model.get('typeName').indexOf('string') > -1) {
maxString = model.get('options').maxStrLength || maxString;
}
return maxString;
}
})
},
options: {
label: "Entity Type(s)",
cell: "html",
......
......@@ -172,8 +172,8 @@ define(['require',
this.ui.entityTypeSelector.on('select2:open', function(e) { // to make selected option disable in dropdown added remove-from-list class
$('.select2-dropdown--below').addClass('remove-from-list');
});
if (this.model.get("searchWeight") && this.model.get("searchWeight") != -1) {
searchWeightValue = this.model.get("searchWeight");
if (this.model.get("searchWeight")) {
searchWeightValue = this.model.get("searchWeight") === -1 ? 0 : this.model.get("searchWeight");
}
if (this.model.get("options")) {
stringLengthValue = this.model.get("options").maxStrLength || '50';
......
......@@ -247,13 +247,15 @@ define(['require',
var attrValues = '',
attrTable = $('table'),
attrTableBody = $('tbody'),
attrTableHeading = "<thead><td style='display:table-cell'><b>Attribute</b></td><td style='display:table-cell'><b>Type</b></td><td style='display:table-cell'><b>Applicable Type(s)</b></td><td style='display:table-cell'><b>Action</b></td></thead>",
attrTableHeading = "<thead><td style='display:table-cell'><b>Attribute</b></td><td style='display:table-cell'><b>Type</b></td><td style='display:table-cell'><b>Search Weight</b></td><td style='display:table-cell'><b>Enable Multivalues</b></td><td style='display:table-cell'><b>Max Length</b></td><td style='display:table-cell'><b>Applicable Type(s)</b></td><td style='display:table-cell'><b>Action</b></td></thead>",
attrRow = '',
attrTableDetails = '';
if (model.attributes && model.attributes.attributeDefs.length) {
_.each(model.attributes.attributeDefs, function(attrObj) {
var applicableEntityTypes = '',
typeName = attrObj.typeName;
typeName = attrObj.typeName,
multiSelect = '',
maxString = 'NA';
if (attrObj.options && attrObj.options.applicableEntityTypes) {
var entityTypes = JSON.parse(attrObj.options.applicableEntityTypes);
_.each(entityTypes, function(values) {
......@@ -262,8 +264,13 @@ define(['require',
}
if (typeName.includes('array')) {
typeName = _.escape(typeName);
multiSelect = 'checked';
}
attrRow += "<tr> <td style='display:table-cell'>" + _.escape(attrObj.name) + "</td><td style='display:table-cell'>" + typeName + "</td><td style='display:table-cell'>" + applicableEntityTypes + "</td><td style='display:table-cell'> <div class='btn btn-action btn-sm' style='margin-left:0px;' data-id='attributeEdit' data-guid='" + model.get('guid') + "' data-name ='" + _.escape(attrObj.name) + "' data-action='attributeEdit' >Edit</div> </td></tr> ";
if (typeName.includes('string') && attrObj.options && attrObj.options.maxStrLength) {
maxString = attrObj.options.maxStrLength;
}
attrRow += "<tr> <td style='display:table-cell'>" + _.escape(attrObj.name) + "</td><td style='display:table-cell'>" + typeName + "</td><td style='display:table-cell'>" + _.escape(attrObj.searchWeight) + "</td><td style='display:table-cell'><input type='checkbox' class='form-check-input multi-value-select' " + multiSelect + " disabled='disabled'> </td><td style='display:table-cell'>" + maxString + "</td><td style='display:table-cell'>" + applicableEntityTypes + "</td><td style='display:table-cell'> <div class='btn btn-action btn-sm' style='margin-left:0px;' data-id='attributeEdit' data-guid='" + model.get('guid') + "' data-name ='" + _.escape(attrObj.name) + "' data-action='attributeEdit' >Edit</div> </td></tr> ";
});
var adminText = '<div class="row"><div class="col-sm-12 attr-details"><table style="padding: 50px;">' + attrTableHeading + attrRow + '</table></div></div>';
$(el).append($('<div>').html(adminText));
......@@ -271,7 +278,6 @@ define(['require',
var adminText = '<div class="row"><div class="col-sm-12 attr-details"><h5 class="text-center"> No attributes to show.</h5></div></div>';
$(el).append($('<div>').html(adminText));
}
}
},
name: {
......
......@@ -215,7 +215,8 @@ define([
this.collection.unshift(modelObj);
},
renderBusinessMetadata: function() {
var li = ""
var that = this,
li = ""
this.actualCollection.forEach(function(obj) {
var attrLi = "";
_.each(obj.attributes, function(val, key) {
......@@ -236,13 +237,20 @@ define([
attrLi += "<tr><td>" + _.escape(key) + " (" + _.escape(val.typeName) + ")</td><td>" + _.escape(newVal) + "</td></tr>";
}
});
li += "<ul class='business-metadata-tree-parent'><li class='table'>" + _.escape(obj.get("__internal_UI_businessMetadataName")) + "</li>" +
"<li class='business-metadata-tree-child entity-detail-table'>" +
"<table class='table'>" + attrLi + "</table>" +
"</li></ul>";
li += that.associateAttributePanel(obj, attrLi);
});
this.ui.businessMetadataTree.html(li);
},
associateAttributePanel: function(obj, tableBody) {
return '<div class="panel panel-default custom-panel expand_collapse_panel-icon no-border business-metadata-detail-attr">' +
'<div class="panel-heading" data-toggle="collapse" href="#' + _.escape(obj.get("__internal_UI_businessMetadataName")) + '" aria-expanded="true" style="width: 70%;">' +
'<h4 class="panel-title"> <a>' + _.escape(obj.get("__internal_UI_businessMetadataName")) + '</a></h4>' +
'<div class="btn-group pull-left"> <button type="button" title="Collapse"><i class="ec-icon fa"></i></button></div>' +
'</div>' +
'<div id="' + _.escape(obj.get("__internal_UI_businessMetadataName")) + '" class="panel-collapse collapse in">' +
'<div class="panel-body"><table class="table">' + tableBody + '</table></div>' +
'</div></div>';
},
onRender: function() {
this.panelOpenClose();
this.renderBusinessMetadata();
......
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