-
Notifications
You must be signed in to change notification settings - Fork 978
feat: show queue position of pending workspace build #8244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ import { ImpendingDeletionBanner } from "components/WorkspaceDeletion" | |
import { useLocalStorage } from "hooks" | ||
import { ChooseOne, Cond } from "components/Conditionals/ChooseOne" | ||
import AlertTitle from "@mui/material/AlertTitle" | ||
import { Maybe } from "components/Conditionals/Maybe" | ||
|
||
export enum WorkspaceErrors { | ||
GET_BUILDS_ERROR = "getBuildsError", | ||
|
@@ -207,6 +208,28 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({ | |
|
||
<TemplateVersionWarnings warnings={templateWarnings} /> | ||
|
||
<Maybe | ||
condition={ | ||
workspace.latest_build.status === "pending" && | ||
workspace.latest_build.job.queue_size > 0 | ||
} | ||
> | ||
<Alert severity="info"> | ||
<AlertTitle>Workspace build is pending</AlertTitle> | ||
<AlertDetail> | ||
<div className={styles.alertPendingInQueue}> | ||
This build job is waiting for a provisioner to become | ||
available. If you have been waiting for an extended period, | ||
contact your administrator for assistance. | ||
</div> | ||
<div> | ||
Position in queue:{" "} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems to be necessary. Otherwise, it's merged together: |
||
<strong>{workspace.latest_build.job.queue_position}</strong> | ||
</div> | ||
</AlertDetail> | ||
</Alert> | ||
</Maybe> | ||
|
||
{failedBuildLogs && ( | ||
<Stack> | ||
<Alert | ||
|
@@ -319,5 +342,9 @@ export const useStyles = makeStyles((theme) => { | |
fullWidth: { | ||
width: "100%", | ||
}, | ||
|
||
alertPendingInQueue: { | ||
marginBottom: 12, | ||
}, | ||
} | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,6 +194,7 @@ export const getDisplayWorkspaceTemplateName = ( | |
|
||
export const getDisplayWorkspaceStatus = ( | ||
workspaceStatus: TypesGen.WorkspaceStatus, | ||
provisionerJob?: TypesGen.ProvisionerJob, | ||
) => { | ||
const { t } = i18next | ||
|
||
|
@@ -260,12 +261,23 @@ export const getDisplayWorkspaceStatus = ( | |
case "pending": | ||
return { | ||
type: "info", | ||
text: t("workspaceStatus.pending", { ns: "common" }), | ||
text: getPendingWorkspaceStatusText(provisionerJob), | ||
icon: <QueuedIcon />, | ||
} as const | ||
} | ||
} | ||
|
||
const getPendingWorkspaceStatusText = ( | ||
provisionerJob?: TypesGen.ProvisionerJob, | ||
): string => { | ||
const { t } = i18next | ||
|
||
if (provisionerJob === undefined || provisionerJob.queue_size === 0) { | ||
mtojek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return t("workspaceStatus.pending", { ns: "common" }) | ||
} | ||
return "Position in queue: " + provisionerJob.queue_position | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I skipped this on purpose, as we are not going to implement translations. I learnt some time ago |
||
} | ||
|
||
const LoadingIcon = () => { | ||
return <CircularProgress size={10} style={{ color: "#FFF" }} /> | ||
} |
Uh oh!
There was an error while loading. Please reload this page.