diff --git a/superset-frontend/src/explore/reducers/exploreReducer.ts b/superset-frontend/src/explore/reducers/exploreReducer.ts index 92829304c37..11e2bdb627b 100644 --- a/superset-frontend/src/explore/reducers/exploreReducer.ts +++ b/superset-frontend/src/explore/reducers/exploreReducer.ts @@ -144,7 +144,7 @@ interface SetStashFormDataAction { interface SliceUpdatedAction { type: typeof actions.SLICE_UPDATED; - slice: Slice & { + slice: Omit & { owners?: Array<{ value: number; label: string }>; slice_name?: string; }; @@ -175,7 +175,11 @@ type ExploreAction = | SetForceQueryAction | HydrateExplore; -interface ExtendedControlState extends ControlState { +// Extended control state for dynamic form controls - uses Record for flexibility +// since control configs vary significantly across different control types +interface ExtendedControlState { + [key: string]: unknown; + value?: unknown; valueKey?: string; savedMetrics?: unknown[]; columns?: unknown[]; diff --git a/superset-frontend/src/features/reports/ReportModal/actions.ts b/superset-frontend/src/features/reports/ReportModal/actions.ts index 74403a16eae..35e280f0cc1 100644 --- a/superset-frontend/src/features/reports/ReportModal/actions.ts +++ b/superset-frontend/src/features/reports/ReportModal/actions.ts @@ -26,6 +26,7 @@ import { } from 'src/components/MessageToasts/actions'; import { isEmpty } from 'lodash'; import { Dispatch, AnyAction } from 'redux'; +import { ThunkDispatch } from 'redux-thunk'; import { ReportObject, ReportCreationMethod } from 'src/features/reports/types'; import { DashboardInfo, ChartsState } from 'src/dashboard/types'; import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; @@ -130,7 +131,7 @@ export function fetchUISpecificReport({ } const structureFetchAction = ( - dispatch: Dispatch, + dispatch: ThunkDispatch, getState: () => ReportRootState, ) => { const state = getState(); @@ -169,10 +170,14 @@ export const addReport = SupersetClient.post({ endpoint: `/api/v1/report/`, jsonPayload: report, - }).then(({ json }) => { - dispatch({ type: ADD_REPORT, json } as AddReportAction); - dispatch(addSuccessToast(t('The report has been created'))); - }); + }) + .then(({ json }) => { + dispatch({ type: ADD_REPORT, json } as AddReportAction); + dispatch(addSuccessToast(t('The report has been created'))); + }) + .catch(() => { + dispatch(addDangerToast(t('Failed to create report'))); + }); export const EDIT_REPORT = 'EDIT_REPORT' as const; @@ -193,7 +198,9 @@ export const editReport = }); export function toggleActive(report: ReportObject, isActive: boolean) { - return function toggleActiveThunk(dispatch: Dispatch) { + return function toggleActiveThunk( + dispatch: ThunkDispatch, + ) { return SupersetClient.put({ endpoint: encodeURI(`/api/v1/report/${report.id}`), headers: { 'Content-Type': 'application/json' }, diff --git a/superset-frontend/src/features/reports/ReportModal/reducer.ts b/superset-frontend/src/features/reports/ReportModal/reducer.ts index 14bd1c5e8dd..e544aa17177 100644 --- a/superset-frontend/src/features/reports/ReportModal/reducer.ts +++ b/superset-frontend/src/features/reports/ReportModal/reducer.ts @@ -54,7 +54,7 @@ export default function reportsReducer( // functionality changes. const reportObject = report.result?.find( (r: ReportObject) => - (r as Record)[filterField] === resourceId, + (r as unknown as Record)[filterField] === resourceId, ); if (reportObject) { diff --git a/superset-frontend/src/middleware/logger.test.ts b/superset-frontend/src/middleware/logger.test.ts index 2c653e3b118..106f5272478 100644 --- a/superset-frontend/src/middleware/logger.test.ts +++ b/superset-frontend/src/middleware/logger.test.ts @@ -31,6 +31,7 @@ interface MockStore { dashboardInfo: { id: number }; impressionId: string; }; + dispatch: () => void; } interface LogEventAction { @@ -52,6 +53,7 @@ describe('logger middleware', () => { }, impressionId: 'impression_id', }), + dispatch: () => {}, }; const action: LogEventAction = { type: LOG_EVENT, diff --git a/superset-frontend/src/utils/common.ts b/superset-frontend/src/utils/common.ts index 41a8fed11b8..457a7adcb5b 100644 --- a/superset-frontend/src/utils/common.ts +++ b/superset-frontend/src/utils/common.ts @@ -173,5 +173,5 @@ export const detectOS = (): OSType => { export const isSafari = (): boolean => { const { userAgent } = navigator; - return userAgent && /^((?!chrome|android).)*safari/i.test(userAgent); + return Boolean(userAgent && /^((?!chrome|android).)*safari/i.test(userAgent)); };