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 3cc6fb6 Add increment back arrow to time player (#6062)
3cc6fb6 is described below
commit 3cc6fb61abc7eb04612940823988979cfc513ed3
Author: Beto Dealmeida <[email protected]>
AuthorDate: Tue Oct 9 11:47:59 2018 -0700
Add increment back arrow to time player (#6062)
* Working on CSS
* Will fix CSS later
* Simplify PR
---
superset/assets/src/visualizations/PlaySlider.jsx | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/superset/assets/src/visualizations/PlaySlider.jsx
b/superset/assets/src/visualizations/PlaySlider.jsx
index fbe635e..88b0335 100644
--- a/superset/assets/src/visualizations/PlaySlider.jsx
+++ b/superset/assets/src/visualizations/PlaySlider.jsx
@@ -47,7 +47,8 @@ export default class PlaySlider extends React.PureComponent {
this.onChange = this.onChange.bind(this);
this.play = this.play.bind(this);
this.pause = this.pause.bind(this);
- this.step = this.step.bind(this);
+ this.stepBackward = this.stepBackward.bind(this);
+ this.stepForward = this.stepForward.bind(this);
this.getPlayClass = this.getPlayClass.bind(this);
this.formatter = this.formatter.bind(this);
}
@@ -76,7 +77,7 @@ export default class PlaySlider extends React.PureComponent {
if (this.state.intervalId != null) {
this.pause();
} else {
- const id = setInterval(this.step, this.intervalMilliseconds);
+ const id = setInterval(this.stepForward, this.intervalMilliseconds);
this.setState({ intervalId: id });
}
}
@@ -84,7 +85,7 @@ export default class PlaySlider extends React.PureComponent {
clearInterval(this.state.intervalId);
this.setState({ intervalId: null });
}
- step() {
+ stepForward() {
const { start, end, step, values, disabled } = this.props;
if (disabled) {
@@ -97,6 +98,19 @@ export default class PlaySlider extends React.PureComponent {
this.props.onChange(nextValues.map(value => value - carriageReturn));
}
+ stepBackward() {
+ const { start, end, step, values, disabled } = this.props;
+
+ if (disabled) {
+ return;
+ }
+
+ const currentValues = Array.isArray(values) ? values : [values, values +
step];
+ const nextValues = currentValues.map(value => value - this.increment);
+ const carriageReturn = (nextValues[0] < start) ? (end - nextValues[1]) : 0;
+
+ this.props.onChange(nextValues.map(value => value + carriageReturn));
+ }
formatter(values) {
if (this.props.disabled) {
return t('Data has no time steps');
@@ -115,8 +129,9 @@ export default class PlaySlider extends React.PureComponent
{
return (
<Row className="play-slider">
<Col md={1} className="padded">
+ <i className="fa fa-step-backward fa-lg slider-button "
onClick={this.stepBackward} />
<i className={this.getPlayClass()} onClick={this.play} />
- <i className="fa fa-step-forward fa-lg slider-button "
onClick={this.step} />
+ <i className="fa fa-step-forward fa-lg slider-button "
onClick={this.stepForward} />
</Col>
<Col md={11} className="padded">
<BootrapSliderWrapper