MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / Node

Function Node

javascript/grid-ui/src/components/Node/Node.tsx:78–213  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

76}
77
78function Node (props) {
79 const { node, sessions = [], origin } = props
80 const [liveViewSessionId, setLiveViewSessionId] = useState('')
81 const liveViewRef = useRef<{ disconnect: () => void }>(null)
82
83 const vncSession = sessions.find(session => {
84 try {
85 const capabilities = JSON.parse(session.capabilities)
86 return capabilities['se:vnc'] !== undefined && capabilities['se:vnc'] !== ''
87 } catch (e) {
88 return false
89 }
90 })
91
92 const handleLiveViewIconClick = () => {
93 if (vncSession) {
94 setLiveViewSessionId(vncSession.id)
95 }
96 }
97
98 const handleDialogClose = () => {
99 if (liveViewRef.current) {
100 liveViewRef.current.disconnect()
101 }
102 setLiveViewSessionId('')
103 }
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 }
131
132 return (
133 <>
134 <Card sx={getCardStyle(node.status)}>
135 <CardContent sx={{ pl: 2, pr: 1 }}>

Callers

nothing calls this directly

Calls 4

getCardStyleFunction · 0.85
getVncUrlFunction · 0.85
findMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected