From 613be839c90b24190344f811b40f707aeab712ea Mon Sep 17 00:00:00 2001 From: "illia.prokopchuk" Date: Thu, 8 Jan 2026 13:37:44 +0200 Subject: [PATCH] Handle permission denied error message in the table --- .../MonitoringApplications.jsx | 16 ++------------ .../MonitoringApplicationsPage.jsx | 4 ---- src/reducers/monitoringApplicationsReducer.js | 21 +++++++++++++++---- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/components/MonitoringApplicationsPage/MonitoringApplications/MonitoringApplications.jsx b/src/components/MonitoringApplicationsPage/MonitoringApplications/MonitoringApplications.jsx index f673e9cbc7..7bd1a784ac 100644 --- a/src/components/MonitoringApplicationsPage/MonitoringApplications/MonitoringApplications.jsx +++ b/src/components/MonitoringApplicationsPage/MonitoringApplications/MonitoringApplications.jsx @@ -102,13 +102,7 @@ const MonitoringApplications = () => { {operatingFunctions.length === 0 && !loading ? ( - + ) : ( )} @@ -120,13 +114,7 @@ const MonitoringApplications = () => { All applications {applications.length === 0 && !loading ? ( - + ) : loading ? ( ) : ( diff --git a/src/components/MonitoringApplicationsPage/MonitoringApplicationsPage.jsx b/src/components/MonitoringApplicationsPage/MonitoringApplicationsPage.jsx index f22fd5ed05..6e295b3c89 100644 --- a/src/components/MonitoringApplicationsPage/MonitoringApplicationsPage.jsx +++ b/src/components/MonitoringApplicationsPage/MonitoringApplicationsPage.jsx @@ -62,10 +62,6 @@ const MonitoringApplicationsPage = () => { showErrorNotification(dispatch, error, '', 'Failed to fetch applications summary') }) dispatch(fetchMonitoringApplications({ project: params.projectName, filters })) - .unwrap() - .catch(error => { - showErrorNotification(dispatch, error, '', 'Failed to fetch monitoring applications') - }) dispatch( fetchMEPWithDetections({ project: params.projectName, diff --git a/src/reducers/monitoringApplicationsReducer.js b/src/reducers/monitoringApplicationsReducer.js index 0599ffa3c1..a15f432bbd 100644 --- a/src/reducers/monitoringApplicationsReducer.js +++ b/src/reducers/monitoringApplicationsReducer.js @@ -22,9 +22,13 @@ import { get } from 'lodash' import { defaultPendingHandler, defaultRejectedHandler } from './redux.util' import { splitApplicationsContent } from '../utils/applications.utils' +import { largeResponseCatchHandler } from '../utils/largeResponseCatchHandler' +import { getErrorMsg } from 'igz-controls/utils/common.util' + +import { DATES_FILTER } from '../constants' + import monitoringApplicationsApi from '../api/monitoringApplications-api' import nuclioApi from '../api/nuclio' -import { DATES_FILTER } from '../constants' const initialState = { applicationsSummary: { @@ -95,7 +99,7 @@ export const fetchMonitoringApplication = createAsyncThunk( export const fetchMonitoringApplications = createAsyncThunk( 'fetchMonitoringApplications', - async ({ project, filters }) => { + async ({ project, filters }, thunkAPI) => { const params = { start: filters[DATES_FILTER].value[0].getTime() } @@ -110,7 +114,13 @@ export const fetchMonitoringApplications = createAsyncThunk( ]) if (mlrunResult.status !== 'fulfilled') { - throw new Error(mlrunResult.reason) + largeResponseCatchHandler( + mlrunResult.reason, + 'Failed to fetch monitoring applications', + thunkAPI.dispatch + ) + + return thunkAPI.rejectWithValue(getErrorMsg(mlrunResult.reason)) } const mlrunApiApps = get(mlrunResult, 'value.data') @@ -180,7 +190,10 @@ const monitoringApplicationsSlice = createSlice({ state.loading = false state.error = null }) - builder.addCase(fetchMonitoringApplications.rejected, defaultRejectedHandler) + builder.addCase(fetchMonitoringApplications.rejected, (state, action) => { + state.loading = false + state.error = action.payload + }) builder.addCase(fetchMonitoringApplicationsSummary.pending, state => { state.applicationsSummary.loading = true })