Browse Source

refactor(gui): avoid locking treeview operation based on view lock

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3993/head
Pranav C 2 years ago
parent
commit
3ef9115674
  1. 7
      packages/nc-gui/components/dashboard/TreeView.vue
  2. 6
      packages/nc-gui/components/tabs/Smartsheet.vue
  3. 5
      packages/nc-gui/pages/[projectType]/[projectId]/index.vue

7
packages/nc-gui/components/dashboard/TreeView.vue

@ -5,7 +5,6 @@ import GithubButton from 'vue-github-button'
import {
Empty,
computed,
inject,
reactive,
ref,
resolveComponent,
@ -36,8 +35,6 @@ const { isUIAllowed } = useUIPermission()
const [searchActive, toggleSearchActive] = useToggle()
const isLocked = inject('TreeViewIsLockedInj')
let key = $ref(0)
const menuRef = $ref<HTMLLIElement>()
@ -349,7 +346,7 @@ function openTableCreateDialog() {
</div>
<a-dropdown
v-if="!isSharedBase && !isLocked && (isUIAllowed('table-rename') || isUIAllowed('table-delete'))"
v-if="!isSharedBase && (isUIAllowed('table-rename') || isUIAllowed('table-delete'))"
:trigger="['click']"
@click.stop
>
@ -383,7 +380,7 @@ function openTableCreateDialog() {
</div>
</div>
<template v-if="!isLocked && !isSharedBase" #overlay>
<template v-if="!isSharedBase" #overlay>
<a-menu class="!py-0 rounded text-sm">
<template v-if="contextMenuTarget.type === 'table'">
<a-menu-item v-if="isUIAllowed('table-rename')" @click="openRenameTableDialog(contextMenuTarget.value, true)">

6
packages/nc-gui/components/tabs/Smartsheet.vue

@ -12,14 +12,12 @@ import {
TabMetaInj,
computed,
createEventHook,
inject,
provide,
ref,
toRef,
useMetas,
useProvideKanbanViewStore,
useProvideSmartsheetStore,
watch,
} from '#imports'
import type { TabItem } from '~/lib'
@ -57,10 +55,6 @@ provide(OpenNewRecordFormHookInj, openNewRecordFormHook)
provide(FieldsInj, fields)
provide(IsFormInj, isForm)
provide(TabMetaInj, activeTab)
const treeViewIsLockedInj = inject('TreeViewIsLockedInj', ref(false))
watch(isLocked, (nextValue) => (treeViewIsLockedInj.value = nextValue), { immediate: true })
</script>
<template>

5
packages/nc-gui/pages/[projectType]/[projectId]/index.vue

@ -11,7 +11,6 @@ import {
onMounted,
openLink,
projectThemeColors,
provide,
ref,
useCopy,
useGlobal,
@ -48,10 +47,6 @@ const { isUIAllowed } = useUIPermission()
const { copy } = useCopy()
const isLocked = ref(false)
provide('TreeViewIsLockedInj', isLocked)
// create a new sidebar state
const { isOpen, toggle, toggleHasSidebar } = useSidebar('nc-left-sidebar', { hasSidebar: false, isOpen: false })

Loading…
Cancel
Save