From 442d184953f0dbaf0cf68e8514b9ae6d141a0451 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 24 Aug 2023 16:57:36 +0530 Subject: [PATCH] sync @1700 Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- packages/nc-gui/components.d.ts | 1 + .../nc-gui/components/dashboard/Sidebar.vue | 15 ++++--- .../dashboard/TreeViewNew/TableNode.vue | 9 +++++ .../dlg/share-and-collaborate/ShareBase.vue | 2 +- .../dlg/share-and-collaborate/View.vue | 6 +-- packages/nc-gui/components/nc/Dropdown.vue | 4 +- packages/nc-gui/components/nc/Select.vue | 2 + packages/nc-gui/components/nc/Tabs.vue | 2 +- .../components/project/AccessSettings.vue | 12 ++++-- .../project/InviteProjectCollabSection.vue | 17 ++++---- packages/nc-gui/components/project/View.vue | 39 ++++++++++++------- .../components/smartsheet/details/Api.vue | 9 ----- .../components/smartsheet/header/Menu.vue | 2 +- .../components/smartsheet/sidebar/MenuTop.vue | 8 ++-- .../components/smartsheet/sidebar/index.vue | 6 +-- packages/nc-gui/components/webhook/Editor.vue | 10 ++++- .../components/workspace/CreateProjectBtn.vue | 2 +- .../components/workspace/CreateProjectDlg.vue | 2 +- packages/nc-gui/components/workspace/Menu.vue | 10 ----- .../nc-gui/pages/index-old/index/index.vue | 16 -------- packages/nc-gui/pages/index/[typeOrId].vue | 4 +- packages/nc-gui/store/project.ts | 14 +++++++ packages/nc-gui/store/projects.ts | 10 ++++- packages/nc-gui/store/views.ts | 17 +++++--- packages/nc-gui/store/webhooks.ts | 2 +- .../extract-ids/extract-ids.middleware.ts | 11 ++++-- 26 files changed, 133 insertions(+), 99 deletions(-) diff --git a/packages/nc-gui/components.d.ts b/packages/nc-gui/components.d.ts index 3b9a2c397e..d0e6ae0466 100644 --- a/packages/nc-gui/components.d.ts +++ b/packages/nc-gui/components.d.ts @@ -151,6 +151,7 @@ declare module '@vue/runtime-core' { MdiDotsVertical: typeof import('~icons/mdi/dots-vertical')['default'] MdiEarth: typeof import('~icons/mdi/earth')['default'] MdiEditOutline: typeof import('~icons/mdi/edit-outline')['default'] + MdiEye: typeof import('~icons/mdi/eye')['default'] MdiFlag: typeof import('~icons/mdi/flag')['default'] MdiFolder: typeof import('~icons/mdi/folder')['default'] MdiHeart: typeof import('~icons/mdi/heart')['default'] diff --git a/packages/nc-gui/components/dashboard/Sidebar.vue b/packages/nc-gui/components/dashboard/Sidebar.vue index 6386868974..eedf598263 100644 --- a/packages/nc-gui/components/dashboard/Sidebar.vue +++ b/packages/nc-gui/components/dashboard/Sidebar.vue @@ -55,6 +55,7 @@ const navigateToSettings = () => { class="nc-sidebar flex flex-col bg-gray-50 outline-r-1 outline-gray-100 select-none" :style="{ outlineWidth: '1px', + height: isSharedBase ? '100%' : null, }" >
@@ -66,12 +67,7 @@ const navigateToSettings = () => { href="https://github.com/nocodb/nocodb" target="_blank" > - - - NocoDB - + NocoDB @@ -135,6 +131,9 @@ const navigateToSettings = () => { >
@@ -145,4 +144,8 @@ const navigateToSettings = () => { .nc-sidebar-top-button { @apply flex flex-row mx-1 px-3.5 rounded-md items-center py-0.75 my-0.5 gap-x-2 hover:bg-gray-200 cursor-pointer; } + +:deep(.nc-shared-base.nc-treeview-container) { + @apply !h-full; +} diff --git a/packages/nc-gui/components/dashboard/TreeViewNew/TableNode.vue b/packages/nc-gui/components/dashboard/TreeViewNew/TableNode.vue index 52897f6fdd..4a6b9b6ce2 100644 --- a/packages/nc-gui/components/dashboard/TreeViewNew/TableNode.vue +++ b/packages/nc-gui/components/dashboard/TreeViewNew/TableNode.vue @@ -113,6 +113,15 @@ const { isSharedBase } = useProject() +
Enable Public Access
- +
diff --git a/packages/nc-gui/components/dlg/share-and-collaborate/View.vue b/packages/nc-gui/components/dlg/share-and-collaborate/View.vue index 935fd74f12..905560a185 100644 --- a/packages/nc-gui/components/dlg/share-and-collaborate/View.vue +++ b/packages/nc-gui/components/dlg/share-and-collaborate/View.vue @@ -1,7 +1,7 @@ diff --git a/packages/nc-gui/store/project.ts b/packages/nc-gui/store/project.ts index 7101b1a6a3..e9c572f20b 100644 --- a/packages/nc-gui/store/project.ts +++ b/packages/nc-gui/store/project.ts @@ -256,6 +256,19 @@ export const useProject = defineStore('projectStore', () => { }, ) + const navigateToProjectPage = async ({ page }: { page: 'all-table' | 'collaborator' | 'data-source' }) => { + await router.push({ + name: 'index-typeOrId-projectId-index-index', + params: { + typeOrId: route.value.params.typeOrId, + projectId: route.value.params.projectId, + }, + query: { + page, + }, + }) + } + return { project, bases, @@ -284,6 +297,7 @@ export const useProject = defineStore('projectStore', () => { setProject, projectUrl, getBaseType, + navigateToProjectPage, } }) diff --git a/packages/nc-gui/store/projects.ts b/packages/nc-gui/store/projects.ts index 9af558dd70..f9f7ae97a0 100644 --- a/packages/nc-gui/store/projects.ts +++ b/packages/nc-gui/store/projects.ts @@ -86,6 +86,11 @@ export const useProjects = defineStore('projectsStore', () => { await api.auth.projectUserUpdate(projectId, user.id, user as ProjectUserReqType) } + + const removeProjectUser = async (projectId: string, user: User) => { + await api.auth.projectUserRemove(projectId, user.id) + } + const loadProjects = async (page: 'recent' | 'shared' | 'starred' | 'workspace' = 'recent') => { // if shared base then get the shared project and create a list if (route.value.params.typeOrId === 'base' && route.value.params.projectId) { @@ -102,7 +107,7 @@ export const useProjects = defineStore('projectsStore', () => { projects.value.set(project.id!, { ...(projects.value.get(project.id!) || {}), ...project, - bases: [...(projects.value.get(project.id!)?.bases ?? []), ...(project.bases ?? [])], + bases: [...(project.bases ?? projects.value.get(project.id!)?.bases ?? [])], isExpanded: route.value.params.projectId === project.id || projects.value.get(project.id!)?.isExpanded, isLoading: false, }) @@ -224,7 +229,7 @@ export const useProjects = defineStore('projectsStore', () => { linked_db_project_ids: projectPayload.linkedDbProjectIds, }, { - baseURL: getBaseUrl('default'), + baseURL: getBaseUrl('nc'), }, ) @@ -310,6 +315,7 @@ export const useProjects = defineStore('projectsStore', () => { createProjectUser, updateProjectUser, navigateToProject, + removeProjectUser } }) diff --git a/packages/nc-gui/store/views.ts b/packages/nc-gui/store/views.ts index 25faafe344..db5093522f 100644 --- a/packages/nc-gui/store/views.ts +++ b/packages/nc-gui/store/views.ts @@ -15,8 +15,8 @@ export const useViewsStore = defineStore('viewsStore', () => { const { activeTable } = storeToRefs(useTablesStore()) - const activeViewTitle = computed(() => { - if (!route.value.params.viewTitle?.length) return views.value.length ? views.value[0].title : undefined + const activeViewTitleOrId = computed(() => { + if (!route.value.params.viewTitle?.length) return views.value.length ? views.value[0].id : undefined return route.value.params.viewTitle }) @@ -42,9 +42,12 @@ export const useViewsStore = defineStore('viewsStore', () => { if (!activeTable.value) return undefined - if (!activeViewTitle.value) return undefined + if (!activeViewTitleOrId.value) return undefined - return views.value.find((v) => v.title === activeViewTitle.value) + return ( + views.value.find((v) => v.id === activeViewTitleOrId.value) ?? + views.value.find((v) => v.title === activeViewTitleOrId.value) + ) }, set(_view: ViewType | undefined) { if (sharedView.value) { @@ -55,7 +58,9 @@ export const useViewsStore = defineStore('viewsStore', () => { if (!activeTable.value) return if (!_view) return - const viewIndex = views.value.findIndex((v) => v.title === activeViewTitle.value) + const viewIndex = + views.value.findIndex((v) => v.id === activeViewTitleOrId.value) ?? + views.value.findIndex((v) => v.title === activeViewTitleOrId.value) if (viewIndex === -1) return views.value[viewIndex] = _view @@ -86,7 +91,7 @@ export const useViewsStore = defineStore('viewsStore', () => { projectId: route.value.params.projectId, type: route.value.params.type, viewId: route.value.params.viewId, - viewTitle: activeViewTitle.value, + viewTitle: activeViewTitleOrId.value, slugs: [page], }, }) diff --git a/packages/nc-gui/store/webhooks.ts b/packages/nc-gui/store/webhooks.ts index 99789ee9ca..b22993a4f4 100644 --- a/packages/nc-gui/store/webhooks.ts +++ b/packages/nc-gui/store/webhooks.ts @@ -178,7 +178,7 @@ export const useWebhooksStore = defineStore('webhooksStore', () => { projectId: route.value.params.projectId, type: route.value.params.type, viewId: route.value.params.viewId, - viewTitle: activeView.title, + viewTitle: activeView.id, slugs: openMainPage ? ['webhook'] : ['webhook', openCreatePage ? 'create' : hookId!], }, } diff --git a/packages/nocodb/src/middlewares/extract-ids/extract-ids.middleware.ts b/packages/nocodb/src/middlewares/extract-ids/extract-ids.middleware.ts index bbd807c7e6..6559d4ff44 100644 --- a/packages/nocodb/src/middlewares/extract-ids/extract-ids.middleware.ts +++ b/packages/nocodb/src/middlewares/extract-ids/extract-ids.middleware.ts @@ -154,11 +154,14 @@ export class ExtractIdsMiddleware implements NestMiddleware, CanActivate { }); req.ncProjectId = model?.project_id; } - // extract project id from query params only if it's userMe endpoint + // extract project id from query params only if it's userMe endpoint or webhook plugin list else if ( - ['/auth/user/me', '/api/v1/db/auth/user/me', '/api/v1/auth/user/me'].some( - (userMePath) => req.route.path === userMePath, - ) && + [ + '/auth/user/me', + '/api/v1/db/auth/user/me', + '/api/v1/auth/user/me', + '/api/v1/db/meta/plugins/webhook', + ].some((userMePath) => req.route.path === userMePath) && req.query.project_id ) { req.ncProjectId = req.query.project_id;