Make explore container resize with browser window (#1608)

This commit is contained in:
vera-liu 2016-11-22 14:36:41 -08:00 committed by GitHub
parent db1ed2a765
commit face5245a9

View File

@ -25,11 +25,18 @@ class ExploreViewContainer extends React.Component {
}; };
} }
componentDidMount() {
window.addEventListener('resize', this.handleResize.bind(this));
}
componentWillUnmount() {
window.removeEventListener('resize', this.handleResize.bind(this));
}
onQuery() { onQuery() {
const data = {}; const data = {};
const form_data = this.props.form_data; const form_data = this.props.form_data;
Object.keys(form_data).forEach((field) => { Object.keys(form_data).forEach((field) => {
// filter out null fields // filter out null fields
if (form_data[field] !== null && field !== 'datasource') { if (form_data[field] !== null && field !== 'datasource') {
data[field] = form_data[field]; data[field] = form_data[field];
} }
@ -64,6 +71,9 @@ class ExploreViewContainer extends React.Component {
this.props.actions.updateExplore( this.props.actions.updateExplore(
this.props.datasource_type, this.props.form_data.datasource, data); this.props.datasource_type, this.props.form_data.datasource, data);
} }
handleResize() {
this.setState({ height: this.getHeight() });
}
toggleModal() { toggleModal() {
this.setState({ showModal: !this.state.showModal }); this.setState({ showModal: !this.state.showModal });
@ -72,6 +82,7 @@ class ExploreViewContainer extends React.Component {
render() { render() {
return ( return (
<div <div
id="explore-container"
className="container-fluid" className="container-fluid"
style={{ style={{
height: this.state.height, height: this.state.height,