Skip to content

Commit 7a0e999

Browse files
committed
[workspace] refactor code for showing ide alert
1 parent 3e8d57d commit 7a0e999

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
@@ -447,8 +447,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
447447
const withPrebuild = WithPrebuild.is(this.state.workspace?.context);
448448
let phase: StartPhase | undefined = StartPhase.Preparing;
449449
let title = undefined;
450-
let isTimedOut = false;
451-
let isStoppingOrStopped = false;
450+
let isStoppingOrStoppedPhase = false;
452451
let isError = error ? true : false;
453452
let statusMessage = !!error ? undefined : <p className="text-base text-gray-400">Preparing workspace …</p>;
454453
const contextURL = ContextURL.getNormalizedURL(this.state.workspace)?.toString();
@@ -624,7 +623,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
624623

625624
// Stopping means that the workspace is currently shutting down. It could go to stopped every moment.
626625
case "stopping":
627-
isStoppingOrStopped = true;
626+
isStoppingOrStoppedPhase = true;
628627
if (isPrebuild) {
629628
return (
630629
<StartPage title="Prebuild in Progress">
@@ -662,7 +661,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
662661

663662
// Stopped means the workspace ended regularly because it was shut down.
664663
case "stopped":
665-
isStoppingOrStopped = true;
664+
isStoppingOrStoppedPhase = true;
666665
phase = StartPhase.Stopped;
667666
if (this.state.hasImageBuildLogs) {
668667
const restartWithDefaultImage = (event: React.MouseEvent) => {
@@ -680,7 +679,6 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
680679
}
681680
if (!isPrebuild && this.state.workspaceInstance.status.conditions.timeout) {
682681
title = "Timed Out";
683-
isTimedOut = true;
684682
}
685683
statusMessage = (
686684
<div>
@@ -718,7 +716,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
718716
phase={phase}
719717
error={error}
720718
title={title}
721-
showLatestIdeWarning={isError || (!isTimedOut && !isStoppingOrStopped && useLatest)}
719+
showLatestIdeWarning={useLatest && (isError || !isStoppingOrStoppedPhase)}
722720
>
723721
{statusMessage}
724722
</StartPage>

0 commit comments

Comments
 (0)