Skip to content

Commit 435e26c

Browse files
committed
[workspace] refactor code for showing ide alert
1 parent 4489026 commit 435e26c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

components/dashboard/src/start/StartWorkspace.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
450450
const withPrebuild = WithPrebuild.is(this.state.workspace?.context);
451451
let phase: StartPhase | undefined = StartPhase.Preparing;
452452
let title = undefined;
453-
let isTimedOut = false;
454-
let isStoppingOrStopped = false;
453+
let isStoppingOrStoppedPhase = false;
455454
let isError = error ? true : false;
456455
let statusMessage = !!error ? undefined : <p className="text-base text-gray-400">Preparing workspace …</p>;
457456
const contextURL = ContextURL.getNormalizedURL(this.state.workspace)?.toString();
@@ -626,7 +625,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
626625

627626
// Stopping means that the workspace is currently shutting down. It could go to stopped every moment.
628627
case "stopping":
629-
isStoppingOrStopped = true;
628+
isStoppingOrStoppedPhase = true;
630629
if (isPrebuild) {
631630
return (
632631
<StartPage title="Prebuild in Progress">
@@ -664,7 +663,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
664663

665664
// Stopped means the workspace ended regularly because it was shut down.
666665
case "stopped":
667-
isStoppingOrStopped = true;
666+
isStoppingOrStoppedPhase = true;
668667
phase = StartPhase.Stopped;
669668
if (this.state.hasImageBuildLogs) {
670669
const restartWithDefaultImage = (event: React.MouseEvent) => {
@@ -682,7 +681,6 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
682681
}
683682
if (!isPrebuild && this.state.workspaceInstance.status.conditions.timeout) {
684683
title = "Timed Out";
685-
isTimedOut = true;
686684
}
687685
statusMessage = (
688686
<div>
@@ -720,7 +718,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
720718
phase={phase}
721719
error={error}
722720
title={title}
723-
showLatestIdeWarning={isError || (!isTimedOut && !isStoppingOrStopped && useLatest)}
721+
showLatestIdeWarning={useLatest && (isError || !isStoppingOrStoppedPhase)}
724722
>
725723
{statusMessage}
726724
</StartPage>

0 commit comments

Comments
 (0)