mirror of https://github.com/apache/superset.git
[bugfix] fix metrics/metric control default (#3009)
We should pick an arbitrary metric by default. This broke when improving the metrics selector recently.
This commit is contained in:
parent
53dead9c29
commit
593861eac6
|
@ -63,8 +63,7 @@ export const controls = {
|
||||||
valueKey: 'metric_name',
|
valueKey: 'metric_name',
|
||||||
optionRenderer: m => <MetricOption metric={m} />,
|
optionRenderer: m => <MetricOption metric={m} />,
|
||||||
valueRenderer: m => <MetricOption metric={m} />,
|
valueRenderer: m => <MetricOption metric={m} />,
|
||||||
default: control =>
|
default: c => c.options && c.options.length > 0 ? [c.options[0].metric_name] : null,
|
||||||
control.choices && control.choices.length > 0 ? [control.choices[0][0]] : null,
|
|
||||||
mapStateToProps: state => ({
|
mapStateToProps: state => ({
|
||||||
options: (state.datasource) ? state.datasource.metrics : [],
|
options: (state.datasource) ? state.datasource.metrics : [],
|
||||||
}),
|
}),
|
||||||
|
@ -100,9 +99,8 @@ export const controls = {
|
||||||
validators: [v.nonEmpty],
|
validators: [v.nonEmpty],
|
||||||
optionRenderer: m => <MetricOption metric={m} />,
|
optionRenderer: m => <MetricOption metric={m} />,
|
||||||
valueRenderer: m => <MetricOption metric={m} />,
|
valueRenderer: m => <MetricOption metric={m} />,
|
||||||
|
default: c => c.options && c.options.length > 0 ? c.options[0].metric_name : null,
|
||||||
valueKey: 'metric_name',
|
valueKey: 'metric_name',
|
||||||
default: control =>
|
|
||||||
control.choices && control.choices.length > 0 ? control.choices[0][0] : null,
|
|
||||||
mapStateToProps: state => ({
|
mapStateToProps: state => ({
|
||||||
options: (state.datasource) ? state.datasource.metrics : [],
|
options: (state.datasource) ? state.datasource.metrics : [],
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in New Issue