-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a10995
commit a151447
Showing
2 changed files
with
193 additions
and
88 deletions.
There are no files selected for viewing
121 changes: 121 additions & 0 deletions
121
www/src/components/overview/clusters/plural-cloud/EditPluralOIDCClient.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import { | ||
AppIcon, | ||
Button, | ||
ConsoleIcon, | ||
Flex, | ||
FormField, | ||
Input, | ||
ListBoxItem, | ||
MailIcon, | ||
Modal, | ||
PlusIcon, | ||
Select, | ||
Table, | ||
} from '@pluralsh/design-system' | ||
import { FormFieldSC } from 'components/create-cluster/steps/ConfigureCloudInstanceStep' | ||
import { | ||
ConsoleInstanceFragment, | ||
ConsoleSize, | ||
OidcProviderFragment, | ||
useGroupMembersQuery, | ||
useNotificationsQuery, | ||
useOidcProvidersQuery, | ||
useUpdateConsoleInstanceMutation, | ||
} from 'generated/graphql' | ||
import { useMemo, useState } from 'react' | ||
|
||
import { GqlError } from 'components/utils/Alert' | ||
|
||
import { useTheme } from 'styled-components' | ||
|
||
import { firstLetterUppercase } from './CloudInstanceTableCols' | ||
import { | ||
DEFAULT_REACT_VIRTUAL_OPTIONS, | ||
useFetchPaginatedData, | ||
} from '../../../utils/useFetchPaginatedData' | ||
import { mapExistingNodes } from '../../../../utils/graphql' | ||
import { createColumnHelper } from '@tanstack/react-table' | ||
import { CellWrap } from '../SelfHostedTableCols' | ||
import { isEmpty } from 'lodash' | ||
|
||
export function EditPluralOIDCClientModal({ | ||
open, | ||
onClose, | ||
instance, | ||
oidcProvider, | ||
}: { | ||
open: boolean | ||
onClose: () => void | ||
instance: ConsoleInstanceFragment | ||
oidcProvider?: OidcProviderFragment | ||
}) { | ||
return ( | ||
<Modal | ||
open={open} | ||
onClose={onClose} | ||
overlayStyles={{ background: 'none' }} // TODO | ||
header={`${instance.name} - Edit Plural OIDC clients`} | ||
> | ||
<EditPluralOIDCClient | ||
onClose={onClose} | ||
oidcProvider={oidcProvider} | ||
/> | ||
</Modal> | ||
) | ||
} | ||
|
||
function EditPluralOIDCClient({ | ||
onClose, | ||
oidcProvider, | ||
}: { | ||
onClose: () => void | ||
oidcProvider?: OidcProviderFragment | ||
}) { | ||
const theme = useTheme() | ||
const createMode = isEmpty(oidcProvider) | ||
const [name, setName] = useState(oidcProvider?.name ?? '') | ||
const [description, setDescription] = useState(oidcProvider?.name ?? '') | ||
|
||
return ( | ||
<div | ||
css={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: theme.spacing.xlarge, | ||
}} | ||
> | ||
<div> | ||
<FormField | ||
label="Name" | ||
required | ||
> | ||
<Input | ||
autoFocus | ||
value={name} | ||
onChange={({ target: { value } }) => setName(value)} | ||
/> | ||
</FormField> | ||
<FormField label="Description"> | ||
<Input | ||
value={description} | ||
onChange={({ target: { value } }) => setDescription(value)} | ||
/> | ||
</FormField> | ||
</div> | ||
<div css={{ display: 'flex', justifyContent: 'space-between' }}> | ||
<Button | ||
secondary | ||
onClick={onClose} | ||
> | ||
Back to Plural OIDC clients | ||
</Button> | ||
<Button | ||
secondary | ||
onClick={onClose} | ||
> | ||
{createMode ? 'Create' : 'Save'} | ||
</Button> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters