diff --git a/frontend/src/components/Contexts/AlertContext.tsx b/frontend/src/components/Contexts/AlertContext.tsx index e38f67f65..841a5d02d 100644 --- a/frontend/src/components/Contexts/AlertContext.tsx +++ b/frontend/src/components/Contexts/AlertContext.tsx @@ -1,20 +1,20 @@ import { createContext, FC, ReactNode, useContext, useEffect, useState } from 'react' import { addMinutes, max } from 'date-fns' import { Mission, MissionStatus } from 'models/Mission' -import { FailedMissionAlertContent } from 'components/Alerts/FailedMissionAlert' +import { FailedMissionAlertContent, FailedMissionAlertListContent } from 'components/Alerts/FailedMissionAlert' import { BackendAPICaller } from 'api/ApiCaller' import { SignalREventLabels, useSignalRContext } from './SignalRContext' import { useInstallationContext } from './InstallationContext' import { Alert } from 'models/Alert' import { useRobotContext } from './RobotContext' -import { BlockedRobotAlertContent } from 'components/Alerts/BlockedRobotAlert' +import { BlockedRobotAlertContent, BlockedRobotAlertListContent } from 'components/Alerts/BlockedRobotAlert' import { RobotStatus } from 'models/Robot' -import { FailedAlertContent } from 'components/Alerts/FailedAlertContent' +import { FailedAlertContent, FailedAlertListContent } from 'components/Alerts/FailedAlertContent' import { convertUTCDateToLocalDate } from 'utils/StringFormatting' import { AlertCategory } from 'components/Alerts/AlertsBanner' -import { SafeZoneAlertContent } from 'components/Alerts/SafeZoneAlert' +import { SafeZoneAlertContent, SafeZoneAlertListContent } from 'components/Alerts/SafeZoneAlert' import { useLanguageContext } from './LanguageContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' export enum AlertType { MissionFail, @@ -165,6 +165,13 @@ export const AlertProvider: FC = ({ children }) => { />, AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) } if (!recentFailedMissions || recentFailedMissions.length === 0) updateRecentFailedMissions() @@ -213,12 +220,23 @@ export const AlertProvider: FC = ({ children }) => { AlertCategory.INFO ) clearAlert(AlertType.RequestSafeZone) + setListAlert( + alertType, + , + AlertCategory.INFO + ) + clearListAlert(AlertType.RequestSafeZone) } else { setAlert( alertType, , AlertCategory.ERROR ) + setListAlert( + alertType, + , + AlertCategory.ERROR + ) } }) } @@ -232,6 +250,11 @@ export const AlertProvider: FC = ({ children }) => { , AlertCategory.ERROR ) + setListAlert( + AlertType.MissionFail, + , + AlertCategory.ERROR + ) setNewFailedMissions([]) } // eslint-disable-next-line react-hooks/exhaustive-deps @@ -253,8 +276,14 @@ export const AlertProvider: FC = ({ children }) => { , AlertCategory.WARNING ) + setListAlert( + AlertType.BlockedRobot, + , + AlertCategory.WARNING + ) } else { clearAlert(AlertType.BlockedRobot) + clearListAlert(AlertType.BlockedRobot) } } setBlockedRobotNames(newBlockedRobotNames) diff --git a/frontend/src/components/Contexts/InstallationContext.tsx b/frontend/src/components/Contexts/InstallationContext.tsx index 668aab9d0..ec95e7c5c 100644 --- a/frontend/src/components/Contexts/InstallationContext.tsx +++ b/frontend/src/components/Contexts/InstallationContext.tsx @@ -6,7 +6,7 @@ import { SignalREventLabels, useSignalRContext } from './SignalRContext' import { Area } from 'models/Area' import { useLanguageContext } from './LanguageContext' import { AlertType, useAlertContext } from './AlertContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' interface IInstallationContext { @@ -42,7 +42,7 @@ export const InstallationContext = createContext(defaultIn export const InstallationProvider: FC = ({ children }) => { const { registerEvent, connectionReady } = useSignalRContext() const { TranslateText } = useLanguageContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const [allPlantsMap, setAllPlantsMap] = useState>(new Map()) const [installationName, setInstallationName] = useState( window.localStorage.getItem('installationName') || '' @@ -66,6 +66,13 @@ export const InstallationProvider: FC = ({ children }) => { />, AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) // eslint-disable-next-line react-hooks/exhaustive-deps }, []) @@ -99,6 +106,15 @@ export const InstallationProvider: FC = ({ children }) => { />, AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) ) }) @@ -112,6 +128,15 @@ export const InstallationProvider: FC = ({ children }) => { />, AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) // eslint-disable-next-line react-hooks/exhaustive-deps }, [installationCode]) diff --git a/frontend/src/components/Contexts/MissionControlContext.tsx b/frontend/src/components/Contexts/MissionControlContext.tsx index 2077ee1bb..929c7a557 100644 --- a/frontend/src/components/Contexts/MissionControlContext.tsx +++ b/frontend/src/components/Contexts/MissionControlContext.tsx @@ -2,7 +2,7 @@ import { createContext, useContext, useState, FC } from 'react' import { BackendAPICaller } from 'api/ApiCaller' import { MissionStatusRequest } from 'components/Pages/FrontPage/MissionOverview/StopDialogs' import { AlertType, useAlertContext } from './AlertContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' import { useLanguageContext } from './LanguageContext' import { useRobotContext } from './RobotContext' @@ -33,7 +33,7 @@ const defaultManagementState: IMissionControlState = { export const MissionControlProvider: FC = ({ children }) => { const { TranslateText } = useLanguageContext() const { enabledRobots } = useRobotContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const [missionControlState, setMissionControlState] = useState(defaultManagementState) const setIsWaitingForResponse = (robotId: string, isWaiting: boolean) => { @@ -52,6 +52,13 @@ export const MissionControlProvider: FC = ({ children }) => { />, AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) return } @@ -61,7 +68,7 @@ export const MissionControlProvider: FC = ({ children }) => { setIsWaitingForResponse(robotId, true) BackendAPICaller.pauseMission(robotId) .then((_) => setIsWaitingForResponse(robotId, false)) - .catch((_) => + .catch((_) => { setAlert( AlertType.RequestFail, = ({ children }) => { />, AlertCategory.ERROR ) - ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) + }) break } case MissionStatusRequest.Resume: { setIsWaitingForResponse(robotId, true) BackendAPICaller.resumeMission(robotId) .then((_) => setIsWaitingForResponse(robotId, false)) - .catch((_) => + .catch((_) => { setAlert( AlertType.RequestFail, = ({ children }) => { />, AlertCategory.ERROR ) - ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) + }) break } case MissionStatusRequest.Stop: { setIsWaitingForResponse(robotId, true) BackendAPICaller.stopMission(robotId) .then((_) => setIsWaitingForResponse(robotId, false)) - .catch((_) => + .catch((_) => { setAlert( AlertType.RequestFail, = ({ children }) => { />, AlertCategory.ERROR ) - ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) + }) break } } diff --git a/frontend/src/components/Contexts/MissionDefinitionsContext.tsx b/frontend/src/components/Contexts/MissionDefinitionsContext.tsx index e7f73f74f..7d57636b8 100644 --- a/frontend/src/components/Contexts/MissionDefinitionsContext.tsx +++ b/frontend/src/components/Contexts/MissionDefinitionsContext.tsx @@ -5,7 +5,7 @@ import { CondensedMissionDefinition } from 'models/MissionDefinition' import { useInstallationContext } from './InstallationContext' import { useLanguageContext } from './LanguageContext' import { AlertType, useAlertContext } from './AlertContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' interface IMissionDefinitionsContext { @@ -48,7 +48,7 @@ export const useMissionDefinitions = (): IMissionDefinitionsContext => { const { registerEvent, connectionReady } = useSignalRContext() const { installationCode } = useInstallationContext() const { TranslateText } = useLanguageContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() useEffect(() => { if (connectionReady) { @@ -92,6 +92,13 @@ export const useMissionDefinitions = (): IMissionDefinitionsContext => { />, AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) setMissionDefinitions(missionDefinitionsInInstallation ?? []) } diff --git a/frontend/src/components/Contexts/MissionRunsContext.tsx b/frontend/src/components/Contexts/MissionRunsContext.tsx index a8b0e9240..4be3a4f6f 100644 --- a/frontend/src/components/Contexts/MissionRunsContext.tsx +++ b/frontend/src/components/Contexts/MissionRunsContext.tsx @@ -5,7 +5,7 @@ import { SignalREventLabels, useSignalRContext } from './SignalRContext' import { TaskStatus } from 'models/Task' import { useLanguageContext } from './LanguageContext' import { AlertType, useAlertContext } from './AlertContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' import { useInstallationContext } from './InstallationContext' @@ -82,7 +82,7 @@ export const useMissionRuns = (): IMissionRunsContext => { const [loadingMissionSet, setLoadingMissionSet] = useState>(new Set()) const { registerEvent, connectionReady } = useSignalRContext() const { TranslateText } = useLanguageContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const { installationCode } = useInstallationContext() useEffect(() => { @@ -137,6 +137,13 @@ export const useMissionRuns = (): IMissionRunsContext => { , AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) setOngoingMissions(ongoing ?? []) @@ -151,6 +158,13 @@ export const useMissionRuns = (): IMissionRunsContext => { , AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) setMissionQueue(queue ?? []) diff --git a/frontend/src/components/Contexts/RobotContext.tsx b/frontend/src/components/Contexts/RobotContext.tsx index 8de161655..6c3c6da0c 100644 --- a/frontend/src/components/Contexts/RobotContext.tsx +++ b/frontend/src/components/Contexts/RobotContext.tsx @@ -4,7 +4,7 @@ import { Robot } from 'models/Robot' import { SignalREventLabels, useSignalRContext } from './SignalRContext' import { useLanguageContext } from './LanguageContext' import { AlertType, useAlertContext } from './AlertContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' import { useInstallationContext } from './InstallationContext' @@ -34,7 +34,7 @@ export const RobotProvider: FC = ({ children }) => { const [enabledRobots, setEnabledRobots] = useState(defaultRobotState.enabledRobots) const { registerEvent, connectionReady } = useSignalRContext() const { TranslateText } = useLanguageContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const { installationCode } = useInstallationContext() useEffect(() => { @@ -84,6 +84,13 @@ export const RobotProvider: FC = ({ children }) => { , AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) // eslint-disable-next-line react-hooks/exhaustive-deps }, []) diff --git a/frontend/src/components/Contexts/SafeZoneContext.tsx b/frontend/src/components/Contexts/SafeZoneContext.tsx index 379efbbc9..c9b44f724 100644 --- a/frontend/src/components/Contexts/SafeZoneContext.tsx +++ b/frontend/src/components/Contexts/SafeZoneContext.tsx @@ -1,9 +1,10 @@ import { createContext, FC, useContext, useEffect, useState } from 'react' import { useRobotContext } from './RobotContext' -import { AlertType, useAlertContext } from './AlertContext' -import { SafeZoneAlertContent } from 'components/Alerts/SafeZoneAlert' +import { AlertType } from './AlertContext' +import { SafeZoneAlertContent, SafeZoneAlertListContent } from 'components/Alerts/SafeZoneAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' import { RobotFlotillaStatus } from 'models/Robot' +import { useAlertContext } from './AlertContext' interface ISafeZoneContext { safeZoneStatus: boolean @@ -22,7 +23,7 @@ export const SafeZoneContext = createContext(defaultSafeZoneIn export const SafeZoneProvider: FC = ({ children }) => { const [safeZoneStatus, setSafeZoneStatus] = useState(defaultSafeZoneInterface.safeZoneStatus) const { enabledRobots } = useRobotContext() - const { setAlert, clearAlert } = useAlertContext() + const { setAlert, clearAlert, setListAlert, clearListAlert } = useAlertContext() useEffect(() => { const missionQueueFozenStatus = enabledRobots.filter( @@ -31,7 +32,16 @@ export const SafeZoneProvider: FC = ({ children }) => { if (missionQueueFozenStatus.length > 0 && safeZoneStatus === false) { setSafeZoneStatus((oldStatus) => !oldStatus) + clearListAlert(AlertType.DismissSafeZone) clearAlert(AlertType.DismissSafeZone) + setListAlert( + AlertType.RequestSafeZone, + , + AlertCategory.WARNING + ) setAlert( AlertType.RequestSafeZone, , @@ -39,8 +49,15 @@ export const SafeZoneProvider: FC = ({ children }) => { ) } else if (missionQueueFozenStatus.length === 0 && safeZoneStatus === true) { setSafeZoneStatus((oldStatus) => !oldStatus) + clearListAlert(AlertType.RequestSafeZone) + clearListAlert(AlertType.SafeZoneSuccess) clearAlert(AlertType.RequestSafeZone) clearAlert(AlertType.SafeZoneSuccess) + setListAlert( + AlertType.DismissSafeZone, + , + AlertCategory.INFO + ) setAlert( AlertType.DismissSafeZone, , diff --git a/frontend/src/components/Displays/MissionButtons/MissionRestartButton.tsx b/frontend/src/components/Displays/MissionButtons/MissionRestartButton.tsx index 1f5dfe00f..82a9c47d5 100644 --- a/frontend/src/components/Displays/MissionButtons/MissionRestartButton.tsx +++ b/frontend/src/components/Displays/MissionButtons/MissionRestartButton.tsx @@ -7,7 +7,7 @@ import { useLanguageContext } from 'components/Contexts/LanguageContext' import styled from 'styled-components' import { useRef, useState } from 'react' import { AlertType, useAlertContext } from 'components/Contexts/AlertContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { Mission } from 'models/Mission' import { ScheduleMissionWithConfirmDialogs } from '../ConfirmScheduleDialogs/ConfirmScheduleDialog' import { AlertCategory } from 'components/Alerts/AlertsBanner' @@ -32,7 +32,7 @@ enum ReRunOptions { export const MissionRestartButton = ({ mission, hasFailedTasks, smallButton }: MissionProps) => { const { TranslateText } = useLanguageContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const [isOpen, setIsOpen] = useState(false) const [isLocationVerificationOpen, setIsLocationVerificationOpen] = useState(false) const [selectedRerunOption, setSelectedRerunOption] = useState() @@ -47,13 +47,18 @@ export const MissionRestartButton = ({ mission, hasFailedTasks, smallButton }: M const startReRun = (option: ReRunOptions) => { BackendAPICaller.reRunMission(mission.id, option === ReRunOptions.ReRunFailed) .then(() => navigateToHome()) - .catch(() => + .catch(() => { setAlert( AlertType.RequestFail, , AlertCategory.ERROR ) - ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) + }) setIsLocationVerificationOpen(false) } diff --git a/frontend/src/components/Pages/AssetSelectionPage/AssetSelectionPage.tsx b/frontend/src/components/Pages/AssetSelectionPage/AssetSelectionPage.tsx index 752908397..e132dd9de 100644 --- a/frontend/src/components/Pages/AssetSelectionPage/AssetSelectionPage.tsx +++ b/frontend/src/components/Pages/AssetSelectionPage/AssetSelectionPage.tsx @@ -12,7 +12,7 @@ import { EchoPlantInfo } from 'models/EchoMission' import { Header } from 'components/Header/Header' import { config } from 'config' import { AlertType, useAlertContext } from 'components/Contexts/AlertContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' const Centered = styled.div` @@ -74,7 +74,7 @@ export const AssetSelectionPage = () => { const InstallationPicker = () => { const { installationName, switchInstallation } = useInstallationContext() const { TranslateText } = useLanguageContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const [allPlantsMap, setAllPlantsMap] = useState>(new Map()) const [selectedInstallation, setSelectedInstallation] = useState(installationName) const [showActivePlants, setShowActivePlants] = useState(true) @@ -103,6 +103,13 @@ const InstallationPicker = () => { />, AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) } // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/frontend/src/components/Pages/FrontPage/MissionOverview/MissionQueueView.tsx b/frontend/src/components/Pages/FrontPage/MissionOverview/MissionQueueView.tsx index c80dd1424..3347ca544 100644 --- a/frontend/src/components/Pages/FrontPage/MissionOverview/MissionQueueView.tsx +++ b/frontend/src/components/Pages/FrontPage/MissionOverview/MissionQueueView.tsx @@ -8,10 +8,9 @@ import { EmptyMissionQueuePlaceholder } from './NoMissionPlaceholder' import { useLanguageContext } from 'components/Contexts/LanguageContext' import { useMissionsContext } from 'components/Contexts/MissionRunsContext' import { AlertType, useAlertContext } from 'components/Contexts/AlertContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { FrontPageSectionId } from 'models/FrontPageSectionId' import { AlertCategory } from 'components/Alerts/AlertsBanner' - const StyledMissionView = styled.div` display: grid; grid-column: 1/ -1; @@ -29,16 +28,23 @@ const MissionTable = styled.div` export const MissionQueueView = (): JSX.Element => { const { TranslateText } = useLanguageContext() const { missionQueue, ongoingMissions, loadingMissionSet, setLoadingMissionSet } = useMissionsContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const onDeleteMission = (mission: Mission) => - BackendAPICaller.deleteMission(mission.id).catch((_) => + BackendAPICaller.deleteMission(mission.id).catch((_) => { setAlert( AlertType.RequestFail, , AlertCategory.ERROR ) - ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) + }) useEffect(() => { setLoadingMissionSet((currentLoadingNames) => { diff --git a/frontend/src/components/Pages/FrontPage/MissionOverview/ScheduleMissionDialog/SelectMissionsToScheduleDialog.tsx b/frontend/src/components/Pages/FrontPage/MissionOverview/ScheduleMissionDialog/SelectMissionsToScheduleDialog.tsx index 2f3c6bb68..fc12a6890 100644 --- a/frontend/src/components/Pages/FrontPage/MissionOverview/ScheduleMissionDialog/SelectMissionsToScheduleDialog.tsx +++ b/frontend/src/components/Pages/FrontPage/MissionOverview/ScheduleMissionDialog/SelectMissionsToScheduleDialog.tsx @@ -9,7 +9,7 @@ import { useRobotContext } from 'components/Contexts/RobotContext' import { BackendAPICaller } from 'api/ApiCaller' import { useMissionsContext } from 'components/Contexts/MissionRunsContext' import { AlertType, useAlertContext } from 'components/Contexts/AlertContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' const StyledMissionDialog = styled.div` @@ -43,7 +43,7 @@ interface ScheduleDialogProps { export const SelectMissionsToScheduleDialog = ({ echoMissionsList, closeDialog }: ScheduleDialogProps): JSX.Element => { const { TranslateText } = useLanguageContext() const { installationCode } = useInstallationContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const { setLoadingMissionSet } = useMissionsContext() const [selectedEchoMissions, setSelectedEchoMissions] = useState([]) const [selectedRobot, setSelectedRobot] = useState(undefined) @@ -62,6 +62,15 @@ export const SelectMissionsToScheduleDialog = ({ echoMissionsList, closeDialog } />, AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) setLoadingMissionSet((currentSet: Set) => { const updatedSet: Set = new Set(currentSet) updatedSet.delete(String(mission.name)) diff --git a/frontend/src/components/Pages/FrontPage/MissionOverview/StopDialogs.tsx b/frontend/src/components/Pages/FrontPage/MissionOverview/StopDialogs.tsx index 9055a3665..c3f229f78 100644 --- a/frontend/src/components/Pages/FrontPage/MissionOverview/StopDialogs.tsx +++ b/frontend/src/components/Pages/FrontPage/MissionOverview/StopDialogs.tsx @@ -9,7 +9,7 @@ import { BackendAPICaller } from 'api/ApiCaller' import { useInstallationContext } from 'components/Contexts/InstallationContext' import { TaskType } from 'models/Task' import { AlertType, useAlertContext } from 'components/Contexts/AlertContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' import { useRobotContext } from 'components/Contexts/RobotContext' import { RobotFlotillaStatus } from 'models/Robot' @@ -139,7 +139,7 @@ export const StopRobotDialog = (): JSX.Element => { const { enabledRobots } = useRobotContext() const { TranslateText } = useLanguageContext() const { installationCode } = useInstallationContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const safeZoneActivated = enabledRobots.find((r) => r.flotillaStatus === RobotFlotillaStatus.SafeZone) !== undefined @@ -158,6 +158,13 @@ export const StopRobotDialog = (): JSX.Element => { , AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) closeDialog() return @@ -172,6 +179,13 @@ export const StopRobotDialog = (): JSX.Element => { />, AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) closeDialog() } diff --git a/frontend/src/components/Pages/InspectionPage/InspectionOverview.tsx b/frontend/src/components/Pages/InspectionPage/InspectionOverview.tsx index 7dc23ca84..320ef5c31 100644 --- a/frontend/src/components/Pages/InspectionPage/InspectionOverview.tsx +++ b/frontend/src/components/Pages/InspectionPage/InspectionOverview.tsx @@ -11,7 +11,7 @@ import { useInstallationContext } from 'components/Contexts/InstallationContext' import { useRobotContext } from 'components/Contexts/RobotContext' import { AlertType, useAlertContext } from 'components/Contexts/AlertContext' import { EchoMissionDefinition } from 'models/MissionDefinition' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { StyledDict } from './InspectionUtilities' import { Icons } from 'utils/icons' import { StyledButton } from 'components/Styles/StyledComponents' @@ -46,7 +46,7 @@ export const InspectionOverviewSection = () => { const { TranslateText } = useLanguageContext() const { installationCode } = useInstallationContext() const { enabledRobots } = useRobotContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const { missionDefinitions } = useMissionDefinitionsContext() const [isFetchingEchoMissions, setIsFetchingEchoMissions] = useState(false) const [isScheduleMissionDialogOpen, setIsScheduleMissionDialogOpen] = useState(false) @@ -79,6 +79,13 @@ export const InspectionOverviewSection = () => { , AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) setIsFetchingEchoMissions(false) }) } diff --git a/frontend/src/components/Pages/InspectionPage/ScheduleMissionDialogs.tsx b/frontend/src/components/Pages/InspectionPage/ScheduleMissionDialogs.tsx index b3862069f..ce32a18a2 100644 --- a/frontend/src/components/Pages/InspectionPage/ScheduleMissionDialogs.tsx +++ b/frontend/src/components/Pages/InspectionPage/ScheduleMissionDialogs.tsx @@ -9,7 +9,7 @@ import { Icons } from 'utils/icons' import { useRobotContext } from 'components/Contexts/RobotContext' import { StyledAutoComplete, StyledButton, StyledDialog } from 'components/Styles/StyledComponents' import { useMissionsContext } from 'components/Contexts/MissionRunsContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { AlertType, useAlertContext } from 'components/Contexts/AlertContext' import { ScheduleMissionWithConfirmDialogs } from 'components/Displays/ConfirmScheduleDialogs/ConfirmScheduleDialog' import { FrontPageSectionId } from 'models/FrontPageSectionId' @@ -54,7 +54,7 @@ export const ScheduleMissionDialog = (props: IProps): JSX.Element => { const { TranslateText } = useLanguageContext() const { enabledRobots } = useRobotContext() const { setLoadingMissionSet } = useMissionsContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const [isLocalizationVerificationDialogOpen, setIsLocalizationVerificationDialog] = useState(false) const [selectedRobot, setSelectedRobot] = useState() const [missionsToSchedule, setMissionsToSchedule] = useState() @@ -92,6 +92,15 @@ export const ScheduleMissionDialog = (props: IProps): JSX.Element => { />, AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) setLoadingMissionSet((currentSet: Set) => { const updatedSet: Set = new Set(currentSet) updatedSet.delete(String(mission.name)) diff --git a/frontend/src/components/Pages/MissionDefinitionPage/MissionDefinitionPage.tsx b/frontend/src/components/Pages/MissionDefinitionPage/MissionDefinitionPage.tsx index fd71dd446..a238f298a 100644 --- a/frontend/src/components/Pages/MissionDefinitionPage/MissionDefinitionPage.tsx +++ b/frontend/src/components/Pages/MissionDefinitionPage/MissionDefinitionPage.tsx @@ -16,7 +16,7 @@ import { useMissionDefinitionsContext } from 'components/Contexts/MissionDefinit import { StyledPage } from 'components/Styles/StyledComponents' import styled from 'styled-components' import { AlertType, useAlertContext } from 'components/Contexts/AlertContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' const StyledDictCard = styled(StyledDict.Card)` @@ -149,7 +149,7 @@ const MissionDefinitionEditDialog = ({ isDeprecated: false, } const { TranslateText } = useLanguageContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const navigate = useNavigate() const [form, setForm] = useState(defaultMissionDefinitionForm) @@ -190,6 +190,11 @@ const MissionDefinitionEditDialog = ({ , AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) } diff --git a/frontend/src/components/Pages/MissionHistoryPage/MissionHistoryView.tsx b/frontend/src/components/Pages/MissionHistoryPage/MissionHistoryView.tsx index 5ca014703..e615bc44a 100644 --- a/frontend/src/components/Pages/MissionHistoryPage/MissionHistoryView.tsx +++ b/frontend/src/components/Pages/MissionHistoryPage/MissionHistoryView.tsx @@ -13,7 +13,7 @@ import { InspectionType } from 'models/Inspection' import { tokens } from '@equinor/eds-tokens' import { SmallScreenInfoText } from 'utils/InfoText' import { AlertType, useAlertContext } from 'components/Contexts/AlertContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' enum InspectionTableColumns { @@ -121,7 +121,7 @@ export const MissionHistoryView = ({ refreshInterval }: RefreshProps) => { const { TranslateText } = useLanguageContext() const { page, switchPage, filterState, filterIsSet, filterFunctions, filterError, clearFilterError } = useMissionFilterContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const [filteredMissions, setFilteredMissions] = useState([]) const [paginationDetails, setPaginationDetails] = useState() const [isLoading, setIsLoading] = useState(true) @@ -201,6 +201,13 @@ export const MissionHistoryView = ({ refreshInterval }: RefreshProps) => { />, AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) // eslint-disable-next-line react-hooks/exhaustive-deps }, [page, pageSize, switchPage, filterFunctions]) diff --git a/frontend/src/components/Pages/MissionPage/MissionPage.tsx b/frontend/src/components/Pages/MissionPage/MissionPage.tsx index 2b0a50d80..dc34eb2c8 100644 --- a/frontend/src/components/Pages/MissionPage/MissionPage.tsx +++ b/frontend/src/components/Pages/MissionPage/MissionPage.tsx @@ -13,7 +13,7 @@ import { Header } from 'components/Header/Header' import { SignalREventLabels, useSignalRContext } from 'components/Contexts/SignalRContext' import { AlertType, useAlertContext } from 'components/Contexts/AlertContext' import { useLanguageContext } from 'components/Contexts/LanguageContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' const StyledMissionPage = styled.div` @@ -40,7 +40,7 @@ const VideoStreamSection = styled.div` export const MissionPage = () => { const { missionId } = useParams() const { TranslateText } = useLanguageContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const [videoStreams, setVideoStreams] = useState([]) const [selectedMission, setSelectedMission] = useState() const { registerEvent, connectionReady } = useSignalRContext() @@ -77,6 +77,13 @@ export const MissionPage = () => { />, AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) // eslint-disable-next-line react-hooks/exhaustive-deps }, [missionId]) diff --git a/frontend/src/components/Pages/RobotPage/RobotPage.tsx b/frontend/src/components/Pages/RobotPage/RobotPage.tsx index 232257249..cfb4ede8b 100644 --- a/frontend/src/components/Pages/RobotPage/RobotPage.tsx +++ b/frontend/src/components/Pages/RobotPage/RobotPage.tsx @@ -16,7 +16,7 @@ import { useRobotContext } from 'components/Contexts/RobotContext' import { BackendAPICaller } from 'api/ApiCaller' import { StyledButton, StyledPage } from 'components/Styles/StyledComponents' import { AlertType, useAlertContext } from 'components/Contexts/AlertContext' -import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' +import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' const RobotArmMovementSection = styled.div` @@ -56,7 +56,7 @@ const StatusContent = styled.div<{ $alignItems?: string }>` export const RobotPage = () => { const { TranslateText } = useLanguageContext() - const { setAlert } = useAlertContext() + const { setAlert, setListAlert } = useAlertContext() const { robotId } = useParams() const { enabledRobots } = useRobotContext() @@ -72,6 +72,13 @@ export const RobotPage = () => { />, AlertCategory.ERROR ) + setListAlert( + AlertType.RequestFail, + , + AlertCategory.ERROR + ) }) } }