Skip to content

Commit

Permalink
fix(plugin-chart-table): change default queryMode to null (#659)
Browse files Browse the repository at this point in the history
So it can fallback to `getQueryMode` to have better backward
compatibility. Currently existing tables in NOT GROUP BY mode will not
open the "Raw" tab by default.
  • Loading branch information
ktmud authored and zhaoyongjie committed Nov 26, 2021
1 parent b2f4db4 commit c41a607
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ function getQueryMode(controls: ControlStateMapping): QueryMode {
if (mode === QueryMode.aggregate || mode === QueryMode.raw) {
return mode as QueryMode;
}
const groupby = controls?.groupby?.value;
const hasGroupBy = groupby && (groupby as string[])?.length > 0;
return hasGroupBy ? QueryMode.aggregate : QueryMode.raw;
const rawColumns = controls?.all_columns?.value;
const hasRawColumns = rawColumns && (rawColumns as string[])?.length > 0;
return hasRawColumns ? QueryMode.raw : QueryMode.aggregate;
}

/**
Expand All @@ -69,7 +69,7 @@ const isRawMode = isQueryMode(QueryMode.raw);
const queryMode: ControlConfig<'RadioButtonControl'> = {
type: 'RadioButtonControl',
label: t('Query Mode'),
default: QueryMode.aggregate,
default: null,
options: [
{
label: QueryModeLabel[QueryMode.aggregate],
Expand Down

0 comments on commit c41a607

Please sign in to comment.