This is an automated email from the ASF dual-hosted git repository.

pinal pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit bcdcda645e4ee34d28d4cff2f2a964d8481ecca3
Author: prasad pawar <[email protected]>
AuthorDate: Mon Sep 6 12:47:33 2021 +0530

    ATLAS-4405: #1 UI: Filter Type of DSL search is not consistent while 
switching between New-UI and Old-UI, fixed
    
    Signed-off-by: Pinal Shah <[email protected]>
---
 .../public/js/views/search/SearchLayoutView.js     | 30 +++++++++++++++-------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/dashboardv2/public/js/views/search/SearchLayoutView.js 
b/dashboardv2/public/js/views/search/SearchLayoutView.js
index 408f1fe..714e47b 100644
--- a/dashboardv2/public/js/views/search/SearchLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchLayoutView.js
@@ -96,7 +96,8 @@ define(['require',
                 this.selectedFilter = {
                     'basic': [],
                     'dsl': []
-                }
+                };
+                this.filterTypeSelected = null;
                 var param = Utils.getUrlState.getQueryParams();
                 this.query = {
                     dsl: {
@@ -532,7 +533,7 @@ define(['require',
                 });
 
                 _.each(_.uniq(serviceArr), function(service) {
-                    serviceStr += '<li><div class="pretty p-switch 
p-fill"><input type="checkbox" class="pull-left" data-value="' + (service) + '" 
value="" ' + (_.contains(that.selectedFilter[that.type], service) ? "checked" : 
"") + '/><div class="state p-primary"><label>' + (service.toUpperCase()) + 
'</label></div></div></li>';
+                    serviceStr += '<li><div class="pretty p-switch 
p-fill"><input type="checkbox" class="pull-left" data-value="' + (service) + '" 
value="" ' + (_.contains(that.filterTypeSelected, service) ? "checked" : "") + 
'/><div class="state p-primary"><label>' + (service.toUpperCase()) + 
'</label></div></div></li>';
                 });
                 var templt = serviceStr + '<hr class="hr-filter"/><div 
class="text-right"><div class="divider"></div><button class="btn btn-action 
btn-sm filterDone">Done</button></div>';
                 return templt;
@@ -609,14 +610,18 @@ define(['require',
                     getFilterBox: this.getFilterBox.bind(this),
                     onFilterSubmit: function(options) {
                         that.selectedFilter[that.type] = options.filterVal;
-                        that.renderTypeTagList({ "filterList": 
options.filterVal, isTypeOnly: true })
+                        that.filterTypeSelected = 
that.selectedFilter[that.type];
+                        that.renderTypeTagList({ "filterList": 
options.filterVal, isTypeOnly: true });
+                        that.checkForButtonVisiblity();
                     }
                 });
-                typeLovSelect2.on("select2:close", function() {
-                    typeLovSelect2.trigger("hideFilter");
-                });
-                if (typeLovSelect2 && isTypeOnly) {
-                    typeLovSelect2.select2('open').trigger("change", { 
'manual': true });
+                if (this.value.filterTypeSelected === "undefined") {
+                    typeLovSelect2.on("select2:close", function() {
+                        typeLovSelect2.trigger("hideFilter");
+                    });
+                    if (typeLovSelect2 && isTypeOnly) {
+                        typeLovSelect2.select2('open').trigger("change", { 
'manual': true });
+                    }
                 }
                 if (that.setInitialEntityVal) {
                     var defaultEntity = Enums.addOnEntities[0];
@@ -683,6 +688,11 @@ define(['require',
                 if (paramObj) {
                     this.value = paramObj;
                 }
+                if (this.value.filterTypeSelected) {
+                    this.filterTypeSelected = 
this.value.filterTypeSelected.split(',');
+                    this.renderTypeTagList({ "filterList": 
this.filterTypeSelected, isTypeOnly: true });
+                    this.ui.typeLov.val(this.value.type);
+                }
                 if (this.value) {
                     this.ui.searchInput.val(this.value.query || "");
                     if (this.value.dslChecked == "true" || 
this.value.searchType === "dsl") {
@@ -754,7 +764,8 @@ define(['require',
                         searchType: this.type,
                         dslChecked: this.ui.searchType.is(':checked'),
                         tagFilters: null,
-                        entityFilters: null
+                        entityFilters: null,
+                        filterTypeSelected: this.filterTypeSelected
                     },
                     typeLovValue = 
this.ui.typeLov.find(':selected').data('name'), // to get count of selected 
element used data
                     tagLovValue = 
this.ui.tagLov.find(':selected').data('name') || this.ui.tagLov.val(),
@@ -844,6 +855,7 @@ define(['require',
             },
             clearSearchData: function() {
                 this.selectedFilter[this.type] = [];
+                this.filterTypeSelected = [];
                 this.renderTypeTagList();
                 this.updateQueryObject();
                 this.ui.typeLov.val("").trigger("change");

Reply via email to