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 let res
if (isPublicView.value) { if (isPublicView.value) {
const { exportFile: sharedViewExportFile } = useSharedView() 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 { } else {
res = await $api.dbViewRow.export( res = await $api.dbViewRow.export(
'noco', 'noco',

6
packages/nc-gui/composables/useSharedView.ts

@ -89,15 +89,15 @@ export function useSharedView() {
offset: number, offset: number,
type: ExportTypes.EXCEL | ExportTypes.CSV, type: ExportTypes.EXCEL | ExportTypes.CSV,
responseType: 'base64' | 'blob', responseType: 'base64' | 'blob',
{ sortsArr, filtersArr }: { sortsArr: SortType[]; filtersArr: FilterType[] },
) => { ) => {
return await $api.public.csvExport(sharedView.value!.uuid!, type, { return await $api.public.csvExport(sharedView.value!.uuid!, type, {
format: responseType, format: responseType,
query: { query: {
fields: fields.map((field) => field.title), fields: fields.map((field) => field.title),
offset, offset,
sortArrJson: JSON.stringify(sorts.value), filterArrJson: JSON.stringify(filtersArr ?? nestedFilters.value),
sortArrJson: JSON.stringify(sortsArr ?? sorts.value),
filterArrJson: JSON.stringify(nestedFilters.value),
}, },
headers: { headers: {
'xc-password': password.value, 'xc-password': password.value,

Loading…
Cancel
Save