diff --git a/packages/nc-gui-v2/composables/useTabs.ts b/packages/nc-gui-v2/composables/useTabs.ts
index a381668792..2ef34dbac5 100644
--- a/packages/nc-gui-v2/composables/useTabs.ts
+++ b/packages/nc-gui-v2/composables/useTabs.ts
@@ -2,8 +2,14 @@ import type { WritableComputedRef } from '@vue/reactivity'
import { useState } from '#app'
import useProject from '~/composables/useProject'
+enum TabType {
+ TABLE = 'table',
+ VIEW = 'view',
+ AUTH = 'auth',
+}
+
export interface TabItem {
- type: 'table' | 'view' | 'auth'
+ type: TabType
title: string
id?: string
}
@@ -26,8 +32,8 @@ export default () => {
const activeTabIndex: WritableComputedRef
= computed({
get() {
console.log(route?.name)
- if ((route?.name as string)?.startsWith('nc-projectId-index-index-type-title') && tables?.value?.length) {
- const tab: Partial = { type: 'table', title: route.params.title as string }
+ if ((route?.name as string)?.startsWith('nc-projectId-index-index-type-title-viewTitle') && tables?.value?.length) {
+ const tab: Partial = { type: route.params.type as TabType, title: route.params.title as string }
const id = tables?.value?.find((t) => t.title === tab.title)?.id
tab.id = id as string
let index = tabs.value.findIndex((t) => t.id === tab.id)
@@ -47,11 +53,14 @@ export default () => {
} else {
const tab = tabs.value[index]
if (!tab) {
- } else if (tab.type === 'table') {
+ return
+ }
+
+ if (tab.type === TabType.TABLE) {
router.push(`/nc/${route.params.projectId}/table/${tab?.title}`)
- } else if (tab.type === 'view') {
+ } else if (tab.type === TabType.VIEW) {
router.push(`/nc/${route.params.projectId}/view/${tab?.title}`)
- } else if (tab.type === 'auth') {
+ } else if (tab.type === TabType.AUTH) {
router.push(`/nc/${route.params.projectId}/auth`)
}
}
diff --git a/packages/nc-gui-v2/pages/nc/[projectId]/index.vue b/packages/nc-gui-v2/pages/nc/[projectId]/index.vue
index 67f6799c76..6e621feb1b 100644
--- a/packages/nc-gui-v2/pages/nc/[projectId]/index.vue
+++ b/packages/nc-gui-v2/pages/nc/[projectId]/index.vue
@@ -6,7 +6,9 @@ const { loadProject, loadTables } = useProject(route.params.projectId as string)
const { clearTabs, addTab } = useTabs()
const { $state } = useNuxtApp()
-addTab({ type: 'auth', title: 'Team & Auth' })
+if (!route.params.type) {
+ addTab({ type: 'auth', title: 'Team & Auth' })
+}
watch(
() => route.params.projectId,
@@ -29,39 +31,6 @@ $state.sidebarOpen.value = true
-
-
-
-
-
+
-
-
diff --git a/packages/nc-gui-v2/pages/nc/[projectId]/index/index.vue b/packages/nc-gui-v2/pages/nc/[projectId]/index/index.vue
index 1ee8d54135..15e78b95ce 100644
--- a/packages/nc-gui-v2/pages/nc/[projectId]/index/index.vue
+++ b/packages/nc-gui-v2/pages/nc/[projectId]/index/index.vue
@@ -9,26 +9,24 @@ provide(TabMetaInj, activeTab)
-
-
-
-
-
-
-
-
+
-
+
diff --git a/packages/nc-gui-v2/pages/nc/[projectId]/index/index/[type]/[title]/[viewTitle]/index.vue b/packages/nc-gui-v2/pages/nc/[projectId]/index/index/[type]/[title]/[[viewTitle]].vue
similarity index 100%
rename from packages/nc-gui-v2/pages/nc/[projectId]/index/index/[type]/[title]/[viewTitle]/index.vue
rename to packages/nc-gui-v2/pages/nc/[projectId]/index/index/[type]/[title]/[[viewTitle]].vue
diff --git a/packages/nc-gui-v2/pages/nc/[projectId]/index/index/[type]/[title]/index.vue b/packages/nc-gui-v2/pages/nc/[projectId]/index/index/[type]/[title]/index.vue
deleted file mode 100644
index ec671406ea..0000000000
--- a/packages/nc-gui-v2/pages/nc/[projectId]/index/index/[type]/[title]/index.vue
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-