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' 'plugin:vue/vue3-recommended'
], ],
parserOptions: { parserOptions: {
'ecmaVersion': 2018 'ecmaVersion': 2020
}, },
rules: { rules: {
/* Override/add rules settings here, such as: */ /* Override/add rules settings here, such as: */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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