Skip to content

Commit

Permalink
chore: change Sort-by and Sort-Descending controls for Bar Chart v2 (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenLYZ authored Aug 2, 2022
1 parent 9362e27 commit 7beda3b
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,35 @@ const config: ControlPanelConfig = {
row_limit: {
default: rowLimit,
},
limit: {
rerender: ['timeseries_limit_metric', 'order_desc'],
},
timeseries_limit_metric: {
label: t('Series Limit Sort By'),
description: t(
'Metric used to order the limit if a series limit is present. ' +
'If undefined reverts to the first metric (where appropriate).',
),
visibility: ({ controls }) => Boolean(controls?.limit.value),
mapStateToProps: (state, controlState) => {
const timeserieslimitProps =
sharedControls.timeseries_limit_metric.mapStateToProps?.(
state,
controlState,
) || {};
timeserieslimitProps.value = state.controls?.limit?.value
? controlState.value
: [];
return timeserieslimitProps;
},
},
order_desc: {
label: t('Series Limit Sort Descending'),
default: false,
description: t(
'Whether to sort descending or ascending if a series limit is present',
),
},
},
formDataOverrides: formData => ({
...formData,
Expand Down

0 comments on commit 7beda3b

Please sign in to comment.