Browse Source

fix: Added isDefaultBase util to FE

pull/6444/head
Muhammed Mustafa 1 year ago
parent
commit
707f6c6d07
  1. 4
      packages/nc-gui/components/dashboard/TreeView/ViewsList.vue
  2. 4
      packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue
  3. 5
      packages/nc-gui/utils/baseUtils.ts

4
packages/nc-gui/components/dashboard/TreeView/ViewsList.vue

@ -4,6 +4,7 @@ import { ViewTypes } from 'nocodb-sdk'
import type { SortableEvent } from 'sortablejs' import type { SortableEvent } from 'sortablejs'
import Sortable from 'sortablejs' import Sortable from 'sortablejs'
import type { Menu as AntMenu } from 'ant-design-vue' import type { Menu as AntMenu } from 'ant-design-vue'
import { isDefaultBase as _isDefaultBase } from '~/utils/baseUtils'
import { import {
extractSdkResponseErrorMsg, extractSdkResponseErrorMsg,
message, message,
@ -35,8 +36,9 @@ const { $e } = useNuxtApp()
const isDefaultBase = computed(() => { const isDefaultBase = computed(() => {
const base = project.value?.bases?.find((b) => b.id === table.value.base_id) 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()) const { viewsByTable, activeView } = storeToRefs(useViewsStore())

4
packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue

@ -2,6 +2,7 @@
import type { VNodeRef } from '@vue/runtime-core' import type { VNodeRef } from '@vue/runtime-core'
import type { KanbanType, ViewType, ViewTypes } from 'nocodb-sdk' import type { KanbanType, ViewType, ViewTypes } from 'nocodb-sdk'
import type { WritableComputedRef } from '@vue/reactivity' import type { WritableComputedRef } from '@vue/reactivity'
import { isDefaultBase as _isDefaultBase } from '~/utils/baseUtils'
import { IsLockedInj, inject, message, onKeyStroke, useDebounceFn, useNuxtApp, useRoles, useVModel } from '#imports' import { IsLockedInj, inject, message, onKeyStroke, useDebounceFn, useNuxtApp, useRoles, useVModel } from '#imports'
interface Props { interface Props {
@ -45,8 +46,9 @@ const { rightSidebarState } = storeToRefs(useSidebarStore())
const isDefaultBase = computed(() => { const isDefaultBase = computed(() => {
const base = project.value?.bases?.find((b) => b.id === vModel.value.base_id) 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) const isDropdownOpen = ref(false)

5
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 }
Loading…
Cancel
Save