Browse Source

fix: Disabled view rename if view is locked

pull/7067/head
Muhammed Mustafa 12 months ago
parent
commit
401c840870
  1. 17
      packages/nc-gui/components/smartsheet/toolbar/ViewActionMenu.vue

17
packages/nc-gui/components/smartsheet/toolbar/ViewActionMenu.vue

@ -26,7 +26,7 @@ const view = computed(() => props.view)
const table = computed(() => props.table)
const { viewsByTable, isActiveViewLocked: isLocked } = storeToRefs(useViewsStore())
const { viewsByTable } = storeToRefs(useViewsStore())
const { loadViews, navigateToView } = useViewsStore()
const { base } = storeToRefs(useBase())
@ -56,7 +56,7 @@ const quickImportDialogs: Record<(typeof quickImportDialogTypes)[number], Ref<bo
) as Record<QuickImportDialogType, Ref<boolean>>
const onImportClick = (dialog: any) => {
if (isLocked.value) return
if (lockType.value === LockType.Locked) return
emits('closeModal')
dialog.value = true
@ -161,10 +161,17 @@ const onDelete = async () => {
</NcTooltip>
<NcDivider />
<template v-if="!view?.is_default">
<NcMenuItem @click="onRenameMenuClick">
<NcMenuItem v-if="lockType !== LockType.Locked" @click="onRenameMenuClick">
<GeneralIcon icon="edit" />
{{ $t('activity.renameView') }}
</NcMenuItem>
<NcTooltip v-else>
<template #title> {{ $t('msg.info.disabledAsViewLocked') }} </template>
<NcMenuItem class="!cursor-not-allowed !text-gray-400">
<GeneralIcon icon="edit" />
{{ $t('activity.renameView') }}
</NcMenuItem>
</NcTooltip>
<NcMenuItem @click="onDuplicate">
<GeneralIcon icon="duplicate" class="nc-view-copy-icon" />
{{ $t('labels.duplicateView') }}
@ -203,7 +210,7 @@ const onDelete = async () => {
},
]"
class="nc-base-menu-item"
:class="{ disabled: isLocked }"
:class="{ disabled: lockType === LockType.Locked }"
>
<component :is="iconMap.upload" />
{{ `${$t('general.upload')} ${type.toUpperCase()}` }}
@ -272,7 +279,7 @@ const onDelete = async () => {
</NcSubMenu>
<template v-if="!view.is_default">
<NcDivider />
<NcTooltip v-if="isLocked">
<NcTooltip v-if="lockType === LockType.Locked">
<template #title> {{ $t('msg.info.disabledAsViewLocked') }} </template>
<NcMenuItem class="!cursor-not-allowed !text-gray-400">
<GeneralIcon icon="delete" class="nc-view-delete-icon" />

Loading…
Cancel
Save