graceguo-supercat commented on a change in pull request #9886:
URL:
https://github.com/apache/incubator-superset/pull/9886#discussion_r434200484
##########
File path: superset-frontend/src/dashboard/components/RefreshIntervalModal.jsx
##########
@@ -46,23 +54,43 @@ const options = [
class RefreshIntervalModal extends React.PureComponent {
constructor(props) {
super(props);
+ this.modal = React.createRef();
this.state = {
refreshFrequency: props.refreshFrequency,
};
this.handleFrequencyChange = this.handleFrequencyChange.bind(this);
+ this.onSave = this.onSave.bind(this);
+ this.onCancel = this.onCancel.bind(this);
+ }
+
+ onSave() {
+ this.props.onChange(this.state.refreshFrequency, this.props.editMode);
+ this.modal.current.close();
+ }
+
+ onCancel() {
+ this.setState({
+ refreshFrequency: this.props.refreshFrequency,
+ });
+ this.modal.current.close();
}
handleFrequencyChange(opt) {
const value = opt ? opt.value : options[0].value;
this.setState({
refreshFrequency: value,
});
- this.props.onChange(value, this.props.editMode);
}
render() {
+ const { refreshLimit = 0, refreshWarning, editMode } = this.props;
+ const { refreshFrequency = 0 } = this.state;
+ const showRefreshWarning =
+ !!refreshFrequency && !!refreshWarning && refreshFrequency <
refreshLimit;
Review comment:
without !!refreshFrequency, i will get
`showRefreshWarning = refreshFrequency && ....` which is `0`.
And later in the code i use
```
showRefreshWarning && (...)
```
this will show 0
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]