|
1 | 1 | import { type Interpolation, type Theme } from "@emotion/react";
|
2 | 2 | import Button from "@mui/material/Button";
|
3 | 3 | import AlertTitle from "@mui/material/AlertTitle";
|
4 |
| -import { type FC, useEffect, useState } from "react"; |
| 4 | +import { type FC, useEffect } from "react"; |
5 | 5 | import { useNavigate } from "react-router-dom";
|
6 |
| -import dayjs from "dayjs"; |
7 | 6 | import type * as TypesGen from "api/typesGenerated";
|
8 | 7 | import { Alert, AlertDetail } from "components/Alert/Alert";
|
9 | 8 | import { Stack } from "components/Stack/Stack";
|
@@ -86,43 +85,6 @@ export const Workspace: FC<WorkspaceProps> = ({
|
86 | 85 | const navigate = useNavigate();
|
87 | 86 | const theme = useTheme();
|
88 | 87 |
|
89 |
| - const [showAlertPendingInQueue, setShowAlertPendingInQueue] = useState(false); |
90 |
| - |
91 |
| - // 2023-11-15 - MES - This effect will be called every single render because |
92 |
| - // "now" will always change and invalidate the dependency array. Need to |
93 |
| - // figure out if this effect really should run every render (possibly meaning |
94 |
| - // no dependency array at all), or how to get the array stabilized (ideal) |
95 |
| - const now = dayjs(); |
96 |
| - useEffect(() => { |
97 |
| - if ( |
98 |
| - workspace.latest_build.status !== "pending" || |
99 |
| - workspace.latest_build.job.queue_size === 0 |
100 |
| - ) { |
101 |
| - if (!showAlertPendingInQueue) { |
102 |
| - return; |
103 |
| - } |
104 |
| - |
105 |
| - const hideTimer = setTimeout(() => { |
106 |
| - setShowAlertPendingInQueue(false); |
107 |
| - }, 250); |
108 |
| - return () => { |
109 |
| - clearTimeout(hideTimer); |
110 |
| - }; |
111 |
| - } |
112 |
| - |
113 |
| - const t = Math.max( |
114 |
| - 0, |
115 |
| - 5000 - dayjs().diff(dayjs(workspace.latest_build.created_at)), |
116 |
| - ); |
117 |
| - const showTimer = setTimeout(() => { |
118 |
| - setShowAlertPendingInQueue(true); |
119 |
| - }, t); |
120 |
| - |
121 |
| - return () => { |
122 |
| - clearTimeout(showTimer); |
123 |
| - }; |
124 |
| - }, [workspace, now, showAlertPendingInQueue]); |
125 |
| - |
126 | 88 | const transitionStats =
|
127 | 89 | template !== undefined ? ActiveTransition(template, workspace) : undefined;
|
128 | 90 |
|
@@ -238,24 +200,6 @@ export const Workspace: FC<WorkspaceProps> = ({
|
238 | 200 | />
|
239 | 201 | )}
|
240 | 202 |
|
241 |
| - {showAlertPendingInQueue && ( |
242 |
| - <Alert severity="info"> |
243 |
| - <AlertTitle>Workspace build is pending</AlertTitle> |
244 |
| - <AlertDetail> |
245 |
| - <div css={styles.alertPendingInQueue}> |
246 |
| - This workspace build job is waiting for a provisioner to |
247 |
| - become available. If you have been waiting for an extended |
248 |
| - period of time, please contact your administrator for |
249 |
| - assistance. |
250 |
| - </div> |
251 |
| - <div> |
252 |
| - Position in queue:{" "} |
253 |
| - <strong>{workspace.latest_build.job.queue_position}</strong> |
254 |
| - </div> |
255 |
| - </AlertDetail> |
256 |
| - </Alert> |
257 |
| - )} |
258 |
| - |
259 | 203 | {workspace.latest_build.job.error && (
|
260 | 204 | <Alert
|
261 | 205 | severity="error"
|
@@ -358,8 +302,4 @@ const styles = {
|
358 | 302 | firstColumnSpacer: {
|
359 | 303 | flex: 2,
|
360 | 304 | },
|
361 |
| - |
362 |
| - alertPendingInQueue: { |
363 |
| - marginBottom: 12, |
364 |
| - }, |
365 | 305 | } satisfies Record<string, Interpolation<Theme>>;
|
0 commit comments