Browse Source

fix: allow owner or creator to alter view type

pull/9807/head
Pranav C 2 weeks ago
parent
commit
b037f4bdbe
  1. 88
      packages/nc-gui/components/smartsheet/toolbar/ViewActionMenu.vue

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

@ -298,60 +298,58 @@ const isDefaultView = computed(() => view.value?.is_default)
<template v-if="isUIAllowed('viewCreateOrEdit')"> <template v-if="isUIAllowed('viewCreateOrEdit')">
<NcDivider /> <NcDivider />
<SmartsheetToolbarNotAllowedTooltip <NcSubMenu
v-if="isEeUI" key="lock-type"
:enabled="!isViewOwner && view.lock_type === LockType.Personal" :disabled="!isViewOwner && !isUIAllowed('reAssignViewOwner') && view.lock_type === LockType.Personal"
message="Only view owner can change personal view" class="scrollbar-thin-dull max-h-90vh overflow-auto !py-0"
> >
<NcSubMenu <template #title>
key="lock-type" <div
:disabled="!isViewOwner && view.lock_type === LockType.Personal" v-e="[
class="scrollbar-thin-dull max-h-90vh overflow-auto !py-0" 'c:navdraw:preview-as',
> {
<template #title> sidebar: props.inSidebar,
<div },
v-e="[ ]"
'c:navdraw:preview-as', class="flex flex-row items-center gap-x-3"
{ >
sidebar: props.inSidebar, <div>
}, {{ $t('labels.viewMode') }}
]"
class="flex flex-row items-center gap-x-3"
>
<div :class="{ 'text-gray-400': !isViewOwner && view.lock_type === LockType.Personal }">
{{ $t('labels.viewMode') }}
</div>
<div class="nc-base-menu-item flex !flex-shrink group !py-1 !px-1 rounded-md bg-brand-50">
<LazySmartsheetToolbarLockType
:type="lockType"
:disabled="!isViewOwner && view.lock_type === LockType.Personal"
class="flex nc-view-actions-lock-type !text-brand-500 !flex-shrink"
hide-tick
/>
</div>
<div class="flex flex-grow"></div>
</div> </div>
</template> <div class="nc-base-menu-item flex !flex-shrink group !py-1 !px-1 rounded-md bg-brand-50">
<LazySmartsheetToolbarLockType
<template #expandIcon></template> :type="lockType"
<div class="flex py-3 px-4 font-bold uppercase text-xs text-gray-500">{{ $t('labels.viewMode') }}</div> class="flex nc-view-actions-lock-type !text-brand-500 !flex-shrink"
<a-menu-item class="!mx-1 !py-2 !rounded-md nc-view-action-lock-subaction max-w-[100px]"> hide-tick
<LazySmartsheetToolbarLockType :type="LockType.Collaborative" @click="changeLockType(LockType.Collaborative)" /> />
</a-menu-item> </div>
<div class="flex flex-grow"></div>
</div>
</template>
<template #expandIcon></template>
<div class="flex py-3 px-4 font-bold uppercase text-xs text-gray-500">{{ $t('labels.viewMode') }}</div>
<a-menu-item class="!mx-1 !py-2 !rounded-md nc-view-action-lock-subaction max-w-[100px]">
<LazySmartsheetToolbarLockType :type="LockType.Collaborative" @click="changeLockType(LockType.Collaborative)" />
</a-menu-item>
<SmartsheetToolbarNotAllowedTooltip
v-if="isEeUI && !isDefaultView"
:enabled="!isViewOwner"
message="Only view owner can change to personal view"
>
<a-menu-item <a-menu-item
v-if="isViewOwner && !isDefaultView" :disabled="!isViewOwner"
class="!mx-1 !py-2 !rounded-md nc-view-action-lock-subaction max-w-[100px]" class="!mx-1 !py-2 !rounded-md nc-view-action-lock-subaction max-w-[100px]"
@click="changeLockType(LockType.Personal)" @click="changeLockType(LockType.Personal)"
> >
<LazySmartsheetToolbarLockType :type="LockType.Personal" /> <LazySmartsheetToolbarLockType :type="LockType.Personal" />
</a-menu-item> </a-menu-item>
</SmartsheetToolbarNotAllowedTooltip>
<a-menu-item class="!mx-1 !py-2 !rounded-md nc-view-action-lock-subaction"> <a-menu-item class="!mx-1 !py-2 !rounded-md nc-view-action-lock-subaction">
<LazySmartsheetToolbarLockType :type="LockType.Locked" @click="changeLockType(LockType.Locked)" /> <LazySmartsheetToolbarLockType :type="LockType.Locked" @click="changeLockType(LockType.Locked)" />
</a-menu-item> </a-menu-item>
</NcSubMenu> </NcSubMenu>
</SmartsheetToolbarNotAllowedTooltip>
<SmartsheetToolbarNotAllowedTooltip <SmartsheetToolbarNotAllowedTooltip
v-if="isEeUI && !isDefaultView" v-if="isEeUI && !isDefaultView"
:enabled="!(isViewOwner || isUIAllowed('reAssignViewOwner'))" :enabled="!(isViewOwner || isUIAllowed('reAssignViewOwner'))"

Loading…
Cancel
Save