fix: Don't show progress bar for new templates (#5298)

This commit is contained in:
Ammar Bandukwala
2022-12-07 10:22:20 -06:00
committed by GitHub
parent f7467cac50
commit ee605b34b6
2 changed files with 17 additions and 1 deletions

View File

@ -39,10 +39,21 @@ Starting.args = {
},
}
// When the transition stats are returning null, the progress bar should not be
// displayed
export const StartingUnknown = Template.bind({})
StartingUnknown.args = {
...Starting.args,
transitionStats: undefined,
transitionStats: {
// HACK: the codersdk type generator doesn't support null values, but this
// can be null when the template is new.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- Read comment above
// @ts-ignore-error
P50: null,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- Read comment above
// @ts-ignore-error
P95: null,
},
}
export const StartingPassedEstimate = Template.bind({})

View File

@ -102,6 +102,11 @@ export const WorkspaceBuildProgress: FC<WorkspaceBuildProgressProps> = ({
setTimeout(updateProgress, 5)
}, [progressValue, job, transitionStats])
// HACK: the codersdk type generator doesn't support null values, but this
// can be null when the template is new.
if ((transitionStats.P50 as number | null) === null) {
return <></>
}
return (
<div className={styles.stack}>
<LinearProgress