0
0
Fork 0

Compare commits

...

1 Commits

Author SHA1 Message Date
Alex Moreno 92e147355f fix: better performance 2024-10-24 15:13:05 +02:00
3 changed files with 30 additions and 6 deletions

View File

@ -151,8 +151,8 @@ const tableModes = [
}, },
]; ];
onBeforeMount(() => { onBeforeMount(() => {
setUserParams(route.query[$props.searchUrl]); const urlParams = route.query[$props.searchUrl];
hasParams.value = params.value && Object.keys(params.value).length !== 0; hasParams.value = urlParams && Object.keys(urlParams).length !== 0;
}); });
onMounted(() => { onMounted(() => {
@ -185,7 +185,8 @@ watch(
watch( watch(
() => route.query[$props.searchUrl], () => route.query[$props.searchUrl],
(val) => setUserParams(val) (val) => setUserParams(val),
{ immediate: true, deep: true }
); );
const isTableMode = computed(() => mode.value == TABLE_MODE); const isTableMode = computed(() => mode.value == TABLE_MODE);

View File

@ -9,6 +9,8 @@ import { useQuasar } from 'quasar';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
import FetchData from 'src/components/FetchData.vue';
import { useValidator } from 'src/composables/useValidator';
defineProps({ defineProps({
id: { id: {
@ -23,11 +25,18 @@ const stateStore = useStateStore();
const quasar = useQuasar(); const quasar = useQuasar();
const tableRef = ref(); const tableRef = ref();
const roles = ref();
const validationsStore = useValidator();
const { models } = validationsStore;
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
case 'search': case 'search':
return { model: { like: `%${value}%` } }; return {
or: [
{ model: { like: `%${value}%` } },
{ property: { like: `%${value}%` } },
],
};
default: default:
return { [param]: value }; return { [param]: value };
} }
@ -47,6 +56,13 @@ const columns = computed(() => [
label: t('model'), label: t('model'),
cardVisible: true, cardVisible: true,
create: true, create: true,
columnCreate: {
label: t('model'),
component: 'select',
attrs: {
options: Object.keys(models),
},
},
}, },
{ {
align: 'left', align: 'left',
@ -55,9 +71,10 @@ const columns = computed(() => [
cardVisible: true, cardVisible: true,
component: 'select', component: 'select',
attrs: { attrs: {
url: 'VnRoles', options: roles,
optionLabel: 'name', optionLabel: 'name',
optionValue: 'name', optionValue: 'name',
inputDebounce: 0,
}, },
create: true, create: true,
}, },
@ -130,6 +147,11 @@ const deleteAcl = async ({ id }) => {
/> />
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
</QDrawer> </QDrawer>
<FetchData
url="VnRoles?fields=['name']"
auto-load
@on-fetch="(data) => (roles = data)"
/>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="AccountAcls" data-key="AccountAcls"

View File

@ -33,6 +33,7 @@ const rolesOptions = ref([]);
:search-button="true" :search-button="true"
:hidden-tags="['search']" :hidden-tags="['search']"
:redirect="false" :redirect="false"
search-url="table"
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">