Skip to content

Commit

Permalink
fix(plugin-chart-echarts): 'SORT BY METRIC' add checkbox to Gauge (ap…
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenLYZ authored and zhaoyongjie committed Nov 26, 2021
1 parent b6f2df9 commit 62ec367
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
import { buildQueryContext, QueryFormData } from '@superset-ui/core';

export default function buildQuery(formData: QueryFormData) {
const { metric, sort_by_metric } = formData;
return buildQueryContext(formData, baseQueryObject => [
{
...baseQueryObject,
groupby: formData.groupby || [],
...(sort_by_metric && { orderby: [[metric, false]] }),
},
]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ const config: ControlPanelConfig = {
},
},
],
[
{
name: 'sort_by_metric',
config: {
type: 'CheckboxControl',
label: t('Sort by metric'),
description: t('Whether to sort results by the selected metric in descending order.'),
},
},
],
],
},
{
Expand Down

0 comments on commit 62ec367

Please sign in to comment.