mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
feat: [explore] don't save filters inherited from a dashboard (#9340)
* feat: [explore] don't save filters inherited from a dashboard When navigating to explore from a dashboard context, the current dashboard filter(s) are passed along to explore so that the context is kept. So say you're filtering on "country=Romania", in your dashboard and pivot to explore, that filter is still there and keep on exploring. Now a common issue is that you'll want to make some tweak to your chart that are unrelated to the filter, say toggling the legend off for instance, and then save it. Now you back to your dashboard and even though you started with an "all countries" dashboard, with a global filter on country, now that one chart is stuck on "Romania". Typically you notice this when filtering on something else, say "Italy" and then that one chart now has two mutually exclusive filters, and show "No data". Now, the fix is to flag the filter as "extra" (that's the not-so-good internal name we use for these inherited filters) and make it clear that that specific filter is special and won't be saved when saving the chart. * fix build
This commit is contained in:
committed by
GitHub
parent
3d738eecec
commit
98a71be80b
@@ -19,11 +19,13 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Label, OverlayTrigger } from 'react-bootstrap';
|
||||
import { t } from '@superset-ui/translation';
|
||||
|
||||
import AdhocFilterEditPopover from './AdhocFilterEditPopover';
|
||||
import AdhocFilter from '../AdhocFilter';
|
||||
import columnType from '../propTypes/columnType';
|
||||
import adhocMetricType from '../propTypes/adhocMetricType';
|
||||
import InfoTooltipWithTrigger from '../../components/InfoTooltipWithTrigger';
|
||||
|
||||
const propTypes = {
|
||||
adhocFilter: PropTypes.instanceOf(AdhocFilter).isRequired,
|
||||
@@ -80,7 +82,6 @@ export default class AdhocFilterOption extends React.PureComponent {
|
||||
datasource={this.props.datasource}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<OverlayTrigger
|
||||
ref="overlay"
|
||||
@@ -93,18 +94,31 @@ export default class AdhocFilterOption extends React.PureComponent {
|
||||
onEntered={this.onOverlayEntered}
|
||||
onExited={this.onOverlayExited}
|
||||
>
|
||||
<Label className="adhoc-filter-option">
|
||||
<div onMouseDownCapture={this.onMouseDown}>
|
||||
<span className="m-r-5 option-label">
|
||||
{adhocFilter.getDefaultLabel()}
|
||||
<i
|
||||
className={`glyphicon glyphicon-triangle-${
|
||||
this.state.overlayShown ? 'left' : 'right'
|
||||
} adhoc-label-arrow`}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</Label>
|
||||
<div>
|
||||
{adhocFilter.isExtra && (
|
||||
<InfoTooltipWithTrigger
|
||||
icon="exclamation-triangle"
|
||||
placement="top"
|
||||
className="m-r-5 text-muted"
|
||||
tooltip={t(`
|
||||
This filter was inherited from the dashboard's context.
|
||||
It won't be saved when saving the chart.
|
||||
`)}
|
||||
/>
|
||||
)}
|
||||
<Label className="adhoc-filter-option">
|
||||
<div onMouseDownCapture={this.onMouseDown}>
|
||||
<span className="m-r-5 option-label">
|
||||
{adhocFilter.getDefaultLabel()}
|
||||
<i
|
||||
className={`glyphicon glyphicon-triangle-${
|
||||
this.state.overlayShown ? 'left' : 'right'
|
||||
} adhoc-label-arrow`}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</Label>
|
||||
</div>
|
||||
</OverlayTrigger>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user