Browse Source

fix(nc-gui): disable when the page is index

pull/4482/head
Wing-Kam Wong 2 years ago
parent
commit
fafa4fb17e
  1. 15
      packages/nc-gui/components/dashboard/TreeView.vue
  2. 1
      packages/nc-gui/components/general/ShareBaseButton.vue

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

@ -16,6 +16,7 @@ import {
useDialog,
useNuxtApp,
useProject,
useRoute,
useTable,
useTabs,
useToggle,
@ -37,6 +38,8 @@ const { deleteTable } = useTable()
const { isUIAllowed } = useUIPermission()
const route = useRoute()
const [searchActive, toggleSearchActive] = useToggle()
let key = $ref(0)
@ -219,13 +222,23 @@ const onSearchCloseIconClick = () => {
toggleSearchActive(false)
}
const isCreateTableAllowed = computed(
() =>
isUIAllowed('table-create') &&
route.name !== 'index' &&
route.name !== 'index-index' &&
route.name !== 'index-index-create' &&
route.name !== 'index-index-create-external' &&
route.name !== 'index-user-index',
)
useEventListener(document, 'keydown', async (e: KeyboardEvent) => {
const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey
if (e.altKey && !e.shiftKey && !cmdOrCtrl) {
switch (e.keyCode) {
case 84: {
// ALT + T
if (isUIAllowed('table-create') && !isDrawerOrModalExist()) {
if (isCreateTableAllowed.value && !isDrawerOrModalExist()) {
// prevent the key `T` is inputted to table title input
e.preventDefault()
openTableCreateDialog()

1
packages/nc-gui/components/general/ShareBaseButton.vue

@ -11,6 +11,7 @@ const isShareBaseAllowed = computed(
() =>
isUIAllowed('newUser') &&
route.name !== 'index' &&
route.name !== 'index-index' &&
route.name !== 'index-index-create' &&
route.name !== 'index-index-create-external' &&
route.name !== 'index-user-index',

Loading…
Cancel
Save