Commit 1e64199b by Keval Bhatt Committed by Madhan Neethiraj

ATLAS-2307: basic-search enhancement to optionally exclude sub-type entities and…

ATLAS-2307: basic-search enhancement to optionally exclude sub-type entities and sub-classification-types (UI) Signed-off-by: 's avatarMadhan Neethiraj <madhan@apache.org>
parent 247ad8b2
......@@ -121,4 +121,12 @@ $color_celeste_approx: #1D1F2B;
table {
background: rgba(0, 0, 0, 0.18) !important;
}
}
.filter-box {
.inline-content-fr {
.inline {
margin: 0px;
}
}
}
\ No newline at end of file
......@@ -24,17 +24,27 @@
</div>
<div class="searchTable">
<div class="row well">
<div class="row form-group pagination-box" style="display: none;">
<div class="col-sm-4">
<div class="row form-group pagination-box filter-box" style="display: none;">
<div class="col-sm-3">
<span class="labelShowRecord pull-left" data-id="pageRecordText"> </span>
</div>
<div class="col-sm-8 inline-content-fr">
<div class="col-sm-9 inline-content-fr no-padding-left">
<div class="inline" data-id="colManager"></div>
<div class="inline" data-id="containerCheckBox" style="display: none;">
<label class="checkbox-inline btn" for="inputLabel">
<input type="checkbox" id="inputLabel" name="queryType" name="check" data-id="checkDeletedEntity" />
<input type="checkbox" data-id="checkDeletedEntity" data-value="includeDE" />
<b>Show historical entities</b></label>
</div>
<div class="inline" data-id="containerCheckBox" style="display: none;">
<label class="checkbox-inline btn" for="inputLabel">
<input type="checkbox" data-id="checkSubClassification" data-value="excludeSC"/>
<b>Exclude sub-classification</b></label>
</div>
<div class="inline" data-id="containerCheckBox" style="display: none;">
<label class="checkbox-inline btn" for="inputLabel">
<input type="checkbox" data-id="checkSubType" data-value="excludeST"/>
<b>Exclude sub-type</b></label>
</div>
<div class="inline">
<a href="javascript:void(0)" class=" multiSelectTag assignTag btn btn-action btn-sm" style="display:none" data-id="addAssignTag"><i class="fa fa-plus"></i> Assign Tag</a>
</div>
......
......@@ -306,19 +306,13 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if (!_.isUndefinedNull(val)) {
if (k == "attributes") {
val = val.split(',');
} else if (k == "tagFilters") {
val = CommonViewFunction.attributeFilter.generateAPIObj(val);
} else if (k == "entityFilters") {
} else if (_.contains(["tagFilters","entityFilters"],k)) {
val = CommonViewFunction.attributeFilter.generateAPIObj(val);
} else if (k == "includeDE") {
if (val) {
val = false;
} else {
val = true;
}
} else if (_.contains(["includeDE","excludeST","excludeSC"],k)) {
val = val ? false : true;
}
}
if (k == "includeDE") {
if (_.contains(["includeDE","excludeST","excludeSC"],k)) {
val = _.isUndefinedNull(val) ? true : val;
}
obj.searchParameters[v] = val;
......@@ -371,12 +365,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
});
}
val = CommonViewFunction.attributeFilter.generateUrl({ "value": val.criterion });
} else if (k == "includeDE") {
if (val) {
val = false;
} else {
val = true;
}
} else if (_.contains(["includeDE","excludeST","excludeSC"],k)) {
val = val ? false : true;
}
}
obj[k] = val;
......
......@@ -63,6 +63,8 @@ define(['require'], function(require) {
"query": "query",
"pageOffset": "offset",
"includeDE": "excludeDeletedEntities",
"excludeST": "includeSubTypes",
"excludeSC": "includeSubClassifications",
"tagFilters": "tagFilters",
"entityFilters": "entityFilters",
"attributes": "attributes"
......
......@@ -105,7 +105,9 @@ define(['require',
pageOffset: null,
pageLimit: null,
entityFilters: null,
includeDE: null
includeDE: null,
excludeST:null,
excludeSC : null
}
};
if (!this.value) {
......@@ -145,11 +147,9 @@ define(['require',
urlObj = Utils.getUrlState.getQueryParams();
if (urlObj) {
// includeDE value in because we need to send "true","false" to the server.
if (urlObj.includeDE == "true") {
urlObj.includeDE = true;
} else {
urlObj.includeDE = false;
}
urlObj.includeDE = urlObj.includeDE == "true" ? true : false;
urlObj.excludeSC = urlObj.excludeSC == "true" ? true : false;
urlObj.excludeST = urlObj.excludeST == "true" ? true : false;
}
return _.extend({}, queryObj, urlObj, {
'entityFilters': entityObj ? entityObj[queryObj.type] : null,
......@@ -501,11 +501,9 @@ define(['require',
if (columnList) {
params['attributes'] = columnList.join(',');
}
if (_.isUndefinedNull(this.value.includeDE)) {
params['includeDE'] = false;
} else {
params['includeDE'] = this.value.includeDE;
}
params['includeDE'] = _.isUndefinedNull(this.value.includeDE) ? false : this.value.includeDE;
params['excludeST'] = _.isUndefinedNull(this.value.excludeST) ? false : this.value.excludeST;
params['excludeSC'] = _.isUndefinedNull(this.value.excludeSC) ? false : this.value.excludeSC;
}
if (!_.isUndefinedNull(this.value.pageLimit)) {
params['pageLimit'] = this.value.pageLimit;
......
......@@ -59,6 +59,8 @@ define(['require',
addAssignTag: "[data-id='addAssignTag']",
createEntity: "[data-id='createEntity']",
checkDeletedEntity: "[data-id='checkDeletedEntity']",
checkSubClassification: "[data-id='checkSubClassification']",
checkSubType: "[data-id='checkSubType']",
colManager: "[data-id='colManager']",
containerCheckBox: "[data-id='containerCheckBox']",
columnEmptyInfo: "[data-id='columnEmptyInfo']",
......@@ -112,7 +114,9 @@ define(['require',
events["click " + this.ui.nextData] = "onClicknextData";
events["click " + this.ui.previousData] = "onClickpreviousData";
events["click " + this.ui.createEntity] = 'onClickCreateEntity';
events["click " + this.ui.checkDeletedEntity] = 'onCheckDeletedEntity';
events["click " + this.ui.checkDeletedEntity] = 'onCheckExcludeIncludeResult';
events["click " + this.ui.checkSubClassification] = 'onCheckExcludeIncludeResult';
events["click " + this.ui.checkSubType] = 'onCheckExcludeIncludeResult';
return events;
},
/**
......@@ -234,7 +238,7 @@ define(['require',
saveState: false
},
visibilityControlOpts: {
buttonTemplate: _.template("<button class='btn btn-action btn-md pull-right'>Columns&nbsp<i class='fa fa-caret-down'></i></button>")
buttonTemplate: _.template("<button class='btn btn-action btn-sm pull-right'>Columns&nbsp<i class='fa fa-caret-down'></i></button>")
},
el: this.ui.colManager
},
......@@ -253,6 +257,13 @@ define(['require',
if (value && value.includeDE) {
this.ui.checkDeletedEntity.prop('checked', true);
}
if (value && value.excludeSC) {
this.ui.checkSubClassification.prop('checked', true);
}
if (value && value.excludeST) {
this.ui.checkSubType.prop('checked', true);
}
} else {
value = {
'query': null,
......@@ -355,7 +366,7 @@ define(['require',
}
if (!dataLength && that.offset >= that.limit && ((options && options.next) || goToPage) && (options && !options.fromUrl)) {
/* User clicks on next button and server returns
/* User clicks on next button and server returns
empty response then disabled the next button without rendering table*/
that.hideLoader();
......@@ -385,7 +396,7 @@ define(['require',
/*Next button check.
It's outside of Previous button else condition
It's outside of Previous button else condition
because when user comes from 2 page to 1 page than we need to check next button.*/
if (dataLength < that.limit) {
that.ui.nextData.attr('disabled', true);
......@@ -433,6 +444,13 @@ define(['require',
silent: true,
reset: true
}
if (this.value) {
var checkBoxValue = {
'excludeDeletedEntities': (this.value.includeDE ? false : true),
'includeSubClassifications': (this.value.excludeSC ? false : true),
'includeSubTypes': (this.value.excludeST ? false : true)
}
}
if (value) {
if (value.searchType) {
this.searchCollection.url = UrlLinks.searchApiUrl(value.searchType);
......@@ -448,28 +466,24 @@ define(['require',
}
if (isPostMethod) {
this.searchCollection.filterObj = _.extend({}, filterObj);
apiObj['data'] = _.extend({
'excludeDeletedEntities': (this.value && this.value.includeDE ? false : true)
}, filterObj, _.pick(this.searchCollection.queryParams, 'query', 'excludeDeletedEntities', 'limit', 'offset', 'typeName', 'classification'))
apiObj['data'] = _.extend(checkBoxValue, filterObj, _.pick(this.searchCollection.queryParams, 'query', 'excludeDeletedEntities', 'limit', 'offset', 'typeName', 'classification'))
Globals.searchApiCallRef = this.searchCollection.getBasicRearchResult(apiObj);
} else {
apiObj.data = null;
this.searchCollection.filterObj = null;
if (this.value.profileDBView) {
_.extend(this.searchCollection.queryParams, { 'excludeDeletedEntities': (this.value && this.value.includeDE ? false : true) });
_.extend(this.searchCollection.queryParams, checkBoxValue);
}
Globals.searchApiCallRef = this.searchCollection.fetch(apiObj);
}
} else {
if (isPostMethod) {
apiObj['data'] = _.extend({
'excludeDeletedEntities': (this.value && this.value.includeDE ? false : true)
}, filterObj, _.pick(this.searchCollection.queryParams, 'query', 'excludeDeletedEntities', 'limit', 'offset', 'typeName', 'classification'));
apiObj['data'] = _.extend(checkBoxValue, filterObj, _.pick(this.searchCollection.queryParams, 'query', 'excludeDeletedEntities', 'limit', 'offset', 'typeName', 'classification'));
Globals.searchApiCallRef = this.searchCollection.getBasicRearchResult(apiObj);
} else {
apiObj.data = null;
if (this.value.profileDBView) {
_.extend(this.searchCollection.queryParams, { 'excludeDeletedEntities': (this.value && this.value.includeDE ? false : true) });
_.extend(this.searchCollection.queryParams,checkBoxValue);
}
Globals.searchApiCallRef = this.searchCollection.fetch(apiObj);
}
......@@ -814,13 +828,13 @@ define(['require',
}
},
showLoader: function() {
this.$('.fontLoader:not(.for-ignore)').show();
this.$('.tableOverlay').show();
this.$('.fontLoader:not(.for-ignore)').addClass('show');
this.$('.tableOverlay').addClass('show');
},
hideLoader: function() {
this.$('.fontLoader:not(.for-ignore)').hide();
this.$('.fontLoader:not(.for-ignore)').removeClass('show');
this.$('.ellipsis,.pagination-box').show(); // only for first time
this.$('.tableOverlay').hide();
this.$('.tableOverlay').removeClass('show');
},
checkedValue: function(e) {
var guid = "",
......@@ -913,13 +927,14 @@ define(['require',
});
});
},
onCheckDeletedEntity: function(e) {
var includeDE = false;
onCheckExcludeIncludeResult: function(e) {
var flag = false,
val = $(e.currentTarget).attr('data-value');
if (e.target.checked) {
includeDE = true;
flag = true;
}
if (this.value) {
this.value.includeDE = includeDE;
this.value[val] = flag;
this.triggerUrl();
}
_.extend(this.searchCollection.queryParams, { limit: this.limit, offset: this.offset });
......
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