Browse Source

fix(gui): apply filter and sort on shared view csv download

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3888/head
Pranav C 2 years ago
parent
commit
5da99810c6
  1. 5
      packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue
  2. 6
      packages/nc-gui/composables/useSharedView.ts

5
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',

6
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,

Loading…
Cancel
Save