|
|
@ -4,7 +4,7 @@ import type { OracleUi, ProjectType, TableType } from 'nocodb-sdk' |
|
|
|
import { useNuxtApp, useRoute } from '#app' |
|
|
|
import { useNuxtApp, useRoute } from '#app' |
|
|
|
import type { ProjectMetaInfo } from '~/lib' |
|
|
|
import type { ProjectMetaInfo } from '~/lib' |
|
|
|
import type { ThemeConfig } from '@/composables/useTheme' |
|
|
|
import type { ThemeConfig } from '@/composables/useTheme' |
|
|
|
import { useInjectionState } from '#imports' |
|
|
|
import { createEventHook, useInjectionState } from '#imports' |
|
|
|
|
|
|
|
|
|
|
|
const [setup, use] = useInjectionState((_projectId?: MaybeRef<string>) => { |
|
|
|
const [setup, use] = useInjectionState((_projectId?: MaybeRef<string>) => { |
|
|
|
const { $api, $e } = useNuxtApp() |
|
|
|
const { $api, $e } = useNuxtApp() |
|
|
@ -12,6 +12,8 @@ const [setup, use] = useInjectionState((_projectId?: MaybeRef<string>) => { |
|
|
|
const { includeM2M } = useGlobal() |
|
|
|
const { includeM2M } = useGlobal() |
|
|
|
const { setTheme, theme } = useTheme() |
|
|
|
const { setTheme, theme } = useTheme() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const projectLoadedHook = createEventHook<ProjectType>() |
|
|
|
|
|
|
|
|
|
|
|
const projectId = computed(() => (_projectId ? unref(_projectId) : (route.params.projectId as string))) |
|
|
|
const projectId = computed(() => (_projectId ? unref(_projectId) : (route.params.projectId as string))) |
|
|
|
const project = ref<ProjectType>({}) |
|
|
|
const project = ref<ProjectType>({}) |
|
|
|
const tables = ref<TableType[]>([]) |
|
|
|
const tables = ref<TableType[]>([]) |
|
|
@ -86,6 +88,8 @@ const [setup, use] = useInjectionState((_projectId?: MaybeRef<string>) => { |
|
|
|
await loadProjectRoles() |
|
|
|
await loadProjectRoles() |
|
|
|
await loadTables() |
|
|
|
await loadTables() |
|
|
|
setTheme(projectMeta.value?.theme) |
|
|
|
setTheme(projectMeta.value?.theme) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
projectLoadedHook.trigger(project.value) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function updateProject(data: Partial<ProjectType>) { |
|
|
|
async function updateProject(data: Partial<ProjectType>) { |
|
|
@ -151,6 +155,7 @@ const [setup, use] = useInjectionState((_projectId?: MaybeRef<string>) => { |
|
|
|
projectMetaInfo, |
|
|
|
projectMetaInfo, |
|
|
|
projectMeta, |
|
|
|
projectMeta, |
|
|
|
saveTheme, |
|
|
|
saveTheme, |
|
|
|
|
|
|
|
projectLoadedHook: projectLoadedHook.on, |
|
|
|
} |
|
|
|
} |
|
|
|
}, 'useProject') |
|
|
|
}, 'useProject') |
|
|
|
|
|
|
|
|
|
|
|