[dashboard bug]Instant control should take effect instantly (#3890)

in explore view, controls like color cheme, legend, rich tooltip, etc., change these controls should see effect instantly, without click Run Query.
This commit is contained in:
Grace Guo
2017-11-17 16:34:53 -08:00
committed by GitHub
parent a82bb588f4
commit 831cd21737
4 changed files with 12 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ import ControlPanelsContainer from './ControlPanelsContainer';
import SaveModal from './SaveModal';
import QueryAndSaveBtns from './QueryAndSaveBtns';
import { getExploreUrl } from '../exploreUtils';
import { areObjectsEqual } from '../../reduxUtils';
import { getFormDataFromControls } from '../stores/store';
import { chartPropType } from '../../chart/chartReducer';
import * as exploreActions from '../actions/exploreActions';
@@ -50,6 +51,11 @@ class ExploreViewContainer extends React.Component {
if (np.controls.datasource.value !== this.props.controls.datasource.value) {
this.props.actions.fetchDatasourceMetadata(np.form_data.datasource, true);
}
// if any control value changed and it's an instant control
if (Object.keys(np.controls).some(key => (np.controls[key].renderTrigger &&
!areObjectsEqual(np.controls[key].value, this.props.controls[key].value)))) {
this.props.actions.renderTriggered(new Date().getTime(), this.props.chart.chartKey);
}
}
componentDidUpdate() {