-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[dashboard] Show prebuild status based on prebuild workspace record #8805
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -329,12 +329,66 @@ export function prebuildStatusIcon(prebuild?: PrebuildWithStatus) { | |
} | ||
} | ||
|
||
function PrebuildStatusDescription(props: { prebuild: PrebuildWithStatus }) { | ||
switch (props.prebuild.status) { | ||
case "queued": | ||
return <span>Prebuild is queued and will be processed when there is execution capacity.</span>; | ||
case "building": | ||
return <span>Prebuild is currently in progress.</span>; | ||
case "aborted": | ||
return ( | ||
<span> | ||
Prebuild has been cancelled. Either a user cancelled it, or the prebuild rate limit has been | ||
exceeded. {props.prebuild.error} | ||
Comment on lines
+341
to
+342
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Again, a simpler message here could help while dropping appending information that is already duplicated. WDYT?
|
||
</span> | ||
); | ||
case "failed": | ||
return <span>Prebuild failed for system reasons. Please contact support. {props.prebuild.error}</span>; | ||
case "timeout": | ||
return ( | ||
<span> | ||
Prebuild timed out. Either the image, or the prebuild tasks took too long. {props.prebuild.error} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Maybe the following suffices?
Optiontally, we could append some information about the max prebuild limit.
|
||
</span> | ||
); | ||
case "available": | ||
if (props.prebuild?.error) { | ||
return ( | ||
<span> | ||
The tasks executed in the prebuild returned a non-zero exit code. {props.prebuild.error} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: This could be confusing. Could we use simpler words to describe the error. Maybe something like the following?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Definitely. I'm trying to clean it up incrementally as there's a lot of tech debt with respect where we collect the "truth" from. Unify first, then improve the messaging. I'll cut a ticket for this concrete case to not show the same error twice. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
💯
Thanks, @easyCZ! 🏀 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fyi: I've opened #9111 to keep track of this discussion and the unresolved comments below. |
||
</span> | ||
); | ||
} | ||
return <span>Prebuild completed succesfully.</span>; | ||
default: | ||
return <span>Unknown prebuild status.</span>; | ||
} | ||
} | ||
|
||
function formatDuration(milliseconds: number) { | ||
const hours = Math.floor(milliseconds / (1000 * 60 * 60)); | ||
return (hours > 0 ? `${hours}:` : "") + moment(milliseconds).format("mm:ss"); | ||
} | ||
|
||
export function PrebuildInstanceStatus(props: { prebuildInstance?: WorkspaceInstance }) { | ||
export function PrebuildStatus(props: { prebuild: PrebuildWithStatus }) { | ||
const prebuild = props.prebuild; | ||
|
||
return ( | ||
<div className="flex flex-col space-y-1 justify-center text-sm font-semibold"> | ||
<div> | ||
<div className="flex space-x-1 items-center"> | ||
{prebuildStatusIcon(prebuild)} | ||
{prebuildStatusLabel(prebuild)} | ||
</div> | ||
</div> | ||
<div className="flex space-x-1 items-center text-gray-400"> | ||
<PrebuildStatusDescription prebuild={prebuild} /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
// Deprecated. Use PrebuildStatus instead. | ||
export function PrebuildInstanceStatus(props: { prebuildInstance?: WorkspaceInstance; prebuild?: PrebuildWithStatus }) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, it's still used in ConfigureProject component. OK |
||
let status = <></>; | ||
let details = <></>; | ||
switch (props.prebuildInstance?.status.phase) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: Sounds accurate but a bit scary for humans, no? Maybe we could use something like the following: