remove extra call to get_viz in explorev2 (#1812)

* Not working errors

* Remove update_explore endpoint, only update explore endpoints in reducer on query

* Change scroll to auto and make container reponse to height:

* Remove update_explore endpoint

* Remove can_update_explore perm
This commit is contained in:
vera-liu
2016-12-12 10:58:07 -08:00
committed by GitHub
parent 699602d1c5
commit 9f7486f402
8 changed files with 84 additions and 116 deletions

View File

@@ -26,13 +26,13 @@ const propTypes = {
json_endpoint: PropTypes.string.isRequired,
csv_endpoint: PropTypes.string.isRequired,
standalone_endpoint: PropTypes.string.isRequired,
query: PropTypes.string.isRequired,
query: PropTypes.string,
column_formats: PropTypes.object,
data: PropTypes.any,
chartStatus: PropTypes.bool,
chartStatus: PropTypes.string,
isStarred: PropTypes.bool.isRequired,
chartUpdateStartTime: PropTypes.string.isRequired,
chartUpdateEndTime: PropTypes.string.isRequired,
chartUpdateStartTime: PropTypes.number.isRequired,
chartUpdateEndTime: PropTypes.number,
alert: PropTypes.string,
table_name: PropTypes.string,
};
@@ -55,7 +55,15 @@ class ChartContainer extends React.Component {
}
componentWillReceiveProps(nextProps) {
this.setState({ mockSlice: this.getMockedSliceObject(nextProps) });
if (nextProps.chartStatus !== this.props.chartStatus
|| nextProps.height !== this.props.height) {
this.setState({ mockSlice: this.getMockedSliceObject(nextProps) });
}
}
shouldComponentUpdate(nextProps) {
return (nextProps.chartStatus !== this.props.chartStatus
|| nextProps.height !== this.props.height);
}
componentDidUpdate() {
@@ -114,8 +122,10 @@ class ChartContainer extends React.Component {
{}
),
done: () => {
done: (payload) => {
// finished rendering callback
// Todo: end timer and chartLoading set to success
props.actions.chartUpdateSucceeded(payload.query);
},
clearError: () => {
@@ -166,16 +176,19 @@ class ChartContainer extends React.Component {
</Alert>
);
}
if (this.props.chartStatus === 'loading') {
return (<img alt="loading" width="25" src="/static/assets/images/loading.gif" />);
}
const loading = this.props.chartStatus === 'loading';
return (
<div
id={this.props.containerId}
ref={(ref) => { this.chartContainerRef = ref; }}
className={this.props.viz_type}
style={{ overflowX: 'scroll' }}
/>
<div>
{loading &&
<img alt="loading" width="25" src="/static/assets/images/loading.gif" />
}
<div
id={this.props.containerId}
ref={(ref) => { this.chartContainerRef = ref; }}
className={this.props.viz_type}
style={{ overflowX: 'auto' }}
/>
</div>
);
}
@@ -219,7 +232,7 @@ class ChartContainer extends React.Component {
endTime={this.props.chartUpdateEndTime}
isRunning={this.props.chartStatus === 'loading'}
state={CHART_STATUS_MAP[this.props.chartStatus]}
style={{ 'font-size': '10px', 'margin-right': '5px' }}
style={{ fontSize: '10px', marginRight: '5px' }}
/>
<ExploreActionButtons
slice={this.state.mockSlice}