fix(base): export CSV with the active view's filter (#2541)
The export button only sent the page id, so filtered views still downloaded every row. Send the view's current (including unsaved draft) filter, and bump the ee submodule for server-side support.
This commit is contained in:
parent
2e0538c70e
commit
d3a0c9bfdf
3 changed files with 11 additions and 5 deletions
|
|
@ -20,6 +20,7 @@ import {
|
|||
FilterGroup,
|
||||
} from "@/ee/base/types/base.types";
|
||||
import { exportBaseToCsv } from "@/ee/base/services/base-service";
|
||||
import { normalizeFilter } from "@/ee/base/queries/base-row-query";
|
||||
import { getApiErrorMessage } from "@/lib/api-error";
|
||||
import { ViewTabs } from "@/ee/base/components/views/view-tabs";
|
||||
import { ViewSortConfigPopover } from "@/ee/base/components/views/view-sort-config";
|
||||
|
|
@ -69,11 +70,13 @@ export function BaseToolbar({
|
|||
|
||||
const isKanban = activeView?.type === "kanban";
|
||||
|
||||
const viewFilter = activeView?.config?.filter;
|
||||
|
||||
const handleExport = useCallback(async () => {
|
||||
if (exporting) return;
|
||||
setExporting(true);
|
||||
try {
|
||||
await exportBaseToCsv(base.id);
|
||||
await exportBaseToCsv(base.id, normalizeFilter(viewFilter));
|
||||
} catch (err) {
|
||||
notifications.show({
|
||||
color: "red",
|
||||
|
|
@ -82,7 +85,7 @@ export function BaseToolbar({
|
|||
} finally {
|
||||
setExporting(false);
|
||||
}
|
||||
}, [base.id, exporting, t]);
|
||||
}, [base.id, exporting, t, viewFilter]);
|
||||
|
||||
const openToolbar = useCallback((panel: "sort" | "filter" | "properties") => {
|
||||
setSortOpened(panel === "sort" ? (v) => !v : false);
|
||||
|
|
|
|||
|
|
@ -57,10 +57,13 @@ export async function convertPageToBase(
|
|||
return req.data;
|
||||
}
|
||||
|
||||
export async function exportBaseToCsv(pageId: string): Promise<void> {
|
||||
export async function exportBaseToCsv(
|
||||
pageId: string,
|
||||
filter?: FilterNode,
|
||||
): Promise<void> {
|
||||
const req = await api.post(
|
||||
"/bases/export-csv",
|
||||
{ pageId },
|
||||
{ pageId, filter },
|
||||
{ responseType: "blob" },
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 8190e2182cbbcc5e291217a13147fcd246ede3fe
|
||||
Subproject commit d6260785de583ddb85109802c92499eb9c21b8f0
|
||||
Loading…
Reference in a new issue