refactor: enhance access control and visibility logic across various components
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 6s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 6s
This commit is contained in:
parent
a59e0c5157
commit
c481266654
8 changed files with 43 additions and 30 deletions
|
|
@ -14,7 +14,7 @@ import { FloatingActionButton, PaginationComponent } from 'src/components';
|
|||
import PaginationPageSize from 'src/components/PaginationPageSize.vue';
|
||||
import PropertyDialog from './PropertyDialog.vue';
|
||||
import { Property } from 'src/stores/property/types';
|
||||
import { dialog, toCamelCase } from 'src/stores/utils';
|
||||
import { dialog, toCamelCase, canAccess } from 'src/stores/utils';
|
||||
import CreateButton from 'src/components/AddButton.vue';
|
||||
import useOptionStore from 'stores/options';
|
||||
import AdvanceSearch from 'src/components/shared/AdvanceSearch.vue';
|
||||
|
|
@ -331,6 +331,7 @@ watch(
|
|||
</script>
|
||||
<template>
|
||||
<FloatingActionButton
|
||||
v-if="canAccess('workflow', 'edit')"
|
||||
style="z-index: 999"
|
||||
hide-icon
|
||||
@click="triggerDialog('add')"
|
||||
|
|
@ -536,11 +537,19 @@ watch(
|
|||
class="col surface-2 flex items-center justify-center"
|
||||
>
|
||||
<NoData
|
||||
v-if="pageState.total !== 0 || pageState.searchDate.length > 0"
|
||||
v-if="
|
||||
pageState.total !== 0 ||
|
||||
pageState.searchDate.length > 0 ||
|
||||
!canAccess('workflow', 'edit')
|
||||
"
|
||||
:not-found="!!pageState.inputSearch"
|
||||
/>
|
||||
<CreateButton
|
||||
v-if="pageState.total === 0 && pageState.searchDate.length === 0"
|
||||
v-if="
|
||||
pageState.total === 0 &&
|
||||
pageState.searchDate.length === 0 &&
|
||||
canAccess('workflow', 'edit')
|
||||
"
|
||||
@click="triggerDialog('add')"
|
||||
label="general.add"
|
||||
:i18n-args="{ text: $t('flow.title') }"
|
||||
|
|
@ -698,6 +707,7 @@ watch(
|
|||
"
|
||||
/>
|
||||
<KebabAction
|
||||
v-if="canAccess('workflow', 'edit')"
|
||||
:id-name="props.row.name"
|
||||
:status="props.row.status"
|
||||
@view="
|
||||
|
|
@ -815,6 +825,7 @@ watch(
|
|||
"
|
||||
/>
|
||||
<KebabAction
|
||||
v-if="canAccess('workflow', 'edit')"
|
||||
:id-name="props.row.id"
|
||||
:status="props.row.status"
|
||||
@view="
|
||||
|
|
@ -906,6 +917,7 @@ watch(
|
|||
@drawer-undo="() => undo()"
|
||||
@close="() => resetForm()"
|
||||
@submit="() => submit()"
|
||||
:hide-action="!canAccess('workflow', 'edit')"
|
||||
:readonly="!pageState.isDrawerEdit"
|
||||
:isEdit="pageState.isDrawerEdit"
|
||||
v-model="pageState.addModal"
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ withDefaults(
|
|||
defineProps<{
|
||||
readonly?: boolean;
|
||||
isEdit?: boolean;
|
||||
hideAction?: boolean;
|
||||
}>(),
|
||||
{ readonly: false, isEdit: false },
|
||||
);
|
||||
|
|
@ -151,7 +152,7 @@ defineEmits<{
|
|||
style="position: absolute; z-index: 999; top: 0; right: 0"
|
||||
>
|
||||
<div
|
||||
v-if="propertyData.status !== 'INACTIVE'"
|
||||
v-if="propertyData.status !== 'INACTIVE' && !hideAction"
|
||||
class="surface-1 row rounded"
|
||||
>
|
||||
<UndoButton
|
||||
|
|
@ -236,6 +237,7 @@ defineEmits<{
|
|||
<FormProperty
|
||||
onDrawer
|
||||
:readonly="!isEdit"
|
||||
:disable-toggle="hideAction"
|
||||
v-model:name="formProperty.name"
|
||||
v-model:name-en="formProperty.nameEN"
|
||||
v-model:type="formProperty.type"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue