@@ -16,6 +16,7 @@ import { phone_width } from 'utils/constants'
1616import { useContext } from 'react'
1717import { InstallationContext } from 'components/Contexts/InstallationContext'
1818import { RobotStatus } from 'models/Robot'
19+ import { AnalysisType } from 'models/MissionDefinition'
1920
2021const HeaderSection = styled ( Card ) `
2122 width: 100%;
@@ -175,6 +176,23 @@ export const MissionHeader = ({ mission }: { mission: Mission }) => {
175176 mission . robot . status !== RobotStatus . GoingToRecharging &&
176177 mission . robot . status !== RobotStatus . RechargingWithMission
177178
179+ const analysisType = mission . tasks
180+ . flatMap ( ( task ) => task . inspection ?. analysisTypes ?? [ ] )
181+ . find ( ( type ) => type === AnalysisType . Fencilla || type === AnalysisType . CLOE )
182+
183+ const getDataOverviewUrl = ( type : AnalysisType ) : string | undefined => {
184+ switch ( type ) {
185+ case AnalysisType . Fencilla :
186+ return `/${ installation . installationCode } /data-view?missionName="Perimeter"&statuses=%5B"Successful"%2C"PartiallySuccessful"%5D`
187+ case AnalysisType . CLOE :
188+ return `/${ installation . installationCode } /cloe-view`
189+ default :
190+ return undefined
191+ }
192+ }
193+
194+ const dataOverviewUrl = analysisType ? getDataOverviewUrl ( analysisType ) : undefined
195+
178196 return (
179197 < >
180198 < HeaderSection >
@@ -204,6 +222,11 @@ export const MissionHeader = ({ mission }: { mission: Mission }) => {
204222 >
205223 { TranslateText ( 'View mission definition' ) }
206224 </ Button >
225+ { dataOverviewUrl && (
226+ < Button variant = "outlined" onClick = { ( ) => navigate ( dataOverviewUrl ) } >
227+ { TranslateText ( 'Go to data overview' ) }
228+ </ Button >
229+ ) }
207230 </ TitleSection >
208231 < Typography
209232 variant = "body_long"
@@ -235,7 +258,8 @@ export const MissionHeader = ({ mission }: { mission: Mission }) => {
235258export const SimpleMissionHeader = ( { mission } : { mission : Mission } ) => {
236259 const { TranslateText } = useLanguageContext ( )
237260 const isMissionCompleted = mission . endTime ? true : false
238-
261+ const { installation } = useContext ( InstallationContext )
262+ const navigate = useNavigate ( )
239263 const translatedStartDate = TranslateText ( 'Start date' )
240264 const translatedStartTime = TranslateText ( 'Start time' )
241265 const translatedUsedTime = TranslateText ( 'Time used' )
@@ -264,6 +288,18 @@ export const SimpleMissionHeader = ({ mission }: { mission: Mission }) => {
264288 { mission . description && `${ translatedDescription } : ${ mission . description } ` }
265289 </ Typography >
266290 < StatusReason statusReason = { mission . statusReason } status = { mission . status } > </ StatusReason >
291+ < TitleSection >
292+ < Button
293+ variant = "outlined"
294+ onClick = { ( ) =>
295+ navigate (
296+ `/${ installation . installationCode } /data-view?missionName="Perimeter"&statuses=%5B"Successful"%2C"PartiallySuccessful"%5D`
297+ )
298+ }
299+ >
300+ { TranslateText ( 'Go to data overview' ) }
301+ </ Button >
302+ </ TitleSection >
267303 </ StaticHeaderSection >
268304 < StyledMissionHeader >
269305 < InfoSection >
0 commit comments