From d194a5497c71c360bac25bb4581d638f886c7eba Mon Sep 17 00:00:00 2001 From: Eddasol Date: Thu, 9 Nov 2023 09:10:23 +0100 Subject: [PATCH] Show only areas on selected installation --- .../src/components/Pages/RobotPage/LocalizationDialog.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Pages/RobotPage/LocalizationDialog.tsx b/frontend/src/components/Pages/RobotPage/LocalizationDialog.tsx index 46beb7f1c..300c6c5bf 100644 --- a/frontend/src/components/Pages/RobotPage/LocalizationDialog.tsx +++ b/frontend/src/components/Pages/RobotPage/LocalizationDialog.tsx @@ -11,6 +11,7 @@ import { Pose } from 'models/Pose' import { Orientation } from 'models/Orientation' import { Mission, MissionStatus } from 'models/Mission' import { tokens } from '@equinor/eds-tokens' +import { useInstallationContext } from 'components/Contexts/InstallationContext' const StyledDialog = styled(Card)` display: flex; @@ -50,6 +51,7 @@ interface RobotProps { export const LocalizationDialog = ({ robot }: RobotProps): JSX.Element => { const { TranslateText } = useLanguageContext() + const { installationCode } = useInstallationContext() const [isLocalizationDialogOpen, setIsLocalizationDialogOpen] = useState(false) const [missionLocalizationStatus, setMissionLocalizationInfo] = useState() const [selectedArea, setSelectedArea] = useState() @@ -70,7 +72,10 @@ export const LocalizationDialog = ({ robot }: RobotProps): JSX.Element => { useEffect(() => { BackendAPICaller.getAreas().then((response: Area[]) => { - setAreas(response) + const relevantAreas = response.filter( + (area) => area.installationCode.toLowerCase() === installationCode.toLowerCase() + ) + setAreas(relevantAreas) }) }, [])