File tree 7 files changed +56
-2
lines changed
7 files changed +56
-2
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,13 @@ export const WithoutUpdateAccess: Story = {
98
98
} ,
99
99
}
100
100
101
+ export const PendingInQueue : Story = {
102
+ args : {
103
+ ...Running . args ,
104
+ workspace : Mocks . MockPendingWorkspace ,
105
+ } ,
106
+ }
107
+
101
108
export const Starting : Story = {
102
109
args : {
103
110
...Running . args ,
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import { ImpendingDeletionBanner } from "components/WorkspaceDeletion"
31
31
import { useLocalStorage } from "hooks"
32
32
import { ChooseOne , Cond } from "components/Conditionals/ChooseOne"
33
33
import AlertTitle from "@mui/material/AlertTitle"
34
+ import { Maybe } from "components/Conditionals/Maybe"
34
35
35
36
export enum WorkspaceErrors {
36
37
GET_BUILDS_ERROR = "getBuildsError" ,
@@ -207,6 +208,29 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
207
208
208
209
< TemplateVersionWarnings warnings = { templateWarnings } />
209
210
211
+ < Maybe
212
+ condition = {
213
+ workspace . latest_build . status === "pending" &&
214
+ workspace . latest_build . job . queue_size > 0
215
+ }
216
+ >
217
+ < Alert severity = "info" >
218
+ < AlertTitle > Workspace build is pending</ AlertTitle >
219
+ < AlertDetail >
220
+ < div className = { styles . alertPendingInQueue } >
221
+ This workspace build job is waiting for a provisioner to
222
+ become available. If you have been waiting for an extended
223
+ period of time, please contact your administrator for
224
+ assistance.
225
+ </ div >
226
+ < div >
227
+ Position in queue:{ " " }
228
+ < strong > { workspace . latest_build . job . queue_position } </ strong >
229
+ </ div >
230
+ </ AlertDetail >
231
+ </ Alert >
232
+ </ Maybe >
233
+
210
234
{ failedBuildLogs && (
211
235
< Stack >
212
236
< Alert
@@ -319,5 +343,9 @@ export const useStyles = makeStyles((theme) => {
319
343
fullWidth : {
320
344
width : "100%" ,
321
345
} ,
346
+
347
+ alertPendingInQueue : {
348
+ marginBottom : 12 ,
349
+ } ,
322
350
}
323
351
} )
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export const WorkspaceStatusBadge: FC<
20
20
> = ( { workspace, className } ) => {
21
21
const { text, icon, type } = getDisplayWorkspaceStatus (
22
22
workspace . latest_build . status ,
23
+ workspace . latest_build . job ,
23
24
)
24
25
return (
25
26
< ChooseOne >
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ const Language = {
13
13
template : "Template" ,
14
14
lastUsed : "Last Used" ,
15
15
status : "Status" ,
16
- lastBuiltBy : "Last Built By" ,
17
16
}
18
17
19
18
export interface WorkspacesTableProps {
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {
15
15
MockExperiments ,
16
16
mockApiError ,
17
17
MockUser ,
18
+ MockPendingProvisionerJob ,
18
19
} from "testHelpers/entities"
19
20
import { WorkspacesPageView } from "./WorkspacesPageView"
20
21
import { DashboardProviderContext } from "components/Dashboard/DashboardProvider"
@@ -33,6 +34,10 @@ const createWorkspace = (
33
34
latest_build : {
34
35
...MockWorkspace . latest_build ,
35
36
status,
37
+ job :
38
+ status === "pending"
39
+ ? MockPendingProvisionerJob
40
+ : MockWorkspace . latest_build . job ,
36
41
} ,
37
42
last_used_at : lastUsedAt ,
38
43
}
Original file line number Diff line number Diff line change @@ -310,6 +310,8 @@ export const MockRunningProvisionerJob: TypesGen.ProvisionerJob = {
310
310
export const MockPendingProvisionerJob : TypesGen . ProvisionerJob = {
311
311
...MockProvisionerJob ,
312
312
status : "pending" ,
313
+ queue_position : 2 ,
314
+ queue_size : 4 ,
313
315
}
314
316
export const MockTemplateVersion : TypesGen . TemplateVersion = {
315
317
id : "test-template-version" ,
Original file line number Diff line number Diff line change @@ -194,6 +194,7 @@ export const getDisplayWorkspaceTemplateName = (
194
194
195
195
export const getDisplayWorkspaceStatus = (
196
196
workspaceStatus : TypesGen . WorkspaceStatus ,
197
+ provisionerJob ?: TypesGen . ProvisionerJob ,
197
198
) => {
198
199
const { t } = i18next
199
200
@@ -260,12 +261,23 @@ export const getDisplayWorkspaceStatus = (
260
261
case "pending" :
261
262
return {
262
263
type : "info" ,
263
- text : t ( "workspaceStatus.pending" , { ns : "common" } ) ,
264
+ text : getPendingWorkspaceStatusText ( provisionerJob ) ,
264
265
icon : < QueuedIcon /> ,
265
266
} as const
266
267
}
267
268
}
268
269
270
+ const getPendingWorkspaceStatusText = (
271
+ provisionerJob ?: TypesGen . ProvisionerJob ,
272
+ ) : string => {
273
+ const { t } = i18next
274
+
275
+ if ( ! provisionerJob || provisionerJob . queue_size === 0 ) {
276
+ return t ( "workspaceStatus.pending" , { ns : "common" } )
277
+ }
278
+ return "Position in queue: " + provisionerJob . queue_position
279
+ }
280
+
269
281
const LoadingIcon = ( ) => {
270
282
return < CircularProgress size = { 10 } style = { { color : "#FFF" } } />
271
283
}
You can’t perform that action at this time.
0 commit comments