Browse Source

fix: Fixed issue with project node being closed in shared base

pull/6539/head
Muhammed Mustafa 1 year ago
parent
commit
2cf5af44e2
  1. 16
      packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue
  2. 2
      packages/nc-gui/store/projects.ts
  3. 2
      tests/playwright/pages/Dashboard/common/WorkspaceMenu/index.ts

16
packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue

@ -29,6 +29,9 @@ const indicator = h(LoadingOutlined, {
const router = useRouter() const router = useRouter()
const route = router.currentRoute const route = router.currentRoute
const { isSharedBase } = storeToRefs(useProject())
const { projectUrl } = useProject()
const { setMenuContext, openRenameTableDialog, duplicateTable, contextMenuTarget } = inject(TreeViewInj)! const { setMenuContext, openRenameTableDialog, duplicateTable, contextMenuTarget } = inject(TreeViewInj)!
const project = inject(ProjectInj)! const project = inject(ProjectInj)!
@ -65,8 +68,6 @@ const projectRole = inject(ProjectRoleInj)
const { activeProjectId } = storeToRefs(useProjects()) const { activeProjectId } = storeToRefs(useProjects())
const { projectUrl } = useProject()
const toggleDialog = inject(ToggleDialogInj, () => {}) const toggleDialog = inject(ToggleDialogInj, () => {})
const { $e } = useNuxtApp() 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) => { const onProjectClick = async (project: NcProject, ignoreNavigation?: boolean, toggleIsExpanded?: boolean) => {
if (!project) { if (!project) {
return return
@ -247,12 +245,6 @@ const onProjectClick = async (project: NcProject, ignoreNavigation?: boolean, to
const isProjectPopulated = projectsStore.isProjectPopulated(project.id!) 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 (!isProjectPopulated) project.isLoading = true
if (!ignoreNavigation) { if (!ignoreNavigation) {
@ -260,7 +252,7 @@ const onProjectClick = async (project: NcProject, ignoreNavigation?: boolean, to
projectUrl({ projectUrl({
id: project.id!, id: project.id!,
type: 'database', type: 'database',
isSharedBase, isSharedBase: isSharedBase.value,
}), }),
) )
} }

2
packages/nc-gui/store/projects.ts

@ -105,7 +105,7 @@ export const useProjects = defineStore('projectsStore', () => {
...(projects.value.get(project.id!) || {}), ...(projects.value.get(project.id!) || {}),
...project, ...project,
bases: [...(project.bases ?? projects.value.get(project.id!)?.bases ?? [])], 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, isLoading: false,
}) })

2
tests/playwright/pages/Dashboard/common/WorkspaceMenu/index.ts

@ -20,7 +20,7 @@ export class WorkspaceMenuObject extends BasePage {
async switchWorkspace({ workspaceTitle }: { workspaceTitle: string }) { async switchWorkspace({ workspaceTitle }: { workspaceTitle: string }) {
await this.toggle(); await this.toggle();
await this.rootPage.waitForTimeout(2500); 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, force: true,
}); });
await this.rootPage.keyboard.press('Escape'); await this.rootPage.keyboard.press('Escape');

Loading…
Cancel
Save