From 80a19d68dbca17c8cbb7cc9684d41b18dd904cb6 Mon Sep 17 00:00:00 2001 From: Mateus Machado Luna Date: Mon, 7 May 2018 15:06:34 -0300 Subject: [PATCH] Continue implementation of fetch_only for items page. --- src/admin/pages/lists/items-page.vue | 5 ++--- src/js/event-bus-search.js | 2 +- src/js/store/modules/search/actions.js | 1 + src/js/store/modules/search/getters.js | 5 ----- src/js/store/modules/search/mutations.js | 22 ---------------------- 5 files changed, 4 insertions(+), 31 deletions(-) diff --git a/src/admin/pages/lists/items-page.vue b/src/admin/pages/lists/items-page.vue index 8ccf1d6e1..7c1b6dc37 100644 --- a/src/admin/pages/lists/items-page.vue +++ b/src/admin/pages/lists/items-page.vue @@ -290,9 +290,8 @@ id: field.id, display: display } - ); - this.$eventBusSearch.addFetchOnlyMeta(field.id); - + ); + this.$eventBusSearch.addFetchOnlyMeta(field.id); } } diff --git a/src/js/event-bus-search.js b/src/js/event-bus-search.js index 70217fbbc..de6c2398d 100644 --- a/src/js/event-bus-search.js +++ b/src/js/event-bus-search.js @@ -57,7 +57,7 @@ export default { } }, addFetchOnlyMeta( field ){ - this.$store.dispatch('search/add_fecthonly_meta', field ); + this.$store.dispatch('search/add_fetchonly_meta', field ); }, getErrors( filter_id ){ let error = this.errors.find( errorItem => errorItem.field_id === filter_id ); diff --git a/src/js/store/modules/search/actions.js b/src/js/store/modules/search/actions.js index d771da0d0..6518046b9 100644 --- a/src/js/store/modules/search/actions.js +++ b/src/js/store/modules/search/actions.js @@ -26,6 +26,7 @@ export const add_fetchonly = ( { commit }, field ) => { }; // Fetch Only for metadata limiting on results export const add_fetchonly_meta = ( { commit }, field ) => { + if( field && field.length === 0 ){ commit('removeFetchOnlyMeta', field ); } else { diff --git a/src/js/store/modules/search/getters.js b/src/js/store/modules/search/getters.js index 01825e0f4..89f1e16f8 100644 --- a/src/js/store/modules/search/getters.js +++ b/src/js/store/modules/search/getters.js @@ -34,11 +34,6 @@ export const getSearchQuery = state => { return state.postquery.search; } -<<<<<<< HEAD export const getStatus = state => { return state.postquery.status; -======= -export const getFecthOnly = state => { - return state.postquery.fetchonly; ->>>>>>> Begins implementation of FetchOnly for displayed fields in item page. } \ No newline at end of file diff --git a/src/js/store/modules/search/mutations.js b/src/js/store/modules/search/mutations.js index 60a451214..3e0958cbf 100644 --- a/src/js/store/modules/search/mutations.js +++ b/src/js/store/modules/search/mutations.js @@ -79,25 +79,8 @@ export const removeTaxQuery = ( state, filter ) => { } }; -<<<<<<< HEAD export const removePostQueryAttribute = ( state, attribute) => { Vue.set( state.postquery, attribute , ''); -======= -export const removeFetchOnly = ( state, field ) => { - let index = state.postquery.fetchonly.findIndex( item => item === field); - if (index >= 0) { - state.postquery.metaquery.splice(index, 1); - } -}; - -export const removeFetchOnlyMeta = ( state, field ) => { - if(state.postquery.fetchonly['meta'] != undefined) { - let index = state.postquery.fetchonly['meta'].findIndex( item => item === field); - if (index >= 0) { - state.postquery.metaquery.splice(index, 1); - } - } ->>>>>>> Begins implementation of FetchOnly for displayed fields in item page. }; export const setTotalItems = ( state, total ) => { @@ -108,11 +91,6 @@ export const setSearchQuery = ( state, searchQuery ) => { state.postquery.search = searchQuery; }; -<<<<<<< HEAD export const setStatus = ( state, status ) => { state.status = status; -======= -export const setSearchQueryMeta = ( state, searchQueryMeta ) => { - state.postquery.search['meta'] = searchQueryMeta; ->>>>>>> Begins implementation of FetchOnly for displayed fields in item page. }; \ No newline at end of file