mirror of https://github.com/apache/superset.git
chore: Adds setActiveTabs back (#28520)
This commit is contained in:
parent
5f714b707c
commit
2defa10d37
|
@ -603,6 +603,13 @@ export function setActiveTab(tabId, prevTabId) {
|
||||||
return { type: SET_ACTIVE_TAB, tabId, prevTabId };
|
return { type: SET_ACTIVE_TAB, tabId, prevTabId };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Even though SET_ACTIVE_TABS is not being called from Superset's codebase,
|
||||||
|
// it is being used by Preset extensions.
|
||||||
|
export const SET_ACTIVE_TABS = 'SET_ACTIVE_TABS';
|
||||||
|
export function setActiveTabs(activeTabs) {
|
||||||
|
return { type: SET_ACTIVE_TABS, activeTabs };
|
||||||
|
}
|
||||||
|
|
||||||
export const SET_FOCUSED_FILTER_FIELD = 'SET_FOCUSED_FILTER_FIELD';
|
export const SET_FOCUSED_FILTER_FIELD = 'SET_FOCUSED_FILTER_FIELD';
|
||||||
export function setFocusedFilterField(chartId, column) {
|
export function setFocusedFilterField(chartId, column) {
|
||||||
return { type: SET_FOCUSED_FILTER_FIELD, chartId, column };
|
return { type: SET_FOCUSED_FILTER_FIELD, chartId, column };
|
||||||
|
|
|
@ -38,6 +38,7 @@ import {
|
||||||
SET_FOCUSED_FILTER_FIELD,
|
SET_FOCUSED_FILTER_FIELD,
|
||||||
UNSET_FOCUSED_FILTER_FIELD,
|
UNSET_FOCUSED_FILTER_FIELD,
|
||||||
SET_ACTIVE_TAB,
|
SET_ACTIVE_TAB,
|
||||||
|
SET_ACTIVE_TABS,
|
||||||
SET_FULL_SIZE_CHART_ID,
|
SET_FULL_SIZE_CHART_ID,
|
||||||
ON_FILTERS_REFRESH,
|
ON_FILTERS_REFRESH,
|
||||||
ON_FILTERS_REFRESH_SUCCESS,
|
ON_FILTERS_REFRESH_SUCCESS,
|
||||||
|
@ -188,6 +189,12 @@ export default function dashboardStateReducer(state = {}, action) {
|
||||||
activeTabs: Array.from(newActiveTabs),
|
activeTabs: Array.from(newActiveTabs),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
[SET_ACTIVE_TABS]() {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
activeTabs: action.activeTabs,
|
||||||
|
};
|
||||||
|
},
|
||||||
[SET_OVERRIDE_CONFIRM]() {
|
[SET_OVERRIDE_CONFIRM]() {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import dashboardStateReducer from './dashboardState';
|
import dashboardStateReducer from './dashboardState';
|
||||||
import { setActiveTab } from '../actions/dashboardState';
|
import { setActiveTab, setActiveTabs } from '../actions/dashboardState';
|
||||||
|
|
||||||
describe('DashboardState reducer', () => {
|
describe('DashboardState reducer', () => {
|
||||||
it('SET_ACTIVE_TAB', () => {
|
it('SET_ACTIVE_TAB', () => {
|
||||||
|
@ -35,4 +35,15 @@ describe('DashboardState reducer', () => {
|
||||||
),
|
),
|
||||||
).toEqual({ activeTabs: ['tab2'] });
|
).toEqual({ activeTabs: ['tab2'] });
|
||||||
});
|
});
|
||||||
|
it('SET_ACTIVE_TABS', () => {
|
||||||
|
expect(
|
||||||
|
dashboardStateReducer({ activeTabs: [] }, setActiveTabs(['tab1'])),
|
||||||
|
).toEqual({ activeTabs: ['tab1'] });
|
||||||
|
expect(
|
||||||
|
dashboardStateReducer(
|
||||||
|
{ activeTabs: ['tab1', 'tab2'] },
|
||||||
|
setActiveTabs(['tab3', 'tab4']),
|
||||||
|
),
|
||||||
|
).toEqual({ activeTabs: ['tab3', 'tab4'] });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue