[dashboard] pass dashboard filters to share chart url in dropdown (#7642)
This commit is contained in:
parent
39d67cbc59
commit
f3091c525e
|
|
@ -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,
|
||||
|
|
@ -60,7 +65,7 @@ const BLANK = {};
|
|||
|
||||
const defaultProps = {
|
||||
addFilter: () => BLANK,
|
||||
filters: BLANK,
|
||||
initialValues: BLANK,
|
||||
setControlValue() {},
|
||||
triggerRender: false,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -50,7 +50,7 @@ const BLANK = {};
|
|||
|
||||
const defaultProps = {
|
||||
addFilter: () => BLANK,
|
||||
filters: BLANK,
|
||||
initialValues: BLANK,
|
||||
setControlValue() {},
|
||||
triggerRender: false,
|
||||
};
|
||||
|
|
@ -103,7 +103,7 @@ class ChartRenderer extends React.Component {
|
|||
height,
|
||||
annotationData,
|
||||
datasource,
|
||||
filters,
|
||||
initialValues,
|
||||
formData,
|
||||
queryResponse,
|
||||
setControlValue,
|
||||
|
|
@ -114,7 +114,7 @@ class ChartRenderer extends React.Component {
|
|||
height,
|
||||
annotationData,
|
||||
datasource,
|
||||
filters,
|
||||
filters: initialValues,
|
||||
formData,
|
||||
onAddFilter: this.handleAddFilter,
|
||||
onError: this.handleRenderFailure,
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 || {},
|
||||
|
|
|
|||
Loading…
Reference in New Issue