Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions backend/api/Controllers/Models/RobotResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class RobotResponse

public RobotType Type { get; set; }

public float? AverageDurationPerTag { get; set; }

public IList<RobotCapabilitiesEnum>? RobotCapabilities { get; set; }

[JsonConstructor]
Expand All @@ -58,6 +60,7 @@ public RobotResponse(Robot robot)
IsarUri = robot.IsarUri;
RobotCapabilities = robot.RobotCapabilities;
Type = robot.Type;
AverageDurationPerTag = robot.AverageDurationPerTag;
}
}
}
12 changes: 8 additions & 4 deletions frontend/src/components/Contexts/SignalRContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const SignalRProvider: FC<Props> = ({ children }) => {
signalR.HttpTransportType.LongPolling,
})
.withAutomaticReconnect()
.configureLogging(signalR.LogLevel.Error)
.configureLogging(signalR.LogLevel.Critical)
.build()

newConnection.onclose((error) => {
Expand Down Expand Up @@ -113,15 +113,19 @@ export const SignalRProvider: FC<Props> = ({ children }) => {
setConnectionReady(true)
})
.catch((error) => {
console.error('SignalR connection failed:', error)
setConnectionReady(false)
if (error instanceof Error && error.constructor?.name === 'AbortError') {
// Aborting a connection is expected when the user navigates away or the react dev remounts.
setConnectionReady(false)
} else {
console.error('SignalR connection failed:', error)
setConnectionReady(false)
}
Comment thread
nicholasdalhaug marked this conversation as resolved.
})
return newConnection
}

useEffect(() => {
if (!accounts[0] || inProgress !== 'none') return

const newConnection = resetConnection()

return () => {
Expand Down
15 changes: 12 additions & 3 deletions frontend/src/pages/AssetSelectionPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react'
import { Autocomplete, Button, CircularProgress } from '@equinor/eds-core-react'
import { Autocomplete, Button, CircularProgress, Typography } from '@equinor/eds-core-react'
import styled from 'styled-components'
import { useLanguageContext } from 'components/Contexts/LanguageContext'
import { Header } from 'components/Header/Header'
Expand Down Expand Up @@ -51,28 +51,37 @@ const InstallationPicker = () => {

const [selectedInstallation, setSelectedInstallation] = useState<Installation | undefined>(undefined)
const [installations, setInstallations] = useState<Installation[] | undefined>(undefined)
const [isLoadingInstallations, setIsLoadingInstallations] = useState<boolean>(true)

useEffect(() => {
backendApi
.getInstallations()
.then((installations) => {
setInstallations(installations)
setIsLoadingInstallations(false)
})
.catch(() => {
console.error(`Failed to retrieve list of installations`)
setIsLoadingInstallations(false)
})
}, [])
}, [backendApi])

const handleClick = () => {
navigate(selectedInstallation!.installationCode)
}

if (installations === undefined) {
if (isLoadingInstallations) {
return (
<>
<CircularProgress />
</>
)
} else if (!installations) {
return (
<>
<Typography>Not able to load installations. </Typography>
</>
)
}

return (
Expand Down
Loading