refactor: refs #8197 adapt AccountAcls to VnCardMain
gitea/salix-front/pipeline/pr-master There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2024-12-16 12:27:13 +01:00
parent 0ab12d7b5d
commit 95420e96d1
1 changed files with 31 additions and 29 deletions

View File

@ -1,16 +1,15 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { useStateStore } from 'stores/useStateStore';
import axios from 'axios'; import axios from 'axios';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import { useQuasar } from 'quasar'; 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 VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import { useValidator } from 'src/composables/useValidator'; import { useValidator } from 'src/composables/useValidator';
import VnCardMain from 'src/components/common/VnCardMain.vue';
defineProps({ defineProps({
id: { id: {
@ -21,13 +20,13 @@ defineProps({
const { notify } = useNotify(); const { notify } = useNotify();
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore();
const quasar = useQuasar(); const quasar = useQuasar();
const tableRef = ref(); const tableRef = ref();
const roles = ref(); const roles = ref();
const validationsStore = useValidator(); const validationsStore = useValidator();
const { models } = validationsStore; const { models } = validationsStore;
const dataKey = 'AccountAcls';
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
case 'search': case 'search':
@ -134,39 +133,42 @@ const deleteAcl = async ({ id }) => {
</script> </script>
<template> <template>
<VnSearchbar
data-key="AccountAcls"
url="ACLs"
:expr-builder="exprBuilder"
:label="t('acls.search')"
:info="t('acls.searchInfo')"
/>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
</QDrawer>
<FetchData <FetchData
url="VnRoles?fields=['name']" url="VnRoles?fields=['name']"
auto-load auto-load
@on-fetch="(data) => (roles = data)" @on-fetch="(data) => (roles = data)"
/> />
<VnCardMain
:section="dataKey"
:data-key="dataKey"
:columns="columns"
prefix="acls"
:array-data-props="{
url: 'ACLs',
order: 'id DESC',
exprBuilder,
}"
>
<template #body>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="AccountAcls" data-key="AccountAcls"
:url="`ACLs`"
:create="{ :create="{
urlCreate: 'ACLs', urlCreate: 'ACLs',
title: 'Create ACL', title: 'Create ACL',
onDataSaved: () => tableRef.reload(), onDataSaved: () => tableRef.reload(),
formInitialData: {}, formInitialData: {},
}" }"
order="id DESC"
:disable-option="{ card: true }" :disable-option="{ card: true }"
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
:right-search="true" :right-search="false"
:is-editable="true" :is-editable="true"
:use-model="true" :use-model="true"
/> />
</template> </template>
</VnCardMain>
</template>
<i18n> <i18n>
es: es: