From 1ad11319403dc43419552e997babc2c7d340ef39 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Sun, 26 Oct 2025 21:18:46 +0700 Subject: [PATCH] [grid] Enhance UI with theme integration and improved status indicators Signed-off-by: Viet Nguyen Duc --- .../src/components/LiveView/LiveView.tsx | 4 ++- .../grid-ui/src/components/Node/Node.tsx | 35 +++++++++++++++---- .../src/components/Node/NodeDetailsDialog.tsx | 26 +++++++++++--- .../RunningSessions/RunningSessions.tsx | 2 +- javascript/grid-ui/src/theme/themes.tsx | 6 ++++ 5 files changed, 60 insertions(+), 13 deletions(-) diff --git a/javascript/grid-ui/src/components/LiveView/LiveView.tsx b/javascript/grid-ui/src/components/LiveView/LiveView.tsx index ebe5aba157d60..ec00d98601928 100644 --- a/javascript/grid-ui/src/components/LiveView/LiveView.tsx +++ b/javascript/grid-ui/src/components/LiveView/LiveView.tsx @@ -20,6 +20,7 @@ import RFB from '@novnc/novnc/lib/rfb' import PasswordDialog from './PasswordDialog' import MuiAlert, { AlertProps } from '@mui/material/Alert' import Snackbar from '@mui/material/Snackbar' +import { useTheme } from '@mui/material/styles' const Alert = React.forwardRef(function Alert ( props, @@ -30,6 +31,7 @@ const Alert = React.forwardRef(function Alert ( const LiveView = forwardRef((props, ref) => { let canvas: any = null + const theme = useTheme() const [open, setOpen] = useState(false) const [message, setMessage] = useState('') @@ -62,7 +64,7 @@ const LiveView = forwardRef((props, ref) => { const newRfb = new RFB.default(canvas, props.url, {}) newRfb.scaleViewport = props.scaleViewport - newRfb.background = 'rgb(247,248,248)' + newRfb.background = theme.palette.background.default newRfb.addEventListener('credentialsrequired', handleCredentials) newRfb.addEventListener('securityfailure', securityFailed) newRfb.addEventListener('connect', connectedToServer) diff --git a/javascript/grid-ui/src/components/Node/Node.tsx b/javascript/grid-ui/src/components/Node/Node.tsx index 294474e4faa23..5cf0d29f931b3 100644 --- a/javascript/grid-ui/src/components/Node/Node.tsx +++ b/javascript/grid-ui/src/components/Node/Node.tsx @@ -101,12 +101,33 @@ function Node (props) { } setLiveViewSessionId('') } - const getCardStyle = (status: string) => ({ - height: '100%', - flexGrow: 1, - opacity: status === 'DOWN' ? 0.25 : 1, - bgcolor: (status === 'DOWN' || status === 'DRAINING') ? 'grey.A100' : '' - }) + const getCardStyle = (status: string) => { + const baseStyle = { + height: '100%', + flexGrow: 1 + } + + if (status === 'DOWN') { + return { + ...baseStyle, + opacity: 0.6, + border: '2px solid', + borderColor: 'error.main', + bgcolor: 'action.disabledBackground' + } + } + + if (status === 'DRAINING') { + return { + ...baseStyle, + border: '2px solid', + borderColor: 'warning.main', + bgcolor: 'action.hover' + } + } + + return baseStyle + } return ( <> @@ -172,7 +193,7 @@ function Node (props) { {node.uri} - + { + if (status === 'DOWN') return 'error' + if (status === 'DRAINING') return 'warning' + return 'success' + } + return ( - - - URI: + + + + URI: + + {nodeInfo.uri} + - {nodeInfo.uri} Node Id: {nodeInfo.id} + + Status: {nodeInfo.status} + OS Arch: {nodeInfo.osInfo.arch} diff --git a/javascript/grid-ui/src/components/RunningSessions/RunningSessions.tsx b/javascript/grid-ui/src/components/RunningSessions/RunningSessions.tsx index a47459fc1f948..52c7df7d60e28 100644 --- a/javascript/grid-ui/src/components/RunningSessions/RunningSessions.tsx +++ b/javascript/grid-ui/src/components/RunningSessions/RunningSessions.tsx @@ -548,7 +548,7 @@ function RunningSessions (props) {