Commit 21e9f2f9 by kevalbhatt

ATLAS-3696 : [Business Metadata] No option to check/uncheck Business Metadata…

ATLAS-3696 : [Business Metadata] No option to check/uncheck Business Metadata attributes in search results
parent 7b650f7a
......@@ -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>
......
......@@ -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>
......
......@@ -199,6 +199,10 @@ tr.empty {
font-size: 14px;
letter-spacing: 0.25px;
color: #6a6a6a;
&.no-capitalize {
text-transform: none !important;
}
}
>td {
......
......@@ -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>
......
......@@ -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>
......
......@@ -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;
}
......
......@@ -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() {
......
......@@ -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) {
......
......@@ -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();
......
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