From 707f6c6d0706b59fe3bf060eedbba264e3ea0d29 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Fri, 22 Sep 2023 15:23:16 +0000 Subject: [PATCH] fix: Added isDefaultBase util to FE --- packages/nc-gui/components/dashboard/TreeView/ViewsList.vue | 4 +++- packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue | 4 +++- packages/nc-gui/utils/baseUtils.ts | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 packages/nc-gui/utils/baseUtils.ts diff --git a/packages/nc-gui/components/dashboard/TreeView/ViewsList.vue b/packages/nc-gui/components/dashboard/TreeView/ViewsList.vue index 1a586c1cc1..7a27b1f028 100644 --- a/packages/nc-gui/components/dashboard/TreeView/ViewsList.vue +++ b/packages/nc-gui/components/dashboard/TreeView/ViewsList.vue @@ -4,6 +4,7 @@ import { ViewTypes } from 'nocodb-sdk' import type { SortableEvent } from 'sortablejs' import Sortable from 'sortablejs' import type { Menu as AntMenu } from 'ant-design-vue' +import { isDefaultBase as _isDefaultBase } from '~/utils/baseUtils' import { extractSdkResponseErrorMsg, message, @@ -35,8 +36,9 @@ const { $e } = useNuxtApp() const isDefaultBase = computed(() => { const base = project.value?.bases?.find((b) => b.id === table.value.base_id) + if (!base) return false - return base?.is_meta + return _isDefaultBase(base) }) const { viewsByTable, activeView } = storeToRefs(useViewsStore()) diff --git a/packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue b/packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue index a2a1bd2094..dc658f3236 100644 --- a/packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue +++ b/packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue @@ -2,6 +2,7 @@ import type { VNodeRef } from '@vue/runtime-core' import type { KanbanType, ViewType, ViewTypes } from 'nocodb-sdk' import type { WritableComputedRef } from '@vue/reactivity' +import { isDefaultBase as _isDefaultBase } from '~/utils/baseUtils' import { IsLockedInj, inject, message, onKeyStroke, useDebounceFn, useNuxtApp, useRoles, useVModel } from '#imports' interface Props { @@ -45,8 +46,9 @@ const { rightSidebarState } = storeToRefs(useSidebarStore()) const isDefaultBase = computed(() => { const base = project.value?.bases?.find((b) => b.id === vModel.value.base_id) + if (!base) return false - return base?.is_meta + return _isDefaultBase(base) }) const isDropdownOpen = ref(false) diff --git a/packages/nc-gui/utils/baseUtils.ts b/packages/nc-gui/utils/baseUtils.ts new file mode 100644 index 0000000000..fb8e7ef31f --- /dev/null +++ b/packages/nc-gui/utils/baseUtils.ts @@ -0,0 +1,5 @@ +import type { BaseType } from 'nocodb-sdk' + +const isDefaultBase = (base: BaseType) => base.is_meta + +export { isDefaultBase }