Begins implementation of FetchOnly for displayed fields in item page.
This commit is contained in:
parent
24a5f41ab6
commit
698e433cdc
|
@ -291,6 +291,8 @@
|
|||
display: display
|
||||
}
|
||||
);
|
||||
this.$eventBusSearch.addFetchOnlyMeta(field.id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,9 @@ export default {
|
|||
this.$store.dispatch('search/add_taxquery', data );
|
||||
}
|
||||
},
|
||||
addFetchOnlyMeta( field ){
|
||||
this.$store.dispatch('search/add_fecthonly_meta', field );
|
||||
},
|
||||
getErrors( filter_id ){
|
||||
let error = this.errors.find( errorItem => errorItem.field_id === filter_id );
|
||||
return ( error ) ? error.errors : false
|
||||
|
|
|
@ -16,6 +16,23 @@ export const add_metaquery = ( { commit }, filter ) => {
|
|||
}
|
||||
};
|
||||
|
||||
// Fetch Only for item attributes limiting on results
|
||||
export const add_fetchonly = ( { commit }, field ) => {
|
||||
if( field && field.length === 0 ){
|
||||
commit('removeFetchOnly', field );
|
||||
} else {
|
||||
commit('addFetchOnly', field );
|
||||
}
|
||||
};
|
||||
// Fetch Only for metadata limiting on results
|
||||
export const add_fetchonly_meta = ( { commit }, field ) => {
|
||||
if( field && field.length === 0 ){
|
||||
commit('removeFetchOnlyMeta', field );
|
||||
} else {
|
||||
commit('addFetchOnlyMeta', field );
|
||||
}
|
||||
};
|
||||
|
||||
// Tax Queries from filters
|
||||
export const add_taxquery = ( { commit }, filter ) => {
|
||||
if( filter && filter.terms.length === 0 ){
|
||||
|
|
|
@ -34,6 +34,11 @@ 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.
|
||||
}
|
|
@ -10,6 +10,9 @@ const state = {
|
|||
perpage: 12,
|
||||
status: '',
|
||||
search: '',
|
||||
fetchonly: [
|
||||
{'meta': [] }
|
||||
],
|
||||
post_type: [],
|
||||
metaquery: [],
|
||||
taxquery: []
|
||||
|
|
|
@ -46,6 +46,25 @@ export const addTaxQuery = ( state, filter ) => {
|
|||
}
|
||||
};
|
||||
|
||||
export const addFetchOnly = ( state, field ) => {
|
||||
state.postquery.fechonly = ( ! state.postquery.fechonly ) ? [{'meta': []}] : state.postquery.fechonly;
|
||||
let index = state.postquery.fechonly.findIndex( item => item === field);
|
||||
if ( index >= 0 ){
|
||||
Vue.set( state.postquery.fechonly, index, field);
|
||||
} else {
|
||||
state.postquery.fechonly.push(field);
|
||||
}
|
||||
};
|
||||
export const addFetchOnlyMeta = ( state, field ) => {
|
||||
state.postquery.fechonly['meta'] = ( ! state.postquery.fechonly['meta'] ) ? [] : state.postquery.fechonly['meta'];
|
||||
let index = state.postquery.fechonly['meta'].findIndex( item => item === field);
|
||||
if ( index >= 0 ){
|
||||
Vue.set( state.postquery.fechonly['meta'], index, field);
|
||||
} else {
|
||||
state.postquery.fechonly['meta'].push(field);
|
||||
}
|
||||
};
|
||||
|
||||
export const removeMetaQuery = ( state, filter ) => {
|
||||
let index = state.postquery.metaquery.findIndex( item => item.key === filter.field_id);
|
||||
if (index >= 0) {
|
||||
|
@ -60,8 +79,25 @@ 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 ) => {
|
||||
|
@ -72,6 +108,11 @@ 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.
|
||||
};
|
Loading…
Reference in New Issue