This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new f94bda0 [bugfix] metrics issue in 'Periodicity Pivot' (#5931)
f94bda0 is described below
commit f94bda01b43d0b50ca9297cb3facbc08ac7c132b
Author: Maxime Beauchemin <[email protected]>
AuthorDate: Thu Sep 20 21:42:40 2018 -0700
[bugfix] metrics issue in 'Periodicity Pivot' (#5931)
---
superset/assets/src/explore/components/controls/MetricsControl.jsx | 4 +++-
superset/assets/src/explore/visTypes.jsx | 3 +++
superset/viz.py | 4 ++--
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/superset/assets/src/explore/components/controls/MetricsControl.jsx
b/superset/assets/src/explore/components/controls/MetricsControl.jsx
index 0b2d14c..40f73da 100644
--- a/superset/assets/src/explore/components/controls/MetricsControl.jsx
+++ b/superset/assets/src/explore/components/controls/MetricsControl.jsx
@@ -27,11 +27,13 @@ const propTypes = {
columns: PropTypes.arrayOf(columnType),
savedMetrics: PropTypes.arrayOf(savedMetricType),
multi: PropTypes.bool,
+ clearable: PropTypes.bool,
datasourceType: PropTypes.string,
};
const defaultProps = {
onChange: () => {},
+ clearable: true,
};
function isDictionaryForAdhocMetric(value) {
@@ -250,7 +252,7 @@ export default class MetricsControl extends
React.PureComponent {
value={this.props.multi ? this.state.value : this.state.value[0]}
labelKey="label"
valueKey="optionName"
- clearable
+ clearable={this.props.clearable}
closeOnSelect
onChange={this.onChange}
optionRenderer={this.optionRenderer}
diff --git a/superset/assets/src/explore/visTypes.jsx
b/superset/assets/src/explore/visTypes.jsx
index 936da0e..8037ce4 100644
--- a/superset/assets/src/explore/visTypes.jsx
+++ b/superset/assets/src/explore/visTypes.jsx
@@ -332,6 +332,9 @@ export const visTypes = {
choices: D3_TIME_FORMAT_OPTIONS,
default: 'smart_date',
},
+ metric: {
+ clearable: false,
+ },
},
},
diff --git a/superset/viz.py b/superset/viz.py
index 679c4d8..46cd158 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -1133,12 +1133,12 @@ class NVD3TimeSeriesViz(NVD3Viz):
df = df.pivot_table(
index=DTTM_ALIAS,
columns=fd.get('groupby'),
- values=utils.get_metric_names(fd.get('metrics')))
+ values=self.metric_labels)
else:
df = df.pivot_table(
index=DTTM_ALIAS,
columns=fd.get('groupby'),
- values=utils.get_metric_names(fd.get('metrics')),
+ values=self.metric_labels,
fill_value=0,
aggfunc=sum)