Better way of handling loading state to filters.

This commit is contained in:
mateuswetah 2020-06-29 14:54:30 -03:00
parent 76a2b65473
commit 4f2ec6f4e9
5 changed files with 4 additions and 19 deletions

View File

@ -184,9 +184,6 @@
this.prepareOptionsForTaxonomy(this.facetsFromItemSearch[facet]); this.prepareOptionsForTaxonomy(this.facetsFromItemSearch[facet]);
else else
this.prepareOptionsForTaxonomy(Object.values(this.facetsFromItemSearch[facet])); this.prepareOptionsForTaxonomy(Object.values(this.facetsFromItemSearch[facet]));
if (this.isUsingElasticSearch)
this.isLoadingOptions = false;
} }
} }
} }

View File

@ -287,11 +287,11 @@
props: { props: {
collectionId: String, collectionId: String,
isRepositoryLevel: Boolean, isRepositoryLevel: Boolean,
taxonomy: String taxonomy: String,
isLoadingItems: Boolean
}, },
data() { data() {
return { return {
isLoadingItems: true,
isLoadingFilters: false, isLoadingFilters: false,
collapseAll: false, collapseAll: false,
taxonomyFiltersCollectionNames: {}, taxonomyFiltersCollectionNames: {},
@ -375,11 +375,6 @@
*/ */
this.prepareFilters(); this.prepareFilters();
}); });
if (this.isUsingElasticSearch) {
this.$eventBusSearch.$on('isLoadingItems', isLoadingItems => {
this.isLoadingItems = isLoadingItems;
});
}
}, },
beforeDestroy() { beforeDestroy() {
// Cancels previous collection name Request // Cancels previous collection name Request
@ -395,9 +390,6 @@
this.filtersSearchCancel.cancel('Filters search Canceled.'); this.filtersSearchCancel.cancel('Filters search Canceled.');
this.$eventBusSearch.$off('hasToPrepareMetadataAndFilters'); this.$eventBusSearch.$off('hasToPrepareMetadataAndFilters');
if (this.isUsingElasticSearch)
this.$eventBusSearch.$off('isLoadingItems');
}, },
methods: { methods: {

View File

@ -133,9 +133,6 @@ export const dynamicFilterTypeMixin = {
for (const facet in this.facetsFromItemSearch) { for (const facet in this.facetsFromItemSearch) {
if (facet == this.filter.id) { if (facet == this.filter.id) {
this.prepareOptionsForPlainText(this.facetsFromItemSearch[facet], search, valuesToIgnore, isInCheckboxModal); this.prepareOptionsForPlainText(this.facetsFromItemSearch[facet], search, valuesToIgnore, isInCheckboxModal);
if (this.isUsingElasticSearch)
this.isLoadingOptions = false;
} }
} }
resolve(); resolve();
@ -213,9 +210,6 @@ export const dynamicFilterTypeMixin = {
for (const facet in this.facetsFromItemSearch) { for (const facet in this.facetsFromItemSearch) {
if (facet == this.filter.id) { if (facet == this.filter.id) {
this.prepareOptionsForRelationship(this.facetsFromItemSearch[facet], search, valuesToIgnore, isInCheckboxModal); this.prepareOptionsForRelationship(this.facetsFromItemSearch[facet], search, valuesToIgnore, isInCheckboxModal);
if (this.isUsingElasticSearch)
this.isLoadingOptions = false;
} }
} }
resolve(); resolve();

View File

@ -429,6 +429,7 @@
aria-role="dialog" aria-role="dialog"
custom-class="tainacan-form filters-menu"> custom-class="tainacan-form filters-menu">
<filters-items-list <filters-items-list
:is-loading-items="isLoadingItems"
autofocus="true" autofocus="true"
tabindex="-1" tabindex="-1"
aria-modal aria-modal

View File

@ -408,6 +408,7 @@
:custom-class="'tainacan-form filters-menu' + (filtersAsModal ? ' filters-menu-modal' : '')" :custom-class="'tainacan-form filters-menu' + (filtersAsModal ? ' filters-menu-modal' : '')"
:can-cancel="hideHideFiltersButton ? ['x', 'outside'] : ['x', 'escape', 'outside']"> :can-cancel="hideHideFiltersButton ? ['x', 'outside'] : ['x', 'escape', 'outside']">
<filters-items-list <filters-items-list
:is-loading-items="isLoadingItems"
:autofocus="filtersAsModal" :autofocus="filtersAsModal"
:tabindex="filtersAsModal ? -1 : 0" :tabindex="filtersAsModal ? -1 : 0"
:aria-modal="filtersAsModal" :aria-modal="filtersAsModal"