Repository: incubator-atlas Updated Branches: refs/heads/0.8-incubating 90e53223e -> 9941d74f2
ATLAS-1755: added checkbox to exclude deleted entities in basic and fulltext search Signed-off-by: Madhan Neethiraj <[email protected]> (cherry picked from commit c3b1bcb1c4240027b2fa613bf32b7dd7a3a3d205) Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/9941d74f Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/9941d74f Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/9941d74f Branch: refs/heads/0.8-incubating Commit: 9941d74f2e50ce1de05b945ea08aa6bad22d997a Parents: 90e5322 Author: Kalyani <[email protected]> Authored: Fri Apr 28 16:19:25 2017 +0530 Committer: Madhan Neethiraj <[email protected]> Committed: Sun Apr 30 18:41:52 2017 -0700 ---------------------------------------------------------------------- .../search/SearchResultLayoutView_tmpl.html | 4 +++ .../js/views/search/SearchResultLayoutView.js | 36 +++++++++++--------- 2 files changed, 24 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/9941d74f/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 af984f5..4361ca1 100644 --- a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html @@ -25,6 +25,10 @@ <a href="javascript:void(0)" class="inputAssignTag multiSelectTag assignTag btnAssign" style="display:none" data-id="addAssignTag"><i class="fa fa-plus"></i> Assign Tag</a> </div> <div class="searchTable"> + <div style="display: none;margin-left: 20px" data-id="checkDeletedEntity"> + <label class="checkbox"> + <input type="checkbox" class="input" name="queryType" value="text" name="check" value="1" />Include historical entities</label> + </div> <span style="display: none;" class="labelShowRecord pull-left" data-id="pageRecordText"></span> <div data-id="paginationDiv" style="display:none"> <ul class="pager pull-right"> http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/9941d74f/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 cad4bec..b2f24d4 100644 --- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js @@ -60,6 +60,7 @@ define(['require', addAssignTag: "[data-id='addAssignTag']", editEntityButton: "[data-id='editEntityButton']", createEntity: "[data-id='createEntity']", + checkDeletedEntity: "[data-id='checkDeletedEntity']" }, templateHelpers: function() { return { @@ -116,6 +117,7 @@ define(['require', events["click " + this.ui.previousData] = "onClickpreviousData"; events["click " + this.ui.editEntityButton] = "onClickEditEntity"; events["click " + this.ui.createEntity] = 'onClickCreateEntity'; + events["click " + this.ui.checkDeletedEntity] = 'onCheckDeletedEntity'; return events; }, /** @@ -128,7 +130,6 @@ define(['require', this.entityModel = new VEntity(); this.searchCollection = new VSearchList(); this.limit = 25; - this.firstFetch = true; this.asyncFetchCounter = 0; this.offset = 0; this.commonTableOptions = { @@ -231,18 +232,19 @@ define(['require', } } }, - fetchCollection: function(value) { + fetchCollection: function(value, deleteChecked) { var that = this; this.showLoader(); if (Globals.searchApiCallRef && Globals.searchApiCallRef.readyState === 1) { Globals.searchApiCallRef.abort(); } - if (value && !value.paginationChange) { $.extend(this.searchCollection.queryParams, { limit: this.limit }); if (value.searchType) { this.searchCollection.url = UrlLinks.searchApiUrl(value.searchType); - $.extend(this.searchCollection.queryParams, { limit: this.limit }); + if (deleteChecked === undefined) { + $.extend(this.searchCollection.queryParams, { limit: this.limit, excludeDeletedEntities: true }); + } this.offset = 0; } _.extend(this.searchCollection.queryParams, { 'query': (value.query ? value.query.trim() : null), 'typeName': value.type || null, 'classification': value.tag || null }); @@ -281,21 +283,10 @@ define(['require', that.ui.previousData.attr('disabled', true); } if (that.searchCollection.models.length === 0) { - that.checkTableFetch(); that.offset = that.offset - that.limit; - if (that.firstFetch) { - that.renderTableLayoutView(); - } } } - if (that.firstFetch) { - that.firstFetch = false; - } - - // checking length for not rendering the table - if (that.searchCollection.models.length) { - that.renderTableLayoutView(); - } + that.renderTableLayoutView(); if (value) { var resultArr = []; if (that.searchCollection.queryParams.typeName) { @@ -326,6 +317,11 @@ define(['require', that.REntityTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, { columns: columns }))); + if (that.searchCollection.models.length && that.value.searchType !== "dsl") { + that.ui.checkDeletedEntity.show(); + } else { + that.ui.checkDeletedEntity.hide(); + } that.ui.paginationDiv.show(); that.$(".ellipsis .inputAssignTag").hide(); that.renderBreadcrumb(); @@ -656,6 +652,14 @@ define(['require', } }); }); + }, + onCheckDeletedEntity: function(e) { + if (e.target.checked) { + $.extend(this.searchCollection.queryParams, { limit: this.limit, excludeDeletedEntities: false }); + } else { + $.extend(this.searchCollection.queryParams, { limit: this.limit, excludeDeletedEntities: true }); + } + this.fetchCollection(this.value, e.target.checked); } }); return SearchResultLayoutView;
