Skip to content
Closed
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
27 changes: 12 additions & 15 deletions superset-frontend/src/explore/components/ControlPanelsContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,20 @@ class ControlPanelsContainer extends React.Component {
const querySectionsToRender = [];
const displaySectionsToRender = [];
this.sectionsToRender().forEach(section => {
// if at least one control in the section is not `renderTrigger`
// or asks to be displayed at the Data tab
if (
section.tabOverride === 'data' ||
section.controlSetRows.some(rows =>
rows.some(
control =>
control &&
control.config &&
(!control.config.renderTrigger ||
control.config.tabOverride === 'data'),
),
)
) {
if (section.tabOverride === 'customize') {
displaySectionsToRender.push(section);
} else if (section.tabOverride === 'data') {
querySectionsToRender.push(section);
} else {
displaySectionsToRender.push(section);
const allRenderTriggers = section.controlSetRows.every(rows =>
rows.every(control => control?.config?.renderTrigger),
);
// if at least one control in the section is not `renderTrigger`, it goes to the query section
if (allRenderTriggers) {
displaySectionsToRender.push(section);
} else {
querySectionsToRender.push(section);
}
}
});

Expand Down
1 change: 0 additions & 1 deletion superset-frontend/src/explore/controlPanels/sections.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export const annotations = {
default: [],
description: 'Annotation Layers',
renderTrigger: true,
tabOverride: 'data',
},
},
],
Expand Down
8 changes: 5 additions & 3 deletions superset-frontend/src/explore/controls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
* - renderTrigger: a bool that defines whether the visualization should be re-rendered
when changed. This should `true` for controls that only affect the rendering (client side)
and don't affect the query or backend data processing as those require to re run a query
and fetch the data
and fetch the data. Note that if ALL controls in a seciton are set to "renderTrigger: true"
the section will appear in the "Customize" tab rather than the "Data" tab. You can add a
"tabOverride" parameter to the controls section with a value of "data" or "customize" if
you'd like to override this behavior either way
* - validators: an array of functions that will receive the value of the component and
should return error messages when the value is not valid. The error message gets
bubbled up to the control header, section header and query panel header.
Expand All @@ -48,8 +51,7 @@
anything external to it, like another control's value. For instance it's possible to
show a warning based on the value of another component. It's also possible to bind
arbitrary data from the redux store to the component this way.
* - tabOverride: set to 'data' if you want to force a renderTrigger to show up on the `Data`
tab, otherwise `renderTrigger: true` components will show up on the `Style` tab.

*
* Note that the keys defined in controls in this file that are not listed above represent
* props specific for the React component defined as `type`. Also note that this module work
Expand Down