Skip to content

chore: revert "refactor(site): verify external auth before display ws form (#11777)" #12183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Feb 22, 2024
Prev Previous commit
Next Next commit
fix merge stuff
  • Loading branch information
aslilac committed Feb 20, 2024
commit 392f6eb66f95bb02a9387fa7bd657215bac89e00
43 changes: 32 additions & 11 deletions site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
</Stack>
</PageHeader>

<HorizontalForm onSubmit={form.handleSubmit} css={{ padding: "16px 0" }}>
<HorizontalForm
name="create-workspace-form"
onSubmit={form.handleSubmit}
css={{ padding: "16px 0" }}
>
{Boolean(error) && <ErrorAlert error={error} />}

{mode === "duplicate" && (
Expand Down Expand Up @@ -204,15 +208,30 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
</Stack>
)}

<TextField
{...getFieldHelpers("name")}
disabled={creatingWorkspace}
// resetMutation facilitates the clearing of validation errors
onChange={onChangeTrimmed(form, resetMutation)}
autoFocus
fullWidth
label="Workspace Name"
/>
<div>
<TextField
{...getFieldHelpers("name")}
disabled={creatingWorkspace}
// resetMutation facilitates the clearing of validation errors
onChange={onChangeTrimmed(form, resetMutation)}
autoFocus
fullWidth
label="Workspace Name"
/>
<FormHelperText data-chromatic="ignore">
Need a suggestion?{" "}
<Button
variant="text"
css={styles.nameSuggestion}
onClick={async () => {
await form.setFieldValue("name", suggestedName);
rerollSuggestedName();
}}
>
{suggestedName}
</Button>
</FormHelperText>
</div>

{permissions.createWorkspaceForUser && (
<UserAutocomplete
Expand All @@ -234,7 +253,9 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
>
<FormFields>
{requiresExternalAuth && (
<Alert severity="error">
// This should really be a `notice` but `severity` is a MUI prop, and we'd need
// to basically make our own `Alert` component.
<Alert severity="info">
To create a workspace using the selected template, please
ensure you are authenticated with all the external providers
listed below.
Expand Down