Browse Source

Merge pull request #3993 from nocodb/fix/3987-locked-view-bug

Fix: Avoid locking treeview operations based on view lock
pull/3996/head
Pranav C 2 years ago committed by GitHub
parent
commit
fcdf749de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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 { import {
Empty, Empty,
computed, computed,
inject,
reactive, reactive,
ref, ref,
resolveComponent, resolveComponent,
@ -36,8 +35,6 @@ const { isUIAllowed } = useUIPermission()
const [searchActive, toggleSearchActive] = useToggle() const [searchActive, toggleSearchActive] = useToggle()
const isLocked = inject('TreeViewIsLockedInj')
let key = $ref(0) let key = $ref(0)
const menuRef = $ref<HTMLLIElement>() const menuRef = $ref<HTMLLIElement>()
@ -349,7 +346,7 @@ function openTableCreateDialog() {
</div> </div>
<a-dropdown <a-dropdown
v-if="!isSharedBase && !isLocked && (isUIAllowed('table-rename') || isUIAllowed('table-delete'))" v-if="!isSharedBase && (isUIAllowed('table-rename') || isUIAllowed('table-delete'))"
:trigger="['click']" :trigger="['click']"
@click.stop @click.stop
> >
@ -383,7 +380,7 @@ function openTableCreateDialog() {
</div> </div>
</div> </div>
<template v-if="!isLocked && !isSharedBase" #overlay> <template v-if="!isSharedBase" #overlay>
<a-menu class="!py-0 rounded text-sm"> <a-menu class="!py-0 rounded text-sm">
<template v-if="contextMenuTarget.type === 'table'"> <template v-if="contextMenuTarget.type === 'table'">
<a-menu-item v-if="isUIAllowed('table-rename')" @click="openRenameTableDialog(contextMenuTarget.value, true)"> <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, TabMetaInj,
computed, computed,
createEventHook, createEventHook,
inject,
provide, provide,
ref, ref,
toRef, toRef,
useMetas, useMetas,
useProvideKanbanViewStore, useProvideKanbanViewStore,
useProvideSmartsheetStore, useProvideSmartsheetStore,
watch,
} from '#imports' } from '#imports'
import type { TabItem } from '~/lib' import type { TabItem } from '~/lib'
@ -57,10 +55,6 @@ provide(OpenNewRecordFormHookInj, openNewRecordFormHook)
provide(FieldsInj, fields) provide(FieldsInj, fields)
provide(IsFormInj, isForm) provide(IsFormInj, isForm)
provide(TabMetaInj, activeTab) provide(TabMetaInj, activeTab)
const treeViewIsLockedInj = inject('TreeViewIsLockedInj', ref(false))
watch(isLocked, (nextValue) => (treeViewIsLockedInj.value = nextValue), { immediate: true })
</script> </script>
<template> <template>

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

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

Loading…
Cancel
Save