Skip to content

Commit 1a76d65

Browse files
committed
fix: keep "workspace create" form when rendering errors
1 parent f1dfeb0 commit 1a76d65

File tree

1 file changed

+50
-55
lines changed

1 file changed

+50
-55
lines changed

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx

Lines changed: 50 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -149,73 +149,68 @@ export const CreateWorkspacePageView: FC<
149149
return <Loader />
150150
}
151151

152-
if (props.hasTemplateErrors) {
153-
return (
154-
<Stack>
155-
{Boolean(
156-
props.createWorkspaceErrors[
152+
return (
153+
<FullPageHorizontalForm title="New workspace" onCancel={props.onCancel}>
154+
155+
<HorizontalForm onSubmit={form.handleSubmit}>
156+
157+
{Boolean(props.hasTemplateErrors) && (<Stack>
158+
{Boolean(
159+
props.createWorkspaceErrors[
157160
CreateWorkspaceErrors.GET_TEMPLATES_ERROR
158-
],
159-
) && (
160-
<AlertBanner
161-
severity="error"
162-
error={
163-
props.createWorkspaceErrors[
164-
CreateWorkspaceErrors.GET_TEMPLATES_ERROR
165-
]
166-
}
167-
/>
168-
)}
169-
{Boolean(
170-
props.createWorkspaceErrors[
161+
],
162+
) && (
163+
<AlertBanner
164+
severity="error"
165+
error={
166+
props.createWorkspaceErrors[
167+
CreateWorkspaceErrors.GET_TEMPLATES_ERROR
168+
]
169+
}
170+
/>
171+
)}
172+
{Boolean(
173+
props.createWorkspaceErrors[
171174
CreateWorkspaceErrors.GET_TEMPLATE_SCHEMA_ERROR
172-
],
173-
) && (
174-
<AlertBanner
175-
severity="error"
176-
error={
177-
props.createWorkspaceErrors[
178-
CreateWorkspaceErrors.GET_TEMPLATE_SCHEMA_ERROR
179-
]
180-
}
181-
/>
182-
)}
183-
{Boolean(
184-
props.createWorkspaceErrors[
175+
],
176+
) && (
177+
<AlertBanner
178+
severity="error"
179+
error={
180+
props.createWorkspaceErrors[
181+
CreateWorkspaceErrors.GET_TEMPLATE_SCHEMA_ERROR
182+
]
183+
}
184+
/>
185+
)}
186+
{Boolean(
187+
props.createWorkspaceErrors[
185188
CreateWorkspaceErrors.GET_TEMPLATE_GITAUTH_ERROR
186-
],
187-
) && (
189+
],
190+
) && (
191+
<AlertBanner
192+
severity="error"
193+
error={
194+
props.createWorkspaceErrors[
195+
CreateWorkspaceErrors.GET_TEMPLATE_GITAUTH_ERROR
196+
]
197+
}
198+
/>
199+
)}
200+
</Stack>
201+
)}
202+
203+
{Boolean(props.createWorkspaceErrors[CreateWorkspaceErrors.CREATE_WORKSPACE_ERROR]) && (
188204
<AlertBanner
189205
severity="error"
190206
error={
191207
props.createWorkspaceErrors[
192-
CreateWorkspaceErrors.GET_TEMPLATE_GITAUTH_ERROR
208+
CreateWorkspaceErrors.CREATE_WORKSPACE_ERROR
193209
]
194210
}
195211
/>
196212
)}
197-
</Stack>
198-
)
199-
}
200213

201-
if (
202-
props.createWorkspaceErrors[CreateWorkspaceErrors.CREATE_WORKSPACE_ERROR]
203-
) {
204-
return (
205-
<AlertBanner
206-
severity="error"
207-
error={
208-
props.createWorkspaceErrors[
209-
CreateWorkspaceErrors.CREATE_WORKSPACE_ERROR
210-
]
211-
}
212-
/>
213-
)
214-
}
215-
216-
return (
217-
<FullPageHorizontalForm title="New workspace" onCancel={props.onCancel}>
218-
<HorizontalForm onSubmit={form.handleSubmit}>
219214
{/* General info */}
220215
<FormSection
221216
title="General info"

0 commit comments

Comments
 (0)