feat: Show connected robots finished with unit test 94% coverage

ref: N25B-142
This commit is contained in:
Björn Otgaar
2025-10-30 15:47:09 +01:00
parent 6a88aa3d75
commit 5e707224cf
4 changed files with 207 additions and 21 deletions

View File

@@ -3,6 +3,9 @@ import { useEffect, useState } from 'react'
export default function ConnectedRobots() {
const [connected, setConnected] = useState<boolean | null>(null);
useEffect(() => {
// We're excepting a stream of data like that looks like this: `data = False` or `data = True`
const eventSource = new EventSource("http://localhost:8000/robot/ping_stream");
@@ -33,6 +36,9 @@ export default function ConnectedRobots() {
<h1>Is robot currently connected?</h1>
<div>
<h2>Robot is currently: {connected == null ? "checking..." : (connected ? "connected! 🟢" : "not connected... 🔴")} </h2>
<h3>
{connected == null ? "If checking continues, make sure CB is properly loaded with robot at least once." : ""}
</h3>
</div>
</div>
);