refactor(drill-detail): address bito code review nitpicks

Extract DrillControlsProps interface to dedupe the onDownloadCSV/
onDownloadXLSX/onReload props shared by TableControlsProps and
SingleQueryResultPaneProp.

Strengthen DrillByModal CSV/XLSX test assertions to match the test
name intent: verify formData contains slice_id: 0, which is the
distinguishing marker set by drilledFormData, rather than only
checking resultFormat/resultType.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
alex-poor
2026-04-22 13:10:55 +12:00
parent ca0e9cf65d
commit 76cdc1fa31
2 changed files with 11 additions and 8 deletions

View File

@@ -593,6 +593,7 @@ describe('Table view with pagination', () => {
expect.objectContaining({
resultFormat: 'csv',
resultType: 'full',
formData: expect.objectContaining({ slice_id: 0 }),
}),
);
});
@@ -623,6 +624,7 @@ describe('Table view with pagination', () => {
expect.objectContaining({
resultFormat: 'xlsx',
resultType: 'full',
formData: expect.objectContaining({ slice_id: 0 }),
}),
);
});

View File

@@ -63,7 +63,13 @@ export interface SamplesPaneProps {
canDownload: boolean;
}
export interface TableControlsProps {
export interface DrillControlsProps {
onDownloadCSV?: () => void;
onDownloadXLSX?: () => void;
onReload?: () => void;
}
export interface TableControlsProps extends DrillControlsProps {
data: Record<string, any>[];
// {datasource.id}__{datasource.type}, eg: 1__table
datasourceId?: string;
@@ -76,9 +82,6 @@ export interface TableControlsProps {
rowLimit?: number;
rowLimitOptions?: { value: number; label: string }[];
onRowLimitChange?: (limit: number) => void;
onDownloadCSV?: () => void;
onDownloadXLSX?: () => void;
onReload?: () => void;
}
export interface QueryResultInterface {
@@ -88,7 +91,8 @@ export interface QueryResultInterface {
data: Record<string, any>[][];
}
export interface SingleQueryResultPaneProp extends QueryResultInterface {
export interface SingleQueryResultPaneProp
extends QueryResultInterface, DrillControlsProps {
// {datasource.id}__{datasource.type}, eg: 1__table
datasourceId?: string;
isVisible: boolean;
@@ -98,7 +102,4 @@ export interface SingleQueryResultPaneProp extends QueryResultInterface {
rowLimit?: number;
rowLimitOptions?: { value: number; label: string }[];
onRowLimitChange?: (limit: number) => void;
onDownloadCSV?: () => void;
onDownloadXLSX?: () => void;
onReload?: () => void;
}