You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2018/05/30 22:29:55 UTC
[incubator-superset] branch master updated: Override time grain in
annotations (#5084)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin 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 875d0b5 Override time grain in annotations (#5084)
875d0b5 is described below
commit 875d0b5ad29ca69f1cad44257688f02072e9f75e
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Wed May 30 15:29:48 2018 -0700
Override time grain in annotations (#5084)
---
superset/assets/src/chart/chartAction.js | 4 +++
.../components/controls/AnnotationLayer.jsx | 31 +++++++++++++++++++---
2 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/superset/assets/src/chart/chartAction.js b/superset/assets/src/chart/chartAction.js
index f1112f5..cb24f65 100644
--- a/superset/assets/src/chart/chartAction.js
+++ b/superset/assets/src/chart/chartAction.js
@@ -70,6 +70,10 @@ export function runAnnotationQuery(annotation, timeout = 60, formData = null, ke
return Promise.resolve();
}
+ const granularity = fd.time_grain_sqla || fd.granularity;
+ fd.time_grain_sqla = granularity;
+ fd.granularity = granularity;
+
const sliceFormData = Object.keys(annotation.overrides)
.reduce((d, k) => ({
...d,
diff --git a/superset/assets/src/explore/components/controls/AnnotationLayer.jsx b/superset/assets/src/explore/components/controls/AnnotationLayer.jsx
index 3403890..875b959 100644
--- a/superset/assets/src/explore/components/controls/AnnotationLayer.jsx
+++ b/superset/assets/src/explore/components/controls/AnnotationLayer.jsx
@@ -269,8 +269,8 @@ export default class AnnotationLayer extends React.PureComponent {
} else {
label = 'Slice';
description = `Use a pre defined Superset Slice as a source for annotations and overlays.
- 'your Slice must be one of these visualization types:
- '[${getSupportedSourceTypes(sourceType)
+ 'your chart must be one of these visualization types:
+ '[${getSupportedSourceTypes(annotationType)
.map(x => vizTypes[x].label).join(', ')}]'`;
}
} else if (annotationType === AnnotationTypes.FORMULA) {
@@ -400,7 +400,7 @@ export default class AnnotationLayer extends React.PureComponent {
name="annotation-override-since"
label="Override 'Since'"
description={`This controls whether the "Since" field from the current
- view should be passed down to the slice containing the annotation data.`}
+ view should be passed down to the chart containing the annotation data.`}
value={!!Object.keys(overrides).find(x => x === 'since')}
onChange={(v) => {
delete overrides.since;
@@ -416,7 +416,7 @@ export default class AnnotationLayer extends React.PureComponent {
name="annotation-override-until"
label="Override 'Until'"
description={`This controls whether the "Until" field from the current
- view should be passed down to the slice containing the annotation data.`}
+ view should be passed down to the chart containing the annotation data.`}
value={!!Object.keys(overrides).find(x => x === 'until')}
onChange={(v) => {
delete overrides.until;
@@ -427,6 +427,29 @@ export default class AnnotationLayer extends React.PureComponent {
}
}}
/>
+ <CheckboxControl
+ hovered
+ name="annotation-override-timegrain"
+ label="Override time grain"
+ description={`This controls whether the time grain field from the current
+ view should be passed down to the chart containing the annotation data.`}
+ value={!!Object.keys(overrides).find(x => x === 'time_grain_sqla')}
+ onChange={(v) => {
+ delete overrides.time_grain_sqla;
+ delete overrides.granularity;
+ if (v) {
+ this.setState({
+ overrides: {
+ ...overrides,
+ time_grain_sqla: null,
+ granularity: null,
+ },
+ });
+ } else {
+ this.setState({ overrides: { ...overrides } });
+ }
+ }}
+ />
<TextControl
hovered
name="annotation-layer-timeshift"
--
To stop receiving notification emails like this one, please contact
maximebeauchemin@apache.org.