Browse Source

feat(nc-gui): allow downloads for kanban view

#3839
pull/3563/head
Wing-Kam Wong 2 years ago
parent
commit
e521898182
  1. 4
      packages/nc-gui/components/smartsheet/Toolbar.vue
  2. 6
      packages/nc-gui/components/smartsheet/toolbar/ShareView.vue
  3. 4
      packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts

4
packages/nc-gui/components/smartsheet/Toolbar.vue

@ -37,9 +37,7 @@ const { allowCSVDownload } = useSharedView()
<LazySmartsheetToolbarShareView v-if="(isForm || isGrid || isKanban) && !isPublic" />
<LazySmartsheetToolbarExport
v-if="(!isPublic && !isUIAllowed('dataInsert') && !isKanban) || (isPublic && allowCSVDownload && !isKanban)"
/>
<LazySmartsheetToolbarExport v-if="(!isPublic && !isUIAllowed('dataInsert')) || (isPublic && allowCSVDownload)" />
<div class="flex-1" />
<LazySmartsheetToolbarReload v-if="!isPublic && !isForm" class="mx-1" />

6
packages/nc-gui/components/smartsheet/toolbar/ShareView.vue

@ -173,7 +173,11 @@ watch(passwordProtected, (value) => {
</div>
<div>
<!-- Allow Download -->
<a-checkbox v-if="shared && shared.type === ViewTypes.GRID" v-model:checked="allowCSVDownload" class="!text-xs">
<a-checkbox
v-if="shared && (shared.type === ViewTypes.GRID || shared.type === ViewTypes.KANBAN)"
v-model:checked="allowCSVDownload"
class="!text-xs"
>
{{ $t('labels.downloadAllowed') }}
</a-checkbox>
</div>

4
packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts

@ -16,7 +16,7 @@ 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) NcError.notFound('Not found');
if (view.type !== ViewTypes.GRID && view.type !== ViewTypes.KANBAN) NcError.notFound('Not found');
if (view.password && view.password !== req.headers?.['xc-password']) {
NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD);
@ -47,7 +47,7 @@ async function exportCsv(req: Request, res: Response) {
const fields = req.query.fields;
if (!view) NcError.notFound('Not found');
if (view.type !== ViewTypes.GRID) NcError.notFound('Not found');
if (view.type !== ViewTypes.GRID && view.type !== ViewTypes.KANBAN) NcError.notFound('Not found');
if (view.password && view.password !== req.headers?.['xc-password']) {
NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD);

Loading…
Cancel
Save