@@ -147,6 +147,10 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
147
147
) ;
148
148
} , [ autofillParameters ] ) ;
149
149
150
+ const hasAllRequiredExternalAuth = externalAuth . every (
151
+ ( auth ) => auth . optional || auth . authenticated ,
152
+ ) ;
153
+
150
154
return (
151
155
< Margins size = "medium" >
152
156
< PageHeader actions = { < Button onClick = { onCancel } > Cancel</ Button > } >
@@ -179,7 +183,7 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
179
183
{ Boolean ( error ) && < ErrorAlert error = { error } /> }
180
184
181
185
{ mode === "duplicate" && (
182
- < Alert severity = "info" dismissible >
186
+ < Alert severity = "info" dismissible data-testid = "duplication-warning" >
183
187
{ Language . duplicationWarning }
184
188
</ Alert >
185
189
) }
@@ -248,21 +252,19 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
248
252
{ externalAuth && externalAuth . length > 0 && (
249
253
< FormSection
250
254
title = "External Authentication"
251
- description = "This template requires authentication to external services."
255
+ description = "This template uses external services for authentication ."
252
256
>
253
257
< FormFields >
254
- { requiresExternalAuth && (
255
- // This should really be a `notice` but `severity` is a MUI prop, and we'd need
256
- // to basically make our own `Alert` component.
257
- < Alert severity = "info" >
258
- To create a workspace using the selected template, please
259
- ensure you are authenticated with all the external providers
260
- listed below.
258
+ { Boolean ( error ) && ! hasAllRequiredExternalAuth && (
259
+ < Alert severity = "error" >
260
+ To create a workspace using this template, please connect to
261
+ all required external authentication providers listed below.
261
262
</ Alert >
262
263
) }
263
264
{ externalAuth . map ( ( auth ) => (
264
265
< ExternalAuthButton
265
266
key = { auth . id }
267
+ error = { error }
266
268
auth = { auth }
267
269
isLoading = { externalAuthPollingState === "polling" }
268
270
onStartPolling = { startPollingExternalAuth }
@@ -313,6 +315,7 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
313
315
< FormFooter
314
316
onCancel = { onCancel }
315
317
isLoading = { creatingWorkspace }
318
+ submitDisabled = { ! hasAllRequiredExternalAuth }
316
319
submitLabel = "Create Workspace"
317
320
/>
318
321
</ HorizontalForm >
0 commit comments