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)) + } +} + + + diff --git a/packages/nocodb/src/lib/meta/api/publicApis/publicDataApis.ts b/packages/nocodb/src/lib/meta/api/publicApis/publicDataApis.ts index a318856a45..a40ff85331 100644 --- a/packages/nocodb/src/lib/meta/api/publicApis/publicDataApis.ts +++ b/packages/nocodb/src/lib/meta/api/publicApis/publicDataApis.ts @@ -24,7 +24,11 @@ export async function dataList(req: Request, res: Response) { const view = await View.getByUUID(req.params.sharedViewUuid); if (!view) NcError.notFound('Not found'); - if (view.type !== ViewTypes.GRID && view.type !== ViewTypes.KANBAN) { + if ( + view.type !== ViewTypes.GRID && + view.type !== ViewTypes.KANBAN && + view.type !== ViewTypes.GALLERY + ) { NcError.notFound('Not found'); } @@ -88,7 +92,11 @@ async function groupedDataList(req: Request, res: Response) { if (!view) NcError.notFound('Not found'); - if (view.type !== ViewTypes.GRID && view.type !== ViewTypes.KANBAN) { + if ( + view.type !== ViewTypes.GRID && + view.type !== ViewTypes.KANBAN && + view.type !== ViewTypes.GALLERY + ) { NcError.notFound('Not found'); } diff --git a/packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts b/packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts index a12a78a979..6d56f2f393 100644 --- a/packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts +++ b/packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts @@ -16,7 +16,12 @@ import getAst from '../../../db/sql-data-mapper/lib/sql/helpers/getAst'; async function exportExcel(req: Request, res: Response) { const view = await View.getByUUID(req.params.publicDataUuid); if (!view) NcError.notFound('Not found'); - if (view.type !== ViewTypes.GRID && view.type !== ViewTypes.KANBAN) NcError.notFound('Not found'); + if ( + view.type !== ViewTypes.GRID && + view.type !== ViewTypes.KANBAN && + view.type !== ViewTypes.GALLERY + ) + NcError.notFound('Not found'); if (view.password && view.password !== req.headers?.['xc-password']) { NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD); @@ -30,7 +35,7 @@ async function exportExcel(req: Request, res: Response) { const data = XLSX.utils.json_to_sheet(dbRows); const wb = XLSX.utils.book_new(); XLSX.utils.book_append_sheet(wb, data, view.title); - const buf = XLSX.write(wb, { type: "base64", bookType: "xlsx" }); + const buf = XLSX.write(wb, { type: 'base64', bookType: 'xlsx' }); res.set({ 'Access-Control-Expose-Headers': 'nc-export-offset', 'nc-export-offset': offset, @@ -47,7 +52,12 @@ async function exportCsv(req: Request, res: Response) { const fields = req.query.fields; if (!view) NcError.notFound('Not found'); - if (view.type !== ViewTypes.GRID && view.type !== ViewTypes.KANBAN) NcError.notFound('Not found'); + if ( + view.type !== ViewTypes.GRID && + view.type !== ViewTypes.KANBAN && + view.type !== ViewTypes.GALLERY + ) + NcError.notFound('Not found'); if (view.password && view.password !== req.headers?.['xc-password']) { NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD);