From 14dd21f0ecf6b144dc78fafcc67096f386298248 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 12 Jul 2025 14:17:37 -0500 Subject: update ui to show watchdog status --- src/web/src/components/App.jsx | 92 +++++++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 36 deletions(-) (limited to 'src/web') diff --git a/src/web/src/components/App.jsx b/src/web/src/components/App.jsx index 5c82697a..92fe925b 100644 --- a/src/web/src/components/App.jsx +++ b/src/web/src/components/App.jsx @@ -43,6 +43,7 @@ const initialState = { }; const ModeSpecificConnectButton = ({ + connectionWatchdog, controller = {}, mode, pendingReconnect, @@ -85,45 +86,62 @@ const ModeSpecificConnectButton = ({ ); } else { - return ( - <> - {server?.isConnected && ( - disconnect()}> - - - {user?.privileges?.isPrivileged && ( - - )} - - Connected - - )} - {!server?.isConnected && ( - connect()}> - - + if (server?.isConnected) { + return ( + disconnect()}> + + + {user?.privileges?.isPrivileged && ( - - Disconnected - - )} - + )} + + Connected + + ); + } + + // the server is disconnected, and we need to give the user some information about what the client is doing + // options are: + // - nothing. the client was manually disconnected, kicked off by another login, etc., and we're not trying to connect + // - actively trying to make a connection to the server + // - still trying to connect, but waiting for the next connection attempt + let icon = 'close'; + let color = 'red'; + + if (connectionWatchdog?.isAttemptingConnection) { + icon = 'clock'; + color = 'yellow'; + } + + if (server?.isConnecting || server?.IsLoggingIn) { + icon = 'sync alternate loading'; + color = 'green'; + } + + return ( + connect()}> + + + + + Disconnected + ); } }; @@ -264,6 +282,7 @@ class App extends Component { : 'light'), } = this.state; const { + connectionWatchdog = {}, pendingReconnect, pendingRestart, relay = {}, @@ -409,6 +428,7 @@ class App extends Component { Theme