Commit cd177f83 by kevalbhatt

ATLAS-3623 : Beta UI: Basic search improvement to search for namespace attribute

parent fd1aad38
...@@ -61,6 +61,7 @@ define(['require', ...@@ -61,6 +61,7 @@ define(['require',
'entityDefCollection', 'entityDefCollection',
'enumDefCollection', 'enumDefCollection',
'classificationDefCollection', 'classificationDefCollection',
'nameSpaceCollection',
'tag', 'tag',
'searchTableFilters', 'searchTableFilters',
'systemAttrArr')); 'systemAttrArr'));
...@@ -364,6 +365,30 @@ define(['require', ...@@ -364,6 +365,30 @@ define(['require',
filters.push(returnObj); filters.push(returnObj);
} }
}); });
if (this.attrObj.length > 0) {
var sortedNamespaceData = _.sortBy(this.nameSpaceCollection.models, function(obj) {
return obj.get('name')
});
_.each(sortedNamespaceData, function(obj) {
var namespaceName = obj.get('name');
var sortedNamespaceAttr = _.sortBy(obj.attributes.attributeDefs, function(obj) {
return obj.name;
});
_.each(sortedNamespaceAttr, function(attrDetails) {
if (attrDetails.options && attrDetails.options.applicableEntityTypes && that.options.applicableType && (JSON.parse(attrDetails.options.applicableEntityTypes).indexOf(that.options.applicableType) != -1)) {
var returnObj = that.getObjDef(attrDetails, rules_widgets, isGroupView, 'Select Namespace Attribute', true);
if (returnObj) {
returnObj.id = namespaceName + "." + returnObj.id;
returnObj.label = namespaceName + ": " + returnObj.label;
returnObj.data = { 'entityType': "namespace" };
filters.push(returnObj);
}
}
})
});
}
filters = _.uniq(filters, 'id'); filters = _.uniq(filters, 'id');
if (filters && !_.isEmpty(filters)) { if (filters && !_.isEmpty(filters)) {
this.ui.builder.queryBuilder({ this.ui.builder.queryBuilder({
......
...@@ -57,9 +57,11 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa ...@@ -57,9 +57,11 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa
events["click " + this.ui.attrFilter] = function(e) { events["click " + this.ui.attrFilter] = function(e) {
if (this.$('.attribute-filter-container').hasClass("hide")) { if (this.$('.attribute-filter-container').hasClass("hide")) {
this.onClickAttrFilter(); this.onClickAttrFilter();
this.$('.attributeResultContainer').addClass("overlay");
} else {
this.$('.attributeResultContainer').removeClass("overlay");
} }
this.$('.fa-angle-right').toggleClass('fa-angle-down'); this.$('.fa-angle-right').toggleClass('fa-angle-down');
this.$('.attributeResultContainer').addClass("overlay");
this.$('.attribute-filter-container, .attr-filter-overlay').toggleClass('hide'); this.$('.attribute-filter-container, .attr-filter-overlay').toggleClass('hide');
}; };
...@@ -236,6 +238,7 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa ...@@ -236,6 +238,7 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa
enumDefCollection: that.options.enumDefCollection, enumDefCollection: that.options.enumDefCollection,
typeHeaders: that.options.typeHeaders, typeHeaders: that.options.typeHeaders,
classificationDefCollection: that.options.classificationDefCollection, classificationDefCollection: that.options.classificationDefCollection,
nameSpaceCollection: that.options.nameSpaceCollection,
searchTableFilters: that.checkEntityFilter(that.options) searchTableFilters: that.checkEntityFilter(that.options)
}; };
if (that.options.value) { if (that.options.value) {
...@@ -295,7 +298,8 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa ...@@ -295,7 +298,8 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa
this.renderQueryBuilder(_.extend({}, obj, { this.renderQueryBuilder(_.extend({}, obj, {
tag: false, tag: false,
type: true, type: true,
attrObj: attrTypeObj attrObj: attrTypeObj,
applicableType: that.options.value ? that.options.value.type : null
}), this.RQueryBuilderEntity); }), this.RQueryBuilderEntity);
this.ui.entityName.html(that.options.value.type); this.ui.entityName.html(that.options.value.type);
...@@ -362,13 +366,24 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa ...@@ -362,13 +366,24 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa
return col; return col;
}, },
updateFilterOptions: function(rule, filtertype, isTag) { updateFilterOptions: function(rule, filtertype, isTag) {
var ruleUrl = CommonViewFunction.attributeFilter.generateUrl({ value: rule, formatedDateToLong: true }); var that = this,
ruleUrl = CommonViewFunction.attributeFilter.generateUrl({ value: rule, formatedDateToLong: true });
this.options.searchTableFilters[filtertype][isTag ? this.options.value.tag : this.options.value.type] = ruleUrl; this.options.searchTableFilters[filtertype][isTag ? this.options.value.tag : this.options.value.type] = ruleUrl;
if (!isTag && this.options.value && this.options.value.type && this.options.searchTableColumns) { if (!isTag && this.options.value && this.options.value.type && this.options.searchTableColumns) {
if (!this.options.searchTableColumns[this.options.value.type]) { if (!this.options.searchTableColumns[this.options.value.type]) {
this.options.searchTableColumns[this.options.value.type] = ["selected", "name", "owner", "description", "tag", "typeName"]; this.options.searchTableColumns[this.options.value.type] = ["selected", "name", "owner", "description", "tag", "typeName"];
} }
this.options.searchTableColumns[this.options.value.type] = _.sortBy(_.union(this.options.searchTableColumns[this.options.value.type], this.getIdFromRuleObj(rule))); this.options.searchTableColumns[this.options.value.type] = _.sortBy(_.union(this.options.searchTableColumns[this.options.value.type], this.getIdFromRuleObj(rule)));
if (rule.rules) {
_.find(rule.rules, function(checkNamespace) {
if (checkNamespace.data && checkNamespace.data.entityType && checkNamespace.data.entityType == 'namespace') {
if (that.options.searchTableColumns[that.options.value.type].indexOf('namespace') == -1) {
that.options.searchTableColumns[that.options.value.type].push(checkNamespace.data.entityType);
}
return true;
}
});
}
} }
}, },
renderQueryBuilder: function(obj, rQueryBuilder) { renderQueryBuilder: function(obj, rQueryBuilder) {
......
...@@ -641,12 +641,12 @@ define(['require', ...@@ -641,12 +641,12 @@ define(['require',
var that = this, var that = this,
nameCheck = 0, nameCheck = 0,
columnToShow = null, columnToShow = null,
col = {}; col = {},
namespaceRenderable = false;
this.value = Utils.getUrlState.getQueryParams() || this.value; this.value = Utils.getUrlState.getQueryParams() || this.value;
if (this.value && this.value.searchType === "basic" && this.searchTableColumns && (this.searchTableColumns[this.value.type] !== undefined)) { if (this.value && this.value.searchType === "basic" && this.searchTableColumns && (this.searchTableColumns[this.value.type] !== undefined)) {
columnToShow = this.searchTableColumns[this.value.type] == null ? [] : this.searchTableColumns[this.value.type]; columnToShow = this.searchTableColumns[this.value.type] == null ? [] : this.searchTableColumns[this.value.type];
} }
col['Check'] = { col['Check'] = {
name: "selected", name: "selected",
label: "Select", label: "Select",
...@@ -787,6 +787,28 @@ define(['require', ...@@ -787,6 +787,28 @@ define(['require',
} }
}) })
}; };
col['Namespaces'] = {
label: "Namespaces",
cell: "Html",
editable: false,
resizeable: true,
orderable: true,
renderable: _.contains(columnToShow, 'namespace'),
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) {
var obj = model.toJSON(),
namespaceStr = '';
if (obj && obj.attributes) {
_.each(obj.attributes, function(namespaceValue, attributeName) {
if (attributeName.indexOf('.') != -1) {
namespaceStr += '<label class="btn btn-action btn-xs btn-blue no-pointer">' + attributeName + ': ' + namespaceValue + '</label>';
}
})
return namespaceStr;
}
}
})
};
this.getTagCol({ 'col': col, 'columnToShow': columnToShow }); this.getTagCol({ 'col': col, 'columnToShow': columnToShow });
if ((!_.contains(["glossary"], this.fromView))) { if ((!_.contains(["glossary"], this.fromView))) {
this.getTermCol({ 'col': col, 'columnToShow': columnToShow }); this.getTermCol({ 'col': col, 'columnToShow': columnToShow });
......
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