From 92e147355fea8b083948f544daf608fc8db8734c Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 24 Oct 2024 15:13:05 +0200 Subject: [PATCH] fix: better performance --- src/components/VnTable/VnTable.vue | 7 ++++--- src/pages/Account/AccountAcls.vue | 28 +++++++++++++++++++++++++--- src/pages/Account/AccountFilter.vue | 1 + 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 908157610..c1680bf13 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -151,8 +151,8 @@ const tableModes = [ }, ]; onBeforeMount(() => { - setUserParams(route.query[$props.searchUrl]); - hasParams.value = params.value && Object.keys(params.value).length !== 0; + const urlParams = route.query[$props.searchUrl]; + hasParams.value = urlParams && Object.keys(urlParams).length !== 0; }); onMounted(() => { @@ -185,7 +185,8 @@ watch( watch( () => route.query[$props.searchUrl], - (val) => setUserParams(val) + (val) => setUserParams(val), + { immediate: true, deep: true } ); const isTableMode = computed(() => mode.value == TABLE_MODE); diff --git a/src/pages/Account/AccountAcls.vue b/src/pages/Account/AccountAcls.vue index dd93a0cb5..63cdac9c7 100644 --- a/src/pages/Account/AccountAcls.vue +++ b/src/pages/Account/AccountAcls.vue @@ -9,6 +9,8 @@ import { useQuasar } from 'quasar'; import VnTable from 'components/VnTable/VnTable.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnConfirm from 'components/ui/VnConfirm.vue'; +import FetchData from 'src/components/FetchData.vue'; +import { useValidator } from 'src/composables/useValidator'; defineProps({ id: { @@ -23,11 +25,18 @@ const stateStore = useStateStore(); const quasar = useQuasar(); const tableRef = ref(); - +const roles = ref(); +const validationsStore = useValidator(); +const { models } = validationsStore; const exprBuilder = (param, value) => { switch (param) { case 'search': - return { model: { like: `%${value}%` } }; + return { + or: [ + { model: { like: `%${value}%` } }, + { property: { like: `%${value}%` } }, + ], + }; default: return { [param]: value }; } @@ -47,6 +56,13 @@ const columns = computed(() => [ label: t('model'), cardVisible: true, create: true, + columnCreate: { + label: t('model'), + component: 'select', + attrs: { + options: Object.keys(models), + }, + }, }, { align: 'left', @@ -55,9 +71,10 @@ const columns = computed(() => [ cardVisible: true, component: 'select', attrs: { - url: 'VnRoles', + options: roles, optionLabel: 'name', optionValue: 'name', + inputDebounce: 0, }, create: true, }, @@ -130,6 +147,11 @@ const deleteAcl = async ({ id }) => { /> +