Browse Source

refactor: migrate simple composable usage syntax to pinia store usage syntax

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5274/head
Pranav C 2 years ago
parent
commit
500979d135
  1. 3
      packages/nc-gui/components/cell/DateTimePicker.vue
  2. 3
      packages/nc-gui/components/cell/MultiSelect.vue
  3. 3
      packages/nc-gui/components/cell/SingleSelect.vue
  4. 1
      packages/nc-gui/components/cell/TimePicker.vue
  5. 3
      packages/nc-gui/components/cell/attachment/utils.ts
  6. 18
      packages/nc-gui/components/dashboard/TreeView.vue
  7. 3
      packages/nc-gui/components/dashboard/settings/AuditTab.vue
  8. 4
      packages/nc-gui/components/dashboard/settings/DataSources.vue
  9. 4
      packages/nc-gui/components/dashboard/settings/Metadata.vue
  10. 5
      packages/nc-gui/components/dashboard/settings/Misc.vue
  11. 3
      packages/nc-gui/components/dashboard/settings/UIAcl.vue
  12. 4
      packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue
  13. 4
      packages/nc-gui/components/dashboard/settings/data-sources/EditBase.vue
  14. 5
      packages/nc-gui/components/dlg/AirtableImport.vue
  15. 3
      packages/nc-gui/components/dlg/QuickImport.vue
  16. 5
      packages/nc-gui/components/dlg/TableRename.vue
  17. 3
      packages/nc-gui/components/smartsheet/Cell.vue
  18. 3
      packages/nc-gui/components/smartsheet/header/CellIcon.ts
  19. 3
      packages/nc-gui/components/smartsheet/sidebar/index.vue
  20. 4
      packages/nc-gui/composables/useKanbanViewStore.ts
  21. 3
      packages/nc-gui/composables/useMetas.ts
  22. 3
      packages/nc-gui/composables/useMultiSelect/index.ts
  23. 3
      packages/nc-gui/composables/useSharedFormViewStore.ts
  24. 3
      packages/nc-gui/composables/useSharedView.ts
  25. 3
      packages/nc-gui/composables/useSmartsheetRowStore.ts
  26. 5
      packages/nc-gui/composables/useSmartsheetStore.ts
  27. 4
      packages/nc-gui/composables/useTable.ts
  28. 5
      packages/nc-gui/composables/useTabs.ts
  29. 3
      packages/nc-gui/composables/useViewColumns.ts
  30. 3
      packages/nc-gui/composables/useViewData.ts
  31. 3
      packages/nc-gui/composables/useViewFilters.ts
  32. 3
      packages/nc-gui/composables/useViewSorts.ts
  33. 2
      packages/nc-gui/nuxt.config.ts
  34. 7
      packages/nc-gui/pages/[projectType]/[projectId]/index.vue
  35. 4
      packages/nc-gui/pages/[projectType]/[projectId]/index/index/[type]/[title]/[[viewTitle]].vue
  36. 5
      packages/nc-gui/pages/[projectType]/[projectId]/index/index/index.vue
  37. 6
      packages/nc-gui/pages/index/index/[projectId].vue
  38. 1
      packages/nc-gui/store/index.ts

3
packages/nc-gui/components/cell/DateTimePicker.vue

@ -13,6 +13,7 @@ import {
useSelectedCellKeyupListener,
watch,
} from '#imports'
import { storeToRefs } from 'pinia'
interface Props {
modelValue?: string | null
@ -23,7 +24,7 @@ const { modelValue, isPk } = defineProps<Props>()
const emit = defineEmits(['update:modelValue'])
const { isMysql } = useProject()
const { isMysql } = (useProject())
const { showNull } = useGlobal()

3
packages/nc-gui/components/cell/MultiSelect.vue

@ -1,6 +1,7 @@
<script lang="ts" setup>
import { onUnmounted } from '@vue/runtime-core'
import { message } from 'ant-design-vue'
import { storeToRefs } from 'pinia'
import tinycolor from 'tinycolor2'
import type { Select as AntSelect } from 'ant-design-vue'
import type { SelectOptionType, SelectOptionsType } from 'nocodb-sdk'
@ -67,7 +68,7 @@ const { getMeta } = useMetas()
const { hasRole } = useRoles()
const { isPg, isMysql } = useProject()
const { isPg, isMysql } = (useProject())
// a variable to keep newly created options value
// temporary until it's add the option to column meta

3
packages/nc-gui/components/cell/SingleSelect.vue

@ -1,6 +1,7 @@
<script lang="ts" setup>
import { onUnmounted } from '@vue/runtime-core'
import { message } from 'ant-design-vue'
import { storeToRefs } from 'pinia'
import tinycolor from 'tinycolor2'
import type { Select as AntSelect } from 'ant-design-vue'
import type { SelectOptionType } from 'nocodb-sdk'
@ -60,7 +61,7 @@ const { getMeta } = useMetas()
const { hasRole } = useRoles()
const { isPg, isMysql } = useProject()
const { isPg, isMysql } = storeToRefs(useProject())
// a variable to keep newly created option value
// temporary until it's add the option to column meta

1
packages/nc-gui/components/cell/TimePicker.vue

@ -1,6 +1,7 @@
<script setup lang="ts">
import dayjs from 'dayjs'
import { ActiveCellInj, ReadonlyInj, inject, onClickOutside, useProject, useSelectedCellKeyupListener, watch } from '#imports'
import { storeToRefs } from 'pinia'
interface Props {
modelValue?: string | null | undefined

3
packages/nc-gui/components/cell/attachment/utils.ts

@ -1,4 +1,5 @@
import type { AttachmentType } from 'nocodb-sdk'
import { storeToRefs } from 'pinia'
import RenameFile from './RenameFile.vue'
import {
ColumnInj,
@ -51,7 +52,7 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState(
/** for image carousel */
const selectedImage = ref()
const { project } = useProject()
const { project } = storeToRefs(useProject())
const { api, isLoading } = useApi()

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

@ -2,10 +2,11 @@
import type { TableType } from 'nocodb-sdk'
import type { Input } from 'ant-design-vue'
import { Dropdown, Tooltip, message } from 'ant-design-vue'
import { storeToRefs } from 'pinia'
import Sortable from 'sortablejs'
import GithubButton from 'vue-github-button'
import { Icon } from '@iconify/vue'
import type { VNodeRef } from '#imports'
import { Icon } from '@iconify/vue'
import {
ClientType,
Empty,
@ -35,7 +36,10 @@ const { addTab, updateTab } = useTabs()
const { $api, $e } = useNuxtApp()
const { bases, tables, loadTables, isSharedBase } = useProject()
const projectStore = useProject()
const { loadTables } = projectStore
const { bases, tables, isSharedBase } = storeToRefs(projectStore)
const { activeTab } = useTabs()
@ -709,8 +713,8 @@ const setIcon = async (icon: string, table: TableType) => {
<MdiPlus />
<span class="text-gray-500 group-hover:(text-primary/100) flex-1 nc-add-new-table">{{
$t('tooltip.addTable')
}}</span>
$t('tooltip.addTable')
}}</span>
<a-dropdown
v-if="!isSharedBase"
@ -804,7 +808,8 @@ const setIcon = async (icon: string, table: TableType) => {
overlay-class-name="nc-dropdown-import-menu"
@click.stop
>
<MdiDotsVertical class="transition-opacity opacity-0 group-hover:opacity-100 nc-import-menu outline-0" />
<MdiDotsVertical
class="transition-opacity opacity-0 group-hover:opacity-100 nc-import-menu outline-0" />
<template #overlay>
<a-menu class="!py-0 rounded text-sm">
@ -905,7 +910,8 @@ const setIcon = async (icon: string, table: TableType) => {
>
<div class="flex items-center" @click.stop>
<component :is="isUIAllowed('tableIconCustomisation') ? Tooltip : 'div'">
<span v-if="table.meta?.icon" :key="table.meta?.icon" class="nc-table-icon flex items-center">
<span v-if="table.meta?.icon" :key="table.meta?.icon"
class="nc-table-icon flex items-center">
<Icon
:key="table.meta?.icon"
:data-testid="`nc-icon-${table.meta?.icon}`"

3
packages/nc-gui/components/dashboard/settings/AuditTab.vue

@ -2,10 +2,11 @@
import { Tooltip as ATooltip, Empty } from 'ant-design-vue'
import type { AuditType } from 'nocodb-sdk'
import { h, onMounted, timeAgo, useGlobal, useI18n, useNuxtApp, useProject } from '#imports'
import { storeToRefs } from 'pinia'
const { $api } = useNuxtApp()
const { project } = useProject()
const { project } = storeToRefs(useProject())
const { t } = useI18n()

4
packages/nc-gui/components/dashboard/settings/DataSources.vue

@ -22,7 +22,9 @@ const vState = useVModel(props, 'state', emits)
const vReload = useVModel(props, 'reload', emits)
const { $api, $e } = useNuxtApp()
const { project, loadProject } = useProject()
const projectStore = useProject()
const { loadProject } = projectStore
const { project } = projectStore
let sources = $ref<BaseType[]>([])
let activeBaseId = $ref('')

4
packages/nc-gui/components/dashboard/settings/Metadata.vue

@ -9,7 +9,9 @@ const emit = defineEmits(['baseSynced'])
const { $api } = useNuxtApp()
const { project, loadTables } = useProject()
const projectStore = useProject()
const { loadTables } = projectStore
const { project } = projectStore
const { t } = useI18n()

5
packages/nc-gui/components/dashboard/settings/Misc.vue

@ -4,7 +4,10 @@ import { useGlobal, useProject, watch } from '#imports'
const { includeM2M, showNull } = useGlobal()
const { project, updateProject, projectMeta, loadTables, hasEmptyOrNullFilters } = useProject()
const projectStore = useProject()
const { updateProject, loadTables,hasEmptyOrNullFilters } = projectStore
const { project, projectMeta } = projectStore
watch(includeM2M, async () => await loadTables())

3
packages/nc-gui/components/dashboard/settings/UIAcl.vue

@ -11,6 +11,7 @@ import {
useNuxtApp,
useProject,
} from '#imports'
import { storeToRefs } from 'pinia'
const props = defineProps<{
baseId: string
@ -20,7 +21,7 @@ const { t } = useI18n()
const { $api, $e } = useNuxtApp()
const { project } = useProject()
const { project } = storeToRefs(useProject())
const { includeM2M } = useGlobal()

4
packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue

@ -33,7 +33,9 @@ const emit = defineEmits(['baseCreated'])
const { appInfo } = useGlobal()
const { project, loadProject } = useProject()
const projectStore = useProject()
const { loadProject } = projectStore
const { project } = projectStore
const useForm = Form.useForm

4
packages/nc-gui/components/dashboard/settings/data-sources/EditBase.vue

@ -31,7 +31,9 @@ const props = defineProps<{
const emit = defineEmits(['baseUpdated'])
const { project, loadProject } = useProject()
const projectStore = useProject()
const { loadProject } = projectStore
const { project } = projectStore
const useForm = Form.useForm

5
packages/nc-gui/components/dlg/AirtableImport.vue

@ -31,7 +31,10 @@ const baseURL = appInfo.ncSiteUrl
const { $state } = useNuxtApp()
const { project, loadTables } = useProject()
const projectStore = useProject()
const { loadProject } = projectStore
const { project } = projectStore
const showGoToDashboardButton = ref(false)

3
packages/nc-gui/components/dlg/QuickImport.vue

@ -22,6 +22,7 @@ import {
useProject,
useVModel,
} from '#imports'
import { storeToRefs } from 'pinia'
import type { importFileList, streamImportFileList } from '~/lib'
interface Props {
@ -37,7 +38,7 @@ const emit = defineEmits(['update:modelValue'])
const { t } = useI18n()
const { tables } = useProject()
const { tables } = storeToRefs(useProject())
const activeKey = ref('uploadTab')

5
packages/nc-gui/components/dlg/TableRename.vue

@ -38,7 +38,10 @@ const dialogShow = useVModel(props, 'modelValue', emit)
const { updateTab } = useTabs()
const { loadTables, tables, project, isMysql, isMssql, isPg } = useProject()
const projectStore = useProject()
const { loadTables, isMysql, isMssql, isPg } = projectStore
const { project } = projectStore
const inputEl = $ref<ComponentPublicInstance>()

3
packages/nc-gui/components/smartsheet/Cell.vue

@ -45,6 +45,7 @@ import {
useSmartsheetRowStoreOrThrow,
useVModel,
} from '#imports'
import { storeToRefs } from 'pinia'
import { NavigateDir } from '~/lib'
interface Props {
@ -85,7 +86,7 @@ const isLocked = inject(IsLockedInj, ref(false))
const { currentRow } = useSmartsheetRowStoreOrThrow()
const { sqlUis } = useProject()
const { sqlUis } = storeToRefs(useProject())
const sqlUi = ref(column.value?.base_id ? sqlUis.value[column.value?.base_id] : Object.values(sqlUis.value)[0])

3
packages/nc-gui/components/smartsheet/header/CellIcon.ts

@ -33,6 +33,7 @@ import {
toRef,
useProject,
} from '#imports'
import { storeToRefs } from 'pinia'
import FilePhoneIcon from '~icons/mdi/file-phone'
import KeyIcon from '~icons/mdi/key-variant'
import JSONIcon from '~icons/mdi/code-json'
@ -123,7 +124,7 @@ export default defineComponent({
const column = inject(ColumnInj, columnMeta)
const { sqlUis } = useProject()
const { sqlUis } = storeToRefs(useProject())
const sqlUi = ref(column.value?.base_id ? sqlUis.value[column.value?.base_id] : Object.values(sqlUis.value)[0])

3
packages/nc-gui/components/smartsheet/sidebar/index.vue

@ -16,6 +16,7 @@ import {
useViews,
watch,
} from '#imports'
import { storeToRefs } from 'pinia'
const meta = inject(MetaInj, ref())
@ -25,7 +26,7 @@ const { activeTab } = useTabs()
const { views, loadViews, isLoading } = useViews(meta)
const { lastOpenedViewMap } = useProject()
const { lastOpenedViewMap } = storeToRefs(useProject())
const setLastOpenedViewId = (viewId?: string) => {
if (viewId && activeTab.value?.id) {

4
packages/nc-gui/composables/useKanbanViewStore.ts

@ -1,3 +1,4 @@
import { storeToRefs } from 'pinia'
import type { ComputedRef, Ref } from 'vue'
import type { Api, ColumnType, KanbanType, SelectOptionType, SelectOptionsType, TableType, ViewType } from 'nocodb-sdk'
import type { Row } from '~/lib'
@ -40,7 +41,7 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState(
const { api } = useApi()
const { project } = useProject()
const { project,sqlUis } = storeToRefs(useProject())
const { $e, $api } = useNuxtApp()
@ -56,7 +57,6 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState(
const { search } = useFieldQuery()
const { sqlUis } = useProject()
const sqlUi = ref(
(meta.value as TableType)?.base_id ? sqlUis.value[(meta.value as TableType).base_id!] : Object.values(sqlUis.value)[0],

3
packages/nc-gui/composables/useMetas.ts

@ -1,4 +1,5 @@
import { message } from 'ant-design-vue'
import { storeToRefs } from 'pinia'
import type { WatchStopHandle } from 'vue'
import type { TableInfoType, TableType } from 'nocodb-sdk'
import { extractSdkResponseErrorMsg, useNuxtApp, useProject, useState, watch } from '#imports'
@ -6,7 +7,7 @@ import { extractSdkResponseErrorMsg, useNuxtApp, useProject, useState, watch } f
export function useMetas() {
const { $api } = useNuxtApp()
const { tables } = useProject()
const { tables } = storeToRefs(useProject())
const metas = useState<{ [idOrTitle: string]: TableType | any }>('metas', () => ({}))

3
packages/nc-gui/composables/useMultiSelect/index.ts

@ -1,6 +1,7 @@
import type { MaybeRef } from '@vueuse/core'
import type { ColumnType, LinkToAnotherRecordType, TableType } from 'nocodb-sdk'
import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk'
import { storeToRefs } from 'pinia'
import type { Cell } from './cellRange'
import { CellRange } from './cellRange'
import convertCellData from './convertCellData'
@ -52,7 +53,7 @@ export function useMultiSelect(
const { appInfo } = useGlobal()
const { isMysql } = useProject()
const { isMysql } = storeToRefs( useProject)
let clipboardContext = $ref<{ value: any; uidt: UITypes } | null>(null)

3
packages/nc-gui/composables/useSharedFormViewStore.ts

@ -1,5 +1,6 @@
import useVuelidate from '@vuelidate/core'
import { helpers, minLength, required } from '@vuelidate/validators'
import { storeToRefs } from 'pinia'
import type { Ref } from 'vue'
import type { ColumnType, FormType, LinkToAnotherRecordType, TableType, ViewType } from 'nocodb-sdk'
import { ErrorMessages, RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk'
@ -43,7 +44,7 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
const { metas, setMeta } = useMetas()
const { project } = useProject()
const { project } = storeToRefs( useProject)
const { t } = useI18n()

3
packages/nc-gui/composables/useSharedView.ts

@ -1,13 +1,14 @@
import type { ExportTypes, FilterType, KanbanType, PaginatedType, RequestParams, SortType, TableType, ViewType } from 'nocodb-sdk'
import { UITypes } from 'nocodb-sdk'
import { computed, useGlobal, useMetas, useNuxtApp, useState } from '#imports'
import { storeToRefs } from 'pinia'
export function useSharedView() {
const nestedFilters = ref<(FilterType & { status?: 'update' | 'delete' | 'create'; parentId?: string })[]>([])
const { appInfo } = $(useGlobal())
const { project } = useProject()
const { project } = storeToRefs(useProject())
const appInfoDefaultLimit = appInfo.defaultLimit || 25

3
packages/nc-gui/composables/useSmartsheetRowStore.ts

@ -1,5 +1,6 @@
import { RelationTypes, UITypes } from 'nocodb-sdk'
import type { ColumnType, LinkToAnotherRecordType, TableType } from 'nocodb-sdk'
import { storeToRefs } from 'pinia'
import type { Ref } from 'vue'
import type { MaybeRef } from '@vueuse/core'
import {
@ -28,7 +29,7 @@ const [useProvideSmartsheetRowStore, useSmartsheetRowStore] = useInjectionState(
const { t } = useI18n()
const { project } = useProject()
const { project } = storeToRefs(useProject())
const { metas } = useMetas()

5
packages/nc-gui/composables/useSmartsheetStore.ts

@ -1,5 +1,6 @@
import { ViewTypes } from 'nocodb-sdk'
import type { FilterType, KanbanType, SortType, TableType, ViewType } from 'nocodb-sdk'
import { storeToRefs } from 'pinia'
import type { Ref } from 'vue'
import { computed, ref, unref, useEventBus, useFieldQuery, useInjectionState, useNuxtApp, useProject } from '#imports'
import type { SmartsheetStoreEvents } from '~/lib'
@ -14,7 +15,9 @@ const [useProvideSmartsheetStore, useSmartsheetStore] = useInjectionState(
) => {
const { $api } = useNuxtApp()
const { sqlUis } = useProject()
const projectStore = useProject()
const { sqlUis } = storeToRefs(projectStore)
const sqlUi = ref(
(meta.value as TableType)?.base_id ? sqlUis.value[(meta.value as TableType).base_id!] : Object.values(sqlUis.value)[0],

4
packages/nc-gui/composables/useTable.ts

@ -14,6 +14,7 @@ import {
useTabs,
watch,
} from '#imports'
import { storeToRefs } from 'pinia'
import { TabType } from '~/lib'
export function useTable(onTableCreate?: (tableMeta: TableType) => void, baseId?: string) {
@ -32,7 +33,8 @@ export function useTable(onTableCreate?: (tableMeta: TableType) => void, baseId?
const { loadTables } = useProject()
const { closeTab } = useTabs()
const { sqlUis, project, tables } = useProject()
const projectStore = useProject()
const { sqlUis, project, tables } = storeToRefs(projectStore)
const sqlUi = computed(() => (baseId && sqlUis.value[baseId] ? sqlUis.value[baseId] : Object.values(sqlUis.value)[0]))

5
packages/nc-gui/composables/useTabs.ts

@ -1,5 +1,6 @@
import type { WritableComputedRef } from '@vue/reactivity'
import { computed, createSharedComposable, navigateTo, ref, useProject, useRouter, watch } from '#imports'
import { storeToRefs } from 'pinia'
import type { TabItem } from '~/lib'
import { TabType } from '~/lib'
@ -17,7 +18,9 @@ export const useTabs = createSharedComposable(() => {
const route = $(router.currentRoute)
const { bases, tables } = useProject()
const projectStore = useProject()
const { bases, tables } = storeToRefs(projectStore)
const projectType = $computed(() => route.params.projectType as string)

3
packages/nc-gui/composables/useViewColumns.ts

@ -1,5 +1,6 @@
import { ViewTypes, isSystemColumn } from 'nocodb-sdk'
import type { ColumnType, MapType, TableType, ViewType } from 'nocodb-sdk'
import { storeToRefs } from 'pinia'
import type { ComputedRef, Ref } from 'vue'
import { IsPublicInj, computed, inject, ref, useNuxtApp, useProject, useUIPermission, watch } from '#imports'
import type { Field } from '~/lib'
@ -19,7 +20,7 @@ export function useViewColumns(
const { isUIAllowed } = useUIPermission()
const { isSharedBase } = useProject()
const { isSharedBase } = storeToRefs(useProject())
const isLocalMode = computed(
() => isPublic.value || !isUIAllowed('hideAllColumns') || !isUIAllowed('showAllColumns') || isSharedBase.value,

3
packages/nc-gui/composables/useViewData.ts

@ -1,5 +1,6 @@
import { UITypes, ViewTypes } from 'nocodb-sdk'
import type { Api, ColumnType, FormColumnType, FormType, GalleryType, PaginatedType, TableType, ViewType } from 'nocodb-sdk'
import { storeToRefs } from 'pinia'
import type { ComputedRef, Ref } from 'vue'
import {
IsPublicInj,
@ -70,7 +71,7 @@ export function useViewData(
const isPublic = inject(IsPublicInj, ref(false))
const { project, isSharedBase } = useProject()
const { project, isSharedBase } = storeToRefs(useProject())
const { sharedView, fetchSharedViewData, paginationData: sharedPaginationData } = useSharedView()

3
packages/nc-gui/composables/useViewFilters.ts

@ -1,4 +1,5 @@
import type { ColumnType, FilterType, ViewType } from 'nocodb-sdk'
import { storeToRefs } from 'pinia'
import type { ComputedRef, Ref } from 'vue'
import type { SelectProps } from 'ant-design-vue'
import { UITypes, isSystemColumn } from 'nocodb-sdk'
@ -35,7 +36,7 @@ export function useViewFilters(
const { nestedFilters } = useSmartsheetStoreOrThrow()
const { projectMeta } = useProject()
const { projectMeta } = storeToRefs(useProject())
const isPublic = inject(IsPublicInj, ref(false))

3
packages/nc-gui/composables/useViewSorts.ts

@ -1,4 +1,5 @@
import type { SortType, ViewType } from 'nocodb-sdk'
import { storeToRefs } from 'pinia'
import type { Ref } from 'vue'
import {
IsPublicInj,
@ -24,7 +25,7 @@ export function useViewSorts(view: Ref<ViewType | undefined>, reloadData?: () =>
const { isUIAllowed } = useUIPermission()
const { isSharedBase } = useProject()
const { isSharedBase } = storeToRefs(useProject())
const reloadHook = inject(ReloadViewDataHookInj)

2
packages/nc-gui/nuxt.config.ts

@ -190,7 +190,7 @@ export default defineNuxtConfig({
},
imports: {
dirs: ['./context', './utils/**', './lib', './composables/**'],
dirs: ['./context', './utils/**', './lib', './composables/**', './store/**'],
imports: [
{ name: 'useI18n', from: 'vue-i18n' },
{ name: 'message', from: 'ant-design-vue/es' },

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

@ -1,4 +1,5 @@
<script setup lang="ts">
import { storeToRefs } from 'pinia'
import tinycolor from 'tinycolor2'
import {
TabType,
@ -46,7 +47,11 @@ const router = useRouter()
const { appInfo, token, signOut, signedIn, user, currentVersion } = useGlobal()
const { project, isSharedBase, loadProjectMetaInfo, projectMetaInfo, saveTheme, loadProject, reset } = useProject()
const projectStore = useProject()
const { loadProjectMetaInfo, saveTheme, loadProject, reset } = projectStore
const {project, isSharedBase, projectMetaInfo } = storeToRefs(projectStore)
const { clearTabs, addTab } = useTabs()

4
packages/nc-gui/pages/[projectType]/[projectId]/index/index/[type]/[title]/[[viewTitle]].vue

@ -1,10 +1,12 @@
<script setup lang="ts">
import { storeToRefs } from 'pinia'
import type { TabItem } from '~/lib'
import { TabMetaInj, computed, inject, ref, until, useMetas, useProject, useRoute } from '#imports'
const { getMeta } = useMetas()
const { tables } = useProject()
const projectStore = useProject()
const { tables } = storeToRefs(projectStore)
const route = useRoute()

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

@ -13,6 +13,7 @@ import {
useUIPermission,
watch,
} from '#imports'
import { storeToRefs } from 'pinia'
const dropZone = ref<HTMLDivElement>()
@ -20,7 +21,9 @@ const { isOverDropZone } = useDropZone(dropZone, onDrop)
const { files, open, reset } = useFileDialog()
const { bases, isSharedBase } = useProject()
const projectStore = useProject()
const { bases, isSharedBase } = storeToRefs(projectStore)
const { isUIAllowed } = useUIPermission()

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

@ -13,10 +13,14 @@ import {
useProject,
useRoute,
} from '#imports'
import { storeToRefs } from 'pinia'
const route = useRoute()
const { project, loadProject, updateProject, isLoading } = useProject()
const projectStore = useProject()
const { loadProject, updateProject } = projectStore
const {project, isLoading } = storeToRefs(projectStore)
const nameValidationRules = [
{

1
packages/nc-gui/store/index.ts

@ -0,0 +1 @@
export * from './project'
Loading…
Cancel
Save