mirror of
https://github.com/apache/superset.git
synced 2026-04-12 20:57:55 +00:00
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:
@@ -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>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user