@@ -5,7 +5,7 @@ import { Spinner } from "../ui/spinner";
55import type { EnvironmentId , SshDeviceHostConfig } from "@t3tools/contracts" ;
66import { randomUUID } from "../../lib/utils" ;
77import { useState } from "react" ;
8- import { useDeviceState } from "../../state/device" ;
8+ import { deviceEnvironment , useDeviceState } from "../../state/device" ;
99import { serverEnvironment } from "../../state/server" ;
1010import { useAtomCommand } from "../../state/use-atom-command" ;
1111import { Button } from "../ui/button" ;
@@ -110,6 +110,7 @@ export function DeviceHostsSettings(props: { environmentId: EnvironmentId | null
110110 </ p >
111111 ) : null }
112112 < DeviceHostList
113+ environmentLabel = { environment . label }
113114 environmentId = { environment . environmentId }
114115 hosts = { environment . serverConfig ?. settings . deviceHosts ?? [ ] }
115116 busy = { projectScope || busy }
@@ -158,6 +159,7 @@ export function DeviceHostsSettings(props: { environmentId: EnvironmentId | null
158159}
159160
160161function DeviceHostList ( {
162+ environmentLabel,
161163 environmentId,
162164 hosts,
163165 busy,
@@ -166,6 +168,7 @@ function DeviceHostList({
166168 checks,
167169 testConnection,
168170} : {
171+ environmentLabel : string ;
169172 environmentId : EnvironmentId ;
170173 hosts : ReadonlyArray < SshDeviceHostConfig > ;
171174 busy : boolean ;
@@ -175,6 +178,8 @@ function DeviceHostList({
175178 testConnection : ReturnType < typeof useHostConnectionChecks > [ "testConnection" ] ;
176179} ) {
177180 const { state } = useDeviceState ( environmentId ) ;
181+ const retry = useAtomCommand ( deviceEnvironment . list ) ;
182+ const [ retrying , setRetrying ] = useState < string | null > ( null ) ;
178183 return (
179184 < >
180185 { hosts . length === 0 ? (
@@ -238,9 +243,11 @@ function DeviceHostList({
238243 </ div >
239244 < p className = "truncate text-xs text-muted-foreground" > { host . target } </ p >
240245 < DeviceToolVersions
246+ owner = { environmentLabel }
247+ error = { state . hosts . find ( ( value ) => value . id === host . id ) ?. toolInspectionError }
241248 tools = {
242- ( check ?. status === "connected" ? check . tools : undefined ) ??
243- state . hosts . find ( ( value ) => value . id === host . id ) ? .tools
249+ state . hosts . find ( ( value ) => value . id === host . id ) ? .tools ??
250+ ( check ?. status === "connected" ? check . tools : undefined )
244251 }
245252 />
246253 { check ?. status === "local" ? (
@@ -290,14 +297,32 @@ function DeviceHostList({
290297 </ MenuItem >
291298 </ MenuPopup >
292299 </ Menu >
293- < Button
294- size = "sm"
295- variant = "outline"
296- disabled = { busy || progress !== null }
297- onClick = { ( ) => void testConnection ( host ) }
298- >
299- Test connection
300- </ Button >
300+ { status ?. status === "failed" &&
301+ state . supportsHostRetry &&
302+ state . hostStatus !== "disabled" ? (
303+ < Button
304+ size = "sm"
305+ variant = "outline"
306+ disabled = { busy || retrying !== null }
307+ onClick = { ( ) => {
308+ setRetrying ( host . id ) ;
309+ void retry ( { environmentId, input : { retryHostId : host . id } } ) . finally ( ( ) =>
310+ setRetrying ( null ) ,
311+ ) ;
312+ } }
313+ >
314+ { retrying === host . id ? "Retrying…" : "Retry" }
315+ </ Button >
316+ ) : (
317+ < Button
318+ size = "sm"
319+ variant = "outline"
320+ disabled = { busy || progress !== null }
321+ onClick = { ( ) => void testConnection ( host ) }
322+ >
323+ Test connection
324+ </ Button >
325+ ) }
301326 </ div >
302327 ) ;
303328 } ) }
0 commit comments