Skip to content

Commit

Permalink
fix cypress
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyongjie committed Sep 28, 2022
1 parent 432fe35 commit eb4acc6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export default function buildQuery(formData: BoxPlotQueryFormData) {
{
...baseQueryObject,
columns: [
...ensureIsArray(formData.columns).map(col => {
...(ensureIsArray(formData.columns).length === 0 &&
formData.granularity_sqla
? [formData.granularity_sqla] // for backwards compatible: if columns control is empty and granularity_sqla was set, the time columns is default distributed column.
: ensureIsArray(formData.columns)
).map(col => {
if (
isPhysicalColumn(col) &&
formData.time_grain_sqla &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const config: ControlPanelConfig = {
description: t('Columns to calculate distribution across.'),
initialValue: (control: ControlState, state: ControlPanelState) => {
if (
!control?.value ||
(state && !control?.value) ||
(Array.isArray(control?.value) && control.value.length === 0)
) {
return [getTemporalColumns(state.datasource).defaultTemporalColumn];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('BoxPlot buildQuery', () => {
const queryContext = buildQuery(formData);
const [query] = queryContext.queries;
expect(query.metrics).toEqual(['foo']);
expect(query.columns).toEqual(['bar']);
expect(query.columns).toEqual(['ds', 'bar']);
expect(query.series_columns).toEqual(['bar']);
const [rule] = query.post_processing || [];
expect(isPostProcessingBoxplot(rule)).toEqual(true);
Expand Down

0 comments on commit eb4acc6

Please sign in to comment.