Skip to content
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

feat: Plural OIDC clients #1382

Merged
merged 47 commits into from
Oct 21, 2024
Merged
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
3163986
add icons to the menu
maciaszczykm Oct 17, 2024
6e90178
add new menu entry
maciaszczykm Oct 17, 2024
6fc83bf
add oidc providers query
maciaszczykm Oct 17, 2024
35a12c4
add oidc providers modal
maciaszczykm Oct 17, 2024
1a10995
add oidc providers table
maciaszczykm Oct 17, 2024
a151447
add create/edit modal
maciaszczykm Oct 17, 2024
2aa2cc3
add oidc providers to cluster details
maciaszczykm Oct 17, 2024
d61eb10
fix border radius
maciaszczykm Oct 17, 2024
0d90e50
improve list styling
maciaszczykm Oct 17, 2024
692413e
add edit to list
maciaszczykm Oct 17, 2024
e1ea046
align icons
maciaszczykm Oct 17, 2024
3f7ca90
align items
maciaszczykm Oct 17, 2024
86a928b
adjust actions
maciaszczykm Oct 17, 2024
0a0bbfd
add more inputs to form
maciaszczykm Oct 17, 2024
5f4ea05
fix edit
maciaszczykm Oct 17, 2024
2dfc501
remove unused imports
maciaszczykm Oct 17, 2024
2d0506c
remove unused prop
maciaszczykm Oct 17, 2024
3c777e1
improve form
maciaszczykm Oct 18, 2024
a9c5733
add url prefix and suffix
maciaszczykm Oct 18, 2024
8ee7080
add mutations
maciaszczykm Oct 18, 2024
08d7912
small adjustments
maciaszczykm Oct 18, 2024
a98e322
update design system
maciaszczykm Oct 18, 2024
5989a71
layout fixes
maciaszczykm Oct 18, 2024
ae142e1
layout fixes
maciaszczykm Oct 18, 2024
8efe291
fix type problem
maciaszczykm Oct 18, 2024
f641cea
remove flex grow
maciaszczykm Oct 18, 2024
4ba3ef4
fix list colors
maciaszczykm Oct 18, 2024
aff4998
add refetch
maciaszczykm Oct 18, 2024
3988aeb
add missing arg
maciaszczykm Oct 18, 2024
bed3cf3
memoize mutation
maciaszczykm Oct 18, 2024
46fc377
fix attributes format
maciaszczykm Oct 18, 2024
0df915e
add deletion
maciaszczykm Oct 18, 2024
afacb67
update message
maciaszczykm Oct 18, 2024
faca83b
add client id and secret
maciaszczykm Oct 18, 2024
9c32203
fix scrolling area
maciaszczykm Oct 18, 2024
ba60474
add loading indicator
maciaszczykm Oct 21, 2024
6b64c9b
add loading indicator
maciaszczykm Oct 21, 2024
76120d1
add auth method input
maciaszczykm Oct 21, 2024
6926a6f
make auth method required
maciaszczykm Oct 21, 2024
64e6e98
fix auth method
maciaszczykm Oct 21, 2024
ca2513f
add toasts
maciaszczykm Oct 21, 2024
95e90a5
hide form after creation
maciaszczykm Oct 21, 2024
8f3e43d
show client id and secret after creation
maciaszczykm Oct 21, 2024
ca7bd46
refactor
maciaszczykm Oct 21, 2024
edf4afc
remove duplicated element
maciaszczykm Oct 21, 2024
a0cc62d
revert overlay
maciaszczykm Oct 21, 2024
07d7c27
lint
maciaszczykm Oct 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improve form
maciaszczykm committed Oct 18, 2024
commit 3c777e17ee98d0b3baede2573ebefaaec937b9b8
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { Button, FormField, Input, Modal } from '@pluralsh/design-system'
import { Button, Chip, FormField, Input, Modal } from '@pluralsh/design-system'
import { InputMaybe, OidcProviderFragment } from 'generated/graphql'
import { useState } from 'react'
import { useCallback, useState } from 'react'
import { useTheme } from 'styled-components'

Check failure on line 4 in www/src/components/overview/clusters/plural-cloud/EditPluralOIDCClient.tsx

GitHub Actions / Lint

There should be at least one empty line between import groups
import { isEmpty } from 'lodash'
import {
BindingInput,
fetchGroups,
fetchUsers,
} from '../../../account/Typeaheads'
import { UrlsInput } from '../../../app/oidc/OIDC'

export function EditPluralOIDCClientModal({
open,
@@ -51,9 +49,23 @@
const [name, setName] = useState(provider?.name ?? '')
const [description, setDescription] = useState(provider?.description ?? '')
const [bindings, setBindings] = useState<any>(provider?.bindings ?? [])
const [url, setUrl] = useState('')
const [redirectUris, setRedirectUris] = useState<InputMaybe<string>[]>(
provider?.redirectUris ?? []
)

const addUrl = useCallback(() => {
if (redirectUris.indexOf(url) > -1) return

setRedirectUris([...redirectUris, url])
setUrl('')
}, [url, setUrl, redirectUris, setRedirectUris])

const removeUrl = useCallback(
(url) => setRedirectUris(redirectUris.filter((item) => item !== url)),
[redirectUris, setRedirectUris]
)

return (
<div
css={{
@@ -114,10 +126,52 @@
}
/>
<FormField label="Redirect URIs">
<UrlsInput
urls={redirectUris}
setUrls={setRedirectUris}
/>
<div
css={{
display: 'flex',
flexDirection: 'column',
gap: theme.spacing.small,
}}
>
<div
css={{
display: 'flex',
}}
>
<Input
value={url}
width="100%"
placeholder="Enter a redirect URI"
onChange={({ target: { value } }) => setUrl(value)}
/>
<Button
onClick={addUrl}
secondary
marginLeft="small"
>
Add
</Button>
</div>
<div
css={{
display: 'flex',
flexWrap: 'wrap',
gap: theme.spacing.xxsmall,
}}
>
{redirectUris.map((url, i) => (
<Chip
key={i}
size="small"
clickable
closeButton
onClick={() => removeUrl(url)}
>
{url}
</Chip>
))}
</div>
</div>
</FormField>
</div>
<div css={{ display: 'flex', justifyContent: 'space-between' }}>

Unchanged files with check annotations Beta

import ClusterMetadataPanel from './ClusterMetadataPanel'
import { ClusterPromoteModal } from './ClusterPromoteModal'
import { ClusterSidecar } from './ClusterSidecar'
import { CollapsibleButton } from './misc'

Check failure on line 29 in www/src/components/cluster/Cluster.tsx

GitHub Actions / Lint

There should be at least one empty line between import groups
import { EditPluralOIDCClients } from '../overview/clusters/plural-cloud/EditPluralOIDCClients'

Check failure on line 30 in www/src/components/cluster/Cluster.tsx

GitHub Actions / Lint

There should be at least one empty line between import groups

Check failure on line 30 in www/src/components/cluster/Cluster.tsx

GitHub Actions / Lint

`../overview/clusters/plural-cloud/EditPluralOIDCClients` import should occur before import of `./ClusterAdminsModal`
import { useTheme } from 'styled-components'

Check failure on line 31 in www/src/components/cluster/Cluster.tsx

GitHub Actions / Lint

`styled-components` import should occur before import of `../../contexts/ClustersContext`
export function Cluster() {
const theme = useTheme()
key={MenuItemKey.Delete}
destructive
label="Delete instance"
leftContent={<TrashCanIcon color={'icon-danger'} />}

Check failure on line 224 in www/src/components/overview/clusters/plural-cloud/CloudInstanceTableCols.tsx

GitHub Actions / Lint

Curly braces are unnecessary here
/>
</MoreMenu>
{/* Modals */}
useOidcProvidersQuery,
} from 'generated/graphql'
import { useMemo, useState } from 'react'
import { useTheme } from 'styled-components'

Check failure on line 15 in www/src/components/overview/clusters/plural-cloud/EditPluralOIDCClients.tsx

GitHub Actions / Lint

There should be at least one empty line between import groups
import {
DEFAULT_REACT_VIRTUAL_OPTIONS,
useFetchPaginatedData,
} from '../../../utils/useFetchPaginatedData'
import { mapExistingNodes } from '../../../../utils/graphql'

Check failure on line 20 in www/src/components/overview/clusters/plural-cloud/EditPluralOIDCClients.tsx

GitHub Actions / Lint

There should be at least one empty line between import groups
import { createColumnHelper } from '@tanstack/react-table'

Check failure on line 21 in www/src/components/overview/clusters/plural-cloud/EditPluralOIDCClients.tsx

GitHub Actions / Lint

There should be at least one empty line between import groups

Check failure on line 21 in www/src/components/overview/clusters/plural-cloud/EditPluralOIDCClients.tsx

GitHub Actions / Lint

`@tanstack/react-table` import should occur before import of `../../../utils/useFetchPaginatedData`
import { EditPluralOIDCClientModal } from './EditPluralOIDCClient'
import ImpersonateServiceAccount from '../../../utils/ImpersonateServiceAccount'