Skip to content

Commit 235608f

Browse files
authored
Merge branch 'trunk' into feat/pretty-properties-docstrings
2 parents 16a713c + f7ec959 commit 235608f

File tree

5 files changed

+60
-13
lines changed

5 files changed

+60
-13
lines changed

javascript/grid-ui/src/components/LiveView/LiveView.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import RFB from '@novnc/novnc/lib/rfb'
2020
import PasswordDialog from './PasswordDialog'
2121
import MuiAlert, { AlertProps } from '@mui/material/Alert'
2222
import Snackbar from '@mui/material/Snackbar'
23+
import { useTheme } from '@mui/material/styles'
2324

2425
const Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert (
2526
props,
@@ -30,6 +31,7 @@ const Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert (
3031

3132
const LiveView = forwardRef((props, ref) => {
3233
let canvas: any = null
34+
const theme = useTheme()
3335

3436
const [open, setOpen] = useState(false)
3537
const [message, setMessage] = useState('')
@@ -62,7 +64,7 @@ const LiveView = forwardRef((props, ref) => {
6264

6365
const newRfb = new RFB.default(canvas, props.url, {})
6466
newRfb.scaleViewport = props.scaleViewport
65-
newRfb.background = 'rgb(247,248,248)'
67+
newRfb.background = theme.palette.background.default
6668
newRfb.addEventListener('credentialsrequired', handleCredentials)
6769
newRfb.addEventListener('securityfailure', securityFailed)
6870
newRfb.addEventListener('connect', connectedToServer)

javascript/grid-ui/src/components/Node/Node.tsx

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,33 @@ function Node (props) {
101101
}
102102
setLiveViewSessionId('')
103103
}
104-
const getCardStyle = (status: string) => ({
105-
height: '100%',
106-
flexGrow: 1,
107-
opacity: status === 'DOWN' ? 0.25 : 1,
108-
bgcolor: (status === 'DOWN' || status === 'DRAINING') ? 'grey.A100' : ''
109-
})
104+
const getCardStyle = (status: string) => {
105+
const baseStyle = {
106+
height: '100%',
107+
flexGrow: 1
108+
}
109+
110+
if (status === 'DOWN') {
111+
return {
112+
...baseStyle,
113+
opacity: 0.6,
114+
border: '2px solid',
115+
borderColor: 'error.main',
116+
bgcolor: 'action.disabledBackground'
117+
}
118+
}
119+
120+
if (status === 'DRAINING') {
121+
return {
122+
...baseStyle,
123+
border: '2px solid',
124+
borderColor: 'warning.main',
125+
bgcolor: 'action.hover'
126+
}
127+
}
128+
129+
return baseStyle
130+
}
110131

111132
return (
112133
<>
@@ -172,7 +193,7 @@ function Node (props) {
172193
{node.uri}
173194
</Typography>
174195
</DialogTitle>
175-
<DialogContent dividers sx={{ height: '600px' }}>
196+
<DialogContent dividers sx={{ height: '600px', bgcolor: 'background.default', p: 0 }}>
176197
<LiveView
177198
ref={liveViewRef as any}
178199
url={getVncUrl(vncSession, origin)}

javascript/grid-ui/src/components/Node/NodeDetailsDialog.tsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import {
1919
Box,
2020
Button,
21+
Chip,
2122
Dialog,
2223
DialogActions,
2324
DialogContent,
@@ -35,6 +36,12 @@ function NodeDetailsDialog (props) {
3536
const { node } = props
3637
const nodeInfo: NodeInfo = node
3738

39+
const getStatusColor = (status: string) => {
40+
if (status === 'DOWN') return 'error'
41+
if (status === 'DRAINING') return 'warning'
42+
return 'success'
43+
}
44+
3845
return (
3946
<Box component='span'>
4047
<IconButton
@@ -50,16 +57,27 @@ function NodeDetailsDialog (props) {
5057
aria-labelledby='node-info-dialog' open={open}
5158
>
5259
<DialogTitle id='node-info-dialog'>
53-
<OsLogo osName={nodeInfo.osInfo.name} />
54-
<Box fontWeight='fontWeightBold' mr={1} display='inline'>
55-
URI:
60+
<Box display='flex' alignItems='center' gap={1} flexWrap='wrap'>
61+
<OsLogo osName={nodeInfo.osInfo.name} />
62+
<Box fontWeight='fontWeightBold' display='inline'>
63+
URI:
64+
</Box>
65+
<Box display='inline'>{nodeInfo.uri}</Box>
66+
<Chip
67+
label={nodeInfo.status}
68+
color={getStatusColor(nodeInfo.status)}
69+
size='small'
70+
sx={{ ml: 'auto' }}
71+
/>
5672
</Box>
57-
{nodeInfo.uri}
5873
</DialogTitle>
5974
<DialogContent dividers>
6075
<Typography gutterBottom>
6176
Node Id: {nodeInfo.id}
6277
</Typography>
78+
<Typography gutterBottom>
79+
Status: {nodeInfo.status}
80+
</Typography>
6381
<Typography gutterBottom>
6482
OS Arch: {nodeInfo.osInfo.arch}
6583
</Typography>

javascript/grid-ui/src/components/RunningSessions/RunningSessions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ function RunningSessions (props) {
548548
</DialogTitle>
549549
<DialogContent
550550
dividers
551-
sx={{ height: '600px' }}
551+
sx={{ height: '600px', bgcolor: 'background.default', p: 0 }}
552552
>
553553
<LiveView
554554
ref={liveViewRef}

javascript/grid-ui/src/theme/themes.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ export const lightTheme: Theme = createTheme({
3030
error: {
3131
main: '#FF1744'
3232
},
33+
warning: {
34+
main: '#FF9800'
35+
},
3336
background: {
3437
default: '#F7F8F8'
3538
}
@@ -49,6 +52,9 @@ export const darkTheme: Theme = createTheme({
4952
error: {
5053
main: '#F04747'
5154
},
55+
warning: {
56+
main: '#FFA726'
57+
},
5258
background: {
5359
default: '#0c1117',
5460
paper: '#161B22'

0 commit comments

Comments
 (0)