From 3812a77bb00ee70369906f6ea24d1aef21bb1644 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Tue, 26 Nov 2024 05:46:53 +0000 Subject: [PATCH] fix: add get custom url path and check availability api --- .../dlg/share-and-collaborate/SharePage.vue | 38 +++++-- .../src/controllers/custom-urls.controller.ts | 44 ++++++++ packages/nocodb/src/models/CustomUrl.ts | 32 +++++- packages/nocodb/src/models/View.ts | 34 ++++++ packages/nocodb/src/schema/swagger-v2.json | 106 +++++++++++++++++- packages/nocodb/src/schema/swagger.json | 14 ++- .../src/services/custom-urls.service.ts | 20 ++++ packages/nocodb/src/services/views.service.ts | 6 +- 8 files changed, 277 insertions(+), 17 deletions(-) create mode 100644 packages/nocodb/src/controllers/custom-urls.controller.ts create mode 100644 packages/nocodb/src/services/custom-urls.service.ts diff --git a/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue b/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue index c3f7ab9201..51198ff83b 100644 --- a/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue +++ b/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue @@ -108,11 +108,11 @@ const isOpenCustomUrl = computed(() => { }) const customUrl = computed({ - get: () => (isOpenCustomUrl.value ? activeView.value?.custom_path ?? '' : ''), + get: () => (isOpenCustomUrl.value ? activeView.value?.custom_url_path ?? '' : ''), set: async (value) => { if (!activeView.value) return - activeView.value = { ...(activeView.value as any), custom_path: isOpenCustomUrl.value ? value : null } + activeView.value = { ...(activeView.value as any), custom_url_path: isOpenCustomUrl.value ? value : null } }, }) @@ -124,9 +124,9 @@ const toggleCustomUrl = async () => { isUpdating.value.password = true try { if (passwordProtected.value) { - activeView.value = { ...(activeView.value as any), custom_path: null } + activeView.value = { ...(activeView.value as any), custom_url_path: null } } else { - activeView.value = { ...(activeView.value as any), custom_path: '' } + activeView.value = { ...(activeView.value as any), custom_url_path: '' } } await updateSharedView() @@ -251,6 +251,17 @@ function sharedViewUrl() { }` } +const dashboardUrl1 = computed(() => { + // get base url for workspace + const baseUrl = getBaseUrl(workspaceStore.activeWorkspaceId) + + if (baseUrl) { + return `${baseUrl}${appInfo.value?.dashboardPath}` + } + + return dashboardUrl.value +}) + const toggleViewShare = async () => { if (!activeView.value?.id) return @@ -317,7 +328,7 @@ async function updateSharedView() { await $api.dbViewShare.update(activeView.value.id!, { meta, password: activeView.value.password, - ...(activeView.value?.custom_path ? { custom_path: activeView.value?.custom_path } : {}), + custom_url_path: activeView.value?.custom_url_path ?? null, }) } catch (e: any) { message.error(await extractSdkResponseErrorMsg(e)) @@ -337,8 +348,6 @@ const updateSharedViewWithDebounce = useDebounceFn( async function savePreFilledMode() { await updateSharedView() } - -watchEffect(() => {})