mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
fix(site): only show provisioner warnings for pending workspaces (#15858)
When creating, starting, stopping or otherwise mutating a workspace, we used to erroneously and briefly display a provisioner health warning alert. This PR updates the component to only display this warning if the build is pending, not "starting" or any other state that means a provisioner has already acquired the job.
This commit is contained in:
@ -111,12 +111,13 @@ export const Workspace: FC<WorkspaceProps> = ({
|
||||
);
|
||||
|
||||
const workspaceRunning = workspace.latest_build.status === "running";
|
||||
const workspacePending = workspace.latest_build.status === "pending";
|
||||
const haveBuildLogs = (buildLogs ?? []).length > 0;
|
||||
const shouldShowBuildLogs = haveBuildLogs && !workspaceRunning;
|
||||
const provisionersHealthy =
|
||||
(workspace.latest_build.matched_provisioners?.available ?? 0) > 0;
|
||||
const shouldDisplayBuildLogs = haveBuildLogs && !workspaceRunning;
|
||||
(workspace.latest_build.matched_provisioners?.available ?? 1) > 0;
|
||||
const shouldShowProvisionerAlert =
|
||||
!workspaceRunning && !haveBuildLogs && !provisionersHealthy;
|
||||
workspacePending && !haveBuildLogs && !provisionersHealthy && !isRestarting;
|
||||
|
||||
return (
|
||||
<div
|
||||
@ -244,7 +245,7 @@ export const Workspace: FC<WorkspaceProps> = ({
|
||||
/>
|
||||
)}
|
||||
|
||||
{shouldDisplayBuildLogs && (
|
||||
{shouldShowBuildLogs && (
|
||||
<WorkspaceBuildLogsSection logs={buildLogs} />
|
||||
)}
|
||||
|
||||
|
Reference in New Issue
Block a user