Removes repository level filters from filter list.

This commit is contained in:
Mateus Machado Luna 2018-11-14 11:43:50 -02:00
parent f6f3898373
commit bb7328add9
3 changed files with 18 additions and 11 deletions

View File

@ -62,8 +62,9 @@
watch: {
taxonomyFilters() {
if (this.taxonomyFilters != undefined) {
this.$set(this.taxonomyFiltersCollectionNames, 'repository-filters', this.$i18n.get('title_repository_filters_page'));
for (let taxonomyFilter of Object.keys(this.taxonomyFilters)) {
if (taxonomyFilter != 'repository-filters') {
this.fetchCollectionName(taxonomyFilter)
.then((collectionName) => {
this.$set(this.taxonomyFiltersCollectionNames, taxonomyFilter, collectionName);
@ -71,6 +72,7 @@
}
}
}
}
},
methods: {
...mapGetters('search',[

View File

@ -165,8 +165,10 @@ export const fetchTaxonomyFilters = ({ dispatch, commit }, taxonomyId ) => {
axios.tainacan.get(endpoint)
.then((resp) => {
let filters = resp.data;
commit('setTaxonomyFiltersForCollection', { collectionName: collectionId, taxonomyFilters: filters });
let repositoryFilters = resp.data.filter((filter) => filter.collection_id == 'default' || filter.collection_id == 'filter_in_repository');
let collectionFilters = resp.data.filter((filter) => filter.collection_id != 'default' && filter.collection_id != 'filter_in_repository');
commit('setTaxonomyFiltersForCollection', { collectionName: undefined, taxonomyFilters: repositoryFilters });
commit('setTaxonomyFiltersForCollection', { collectionName: collectionId, taxonomyFilters: collectionFilters });
amountOfCollectionsLoaded++;
if (amountOfCollectionsLoaded == taxonomy.collections_ids.length) {

View File

@ -41,7 +41,10 @@ export const setTaxonomyFilters = (state, taxonomyFilters) => {
}
export const setTaxonomyFiltersForCollection = (state, { collectionName, taxonomyFilters }) => {
if (collectionName != undefined)
Vue.set(state.taxonomyFilters, collectionName, taxonomyFilters);
else
Vue.set(state.taxonomyFilters, 'repository-filters', taxonomyFilters);
}
export const clearTaxonomyFilters = (state) => {