Merge branch 'develop' of https://github.com/tainacan/tainacan into develop
This commit is contained in:
commit
5245bed249
|
@ -17,7 +17,7 @@
|
|||
|
||||
<b-select
|
||||
:loading="metadataIsLoading"
|
||||
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
|
||||
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone, 'hidden-select-arrow': !!bulkEditionProcedures[criterion].metadatumID}"
|
||||
:disabled="!!bulkEditionProcedures[criterion].metadatumID || metadataIsLoading"
|
||||
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-not-last"
|
||||
:placeholder="$i18n.get('instruction_select_a_metadatum')"
|
||||
|
@ -40,7 +40,7 @@
|
|||
</b-select>
|
||||
|
||||
<b-select
|
||||
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
|
||||
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone, 'hidden-select-arrow': !!bulkEditionProcedures[criterion].action }"
|
||||
v-if="bulkEditionProcedures[criterion] &&
|
||||
bulkEditionProcedures[criterion].metadatumID"
|
||||
:disabled="!!bulkEditionProcedures[criterion].action"
|
||||
|
@ -118,7 +118,7 @@
|
|||
v-else-if="bulkEditionProcedures[criterion] &&
|
||||
bulkEditionProcedures[criterion].metadatumID == 'status'">
|
||||
<b-select
|
||||
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
|
||||
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone, 'hidden-select-arrow': bulkEditionProcedures[criterion].isDone}"
|
||||
:disabled="bulkEditionProcedures[criterion].isDone"
|
||||
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-last"
|
||||
:placeholder="$i18n.get('instruction_select_a_status2')"
|
||||
|
@ -370,10 +370,10 @@
|
|||
add: this.$i18n.get('add_value'),
|
||||
redefine: this.$i18n.get('set_new_value'),
|
||||
remove: this.$i18n.get('remove_value'),
|
||||
replace: this.$i18n.get('replace_value'),
|
||||
replace: this.$i18n.get('replace_value')
|
||||
},
|
||||
editionActionsForNotMultiple: {
|
||||
redefine: this.$i18n.get('set_new_value'),
|
||||
redefine: this.$i18n.get('set_new_value')
|
||||
},
|
||||
bulkEditionProcedures: {
|
||||
1: {
|
||||
|
@ -432,7 +432,7 @@
|
|||
let index = this.editionCriteria.indexOf(criterion);
|
||||
|
||||
this.dones[index] = !withError;
|
||||
|
||||
|
||||
this.$set(this.bulkEditionProcedures[criterion], 'isExecuting', false);
|
||||
},
|
||||
executeBulkEditionProcedure(criterion){
|
||||
|
|
|
@ -142,10 +142,12 @@
|
|||
...mapActions('collection', [
|
||||
'fetchCollections'
|
||||
]),
|
||||
updateExporterOptions(){
|
||||
runExporter(){
|
||||
this.runButtonLoading = true;
|
||||
|
||||
let formElement = document.getElementById('exporterOptionsForm');
|
||||
let formData = new FormData(formElement);
|
||||
|
||||
|
||||
let options = {};
|
||||
|
||||
for (let [key, value] of formData.entries())
|
||||
|
@ -153,21 +155,9 @@
|
|||
|
||||
let exporterSessionUpdated = {
|
||||
body: {
|
||||
options: options,
|
||||
},
|
||||
id: this.exporterSession.id,
|
||||
};
|
||||
|
||||
return this.updateExporterSession(exporterSessionUpdated)
|
||||
.then(exporterSessionUpdated => this.verifyError(exporterSessionUpdated));
|
||||
},
|
||||
runExporter(){
|
||||
this.runButtonLoading = true;
|
||||
|
||||
let exporterSessionUpdated = {
|
||||
body: {
|
||||
mapping_selected: this.selectedMapping ? this.selectedMapping : this.selectedMapping,
|
||||
send_email: this.sendEmail
|
||||
mapping_selected: this.selectedMapping,
|
||||
send_email: this.sendEmail,
|
||||
options: options
|
||||
},
|
||||
id: this.exporterSession.id,
|
||||
};
|
||||
|
@ -176,26 +166,28 @@
|
|||
exporterSessionUpdated['body']['collection'] = {
|
||||
id: this.selectedCollection
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
this.updateExporterSession(exporterSessionUpdated)
|
||||
.then(exporterSessionUpdated => {
|
||||
this.verifyError(exporterSessionUpdated);
|
||||
.then(() => {
|
||||
|
||||
if (!this.formErrorMessage) {
|
||||
this.runExporterSession(this.exporterSession.id)
|
||||
.then((bgp) => {
|
||||
this.runButtonLoading = false;
|
||||
this.$router.push(this.$routerHelper.getProcessesPage(bgp.bg_process_id));
|
||||
})
|
||||
.catch((error) => {
|
||||
this.formErrorMessage = error.error_message;
|
||||
this.runButtonLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
this.updateExporterOptions().then(() => {
|
||||
if(!this.formErrorMessage) {
|
||||
this.runExporterSession(this.exporterSession.id)
|
||||
.then((bgp) => {
|
||||
this.runButtonLoading = false;
|
||||
this.$router.push(this.$routerHelper.getProcessesPage(bgp.bg_process_id));
|
||||
})
|
||||
.catch(() => {
|
||||
this.runButtonLoading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => this.runButtonLoading = false);
|
||||
.catch((error) => {
|
||||
this.formErrorMessage = error.error_message;
|
||||
this.runButtonLoading = false;
|
||||
});
|
||||
},
|
||||
formIsValid(){
|
||||
return (
|
||||
|
@ -204,15 +196,6 @@
|
|||
this.exporterSession.accept_no_mapping) &&
|
||||
!this.formErrorMessage
|
||||
);
|
||||
},
|
||||
verifyError(response){
|
||||
if(response.constructor.name === 'Object' &&
|
||||
(response.data && response.data.status &&
|
||||
response.data.status.toString().split('')[0] != 2) || response.error_message) {
|
||||
this.formErrorMessage = response.data.error_message;
|
||||
} else {
|
||||
this.exporterSession = response.data;
|
||||
}
|
||||
}
|
||||
},
|
||||
created(){
|
||||
|
|
|
@ -473,48 +473,6 @@ export default {
|
|||
this.contextMenuCollection = null;
|
||||
this.contextMenuIndex = null;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// COLUMN RESIZE
|
||||
// This feature is not implemented as it would require whitespace
|
||||
// on table cells to be 'wrap' instead of 'no-wrap'. Once the table
|
||||
// needs a scroll, the minimum size for the columns would be reached
|
||||
// text would start to ellipsis, but the column is not resizible anymore.
|
||||
// (function () {
|
||||
// var thElm;
|
||||
// var startOffset;
|
||||
|
||||
// Array.prototype.forEach.call(
|
||||
// document.querySelectorAll("table th"),
|
||||
// function (th) {
|
||||
// th.style.position = 'relative';
|
||||
|
||||
// var grip = document.createElement('div');
|
||||
// grip.innerHTML = " ";
|
||||
// grip.style.top = 0;
|
||||
// grip.style.right = 0;
|
||||
// grip.style.bottom = 0;
|
||||
// grip.style.width = '5px';
|
||||
// grip.style.position = 'absolute';
|
||||
// grip.style.cursor = 'col-resize';
|
||||
// grip.addEventListener('mousedown', function (e) {
|
||||
// thElm = th;
|
||||
// startOffset = th.offsetWidth - e.pageX;
|
||||
// });
|
||||
|
||||
// th.appendChild(grip);
|
||||
// });
|
||||
|
||||
// document.addEventListener('mousemove', function (e) {
|
||||
// if (thElm) {
|
||||
// thElm.style.width = startOffset + e.pageX + 'px';
|
||||
// }
|
||||
// });
|
||||
|
||||
// document.addEventListener('mouseup', function () {
|
||||
// thElm = undefined;
|
||||
// });
|
||||
// })();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -684,12 +684,6 @@ export default {
|
|||
})
|
||||
.catch(() => this.isLoadingFilters = false);
|
||||
|
||||
// On repository level we also fetch collection filters
|
||||
if (this.isRepositoryLevel) {
|
||||
this.fetchRepositoryCollectionFilters()
|
||||
.catch(() => this.isLoadingFilters = false);
|
||||
}
|
||||
|
||||
// Obtains collection name
|
||||
if (!this.isRepositoryLevel) {
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
box-shadow: none !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
&[disabled] {
|
||||
&[disabled=disabled] {
|
||||
background-color: white !important;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,8 +132,14 @@
|
|||
&:focus>option:checked, &:focus>option:hover {
|
||||
background-color: $turquoise1 !important;
|
||||
}
|
||||
}
|
||||
&[disabled=disabled] {
|
||||
border: 1px solid $gray1 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.hidden-select-arrow .select::after {
|
||||
color: transparent !important;
|
||||
}
|
||||
.dropdown {
|
||||
width: 100%;
|
||||
.dropdown-trigger { width: 100% }
|
||||
|
|
|
@ -68,7 +68,7 @@ class REST_Exporters_Controller extends REST_Controller {
|
|||
],
|
||||
'options' => [
|
||||
'type' => 'array/object',
|
||||
'description' => __( 'The importer options', 'tainacan' ),
|
||||
'description' => __( 'The exporter options', 'tainacan' ),
|
||||
]
|
||||
],
|
||||
),
|
||||
|
@ -172,7 +172,7 @@ class REST_Exporters_Controller extends REST_Controller {
|
|||
}
|
||||
|
||||
return new \WP_REST_Response([
|
||||
'error_message' => __('Importer Session not found', 'tainacan' ),
|
||||
'error_message' => __('Exporter Session not found', 'tainacan' ),
|
||||
'session_id' => $session_id
|
||||
], 400);
|
||||
}
|
||||
|
|
|
@ -3,12 +3,6 @@
|
|||
:style="{ 'height': isLoadingOptions ? (Number(filter.max_options)*28) + 'px' : 'auto' }"
|
||||
:class="{ 'skeleton': isLoadingOptions }"
|
||||
class="block">
|
||||
<!-- <span
|
||||
v-if="isLoadingOptions"
|
||||
style="width: 100%; position: absolute;"
|
||||
class="icon has-text-centered loading-icon">
|
||||
<div class="control has-icons-right is-loading is-clearfix" />
|
||||
</span> -->
|
||||
<div
|
||||
v-for="(option, index) in options.slice(0, filter.max_options)"
|
||||
v-if="!isLoadingOptions"
|
||||
|
@ -29,15 +23,6 @@
|
|||
class="has-text-gray"> {{ "(" + option.total_items + ")" }}</span>
|
||||
</span>
|
||||
</label>
|
||||
<!-- <b-checkbox
|
||||
v-if="index <= filter.max_options - 1"
|
||||
v-model="selected"
|
||||
:native-value="option.value">
|
||||
<span class="checkbox-label-text">{{ option.label }}</span>
|
||||
<span
|
||||
v-if="option.total_items != undefined"
|
||||
class="has-text-gray">{{ "(" + option.total_items + ")" }}</span>
|
||||
</b-checkbox> -->
|
||||
<button
|
||||
class="view-all-button link-style"
|
||||
v-if="option.showViewAllButton && index == options.slice(0, filter.max_options).length - 1"
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<template>
|
||||
<b-field
|
||||
class="filter-item-forms"
|
||||
:message="getErrorMessage"
|
||||
:type="filterTypeMessage">
|
||||
class="filter-item-forms">
|
||||
<b-collapse
|
||||
class="show"
|
||||
:open.sync="open"
|
||||
|
@ -48,8 +46,6 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapActions } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'TainacanFilterItem',
|
||||
props: {
|
||||
|
@ -61,33 +57,11 @@
|
|||
data(){
|
||||
return {
|
||||
inputs: [],
|
||||
filterTypeMessage:''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getErrorMessage() {
|
||||
let msg = '';
|
||||
let errors = this.$eventBusSearch.getErrors( this.filter.id );
|
||||
if ( errors) {
|
||||
this.setFilterTypeMessage('is-danger');
|
||||
for (let index in errors) {
|
||||
msg += errors[index] + '\n';
|
||||
}
|
||||
} else {
|
||||
this.setFilterTypeMessage('');
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions('search', [
|
||||
'setPage'
|
||||
]),
|
||||
listen( inputEvent ){
|
||||
this.$eventBusSearch.$emit( 'input', ( inputEvent.metadatum_id ) ? inputEvent : inputEvent.detail[0] );
|
||||
},
|
||||
setFilterTypeMessage( message ){
|
||||
this.filterTypeMessage = message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,8 +123,9 @@
|
|||
</button>
|
||||
<div
|
||||
v-else
|
||||
class="spinner-container">
|
||||
{{ facets.length > 0 ? '' : $root.__('Nothing found.', 'tainacan') }}
|
||||
class="spinner-container"
|
||||
:style="{ display: facets.length > 0 ? 'none' : 'flex'}">
|
||||
{{ $root.__('Nothing found.', 'tainacan') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -217,20 +217,6 @@ export default {
|
|||
this.$store.dispatch('search/remove_fetch_only_meta', metadatum );
|
||||
this.updateURLQueries();
|
||||
},
|
||||
getErrors( filter_id ){
|
||||
let error = this.errors.find( errorItem => errorItem.metadatum_id === filter_id );
|
||||
return ( error ) ? error.errors : false;
|
||||
},
|
||||
// listener(){
|
||||
// const components = this.getAllComponents();
|
||||
// for (let eventElement of components){
|
||||
// eventElement.addEventListener('input', (event) => {
|
||||
// if( event.detail ) {
|
||||
// this.add_metaquery( event.detail[0] );
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
setPage(page) {
|
||||
this.$store.dispatch('search/setPage', page);
|
||||
this.updateURLQueries();
|
||||
|
|
|
@ -3,7 +3,7 @@ import axios from '../../../axios/axios'
|
|||
|
||||
export const fetchActivities = ({ commit }, { page, activitiesPerPage } ) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.tainacan.get(`/logs?paged=${page}&perpage=${activitiesPerPage}&context=edit`)
|
||||
axios.tainacan.get(`/logs?paged=${page}&perpage=${activitiesPerPage}&context=edit&orderby=id&order=desc`)
|
||||
.then(res => {
|
||||
let activities = res.data;
|
||||
|
||||
|
@ -20,7 +20,7 @@ export const fetchActivities = ({ commit }, { page, activitiesPerPage } ) => {
|
|||
|
||||
export const fetchCollectionActivities = ({ commit }, { page, activitiesPerPage, collectionId }) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.tainacan.get(`/collection/${collectionId}/logs?paged=${page}&perpage=${activitiesPerPage}&context=edit`)
|
||||
axios.tainacan.get(`/collection/${collectionId}/logs?paged=${page}&perpage=${activitiesPerPage}&context=edit&orderby=id&order=desc`)
|
||||
.then(res => {
|
||||
let activities = res.data;
|
||||
|
||||
|
@ -37,7 +37,7 @@ export const fetchCollectionActivities = ({ commit }, { page, activitiesPerPage,
|
|||
|
||||
export const fetchItemActivities = ({ commit }, { page, activitiesPerPage, itemId }) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.tainacan.get(`/item/${itemId}/logs?paged=${page}&perpage=${activitiesPerPage}&context=edit`)
|
||||
axios.tainacan.get(`/item/${itemId}/logs?paged=${page}&perpage=${activitiesPerPage}&context=edit&orderby=id&order=desc`)
|
||||
.then(res => {
|
||||
let activities = res.data;
|
||||
|
||||
|
|
|
@ -26,26 +26,28 @@ export const createExporterSession = ({commit}, slug) => {
|
|||
|
||||
export const updateExporterSession = ({commit}, exporterSessionUpdated) => {
|
||||
|
||||
return tainacan.patch(`/exporters/session/${exporterSessionUpdated.id}`, exporterSessionUpdated.body)
|
||||
.then(response => {
|
||||
commit('setExporterSession');
|
||||
|
||||
return response;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error.response.data);
|
||||
});
|
||||
return new Promise(( resolve, reject ) => {
|
||||
tainacan.patch(`/exporters/session/${exporterSessionUpdated.id}`, exporterSessionUpdated.body)
|
||||
.then(response => {
|
||||
commit('setExporterSession');
|
||||
resolve( response.data );
|
||||
})
|
||||
.catch(error => {
|
||||
reject( error.response.data );
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const runExporterSession = ({commit}, exporterSessionID) => {
|
||||
|
||||
return tainacan.post(`/exporters/session/${exporterSessionID}/run`)
|
||||
.then(response => {
|
||||
commit('setBackGroundProcessID', response.data);
|
||||
|
||||
return response.data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error.response.data);
|
||||
})
|
||||
return new Promise(( resolve, reject ) => {
|
||||
tainacan.post(`/exporters/session/${exporterSessionID}/run`)
|
||||
.then(response => {
|
||||
commit('setBackGroundProcessID', response.data);
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(error => {
|
||||
reject( error.response.data );
|
||||
})
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue