Begins implementation of Background process store module. Begins implementation of 'last updated at...' info on Item Edition Page. Fixes disabled metadata not being listed at metadata edition page. Fixes error on creating filter. Get's rid of vuex warning when switching metadata and filter enabled state.
This commit is contained in:
parent
48a4828ad9
commit
7ea185248c
|
@ -229,7 +229,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
import { mapActions, mapGetters } from 'vuex';
|
||||||
import MetadatumEditionForm from './../edition/metadatum-edition-form.vue';
|
import MetadatumEditionForm from './../edition/metadatum-edition-form.vue';
|
||||||
import { tainacan as axios } from '../../../js/axios/axios.js';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ImporterEditionForm',
|
name: 'ImporterEditionForm',
|
||||||
|
@ -288,6 +287,9 @@ export default {
|
||||||
...mapActions('collection', [
|
...mapActions('collection', [
|
||||||
'fetchCollectionsForParent'
|
'fetchCollectionsForParent'
|
||||||
]),
|
]),
|
||||||
|
...mapActions('bgprocess', [
|
||||||
|
'fetchProcess'
|
||||||
|
]),
|
||||||
...mapActions('metadata', [
|
...mapActions('metadata', [
|
||||||
'fetchMetadata',
|
'fetchMetadata',
|
||||||
'fetchMetadatumTypes',
|
'fetchMetadatumTypes',
|
||||||
|
@ -296,6 +298,9 @@ export default {
|
||||||
...mapGetters('metadata', [
|
...mapGetters('metadata', [
|
||||||
'getMetadatumTypes'
|
'getMetadatumTypes'
|
||||||
]),
|
]),
|
||||||
|
...mapGetters('bgprocess', [
|
||||||
|
'getProcess'
|
||||||
|
]),
|
||||||
createImporter() {
|
createImporter() {
|
||||||
// Puts loading on Draft Importer creation
|
// Puts loading on Draft Importer creation
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
@ -390,7 +395,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onCheckBackgroundProcessStatus() {
|
onCheckBackgroundProcessStatus() {
|
||||||
axios.get('/bg-processes/' + this.backgroundProcess.bg_process_id)
|
this.fetchProcess(this.backgroundProcess.bg_process_id)
|
||||||
.then((backgroundProcess) => {
|
.then((backgroundProcess) => {
|
||||||
this.$console.log(JSON.stringify(backgroundProcess));
|
this.$console.log(JSON.stringify(backgroundProcess));
|
||||||
})
|
})
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column is-5-5">
|
<div class="column is-5-5">
|
||||||
|
|
||||||
|
<!-- Last Updated Info -->
|
||||||
|
<p>{{ $i18n.get('info_updated_at') + ' ' + lastUpdated }}</p>
|
||||||
|
|
||||||
<!-- Status -------------------------------- -->
|
<!-- Status -------------------------------- -->
|
||||||
<div class="section-label">
|
<div class="section-label">
|
||||||
<label>{{ $i18n.get('label_status') }}</label>
|
<label>{{ $i18n.get('label_status') }}</label>
|
||||||
|
@ -385,6 +388,9 @@ export default {
|
||||||
},
|
},
|
||||||
attachmentsList(){
|
attachmentsList(){
|
||||||
return this.getAttachments();
|
return this.getAttachments();
|
||||||
|
},
|
||||||
|
lastUpdated() {
|
||||||
|
return this.getLastUpdated();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
@ -405,7 +411,8 @@ export default {
|
||||||
]),
|
]),
|
||||||
...mapGetters('item',[
|
...mapGetters('item',[
|
||||||
'getMetadata',
|
'getMetadata',
|
||||||
'getAttachments'
|
'getAttachments',
|
||||||
|
'getLastUpdated'
|
||||||
]),
|
]),
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
// Puts loading on Item edition
|
// Puts loading on Item edition
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
v-if="filter.filter_type != undefined">
|
v-if="filter.filter_type != undefined">
|
||||||
<b-switch
|
<b-switch
|
||||||
size="is-small"
|
size="is-small"
|
||||||
v-model="filter.enabled"
|
:value="filter.enabled"
|
||||||
@input="onChangeEnable($event, index)"/>
|
@input="onChangeEnable($event, index)"/>
|
||||||
<a
|
<a
|
||||||
:style="{ visibility: filter.collection_id != collectionId && !isRepositoryLevel? 'hidden' : 'visible' }"
|
:style="{ visibility: filter.collection_id != collectionId && !isRepositoryLevel? 'hidden' : 'visible' }"
|
||||||
|
@ -294,11 +294,11 @@ export default {
|
||||||
this.availableMetadatumList = availableMetadata;
|
this.availableMetadatumList = availableMetadata;
|
||||||
},
|
},
|
||||||
onChangeEnable($event, index) {
|
onChangeEnable($event, index) {
|
||||||
this.activeFilterList[index].enabled = $event;
|
|
||||||
let filtersOrder = [];
|
let filtersOrder = [];
|
||||||
for (let filter of this.activeFilterList) {
|
for (let filter of this.activeFilterList) {
|
||||||
filtersOrder.push({'id': filter.id, 'enabled': filter.enabled});
|
filtersOrder.push({'id': filter.id, 'enabled': filter.enabled});
|
||||||
}
|
}
|
||||||
|
filtersOrder[index].enabled = $event;
|
||||||
this.updateCollectionFiltersOrder({ collectionId: this.collectionId, filtersOrder: filtersOrder });
|
this.updateCollectionFiltersOrder({ collectionId: this.collectionId, filtersOrder: filtersOrder });
|
||||||
},
|
},
|
||||||
addMetadatumViaButton(metadatumType, metadatumIndex) {
|
addMetadatumViaButton(metadatumType, metadatumIndex) {
|
||||||
|
@ -319,7 +319,7 @@ export default {
|
||||||
|
|
||||||
for (let filter of this.filterTypes) {
|
for (let filter of this.filterTypes) {
|
||||||
for (let supportedType of filter['supported_types']) {
|
for (let supportedType of filter['supported_types']) {
|
||||||
if (choosenMetadatum.metadatum_type_object.primitive_type == supportedType)
|
if (choosenMetadatum.metadata_type_object.primitive_type == supportedType)
|
||||||
this.allowedFilterTypes.push(filter);
|
this.allowedFilterTypes.push(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,7 @@ export default {
|
||||||
this.isLoadingFilterTypes = false;
|
this.isLoadingFilterTypes = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.fetchFilters({collectionId: this.collectionId, isRepositoryLevel: this.isRepositoryLevel, isContextEdit: true, includeDisabled: 'yes' })
|
this.fetchFilters({collectionId: this.collectionId, isRepositoryLevel: this.isRepositoryLevel, isContextEdit: true, includeDisabled: true })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.isLoadingFilters = false;
|
this.isLoadingFilters = false;
|
||||||
// Needs to be done after activeFilterList exists to compare and remove chosen metadata.
|
// Needs to be done after activeFilterList exists to compare and remove chosen metadata.
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
v-if="metadatum.id !== undefined">
|
v-if="metadatum.id !== undefined">
|
||||||
<b-switch
|
<b-switch
|
||||||
size="is-small"
|
size="is-small"
|
||||||
v-model="metadatum.enabled"
|
:value="metadatum.enabled"
|
||||||
@input="onChangeEnable($event, index)"/>
|
@input="onChangeEnable($event, index)"/>
|
||||||
<a
|
<a
|
||||||
:style="{ visibility:
|
:style="{ visibility:
|
||||||
|
@ -245,11 +245,11 @@ export default {
|
||||||
this.updateCollectionMetadataOrder({ collectionId: this.collectionId, metadataOrder: metadataOrder });
|
this.updateCollectionMetadataOrder({ collectionId: this.collectionId, metadataOrder: metadataOrder });
|
||||||
},
|
},
|
||||||
onChangeEnable($event, index) {
|
onChangeEnable($event, index) {
|
||||||
this.activeMetadatumList[index].enabled = $event;
|
|
||||||
let metadataOrder = [];
|
let metadataOrder = [];
|
||||||
for (let metadatum of this.activeMetadatumList) {
|
for (let metadatum of this.activeMetadatumList) {
|
||||||
metadataOrder.push({'id': metadatum.id, 'enabled': metadatum.enabled});
|
metadataOrder.push({'id': metadatum.id, 'enabled': metadatum.enabled});
|
||||||
}
|
}
|
||||||
|
metadataOrder[index].enabled = $event;
|
||||||
this.updateCollectionMetadataOrder({ collectionId: this.collectionId, metadataOrder: metadataOrder });
|
this.updateCollectionMetadataOrder({ collectionId: this.collectionId, metadataOrder: metadataOrder });
|
||||||
},
|
},
|
||||||
addMetadatumViaButton(metadatumType) {
|
addMetadatumViaButton(metadatumType) {
|
||||||
|
@ -336,7 +336,7 @@ export default {
|
||||||
this.collectionId = this.$route.params.collectionId;
|
this.collectionId = this.$route.params.collectionId;
|
||||||
|
|
||||||
|
|
||||||
this.fetchMetadata({collectionId: this.collectionId, isRepositoryLevel: this.isRepositoryLevel, isContextEdit: true})
|
this.fetchMetadata({collectionId: this.collectionId, isRepositoryLevel: this.isRepositoryLevel, isContextEdit: true, includeDisabled: true})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.isLoadingMetadata = false;
|
this.isLoadingMetadata = false;
|
||||||
})
|
})
|
||||||
|
|
|
@ -336,6 +336,7 @@ return apply_filters('tainacan-admin-i18n',[
|
||||||
'info_upload_a_source_to_see_metadata' => __( 'Upload a source file to load metadata.', 'tainacan' ),
|
'info_upload_a_source_to_see_metadata' => __( 'Upload a source file to load metadata.', 'tainacan' ),
|
||||||
'info_select_collection_to_list_metadata' => __( 'Select a target collection to list metadata.', 'tainacan' ),
|
'info_select_collection_to_list_metadata' => __( 'Select a target collection to list metadata.', 'tainacan' ),
|
||||||
'info_url_source_link_helper' => __( 'Link to file containing the data to be imported.', 'tainacan' ),
|
'info_url_source_link_helper' => __( 'Link to file containing the data to be imported.', 'tainacan' ),
|
||||||
|
'info_updated_at' => __( 'Updated at', 'tainacan' ),
|
||||||
|
|
||||||
// Tainacan Metadatum Types
|
// Tainacan Metadatum Types
|
||||||
'tainacan-text' => __( 'Text', 'tainacan' ),
|
'tainacan-text' => __( 'Text', 'tainacan' ),
|
||||||
|
@ -345,6 +346,7 @@ return apply_filters('tainacan-admin-i18n',[
|
||||||
'tainacan-selectbox' => __( 'Select box', 'tainacan' ),
|
'tainacan-selectbox' => __( 'Select box', 'tainacan' ),
|
||||||
'tainacan-relationship' => __( 'Relationship', 'tainacan' ),
|
'tainacan-relationship' => __( 'Relationship', 'tainacan' ),
|
||||||
'tainacan-taxonomy' => __( 'Taxonomy', 'tainacan' ),
|
'tainacan-taxonomy' => __( 'Taxonomy', 'tainacan' ),
|
||||||
|
'tainacan-compound' => __( 'Compound', 'tainacan' ),
|
||||||
|
|
||||||
// Tainacan Filter Types
|
// Tainacan Filter Types
|
||||||
'tainacan-filter-custom-interval' => __( 'Custom Interval', 'tainacan' ),
|
'tainacan-filter-custom-interval' => __( 'Custom Interval', 'tainacan' ),
|
||||||
|
|
|
@ -344,7 +344,7 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
public function get_items( $request ) {
|
public function get_items( $request ) {
|
||||||
$args = $this->prepare_filters( $request );
|
$args = $this->prepare_filters( $request );
|
||||||
|
|
||||||
if ($request['include_disabled'] === 'yes') {
|
if ($request['include_disabled'] === 'true') {
|
||||||
$args['include_disabled'] = true;
|
$args['include_disabled'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
import axios from '../../../axios/axios';
|
||||||
|
|
||||||
|
// Actions related to background processes
|
||||||
|
export const fetchProcesses = ({ commit }) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
axios.tainacan.get(`/bg-processes/`)
|
||||||
|
.then( res => {
|
||||||
|
let processes = res.data;
|
||||||
|
commit('setProcesses', processes);
|
||||||
|
resolve(processes)
|
||||||
|
})
|
||||||
|
.catch( error => {
|
||||||
|
reject(error);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const updateProcess = ({ commit }, { id, status }) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
axios.tainacan.patch(`/bg-processes/${id}/`, {
|
||||||
|
status: status,
|
||||||
|
})
|
||||||
|
.then( res => {
|
||||||
|
let process = res.data;
|
||||||
|
commit('setProcess', process);
|
||||||
|
resolve(process)
|
||||||
|
})
|
||||||
|
.catch( error => {
|
||||||
|
reject(error);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fetchProcess = ({ commit }, id) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
axios.tainacan.get(`/bg-processes/${id}/`)
|
||||||
|
.then( res => {
|
||||||
|
let process = res.data;
|
||||||
|
commit('setProcess', process);
|
||||||
|
resolve(process)
|
||||||
|
})
|
||||||
|
.catch( error => {
|
||||||
|
reject(error);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fetchProcessLog = ({ commit }, { id: id, isFull: isFull }) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
axios.tainacan.get(`/bg-processes/${id}/log`)
|
||||||
|
.then( res => {
|
||||||
|
let log = res.data;
|
||||||
|
commit('setProcessLog', log);
|
||||||
|
resolve(log)
|
||||||
|
})
|
||||||
|
.catch( error => {
|
||||||
|
reject(error);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fetchProcessErrorLog = ({ commit }, { id: id, isFull: isFull }) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
axios.tainacan.get(`/bg-processes/${id}/log`)
|
||||||
|
.then( res => {
|
||||||
|
let errorLog = res.data;
|
||||||
|
commit('setProcessErrorLog', errorLog);
|
||||||
|
resolve(errorLog)
|
||||||
|
})
|
||||||
|
.catch( error => {
|
||||||
|
reject(error);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const cleanProcesses = ({ commit }) => {
|
||||||
|
commit('cleanProcesses');
|
||||||
|
};
|
||||||
|
|
||||||
|
export const deleteProcess = ({ commit }, id) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
axios.tainacan.delete('/bg-process/' + id)
|
||||||
|
.then( res => {
|
||||||
|
commit('deleteProcess', { id: id });
|
||||||
|
resolve( res );
|
||||||
|
}).catch((error) => {
|
||||||
|
reject( error );
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,17 @@
|
||||||
|
export const getProcesses = state => {
|
||||||
|
return state.bg_processes;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getProcess = state => {
|
||||||
|
return state.bg_process;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getErrorLog = state => {
|
||||||
|
return state.error_log;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getLog = state => {
|
||||||
|
return state.log;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import * as actions from './actions';
|
||||||
|
import * as getters from './getters';
|
||||||
|
import * as mutations from './mutations';
|
||||||
|
|
||||||
|
const state = {
|
||||||
|
bg_processes: [],
|
||||||
|
bg_process: {},
|
||||||
|
log: {},
|
||||||
|
error_log: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
namespaced: true,
|
||||||
|
state,
|
||||||
|
mutations,
|
||||||
|
actions,
|
||||||
|
getters
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
import Vue from 'vue';
|
||||||
|
|
||||||
|
export const setProcesses = ( state, processes ) => {
|
||||||
|
state.bg_processes = processes;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const cleanProcesses = ( state ) => {
|
||||||
|
state.bg_processes = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const setProcess = ( state, process ) => {
|
||||||
|
let index = state.bg_processes.findIndex(newProcess => newProcess.id === process.id);
|
||||||
|
if ( index >= 0){
|
||||||
|
Vue.set( state.bg_processes, index, process );
|
||||||
|
} else {
|
||||||
|
state.bg_processes.push( process );
|
||||||
|
}
|
||||||
|
state.bg_process = process;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const setProcessLog = ( state, log ) => {
|
||||||
|
state.log = log;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const setProcessErrorLog = ( state, errorLog ) => {
|
||||||
|
state.error_log = errorLog;
|
||||||
|
}
|
||||||
|
|
|
@ -353,7 +353,7 @@ export const fetchUsers = ({ commit }, { search, exceptions }) => {
|
||||||
|
|
||||||
// Fetch Collections for choosing Parent Collection
|
// Fetch Collections for choosing Parent Collection
|
||||||
export const fetchCollectionsForParent = ({ commit }) => {
|
export const fetchCollectionsForParent = ({ commit }) => {
|
||||||
return new Promise((resolve, reject) =>{
|
return new Promise((resolve, reject) => {
|
||||||
axios.tainacan.get('/collections/?fetch_only[0]=name&fetch_only[1]=id')
|
axios.tainacan.get('/collections/?fetch_only[0]=name&fetch_only[1]=id')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
let collections = res.data;
|
let collections = res.data;
|
||||||
|
|
|
@ -15,8 +15,8 @@ export const fetchFilters = ({ commit }, {collectionId, isRepositoryLevel, isCon
|
||||||
endpoint += '&context=edit';
|
endpoint += '&context=edit';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeDisabled === 'yes'){
|
if (includeDisabled){
|
||||||
endpoint += '&include_disabled=yes'
|
endpoint += '&include_disabled=' + includeDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
axios.tainacan.get(endpoint)
|
axios.tainacan.get(endpoint)
|
||||||
|
|
|
@ -8,6 +8,7 @@ export const sendMetadatum = ( { commit }, { item_id, metadatum_id, values }) =>
|
||||||
})
|
})
|
||||||
.then( res => {
|
.then( res => {
|
||||||
commit('setSingleMetadata', { item_id: item_id, metadatum_id: metadatum_id, values: values });
|
commit('setSingleMetadata', { item_id: item_id, metadatum_id: metadatum_id, values: values });
|
||||||
|
commit('setLastUpdated');
|
||||||
resolve( res.data );
|
resolve( res.data );
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
@ -16,7 +17,6 @@ export const sendMetadatum = ( { commit }, { item_id, metadatum_id, values }) =>
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const updateMetadata = ({ commit }, { item_id, metadatum_id, values }) => {
|
export const updateMetadata = ({ commit }, { item_id, metadatum_id, values }) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios.tainacan.patch(`/item/${item_id}/metadata/${metadatum_id}`, {
|
axios.tainacan.patch(`/item/${item_id}/metadata/${metadatum_id}`, {
|
||||||
|
@ -25,6 +25,7 @@ export const updateMetadata = ({ commit }, { item_id, metadatum_id, values }) =>
|
||||||
.then( res => {
|
.then( res => {
|
||||||
let metadatum = res.data;
|
let metadatum = res.data;
|
||||||
commit('setSingleMetadatum', metadatum);
|
commit('setSingleMetadatum', metadatum);
|
||||||
|
commit('setLastUpdated');
|
||||||
resolve(metadatum)
|
resolve(metadatum)
|
||||||
})
|
})
|
||||||
.catch( error => {
|
.catch( error => {
|
||||||
|
@ -50,6 +51,7 @@ export const fetchMetadata = ({ commit }, item_id) => {
|
||||||
|
|
||||||
export const cleanMetadata = ({ commit }) => {
|
export const cleanMetadata = ({ commit }) => {
|
||||||
commit('cleanMetadata');
|
commit('cleanMetadata');
|
||||||
|
commit('setLastUpdated');
|
||||||
};
|
};
|
||||||
|
|
||||||
// Actions directly related to Item
|
// Actions directly related to Item
|
||||||
|
@ -90,6 +92,7 @@ export const sendItem = ( { commit }, { collection_id, status }) => {
|
||||||
})
|
})
|
||||||
.then( res => {
|
.then( res => {
|
||||||
commit('setItem', res.data);
|
commit('setItem', res.data);
|
||||||
|
commit('setLastUpdated');
|
||||||
resolve( res.data );
|
resolve( res.data );
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
@ -105,6 +108,7 @@ export const updateItem = ({ commit }, { item_id, status }) => {
|
||||||
status: status
|
status: status
|
||||||
}).then( res => {
|
}).then( res => {
|
||||||
commit('setItem', res.data);
|
commit('setItem', res.data);
|
||||||
|
commit('setLastUpdated');
|
||||||
resolve( res.data );
|
resolve( res.data );
|
||||||
}).catch( error => {
|
}).catch( error => {
|
||||||
reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors });
|
reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors });
|
||||||
|
@ -122,6 +126,7 @@ export const updateItemDocument = ({ commit }, { item_id, document, document_typ
|
||||||
let item = res.data;
|
let item = res.data;
|
||||||
|
|
||||||
commit('setItem', item);
|
commit('setItem', item);
|
||||||
|
commit('setLastUpdated');
|
||||||
resolve( res.data );
|
resolve( res.data );
|
||||||
}).catch( error => {
|
}).catch( error => {
|
||||||
reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors });
|
reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors });
|
||||||
|
@ -140,6 +145,7 @@ export const sendAttachment = ( { commit }, { item_id, file }) => {
|
||||||
.then( res => {
|
.then( res => {
|
||||||
let attachment = res.data;
|
let attachment = res.data;
|
||||||
commit('setSingleAttachment', attachment);
|
commit('setSingleAttachment', attachment);
|
||||||
|
commit('setLastUpdated');
|
||||||
resolve( attachment );
|
resolve( attachment );
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
@ -171,6 +177,7 @@ export const updateThumbnail = ({ commit }, { itemId, thumbnailId }) => {
|
||||||
}).then( res => {
|
}).then( res => {
|
||||||
let item = res.data
|
let item = res.data
|
||||||
commit('setItem', item);
|
commit('setItem', item);
|
||||||
|
commit('setLastUpdated');
|
||||||
resolve( item );
|
resolve( item );
|
||||||
}).catch( error => {
|
}).catch( error => {
|
||||||
reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors });
|
reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors });
|
||||||
|
|
|
@ -6,6 +6,10 @@ export const getItem = state => {
|
||||||
return state.item;
|
return state.item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getLastUpdated = state => {
|
||||||
|
return state.lastUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
export const getItemTitle = state => {
|
export const getItemTitle = state => {
|
||||||
return state.itemTitle;
|
return state.itemTitle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,8 @@ const state = {
|
||||||
error: [],
|
error: [],
|
||||||
itemTitle: '',
|
itemTitle: '',
|
||||||
attachment: {},
|
attachment: {},
|
||||||
attachments: []
|
attachments: [],
|
||||||
|
lastUpdated: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,3 +55,10 @@ export const setSingleMetadatum = ( state, metadatum) => {
|
||||||
state.metadata.push( metadatum );
|
state.metadata.push( metadatum );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const setLastUpdated = (state) => {
|
||||||
|
console.log(state.lastUpdated);
|
||||||
|
let now = new Date();
|
||||||
|
state.lastUpdated = now.toLocaleString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import axios from '../../../axios/axios';
|
import axios from '../../../axios/axios';
|
||||||
|
|
||||||
export const fetchMetadata = ({commit}, {collectionId, isRepositoryLevel, isContextEdit}) => {
|
export const fetchMetadata = ({commit}, {collectionId, isRepositoryLevel, isContextEdit, includeDisabled}) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let endpoint = '';
|
let endpoint = '';
|
||||||
if (!isRepositoryLevel)
|
if (!isRepositoryLevel)
|
||||||
|
@ -9,9 +9,13 @@ export const fetchMetadata = ({commit}, {collectionId, isRepositoryLevel, isCont
|
||||||
endpoint = '/metadata/';
|
endpoint = '/metadata/';
|
||||||
|
|
||||||
endpoint += '?nopaging=1';
|
endpoint += '?nopaging=1';
|
||||||
|
|
||||||
if (isContextEdit)
|
if (isContextEdit)
|
||||||
endpoint += '&context=edit';
|
endpoint += '&context=edit';
|
||||||
|
|
||||||
|
if (includeDisabled)
|
||||||
|
endpoint += '&include_disabled=' + includeDisabled;
|
||||||
|
|
||||||
axios.tainacan.get(endpoint)
|
axios.tainacan.get(endpoint)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let metadata = res.data;
|
let metadata = res.data;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import search from './modules/search/';
|
||||||
import taxonomy from './modules/taxonomy/';
|
import taxonomy from './modules/taxonomy/';
|
||||||
import event from './modules/event';
|
import event from './modules/event';
|
||||||
import importer from './modules/importer';
|
import importer from './modules/importer';
|
||||||
|
import bgprocess from './modules/bgprocess';
|
||||||
|
|
||||||
Vue.use(Vuex);
|
Vue.use(Vuex);
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ export default new Vuex.Store({
|
||||||
search,
|
search,
|
||||||
taxonomy,
|
taxonomy,
|
||||||
event,
|
event,
|
||||||
importer
|
importer,
|
||||||
|
bgprocess
|
||||||
}
|
}
|
||||||
})
|
})
|
Loading…
Reference in New Issue