Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions superset/assets/src/chart/Chart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ const propTypes = {
actions: PropTypes.object,
chartId: PropTypes.number.isRequired,
datasource: PropTypes.object.isRequired,
filters: PropTypes.object,
// original selected values for FilterBox viz
// so that FilterBox can pre-populate selected values
// only affect UI control
initialValues: PropTypes.object,
// formData contains chart's own filter parameter
// and merged with extra filter that current dashboard applying
formData: PropTypes.object.isRequired,
height: PropTypes.number,
width: PropTypes.number,
Expand All @@ -60,7 +65,7 @@ const BLANK = {};

const defaultProps = {
addFilter: () => BLANK,
filters: BLANK,
initialValues: BLANK,
setControlValue() {},
triggerRender: false,
};
Expand Down
8 changes: 4 additions & 4 deletions superset/assets/src/chart/ChartRenderer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const propTypes = {
actions: PropTypes.object,
chartId: PropTypes.number.isRequired,
datasource: PropTypes.object.isRequired,
filters: PropTypes.object,
initialValues: PropTypes.object,
formData: PropTypes.object.isRequired,
height: PropTypes.number,
width: PropTypes.number,
Expand All @@ -50,7 +50,7 @@ const BLANK = {};

const defaultProps = {
addFilter: () => BLANK,
filters: BLANK,
initialValues: BLANK,
setControlValue() {},
triggerRender: false,
};
Expand Down Expand Up @@ -103,7 +103,7 @@ class ChartRenderer extends React.Component {
height,
annotationData,
datasource,
filters,
initialValues,
formData,
queryResponse,
setControlValue,
Expand All @@ -114,7 +114,7 @@ class ChartRenderer extends React.Component {
height,
annotationData,
datasource,
filters,
filters: initialValues,
formData,
onAddFilter: this.handleAddFilter,
onError: this.handleRenderFailure,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class Chart extends React.Component {
chartId={id}
chartStatus={chart.chartStatus}
datasource={datasource}
filters={filters}
initialValues={filters[id]}
formData={formData}
queryResponse={chart.queryResponse}
timeout={timeout}
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/dashboard/containers/Chart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function mapStateToProps(
{},
slice: sliceEntities.slices[id],
timeout: dashboardInfo.common.conf.SUPERSET_WEBSERVER_TIMEOUT,
filters: filters[id] || EMPTY_FILTERS,
filters: filters || EMPTY_FILTERS,
// note: this method caches filters if possible to prevent render cascades
formData: getFormDataWithExtraFilters({
chart,
Expand Down
4 changes: 4 additions & 0 deletions superset/assets/src/dashboard/reducers/getInitialState.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ export default function(bootstrapData) {
dashboardState: {
sliceIds: Array.from(sliceIds),
refresh: false,
// All the filter_box's state in this dashboard
// When dashboard is first loaded into browser,
// its value is from preselect_filters that dashboard owner saved in dashboard's meta data
// When user start interacting with dashboard, it will be user picked values from all filter_box
filters,
directPathToChild,
expandedSlices: dashboard.metadata.expanded_slices || {},
Expand Down