Fixes filter type mixin deregistering global hasFiltered boolean on items page. This prevented some tags to appear.

This commit is contained in:
Mateus Machado Luna 2019-05-14 17:46:21 -03:00
parent 27c4a66dfc
commit 39140fd39d
4 changed files with 20 additions and 17 deletions

View File

@ -12,7 +12,7 @@
"bulma": "^0.7.4", "bulma": "^0.7.4",
"mdi": "^2.2.43", "mdi": "^2.2.43",
"moment": "^2.22.2", "moment": "^2.22.2",
"node-sass": "^4.9.4", "node-sass": "^4.12.0",
"qs": "^6.5.2", "qs": "^6.5.2",
"react": "^16.8.3", "react": "^16.8.3",
"react-dom": "^16.8.3", "react-dom": "^16.8.3",

View File

@ -88,9 +88,7 @@
if (this.isUsingElasticSearch) { if (this.isUsingElasticSearch) {
this.isLoadingOptions = false; this.isLoadingOptions = false;
this.$eventBusSearch.$on('isLoadingItems', isLoading => { this.$eventBusSearch.$on('isLoadingItems', this.updatesIsLoading);
this.isLoadingOptions = isLoading;
});
} }
}, },
props: { props: {
@ -240,13 +238,16 @@
this.selectedValues(); this.selectedValues();
} }
} }
},
updatesIsLoading(isLoading) {
this.isLoadingOptions = isLoading;
} }
}, },
beforeDestroy() { beforeDestroy() {
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags); this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
if (this.isUsingElasticSearch) if (this.isUsingElasticSearch)
this.$eventBusSearch.$off('isLoadingItems'); this.$eventBusSearch.$off('isLoadingItems', this.updatesIsLoading);
} }
} }
</script> </script>

View File

@ -25,10 +25,7 @@ export const filter_type_mixin = {
created() { created() {
// We listen to event, but reload event if hasFiltered is negative, as // We listen to event, but reload event if hasFiltered is negative, as
// an empty query also demands filters reloading. // an empty query also demands filters reloading.
this.$eventBusSearch.$on('hasFiltered', () => { this.$eventBusSearch.$on('hasFiltered', this.reloadOptionsDueToFiltering);
if (typeof this.loadOptions == "function")
this.loadOptions(true);
});
}, },
mounted() { mounted() {
@ -320,6 +317,10 @@ export const filter_type_mixin = {
this.options[this.options.length-1].showViewAllButton = showViewAllButton; this.options[this.options.length-1].showViewAllButton = showViewAllButton;
} }
} }
},
reloadOptionsDueToFiltering() {
if (typeof this.loadOptions == "function")
this.loadOptions(true);
} }
}, },
beforeDestroy() { beforeDestroy() {
@ -327,6 +328,6 @@ export const filter_type_mixin = {
if (this.getOptionsValuesCancel != undefined) if (this.getOptionsValuesCancel != undefined)
this.getOptionsValuesCancel.cancel('Facet search Canceled.'); this.getOptionsValuesCancel.cancel('Facet search Canceled.');
this.$eventBusSearch.$off('hasFiltered'); this.$eventBusSearch.$off('hasFiltered', this.reloadOptionsDueToFiltering);
}, },
}; };

View File

@ -60,11 +60,9 @@
this.loadOptions(); this.loadOptions();
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTag); this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTag);
if (this.isUsingElasticSearch) { if (this.isUsingElasticSearch)
this.$eventBusSearch.$on('isLoadingItems', isLoading => { this.$eventBusSearch.$on('isLoadingItems', this.updatesIsLoading);
this.isLoading = isLoading;
});
}
}, },
mounted(){ mounted(){
// We listen to event, but reload event if hasFiltered is negative, as // We listen to event, but reload event if hasFiltered is negative, as
@ -328,13 +326,16 @@
if (skipSelected == undefined || skipSelected == false) { if (skipSelected == undefined || skipSelected == false) {
this.selectedValues(); this.selectedValues();
} }
},
updatesIsLoading(isLoading) {
this.isLoadingOptions = isLoading;
} }
}, },
beforeDestroy() { beforeDestroy() {
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags); this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
if (this.isUsingElasticSearch) if (this.isUsingElasticSearch)
this.$eventBusSearch.$off('isLoadingItems'); this.$eventBusSearch.$off('isLoadingItems', this.updatesIsLoading);
} }
} }
</script> </script>