From 2cf5af44e264604ccb894ace5e0fffbefeeacf28 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Mon, 2 Oct 2023 11:43:02 +0000 Subject: [PATCH] fix: Fixed issue with project node being closed in shared base --- .../dashboard/TreeView/ProjectNode.vue | 16 ++++------------ packages/nc-gui/store/projects.ts | 2 +- .../Dashboard/common/WorkspaceMenu/index.ts | 2 +- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue b/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue index 5bf8311063..af2afe4a5f 100644 --- a/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue +++ b/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue @@ -29,6 +29,9 @@ const indicator = h(LoadingOutlined, { const router = useRouter() const route = router.currentRoute +const { isSharedBase } = storeToRefs(useProject()) +const { projectUrl } = useProject() + const { setMenuContext, openRenameTableDialog, duplicateTable, contextMenuTarget } = inject(TreeViewInj)! const project = inject(ProjectInj)! @@ -65,8 +68,6 @@ const projectRole = inject(ProjectRoleInj) const { activeProjectId } = storeToRefs(useProjects()) -const { projectUrl } = useProject() - const toggleDialog = inject(ToggleDialogInj, () => {}) const { $e } = useNuxtApp() @@ -228,9 +229,6 @@ const addNewProjectChildEntity = async () => { } } -// todo: temp -const isSharedBase = ref(false) - const onProjectClick = async (project: NcProject, ignoreNavigation?: boolean, toggleIsExpanded?: boolean) => { if (!project) { return @@ -247,12 +245,6 @@ const onProjectClick = async (project: NcProject, ignoreNavigation?: boolean, to const isProjectPopulated = projectsStore.isProjectPopulated(project.id!) - let isSharedBase = false - // if shared base ignore navigation - if (route.value.params.typeOrId === 'base') { - isSharedBase = true - } - if (!isProjectPopulated) project.isLoading = true if (!ignoreNavigation) { @@ -260,7 +252,7 @@ const onProjectClick = async (project: NcProject, ignoreNavigation?: boolean, to projectUrl({ id: project.id!, type: 'database', - isSharedBase, + isSharedBase: isSharedBase.value, }), ) } diff --git a/packages/nc-gui/store/projects.ts b/packages/nc-gui/store/projects.ts index 6708a34f2c..ecc9ae6a98 100644 --- a/packages/nc-gui/store/projects.ts +++ b/packages/nc-gui/store/projects.ts @@ -105,7 +105,7 @@ export const useProjects = defineStore('projectsStore', () => { ...(projects.value.get(project.id!) || {}), ...project, bases: [...(project.bases ?? projects.value.get(project.id!)?.bases ?? [])], - isExpanded: route.value.params.projectId === project.id || projects.value.get(project.id!)?.isExpanded, + isExpanded: true, isLoading: false, }) diff --git a/tests/playwright/pages/Dashboard/common/WorkspaceMenu/index.ts b/tests/playwright/pages/Dashboard/common/WorkspaceMenu/index.ts index 025e4a4d07..cfe7fa9899 100644 --- a/tests/playwright/pages/Dashboard/common/WorkspaceMenu/index.ts +++ b/tests/playwright/pages/Dashboard/common/WorkspaceMenu/index.ts @@ -20,7 +20,7 @@ export class WorkspaceMenuObject extends BasePage { async switchWorkspace({ workspaceTitle }: { workspaceTitle: string }) { await this.toggle(); await this.rootPage.waitForTimeout(2500); - await this.rootPage.getByTestId('nc-workspace-list').getByText(workspaceTitle).click({ + await this.rootPage.locator('.ant-dropdown-menu').getByTestId('nc-workspace-list').getByText(workspaceTitle).click({ force: true, }); await this.rootPage.keyboard.press('Escape');