Added filter in ControlPanelsContainer for explore V2 (#1647)

* Added filter in ControlPanelsContainer

* Move function for getting url params object to utils

* Fixed python test

* Move Filter to separate component

* Added specs and made changes based on comments

* Moved specs to right folder
This commit is contained in:
vera-liu
2016-11-23 09:51:19 -08:00
committed by GitHub
parent cef4a8296a
commit 39ce4aa049
15 changed files with 354 additions and 133 deletions

View File

@@ -4,9 +4,10 @@ import { bindActionCreators } from 'redux';
import * as actions from '../actions/exploreActions';
import { connect } from 'react-redux';
import { Panel, Alert } from 'react-bootstrap';
import { visTypes, sectionsToRender } from '../stores/store';
import { visTypes, sectionsToRender, commonControlPanelSections } from '../stores/store';
import ControlPanelSection from './ControlPanelSection';
import FieldSetRow from './FieldSetRow';
import Filters from './Filters';
const propTypes = {
datasource_type: PropTypes.string.isRequired,
@@ -44,6 +45,12 @@ class ControlPanelsContainer extends React.Component {
return sectionsToRender(this.props.form_data.viz_type, this.props.datasource_type);
}
filterSectionsToRender() {
const filterSections = this.props.datasource_type === 'table' ?
[commonControlPanelSections.filters[0]] : commonControlPanelSections.filters;
return filterSections;
}
fieldOverrides() {
const viz = visTypes[this.props.form_data.viz_type];
return viz.fieldOverrides;
@@ -86,7 +93,20 @@ class ControlPanelsContainer extends React.Component {
))}
</ControlPanelSection>
))}
{/* TODO: add filters section */}
{this.filterSectionsToRender().map((section) => (
<ControlPanelSection
key={section.label}
label={section.label}
tooltip={section.description}
>
<Filters
filterColumnOpts={[]}
filters={this.props.form_data.filters}
actions={this.props.actions}
prefix={section.prefix}
/>
</ControlPanelSection>
))}
</div>
</div>
}