Fixes filters due to changes on Draggable library and other tweaks for #794.

This commit is contained in:
mateuswetah 2024-01-30 16:42:46 -03:00
parent e963a9acd3
commit 95d58e5055
4 changed files with 25 additions and 6 deletions

View File

@ -56,7 +56,7 @@
export default { export default {
name: 'AvailableExportersModal', name: 'AvailableExportersModal',
props: { props: {
sourceCollection: String, sourceCollection: [Number,String],
hideWhenManualCollection: false hideWhenManualCollection: false
}, },
emits: [ emits: [

View File

@ -66,7 +66,7 @@ export const sendFilter = ( { commit }, { collectionId, metadatumId, name, filte
}) })
.then( res => { .then( res => {
let filter = res.data; let filter = res.data;
commit('setSingleFilter', { filter: filter , index: newIndex}); commit('addSingleFilter', { filter: filter , index: newIndex});
resolve( filter ); resolve( filter );
}) })
.catch(error => { .catch(error => {
@ -92,8 +92,8 @@ export const updateFilter = ( { commit }, { filterId, index, options }) => {
commit('setSingleFilter', { filter: filter, index: index }); commit('setSingleFilter', { filter: filter, index: index });
resolve( filter ); resolve( filter );
}) })
.catch(error => { .catch( (error) => {
console.log(error); console.log(JSON.parse(JSON.stringify(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 });
}); });
}); });

View File

@ -20,6 +20,10 @@ export const setSingleFilter = (state, { filter, index}) => {
Object.assign(state.filters, { [index]: filter }); Object.assign(state.filters, { [index]: filter });
} }
export const addSingleFilter = (state, { filter, index}) => {
state.filters.splice( index, 0, filter );
}
export const setFilters = (state, filters) => { export const setFilters = (state, filters) => {
state.filters = filters; state.filters = filters;
} }

View File

@ -310,6 +310,17 @@
style="font-size: 0.875em;"> style="font-size: 0.875em;">
<em>{{ '(' + $i18n.get('info_child_of') + ' ' + metadatum.parent_name + ')' }}</em> <em>{{ '(' + $i18n.get('info_child_of') + ' ' + metadatum.parent_name + ')' }}</em>
</span> </span>
<span
v-if="metadatum.status === 'private'"
v-tooltip="{
content: $i18n.get('status_private'),
autoHide: true,
popperClass: ['tainacan-tooltip', 'tooltip'],
placement: 'auto-start'
}"
class="icon">
<i class="tainacan-icon tainacan-icon-private" />
</span>
</span> </span>
<span <span
v-tooltip="{ v-tooltip="{
@ -767,7 +778,7 @@ export default {
}) })
.then((filter) => { .then((filter) => {
if (!this.isRepositoryLevel) if ( !this.isRepositoryLevel )
this.updateFiltersOrder(); this.updateFiltersOrder();
this.newFilterIndex = 0; this.newFilterIndex = 0;
@ -815,7 +826,7 @@ export default {
}, },
toggleFilterEdition(filterId) { toggleFilterEdition(filterId) {
// Closing collapse // Closing collapse
if (this.openedFilterId == filterId) { if ( this.openedFilterId == filterId ) {
this.openedFilterId = ''; this.openedFilterId = '';
this.$router.push({ query: {}}); this.$router.push({ query: {}});
@ -1173,6 +1184,10 @@ export default {
} }
} }
.available-metadatum-item:not(.sortable-ghost):not(.disabled-metadatum) {
display: none;
visibility: hidden;
}
.sortable-ghost { .sortable-ghost {
border: 1px dashed var(--tainacan-gray2); border: 1px dashed var(--tainacan-gray2);
background: var(--tainacan-white); background: var(--tainacan-white);