diff --git a/src/admin/components/search/filters-items-list.vue b/src/admin/components/search/filters-items-list.vue
index 6145b0334..1b8d2850c 100644
--- a/src/admin/components/search/filters-items-list.vue
+++ b/src/admin/components/search/filters-items-list.vue
@@ -88,11 +88,98 @@
-
-
+
+ :query="getQuery"/>
+
+
+ {{ $i18n.get('label_filters_from') + " " + repositoryCollectionNames[key] + ": " }}
+
+
+
+
+
+
+
+
+ {{ $i18n.get('label_filters_from') + " " + repositoryCollectionNames[key] + ": " }}
+
+
+
+
+
+
+
+
{
- this.$set(this.taxonomyFiltersCollectionNames, taxonomyFilter, collectionName);
+ this.$nextTick(() => {
+ this.$set(this.taxonomyFiltersCollectionNames, taxonomyFilter, collectionName);
+ });
+ });
+ }
+ }
+ }
+ },
+ repositoryCollectionFilters() {
+ if (this.repositoryCollectionFilters != undefined) {
+ this.$set(this.repositoryCollectionNames, 'repository-filters', this.$i18n.get('repository'));
+ for (let repositoryCollectionFilter of Object.keys(this.repositoryCollectionFilters)) {
+ if (repositoryCollectionFilter != 'repository-filters') {
+ this.fetchCollectionName(repositoryCollectionFilter)
+ .then((collectionName) => {
+ this.$nextTick(() => {
+ this.$set(this.repositoryCollectionNames, '' + repositoryCollectionFilter, collectionName);
+ });
});
}
}
@@ -170,6 +276,7 @@
font-size: 0.875rem;
font-weight: 500;
margin-bottom: 0.875rem;
+ margin-top: 1rem;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
diff --git a/src/admin/pages/lists/items-page.vue b/src/admin/pages/lists/items-page.vue
index 8bb0e3e86..d498236e3 100644
--- a/src/admin/pages/lists/items-page.vue
+++ b/src/admin/pages/lists/items-page.vue
@@ -121,6 +121,7 @@
v-if="!isLoadingFilters &&
((filters.length >= 0 && isRepositoryLevel) || filters.length > 0)"
:filters="filters"
+ :repository-collection-filters="repositoryCollectionFilters"
:collapsed="collapseAll"
:is-repository-level="isRepositoryLevel"/>
@@ -772,6 +773,7 @@
((filters.length >= 0 && isRepositoryLevel) || filters.length > 0)"
:filters="filters"
:collapsed="collapseAll"
+ :repository-collection-filters="repositoryCollectionFilters"
:is-repository-level="isRepositoryLevel"/>
this.isLoadingFilters = false)
.catch(() => this.isLoadingFilters = false);
+
+ // On repository level we also fetch collection filters
+ if (this.isRepositoryLevel) {
+ this.fetchRepositoryCollectionFilters()
+ .catch(() => this.isLoadingFilters = false);
+ }
+
},
prepareMetadata() {
diff --git a/src/js/store/modules/filter/actions.js b/src/js/store/modules/filter/actions.js
index 3147d83f2..3fa01c76d 100644
--- a/src/js/store/modules/filter/actions.js
+++ b/src/js/store/modules/filter/actions.js
@@ -145,6 +145,54 @@ export const updateFilteTypes = ( { commit }, filterTypes) => {
commit('setFilterTypes', filterTypes);
};
+// REPOSITORY COLLECTION FILTERS - MULTIPLE COLLECTIONS ------------------------
+export const fetchRepositoryCollectionFilters = ({ dispatch, commit } ) => {
+
+ commit('clearRepositoryCollectionFilters');
+
+ return new Promise((resolve, reject) => {
+
+ dispatch('collection/fetchCollectionsForParent', { } ,{ root: true })
+ .then((res) => {
+ let collections = res;
+ if (collections != undefined && collections.length != undefined) {
+
+ let amountOfCollectionsLoaded = 0;
+
+ for (let collection of collections ) {
+
+ let endpoint = '';
+ endpoint = '/collection/' + collection.id + '/filters/?nopaging=1&include_disabled=no';
+
+ axios.tainacan.get(endpoint)
+ .then((resp) => {
+ let repositoryFilters = resp.data.filter((filter) => {
+ return (filter.collection_id == 'default' || filter.collection_id == 'filter_in_repository')
+ });
+ let collectionFilters = resp.data.filter((filter) => {
+ return (filter.collection_id != 'default' && filter.collection_id != 'filter_in_repository')
+ });
+ commit('setRepositoryCollectionFilters', { collectionName: collection.id, repositoryCollectionFilters: collectionFilters });
+ commit('setRepositoryCollectionFilters', { collectionName: undefined, repositoryCollectionFilters: repositoryFilters });
+ amountOfCollectionsLoaded++;
+
+ if (amountOfCollectionsLoaded == collections.length) {
+ resolve();
+ }
+ })
+ .catch((error) => {
+ console.log(error);
+ reject(error);
+ });
+ }
+ }
+ })
+ .error(() => {
+ reject();
+ });
+ });
+};
+
// TAXONOMY FILTERS - MULTIPLE COLLECTIONS ------------------------
export const fetchTaxonomyFilters = ({ dispatch, commit }, taxonomyId ) => {
diff --git a/src/js/store/modules/filter/getters.js b/src/js/store/modules/filter/getters.js
index dad1b62c9..d238ff74e 100644
--- a/src/js/store/modules/filter/getters.js
+++ b/src/js/store/modules/filter/getters.js
@@ -19,6 +19,10 @@ export const getFilterTypes = state => {
return state.filterTypes;
}
+export const getRepositoryCollectionFilters = state => {
+ return state.repositoryCollectionFilters;
+}
+
export const getTaxonomyFilters = state => {
return state.taxonomyFilters;
}
\ No newline at end of file
diff --git a/src/js/store/modules/filter/index.js b/src/js/store/modules/filter/index.js
index c04db4b8f..926829e6f 100644
--- a/src/js/store/modules/filter/index.js
+++ b/src/js/store/modules/filter/index.js
@@ -10,7 +10,8 @@ const state = {
},
filters: [],
filterTypes: [],
- taxonomyFilters: {}
+ taxonomyFilters: {},
+ repositoryCollectionFilters: {}
};
export default {
diff --git a/src/js/store/modules/filter/mutations.js b/src/js/store/modules/filter/mutations.js
index 45b941896..4d2d60355 100644
--- a/src/js/store/modules/filter/mutations.js
+++ b/src/js/store/modules/filter/mutations.js
@@ -36,6 +36,21 @@ export const setFilterTypes = (state, filterTypes) => {
state.filterTypes = filterTypes;
}
+// export const setRepositoryCollectionFilters = (state, repositoryCollectionFilters) => {
+// state.repositoryCollectionFilters = repositoryCollectionFilters;
+// }
+
+export const setRepositoryCollectionFilters = (state, { collectionName, repositoryCollectionFilters }) => {
+ if (collectionName != undefined)
+ Vue.set(state.repositoryCollectionFilters, collectionName, repositoryCollectionFilters);
+ else
+ Vue.set(state.repositoryCollectionFilters, 'repository-filters', repositoryCollectionFilters);
+}
+
+export const clearRepositoryCollectionFilters = (state) => {
+ state.repositoryCollectionFilters = {};
+}
+
export const setTaxonomyFilters = (state, taxonomyFilters) => {
state.taxonomyFilters = taxonomyFilters;
}