Skip to content

Commit e0dbe89

Browse files
committed
[workspace] refactor code for showing ide alert
1 parent eac6434 commit e0dbe89

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();
@@ -627,7 +626,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
627626

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

666665
// Stopped means the workspace ended regularly because it was shut down.
667666
case "stopped":
668-
isStoppingOrStopped = true;
667+
isStoppingOrStoppedPhase = true;
669668
phase = StartPhase.Stopped;
670669
if (this.state.hasImageBuildLogs) {
671670
const restartWithDefaultImage = (event: React.MouseEvent) => {
@@ -683,7 +682,6 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
683682
}
684683
if (!isPrebuild && this.state.workspaceInstance.status.conditions.timeout) {
685684
title = "Timed Out";
686-
isTimedOut = true;
687685
}
688686
statusMessage = (
689687
<div>
@@ -721,7 +719,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
721719
phase={phase}
722720
error={error}
723721
title={title}
724-
showLatestIdeWarning={isError || (!isTimedOut && !isStoppingOrStopped && useLatest)}
722+
showLatestIdeWarning={useLatest && (isError || !isStoppingOrStoppedPhase)}
725723
>
726724
{statusMessage}
727725
</StartPage>

0 commit comments

Comments
 (0)