From 5da99810c67f7268a199f08c72d7bd0a8f632f4f Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sat, 1 Oct 2022 12:13:14 +0530 Subject: [PATCH] fix(gui): apply filter and sort on shared view csv download Signed-off-by: Pranav C --- .../components/smartsheet/toolbar/ExportSubActions.vue | 5 ++++- packages/nc-gui/composables/useSharedView.ts | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue b/packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue index 00cc8554e8..773e2f4187 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue @@ -45,7 +45,10 @@ const exportFile = async (exportType: ExportTypes) => { let res if (isPublicView.value) { const { exportFile: sharedViewExportFile } = useSharedView() - res = await sharedViewExportFile(fields.value, offset, exportType, responseType) + res = await sharedViewExportFile(fields.value, offset, exportType, responseType, { + sortsArr: sorts.value, + filtersArr: nestedFilters.value, + }) } else { res = await $api.dbViewRow.export( 'noco', diff --git a/packages/nc-gui/composables/useSharedView.ts b/packages/nc-gui/composables/useSharedView.ts index 887d15420d..97553d5601 100644 --- a/packages/nc-gui/composables/useSharedView.ts +++ b/packages/nc-gui/composables/useSharedView.ts @@ -89,15 +89,15 @@ export function useSharedView() { offset: number, type: ExportTypes.EXCEL | ExportTypes.CSV, responseType: 'base64' | 'blob', + { sortsArr, filtersArr }: { sortsArr: SortType[]; filtersArr: FilterType[] }, ) => { return await $api.public.csvExport(sharedView.value!.uuid!, type, { format: responseType, query: { fields: fields.map((field) => field.title), offset, - sortArrJson: JSON.stringify(sorts.value), - - filterArrJson: JSON.stringify(nestedFilters.value), + filterArrJson: JSON.stringify(filtersArr ?? nestedFilters.value), + sortArrJson: JSON.stringify(sortsArr ?? sorts.value), }, headers: { 'xc-password': password.value,