mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix: Clear native filters state (#16893)
* fix:fix get permission function * fix: clear native filters state
This commit is contained in:
parent
e3b14fe170
commit
3d8cc15cba
@ -50,6 +50,7 @@ const propTypes = {
|
|||||||
removeSliceFromDashboard: PropTypes.func.isRequired,
|
removeSliceFromDashboard: PropTypes.func.isRequired,
|
||||||
triggerQuery: PropTypes.func.isRequired,
|
triggerQuery: PropTypes.func.isRequired,
|
||||||
logEvent: PropTypes.func.isRequired,
|
logEvent: PropTypes.func.isRequired,
|
||||||
|
clearDataMaskState: PropTypes.func.isRequired,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
dashboardInfo: dashboardInfoPropShape.isRequired,
|
dashboardInfo: dashboardInfoPropShape.isRequired,
|
||||||
dashboardState: dashboardStatePropShape.isRequired,
|
dashboardState: dashboardStatePropShape.isRequired,
|
||||||
@ -194,6 +195,7 @@ class Dashboard extends React.PureComponent {
|
|||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
window.removeEventListener('visibilitychange', this.onVisibilityChange);
|
window.removeEventListener('visibilitychange', this.onVisibilityChange);
|
||||||
|
this.props.actions.clearDataMaskState();
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibilityChange() {
|
onVisibilityChange() {
|
||||||
|
@ -33,6 +33,7 @@ import {
|
|||||||
getAllActiveFilters,
|
getAllActiveFilters,
|
||||||
getRelevantDataMask,
|
getRelevantDataMask,
|
||||||
} from 'src/dashboard/util/activeAllDashboardFilters';
|
} from 'src/dashboard/util/activeAllDashboardFilters';
|
||||||
|
import { clearDataMaskState } from '../../dataMask/actions';
|
||||||
|
|
||||||
function mapStateToProps(state: RootState) {
|
function mapStateToProps(state: RootState) {
|
||||||
const {
|
const {
|
||||||
@ -83,6 +84,7 @@ function mapDispatchToProps(dispatch: Dispatch) {
|
|||||||
actions: bindActionCreators(
|
actions: bindActionCreators(
|
||||||
{
|
{
|
||||||
setDatasources,
|
setDatasources,
|
||||||
|
clearDataMaskState,
|
||||||
addSliceToDashboard,
|
addSliceToDashboard,
|
||||||
removeSliceFromDashboard,
|
removeSliceFromDashboard,
|
||||||
triggerQuery,
|
triggerQuery,
|
||||||
|
@ -22,6 +22,11 @@ import { FeatureFlag, isFeatureEnabled } from '../featureFlags';
|
|||||||
import { Filters } from '../dashboard/reducers/types';
|
import { Filters } from '../dashboard/reducers/types';
|
||||||
import { getInitialDataMask } from './reducer';
|
import { getInitialDataMask } from './reducer';
|
||||||
|
|
||||||
|
export const CLEAR_DATA_MASK_STATE = 'CLEAR_DATA_MASK_STATE';
|
||||||
|
export interface ClearDataMaskState {
|
||||||
|
type: typeof CLEAR_DATA_MASK_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
export const UPDATE_DATA_MASK = 'UPDATE_DATA_MASK';
|
export const UPDATE_DATA_MASK = 'UPDATE_DATA_MASK';
|
||||||
export interface UpdateDataMask {
|
export interface UpdateDataMask {
|
||||||
type: typeof UPDATE_DATA_MASK;
|
type: typeof UPDATE_DATA_MASK;
|
||||||
@ -74,7 +79,14 @@ export function clearDataMask(filterId: string | number) {
|
|||||||
return updateDataMask(filterId, getInitialDataMask(filterId));
|
return updateDataMask(filterId, getInitialDataMask(filterId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function clearDataMaskState(): ClearDataMaskState {
|
||||||
|
return {
|
||||||
|
type: CLEAR_DATA_MASK_STATE,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export type AnyDataMaskAction =
|
export type AnyDataMaskAction =
|
||||||
|
| ClearDataMaskState
|
||||||
| UpdateDataMask
|
| UpdateDataMask
|
||||||
| SetDataMaskForFilterConfigFail
|
| SetDataMaskForFilterConfigFail
|
||||||
| SetDataMaskForFilterConfigComplete;
|
| SetDataMaskForFilterConfigComplete;
|
||||||
|
@ -29,6 +29,7 @@ import { URL_PARAMS } from 'src/constants';
|
|||||||
import { DataMaskStateWithId, DataMaskWithId } from './types';
|
import { DataMaskStateWithId, DataMaskWithId } from './types';
|
||||||
import {
|
import {
|
||||||
AnyDataMaskAction,
|
AnyDataMaskAction,
|
||||||
|
CLEAR_DATA_MASK_STATE,
|
||||||
SET_DATA_MASK_FOR_FILTER_CONFIG_COMPLETE,
|
SET_DATA_MASK_FOR_FILTER_CONFIG_COMPLETE,
|
||||||
UPDATE_DATA_MASK,
|
UPDATE_DATA_MASK,
|
||||||
} from './actions';
|
} from './actions';
|
||||||
@ -102,6 +103,8 @@ const dataMaskReducer = produce(
|
|||||||
(draft: DataMaskStateWithId, action: AnyDataMaskAction) => {
|
(draft: DataMaskStateWithId, action: AnyDataMaskAction) => {
|
||||||
const cleanState = {};
|
const cleanState = {};
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
case CLEAR_DATA_MASK_STATE:
|
||||||
|
return cleanState;
|
||||||
case UPDATE_DATA_MASK:
|
case UPDATE_DATA_MASK:
|
||||||
draft[action.filterId] = {
|
draft[action.filterId] = {
|
||||||
...getInitialDataMask(action.filterId),
|
...getInitialDataMask(action.filterId),
|
||||||
|
Loading…
Reference in New Issue
Block a user