Fixes v-model for filter forms and other tweaks for #794.

This commit is contained in:
mateuswetah 2024-01-29 16:49:42 -03:00
parent e9e3370504
commit 6e73f28f24
12 changed files with 37 additions and 43 deletions

View File

@ -5,7 +5,7 @@ module.exports = {
'plugin:vue/vue3-recommended'
],
parserOptions: {
'ecmaVersion': 2018
'ecmaVersion': 2020
},
rules: {
/* Override/add rules settings here, such as: */

View File

@ -204,7 +204,7 @@
<component
:is="form.filter_type_object.form_component"
v-if="(form.filter_type_object && form.filter_type_object.form_component) || form.edit_form == ''"
v-model:value="form.filter_type_options"
v-model="form.filter_type_options"
:errors="formErrors['filter_type_options']"
:filter="form" />
<div
@ -256,6 +256,7 @@ export default {
index: '',
editedFilter: Object,
originalFilter: Object,
isRepositoryLevel: Boolean
},
emits: [
'on-update-saved-state',

View File

@ -95,10 +95,10 @@
export default {
props: {
value: [String, Number, Array]
modelValue: Object
},
emits: [
'input',
'update:model-value',
],
data() {
return {
@ -107,11 +107,11 @@
}
},
created() {
this.step = this.value && this.value.step ? this.value.step : 1;
this.step = this.modelValue && this.modelValue.step ? this.modelValue.step : 1;
},
methods: {
onUpdateStep(value) {
this.$emit('input', { step: value });
onUpdateStep(modelValue) {
this.$emit('update:model-value', { step: modelValue });
},
}
}

View File

@ -11,7 +11,7 @@
<b-field>
<b-checkbox
v-model="showIntervalOnTag"
@update:model-value="onUpdateShowIntervalOnTag()">
@update:model-value="onUpdateShowIntervalOnTag">
{{ $i18n.get('info_show_interval_on_tag') }}
</b-checkbox>
</b-field>
@ -89,12 +89,12 @@
export default {
props: {
filter: Object,
value: [String, Number, Array],
modelValue: Object,
id: '',
disabled: false,
},
emits: [
'input',
'update:model-value',
],
data() {
return {
@ -105,14 +105,14 @@
},
created() {
this.intervals =
this.value && this.value.intervals && this.value.intervals.length > 0 ?
this.value.intervals :
this.modelValue && this.modelValue.intervals && this.modelValue.intervals.length > 0 ?
this.modelValue.intervals :
[{
label: '',
to: null,
from: null
}];
this.showIntervalOnTag = this.value && this.value.showIntervalOnTag != undefined ? this.value.showIntervalOnTag : true;
this.showIntervalOnTag = this.modelValue && this.modelValue.showIntervalOnTag != undefined ? this.modelValue.showIntervalOnTag : true;
},
methods: {
onUpdate: _.debounce( function(interval, validade) {
@ -127,7 +127,7 @@
this.showErrorMessage()
} else {
this.isValid = true;
this.$emit('input', {
this.$emit('update:model-value', {
intervals: this.intervals,
showIntervalOnTag: this.showIntervalOnTag
});
@ -135,7 +135,7 @@
}, 600),
onUpdateShowIntervalOnTag() {
if (this.isValid) {
this.$emit('input', {
this.$emit('update:model-value', {
intervals: this.intervals,
showIntervalOnTag: this.showIntervalOnTag
});

View File

@ -94,10 +94,10 @@
export default {
props: {
value: [String, Number, Array]
modelValue: Object
},
emits: [
'input',
'update:model-value',
],
data() {
return {
@ -106,11 +106,11 @@
}
},
created() {
this.step = this.value && this.value.step ? this.value.step : 1;
this.step = this.modelValue && this.modelValue.step ? this.modelValue.step : 1;
},
methods: {
onUpdateStep(value) {
this.$emit('input', { step: value });
onUpdateStep(modelValue) {
this.$emit('update:model-value', { step: modelValue });
}
}
}

View File

@ -618,7 +618,7 @@
FileItem
},
props: {
activityId: String
activityId: Number
},
emits: [
'approveActivity',

View File

@ -319,7 +319,7 @@
name: "BulkEditionModal",
props: {
modalTitle: String,
totalItems: Array,
totalItems: Number,
objectType: String,
selectedForBulk: Object,
collectionId: [String, Number]

View File

@ -77,7 +77,7 @@
<div v-else>
<b-loading
v-model="isLoading"
is-full-page="false" />
:is-full-page="false" />
</div>
<div class="field is-grouped form-submit">
<div class="control">

View File

@ -92,7 +92,7 @@
<div class="pagination">
<b-pagination
v-model="page"
:model-value="page"
aria-controls="items-list-results"
:total="totalItems"
order="is-centered"

View File

@ -207,8 +207,6 @@ export default {
app.config.globalProperties.$store.dispatch('search/setPostQuery', app.config.globalProperties.$route.query);
},
loadItems() {
console.log('loadItems')
console.log(JSON.parse(JSON.stringify(app.config.globalProperties.$store.getters['search/getPostQuery'])))
// Forces fetch_only to be filled before any search happens
if (app.config.globalProperties.$store.getters['search/getPostQuery']['fetch_only'] != undefined) {
@ -216,7 +214,7 @@ export default {
// Cancels previous Request
if (this.searchCancel != undefined)
this.searchCancel.cancel('Item search Canceled.');
console.log('fetching')
app.config.globalProperties.$store.dispatch('collection/fetchItems', {
'collectionId': this.collectionId,
'isOnTheme': app.config.globalProperties.$route.meta && app.config.globalProperties.$route.meta.isOnTheme,
@ -269,13 +267,12 @@ export default {
});
emitter.on('closeAdvancedSearch', () => {
app.config.globalProperties.$eventBusSearch.$store.dispatch('search/setPage', 1);
app.config.globalProperties.$store.dispatch('search/setPage', 1);
app.config.globalProperties.$eventBusSearch.performAdvancedSearch({});
});
emitter.on('performAdvancedSearch', advancedSearchQuery => {
app.config.globalProperties.$eventBusSearch.$store.dispatch('search/setPage', 1);
app.config.globalProperties.$store.dispatch('search/setPage', 1);
app.config.globalProperties.$eventBusSearch.performAdvancedSearch(advancedSearchQuery);
app.config.globalProperties.$eventBusSearch.updateURLQueries();

View File

@ -212,6 +212,7 @@
<transition name="form-collapse">
<b-field v-if="openedFilterId == filter.id">
<filter-edition-form
:is-repository-level="isRepositoryLevel"
:index="index"
:original-filter="filter"
:edited-filter="editForms[openedFilterId]"
@ -652,7 +653,6 @@ export default {
this.allowedFilterTypes = [];
this.selectedFilterType = {};
for (let filter of this.filterTypes) {
for (let supportedType of filter['supported_types']) {
if (choosenMetadatum.metadata_type_object.primitive_type == supportedType)

View File

@ -563,9 +563,9 @@
:is-repository-level="isRepositoryLevel" />
<!-- FILTERS TAG LIST-->
<filters-tags-list
v-if="hasFiltered && !openAdvancedSearch"
class="filter-tags-list" />
<template v-if="hasFiltered && !openAdvancedSearch">
<filters-tags-list class="filter-tags-list" />
</template>
<!-- ITEMS LISTING RESULTS ------------------------- -->
<div
@ -704,13 +704,9 @@
</template>
<script>
import { nextTick } from 'vue';
import { nextTick, defineAsyncComponent } from 'vue';
import ItemsList from '../../components/lists/items-list.vue';
import FiltersTagsList from '../../components/search/filters-tags-list.vue';
import FiltersItemsList from '../../components/search/filters-items-list.vue';
import ItemsStatusTabs from '../../components/other/items-status-tabs.vue';
import ItemsPagination from '../../components/search/items-pagination.vue'
import AdvancedSearch from '../../components/search/advanced-search.vue';
import AvailableImportersModal from '../../components/modals/available-importers-modal.vue';
import ExposersModal from '../../components/modals/exposers-modal.vue';
import CollectionsModal from '../../components/modals/collections-modal.vue';
@ -721,11 +717,11 @@
name: 'ItemsPage',
components: {
ItemsList,
FiltersTagsList,
FiltersItemsList,
ItemsStatusTabs,
FiltersTagsList: defineAsyncComponent(() => import('../../components/search/filters-tags-list.vue')),
FiltersItemsList: defineAsyncComponent(() => import('../../components/search/filters-items-list.vue')),
ItemsStatusTabs: defineAsyncComponent(() => import('../../components/other/items-status-tabs.vue')),
ItemsPagination,
AdvancedSearch
AdvancedSearch: defineAsyncComponent(() => import('../../components/search/advanced-search.vue'))
},
props: {
collectionId: [String, Number]