Skip to content

Commit 673c678

Browse files
committed
[grid] Showing the queue size on the left panel, Grid UI
1 parent 4f0b218 commit 673c678

File tree

2 files changed

+40
-8
lines changed

2 files changed

+40
-8
lines changed

javascript/grid-ui/src/App.tsx

+15-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,18 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
import { ApolloClient, ApolloProvider, InMemoryCache, NormalizedCacheObject } from '@apollo/client'
19-
import { Route, Switch, RouteComponentProps, withRouter } from 'react-router-dom'
18+
import {
19+
ApolloClient,
20+
ApolloProvider,
21+
InMemoryCache,
22+
NormalizedCacheObject
23+
} from '@apollo/client'
24+
import {
25+
Route,
26+
RouteComponentProps,
27+
Switch,
28+
withRouter
29+
} from 'react-router-dom'
2030
import React, { ReactNode } from 'react'
2131
import ReactModal from 'react-modal'
2232
import { GridConfig } from './config'
@@ -124,6 +134,8 @@ class App extends React.Component<AppProps, AppState> {
124134
const maxSession = error !== undefined ? 0 : data?.grid?.maxSession ?? 0
125135
const sessionCount = error !== undefined ? 0 : data?.grid?.sessionCount ?? 0
126136
const nodeCount = error !== undefined ? 0 : data?.grid?.nodeCount ?? 0
137+
const sessionQueueSize = error !== undefined ? 0
138+
: data?.grid?.sessionQueueSize ?? 0
127139

128140
const topBarSubheader = error ?? data?.grid?.version
129141

@@ -142,6 +154,7 @@ class App extends React.Component<AppProps, AppState> {
142154
maxSession={maxSession}
143155
sessionCount={sessionCount}
144156
nodeCount={nodeCount}
157+
sessionQueueSize={sessionQueueSize}
145158
/>
146159
)}
147160
<main className={classes.content}>

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

+25-6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
Box,
3333
createStyles,
3434
Theme,
35+
Typography,
3536
withStyles
3637
} from '@material-ui/core'
3738
import { withRouter } from 'react-router'
@@ -75,7 +76,11 @@ const useStyles = (theme: Theme): StyleRules => createStyles(
7576
[theme.breakpoints.up('sm')]: {
7677
width: theme.spacing(9)
7778
}
79+
},
80+
queueBackground: {
81+
backgroundColor: theme.palette.secondary.main
7882
}
83+
7984
})
8085

8186
function ListItemLink (props): JSX.Element {
@@ -87,6 +92,7 @@ interface NavBarProps extends RouteComponentProps {
8792
maxSession: number
8893
sessionCount: number
8994
nodeCount: number
95+
sessionQueueSize: number
9096
classes: any
9197
}
9298

@@ -101,6 +107,7 @@ class NavBar extends React.Component<NavBarProps, {}> {
101107
maxSession,
102108
sessionCount,
103109
nodeCount,
110+
sessionQueueSize,
104111
classes,
105112
location
106113
} = this.props
@@ -134,24 +141,36 @@ class NavBar extends React.Component<NavBarProps, {}> {
134141
</ListItemLink>
135142
<ListItemLink href='#sessions'>
136143
<ListItemIcon>
137-
<AssessmentIcon />
144+
<AssessmentIcon/>
138145
</ListItemIcon>
139-
<ListItemText primary='Sessions' />
146+
<ListItemText primary='Sessions'/>
140147
</ListItemLink>
141148
<ListItemLink href='#help'>
142149
<ListItemIcon>
143-
<HelpIcon />
150+
<HelpIcon/>
144151
</ListItemIcon>
145-
<ListItemText primary='Help' />
152+
<ListItemText primary='Help'/>
146153
</ListItemLink>
147154
</div>
148155
</List>
149-
<Box flexGrow={1} />
156+
<Box flexGrow={1}/>
157+
{open && (
158+
<Box p={3} m={1} className={classes.queueBackground}>
159+
<Typography
160+
align='center'
161+
gutterBottom
162+
variant='h4'
163+
>
164+
Queue size: {sessionQueueSize}
165+
</Typography>
166+
</Box>
167+
)}
150168
{showOverallConcurrency && open && (
151169
<OverallConcurrency
152170
sessionCount={sessionCount}
153171
maxSession={maxSession}
154-
/>)}
172+
/>
173+
)}
155174
</Drawer>
156175
)
157176
}

0 commit comments

Comments
 (0)