From c8bc89fd0919c58b5e4c93bc7087d105f672bf99 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 6 Oct 2022 12:09:21 +0530 Subject: [PATCH 1/4] fix(gui): hide external db project creation option if disabled Signed-off-by: Pranav C --- packages/nc-gui/pages/index/index/index.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/pages/index/index/index.vue b/packages/nc-gui/pages/index/index/index.vue index 6c132554a1..ee105dd7ee 100644 --- a/packages/nc-gui/pages/index/index/index.vue +++ b/packages/nc-gui/pages/index/index/index.vue @@ -16,6 +16,7 @@ import { useApi, useNuxtApp, useUIPermission, + useGlobal } from '#imports' definePageMeta({ @@ -32,6 +33,8 @@ const filterQuery = ref('') const projects = ref() +const { appInfo, } = $(useGlobal()) + const loadProjects = async () => { const response = await api.project.list({}) projects.value = response.list @@ -177,7 +180,7 @@ onBeforeMount(loadProjects) - +
Date: Thu, 6 Oct 2022 12:18:35 +0530 Subject: [PATCH 2/4] fix(api): disable external project creation in api level Signed-off-by: Pranav C --- packages/nocodb/src/lib/meta/api/projectApis.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/lib/meta/api/projectApis.ts b/packages/nocodb/src/lib/meta/api/projectApis.ts index 177d70b931..75ca810f80 100644 --- a/packages/nocodb/src/lib/meta/api/projectApis.ts +++ b/packages/nocodb/src/lib/meta/api/projectApis.ts @@ -55,7 +55,11 @@ export async function projectUpdate( 'color', ]); - if (data?.title && project.title !== data.title && await Project.getByTitle(data.title)) { + if ( + data?.title && + project.title !== data.title && + (await Project.getByTitle(data.title)) + ) { NcError.badRequest('Project title already in use'); } @@ -114,6 +118,9 @@ async function projectCreate(req: Request, res) { }, ]; } else { + if (process.env.NC_CONNECT_TO_EXTERNAL_DB_DISABLED) { + NcError.badRequest('Connecting to external db is disabled'); + } projectBody.is_meta = false; } From df9e333a198148f8bb16a4885776e93726128e19 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 6 Oct 2022 12:25:46 +0530 Subject: [PATCH 3/4] chore(gui): lint Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/sidebar/MenuTop.vue | 1 - packages/nc-gui/pages/index/index/index.vue | 4 ++-- packages/nc-gui/pages/signup/[[token]].vue | 5 ++++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/sidebar/MenuTop.vue b/packages/nc-gui/components/smartsheet/sidebar/MenuTop.vue index a537d0774c..58d4e94a54 100644 --- a/packages/nc-gui/components/smartsheet/sidebar/MenuTop.vue +++ b/packages/nc-gui/components/smartsheet/sidebar/MenuTop.vue @@ -17,7 +17,6 @@ import { useDialog, useI18n, useNuxtApp, - useRoute, useRouter, viewTypeAlias, watch, diff --git a/packages/nc-gui/pages/index/index/index.vue b/packages/nc-gui/pages/index/index/index.vue index ee105dd7ee..cd4c2a9bd3 100644 --- a/packages/nc-gui/pages/index/index/index.vue +++ b/packages/nc-gui/pages/index/index/index.vue @@ -14,9 +14,9 @@ import { ref, themeV2Colors, useApi, + useGlobal, useNuxtApp, useUIPermission, - useGlobal } from '#imports' definePageMeta({ @@ -33,7 +33,7 @@ const filterQuery = ref('') const projects = ref() -const { appInfo, } = $(useGlobal()) +const { appInfo } = $(useGlobal()) const loadProjects = async () => { const response = await api.project.list({}) diff --git a/packages/nc-gui/pages/signup/[[token]].vue b/packages/nc-gui/pages/signup/[[token]].vue index 0a58307856..e2729bf8e8 100644 --- a/packages/nc-gui/pages/signup/[[token]].vue +++ b/packages/nc-gui/pages/signup/[[token]].vue @@ -85,7 +85,10 @@ function resetError() {
- +

{{ $t('general.signUp') }} From 6c57ba6157fdf141401a499bd05e39b7a4de8941 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 6 Oct 2022 12:50:48 +0530 Subject: [PATCH 4/4] refactor(gui): remove unnecessary wrapping Signed-off-by: Pranav C --- packages/nc-gui/pages/index/index/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nc-gui/pages/index/index/index.vue b/packages/nc-gui/pages/index/index/index.vue index cd4c2a9bd3..022e06fa78 100644 --- a/packages/nc-gui/pages/index/index/index.vue +++ b/packages/nc-gui/pages/index/index/index.vue @@ -33,7 +33,7 @@ const filterQuery = ref('') const projects = ref() -const { appInfo } = $(useGlobal()) +const { appInfo } = useGlobal() const loadProjects = async () => { const response = await api.project.list({})