Skip to content

[dashboard] Don't show 'Continue with Default Image' button while the build is still running #4104

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

Merged
merged 2 commits into from
Apr 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions components/dashboard/src/start/StartWorkspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
// Preparing means that we haven't actually started the workspace instance just yet, but rather
// are still preparing for launch. This means we're building the Docker image for the workspace.
case "preparing":
return <ImageBuildView workspaceId={this.state.workspaceInstance.workspaceId} onStartWithDefaultImage={() => this.startWorkspace(true, true)} />;
return <ImageBuildView workspaceId={this.state.workspaceInstance.workspaceId} />;

// Pending means the workspace does not yet consume resources in the cluster, but rather is looking for
// some space within the cluster. If for example the cluster needs to scale up to accomodate the
Expand Down Expand Up @@ -267,7 +267,11 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
case "stopped":
phase = StartPhase.Stopped;
if (this.state.hasImageBuildLogs) {
return <ImageBuildView workspaceId={this.state.workspaceInstance.workspaceId} onStartWithDefaultImage={() => this.startWorkspace(true, true)} phase={phase} error={error} />;
const restartWithDefaultImage = (event: React.MouseEvent) => {
(event.target as HTMLButtonElement).disabled = true;
this.startWorkspace(true, true);
}
return <ImageBuildView workspaceId={this.state.workspaceInstance.workspaceId} onStartWithDefaultImage={restartWithDefaultImage} phase={phase} error={error} />;
}
if (!isHeadless && this.state.workspaceInstance.status.conditions.timeout) {
title = 'Timed Out';
Expand Down Expand Up @@ -297,7 +301,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,

interface ImageBuildViewProps {
workspaceId: string;
onStartWithDefaultImage: () => void;
onStartWithDefaultImage?: (event: React.MouseEvent) => void;
phase?: StartPhase;
error?: StartWorkspaceError;
}
Expand Down Expand Up @@ -329,7 +333,7 @@ function ImageBuildView(props: ImageBuildViewProps) {
<Suspense fallback={<div />}>
<WorkspaceLogs logsEmitter={logsEmitter} errorMessage={props.error?.message} />
</Suspense>
<button className="mt-6 secondary" onClick={props.onStartWithDefaultImage}>Continue with Default Image</button>
{!!props.onStartWithDefaultImage && <button className="mt-6 secondary" onClick={props.onStartWithDefaultImage}>Continue with Default Image</button>}
</StartPage>;
}

Expand Down