From a3d719e7096947147fa70273f45cc3d5ea5def23 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Mon, 5 Dec 2022 23:34:45 +0000 Subject: [PATCH 1/2] site: don't show progress bar for new templates Resolves #5229 --- .../WorkspaceBuildProgress/WorkspaceBuildProgress.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.tsx b/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.tsx index 389f57e946728..ed38865f21e0b 100644 --- a/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.tsx +++ b/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.tsx @@ -102,6 +102,11 @@ export const WorkspaceBuildProgress: FC = ({ 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 (
Date: Wed, 7 Dec 2022 13:52:17 +0000 Subject: [PATCH 2/2] Fix storybook --- .../WorkspaceBuildProgress.stories.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.stories.tsx b/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.stories.tsx index 23c9ecf1342f8..344828094807f 100644 --- a/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.stories.tsx +++ b/site/src/components/WorkspaceBuildProgress/WorkspaceBuildProgress.stories.tsx @@ -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({})