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
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ export default class FilterScopeSelector extends React.PureComponent {
selectedChartId: filterId,
});
const expanded = getFilterScopeParentNodes(nodes, 1);
// display filter_box chart as checked, but do not show checkbox
const chartIdsInFilterScope = getChartIdsInFilterScope({
filterScope: dashboardFilters[filterId].scopes[columnName],
});
// force display filter_box chart as unchecked, but show checkbox as disabled
const chartIdsInFilterScope = (
getChartIdsInFilterScope({
filterScope: dashboardFilters[filterId].scopes[columnName],
}) || []
).filter(id => id !== filterId);

return {
...mapByChartId,
Expand Down
19 changes: 13 additions & 6 deletions superset/assets/src/dashboard/util/getRevertedFilterScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import { getChartIdAndColumnFromFilterKey } from './getDashboardFilterKey';

export default function getRevertedFilterScope({
checked = [],
filterFields = [],
Expand All @@ -29,14 +31,19 @@ export default function getRevertedFilterScope({
};
}, {});

return filterFields.reduce(
(map, filterField) => ({
return filterFields.reduce((map, filterField) => {
const { chartId } = getChartIdAndColumnFromFilterKey(filterField);
// force display filter_box chart as unchecked, but show checkbox as disabled
const updatedCheckedIds = (
checkedChartIdsByFilterField[filterField] || []
).filter(id => id !== chartId);

return {
...map,
[filterField]: {
...filterScopeMap[filterField],
checked: checkedChartIdsByFilterField[filterField],
checked: updatedCheckedIds,
},
}),
{},
);
};
}, {});
}