Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit05fbbe8

Browse files
committed
add required pill for non-optional external auth providers
1 parent15b4dc9 commit05fbbe8

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

‎site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
147147
);
148148
},[autofillParameters]);
149149

150+
consthasAllRequiredExternalAuth=externalAuth.every(
151+
(auth)=>auth.optional||auth.authenticated,
152+
);
153+
150154
return(
151155
<Marginssize="medium">
152156
<PageHeaderactions={<ButtononClick={onCancel}>Cancel</Button>}>
@@ -251,13 +255,15 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
251255
description="This template requires authentication to external services."
252256
>
253257
<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.
258+
{hasAllRequiredExternalAuth ?(
257259
<Alertseverity="info">
258-
To create a workspace using the selected template, please
259-
ensure you are authenticated with all the external providers
260-
listed below.
260+
This template can connect to the external authentication
261+
providers listed below.
262+
</Alert>
263+
) :(
264+
<Alertseverity="error">
265+
To create a workspace using this template, please connect to
266+
all required external authentication providers listed below.
261267
</Alert>
262268
)}
263269
{externalAuth.map((auth)=>(
@@ -313,6 +319,7 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
313319
<FormFooter
314320
onCancel={onCancel}
315321
isLoading={creatingWorkspace}
322+
submitDisabled={!hasAllRequiredExternalAuth}
316323
submitLabel="Create Workspace"
317324
/>
318325
</HorizontalForm>

‎site/src/pages/CreateWorkspacePage/ExternalAuthButton.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
importReplayIconfrom"@mui/icons-material/Replay";
22
importButtonfrom"@mui/material/Button";
33
importTooltipfrom"@mui/material/Tooltip";
4-
import{typeFC}from"react";
54
importLoadingButtonfrom"@mui/lab/LoadingButton";
65
import{visuallyHidden}from"@mui/utils";
6+
import{typeFC}from"react";
7+
importtype{TemplateVersionExternalAuth}from"api/typesGenerated";
78
import{ExternalImage}from"components/ExternalImage/ExternalImage";
8-
import{TemplateVersionExternalAuth}from"api/typesGenerated";
9+
import{Pill}from"components/Pill/Pill";
910

1011
exportinterfaceExternalAuthButtonProps{
1112
auth:TemplateVersionExternalAuth;
@@ -51,6 +52,11 @@ export const ExternalAuthButton: FC<ExternalAuthButtonProps> = ({
5152
{auth.authenticated
5253
?`Authenticated with${auth.display_name}`
5354
:`Login with${auth.display_name}`}
55+
{!auth.optional&&!auth.authenticated&&(
56+
<Pilltype="error"css={{marginLeft:8}}>
57+
Required
58+
</Pill>
59+
)}
5460
</LoadingButton>
5561

5662
{displayRetry&&(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp