Repository: atlas Updated Branches: refs/heads/master 247ad8b26 -> 1e64199b2
ATLAS-2307: basic-search enhancement to optionally exclude sub-type entities and sub-classification-types (UI) Signed-off-by: Madhan Neethiraj <mad...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/1e64199b Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/1e64199b Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/1e64199b Branch: refs/heads/master Commit: 1e64199b2ca8229f2eab54e37d59d49c1c7d5a1f Parents: 247ad8b Author: Keval Bhatt <kbh...@hortonworks.com> Authored: Wed Dec 13 20:53:09 2017 +0530 Committer: Madhan Neethiraj <mad...@apache.org> Committed: Thu Dec 21 17:39:42 2017 -0800 ---------------------------------------------------------------------- dashboardv2/public/css/scss/search.scss | 8 +++ .../search/SearchResultLayoutView_tmpl.html | 18 +++++-- .../public/js/utils/CommonViewFunction.js | 22 +++----- dashboardv2/public/js/utils/Enums.js | 2 + .../public/js/views/search/SearchLayoutView.js | 20 ++++--- .../js/views/search/SearchResultLayoutView.js | 55 +++++++++++++------- 6 files changed, 74 insertions(+), 51 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/1e64199b/dashboardv2/public/css/scss/search.scss ---------------------------------------------------------------------- diff --git a/dashboardv2/public/css/scss/search.scss b/dashboardv2/public/css/scss/search.scss index ade4c33..d3df2b7 100644 --- a/dashboardv2/public/css/scss/search.scss +++ b/dashboardv2/public/css/scss/search.scss @@ -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 http://git-wip-us.apache.org/repos/asf/atlas/blob/1e64199b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html index 14ba28b..403b064 100644 --- a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html @@ -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> http://git-wip-us.apache.org/repos/asf/atlas/blob/1e64199b/dashboardv2/public/js/utils/CommonViewFunction.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js index 374bde2..08437ac 100644 --- a/dashboardv2/public/js/utils/CommonViewFunction.js +++ b/dashboardv2/public/js/utils/CommonViewFunction.js @@ -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; http://git-wip-us.apache.org/repos/asf/atlas/blob/1e64199b/dashboardv2/public/js/utils/Enums.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/utils/Enums.js b/dashboardv2/public/js/utils/Enums.js index 78445e1..94010ed 100644 --- a/dashboardv2/public/js/utils/Enums.js +++ b/dashboardv2/public/js/utils/Enums.js @@ -63,6 +63,8 @@ define(['require'], function(require) { "query": "query", "pageOffset": "offset", "includeDE": "excludeDeletedEntities", + "excludeST": "includeSubTypes", + "excludeSC": "includeSubClassifications", "tagFilters": "tagFilters", "entityFilters": "entityFilters", "attributes": "attributes" http://git-wip-us.apache.org/repos/asf/atlas/blob/1e64199b/dashboardv2/public/js/views/search/SearchLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/search/SearchLayoutView.js b/dashboardv2/public/js/views/search/SearchLayoutView.js index 151b2af..b0d4558 100644 --- a/dashboardv2/public/js/views/search/SearchLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchLayoutView.js @@ -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; http://git-wip-us.apache.org/repos/asf/atlas/blob/1e64199b/dashboardv2/public/js/views/search/SearchResultLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js index 5b46976..7b909e2 100644 --- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js @@ -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 <i class='fa fa-caret-down'></i></button>") + buttonTemplate: _.template("<button class='btn btn-action btn-sm pull-right'>Columns <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 });