mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
chore(frontend): migrate utility JS files to TypeScript (#36721)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,8 +20,26 @@
|
||||
import * as actions from '../actions/saveModalActions';
|
||||
import { HYDRATE_EXPLORE } from '../actions/hydrateExplore';
|
||||
|
||||
export default function saveModalReducer(state = {}, action) {
|
||||
const actionHandlers = {
|
||||
interface SaveModalState {
|
||||
isVisible?: boolean;
|
||||
dashboards?: unknown[];
|
||||
saveModalAlert?: string;
|
||||
data?: unknown;
|
||||
}
|
||||
|
||||
interface SaveModalAction {
|
||||
type: string;
|
||||
isVisible?: boolean;
|
||||
choices?: unknown[];
|
||||
userId?: string;
|
||||
data?: unknown;
|
||||
}
|
||||
|
||||
export default function saveModalReducer(
|
||||
state: SaveModalState = {},
|
||||
action: SaveModalAction,
|
||||
): SaveModalState {
|
||||
const actionHandlers: Record<string, () => SaveModalState> = {
|
||||
[actions.SET_SAVE_CHART_MODAL_VISIBILITY]() {
|
||||
return { ...state, isVisible: action.isVisible };
|
||||
},
|
||||
@@ -37,11 +55,12 @@ export default function saveModalReducer(state = {}, action) {
|
||||
[actions.SAVE_SLICE_FAILED]() {
|
||||
return { ...state, saveModalAlert: 'Failed to save slice' };
|
||||
},
|
||||
[actions.SAVE_SLICE_SUCCESS](data) {
|
||||
return { ...state, data };
|
||||
[actions.SAVE_SLICE_SUCCESS]() {
|
||||
return { ...state, data: action.data };
|
||||
},
|
||||
[HYDRATE_EXPLORE]() {
|
||||
return { ...action.data.saveModal };
|
||||
const payload = action.data as { saveModal?: SaveModalState } | undefined;
|
||||
return { ...payload?.saveModal };
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user