From 97fa9ef1e2af34a9999bd4bca8c6b89d09883910 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 11 Oct 2022 17:34:25 +0800 Subject: [PATCH] feat(nc-gui): gallery share view --- .../nc-gui/components/shared-view/Gallery.vue | 32 +++++++++++++++++ .../nc-gui/components/smartsheet/Toolbar.vue | 2 +- .../smartsheet/toolbar/ShareView.vue | 8 ++++- .../[projectType]/gallery/[viewId]/index.vue | 35 +++++++++++++++++++ 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 packages/nc-gui/components/shared-view/Gallery.vue create mode 100644 packages/nc-gui/pages/[projectType]/gallery/[viewId]/index.vue diff --git a/packages/nc-gui/components/shared-view/Gallery.vue b/packages/nc-gui/components/shared-view/Gallery.vue new file mode 100644 index 0000000000..7d7bbb5e2c --- /dev/null +++ b/packages/nc-gui/components/shared-view/Gallery.vue @@ -0,0 +1,32 @@ + + + diff --git a/packages/nc-gui/components/smartsheet/Toolbar.vue b/packages/nc-gui/components/smartsheet/Toolbar.vue index d96e88327c..d28c91773a 100644 --- a/packages/nc-gui/components/smartsheet/Toolbar.vue +++ b/packages/nc-gui/components/smartsheet/Toolbar.vue @@ -35,7 +35,7 @@ const { allowCSVDownload } = useSharedView() - +
diff --git a/packages/nc-gui/components/smartsheet/toolbar/ShareView.vue b/packages/nc-gui/components/smartsheet/toolbar/ShareView.vue index 99afe07c3a..fd0878f974 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/ShareView.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/ShareView.vue @@ -98,6 +98,9 @@ const sharedViewUrl = computed(() => { case ViewTypes.KANBAN: viewType = 'kanban' break + case ViewTypes.GALLERY: + viewType = 'gallery' + break default: viewType = 'view' } @@ -314,7 +317,10 @@ watch(passwordProtected, (value) => {
+import { message } from 'ant-design-vue' +import { definePageMeta } from '#imports' + +definePageMeta({ + public: true, + requiresAuth: false, + layout: 'shared-view', +}) + +const route = useRoute() + +const { loadSharedView } = useSharedView() + +const showPassword = ref(false) + +try { + await loadSharedView(route.params.viewId as string) +} catch (e: any) { + if (e?.response?.status === 403) { + showPassword.value = true + } else { + message.error(await extractSdkResponseErrorMsg(e)) + } +} + + +