Skip to content

Commit

Permalink
fix edit
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Oct 17, 2024
1 parent 0a0bbfd commit 5f4ea05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
import { Button, FormField, Input, Modal } from '@pluralsh/design-system'
import { InputMaybe, OidcProviderFragment } from 'generated/graphql'
import { useMemo, useState } from 'react'

import { useState } from 'react'
import { useTheme } from 'styled-components'

import { isEmpty, uniqBy } from 'lodash'
import { isEmpty } from 'lodash'
import {
BindingInput,
fetchGroups,
fetchUsers,
} from '../../../account/Typeaheads'
import sortBy from 'lodash/sortBy'
import { UrlsInput } from '../../../app/oidc/OIDC'

export function EditPluralOIDCClientModal({
open,
onClose,
instanceName,
oidcProvider,
provider,
useModalOverlay = true,
}: {
open: boolean
onClose: () => void
instanceName: string
oidcProvider?: OidcProviderFragment
provider?: OidcProviderFragment
useModalOverlay?: boolean
}) {
return (
Expand All @@ -36,7 +33,7 @@ export function EditPluralOIDCClientModal({
>
<EditPluralOIDCClient
onClose={onClose}
provider={oidcProvider}
provider={provider}
/>
</Modal>
)
Expand All @@ -50,9 +47,9 @@ function EditPluralOIDCClient({
provider?: OidcProviderFragment
}) {
const theme = useTheme()
const createMode = isEmpty(provider)
const createMode = !provider
const [name, setName] = useState(provider?.name ?? '')
const [description, setDescription] = useState(provider?.name ?? '')
const [description, setDescription] = useState(provider?.description ?? '')
const [bindings, setBindings] = useState<any>(provider?.bindings ?? [])
const [redirectUris, setRedirectUris] = useState<InputMaybe<string>[]>(
provider?.redirectUris ?? []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const columnHelper = createColumnHelper<OidcProviderFragment>()
const columns = [
columnHelper.display({
id: 'meta',
cell: function Cell({ row: { original: oidcProvider } }) {
cell: function Cell({ row: { original: provider } }) {
const theme = useTheme()

return (
Expand All @@ -84,15 +84,15 @@ const columns = [
color: theme.colors['text'],
}}
>
{oidcProvider.name}
{provider.name}
</div>
<div
css={{
...theme.partials.text.body2,
color: theme.colors['text-light'],
}}
>
{oidcProvider.description}
{provider.description}
</div>
</div>
)
Expand All @@ -101,7 +101,7 @@ const columns = [
columnHelper.display({
id: 'actions',
meta: { gridTemplate: 'max-content' },
cell: function Cell({ row: { original: oidcProvider }, table }) {
cell: function Cell({ row: { original: provider }, table }) {
const [editOpen, setEditOpen] = useState(false)

return (
Expand All @@ -116,6 +116,7 @@ const columns = [
onClose={() => setEditOpen(false)}
instanceName={table.options.meta?.instanceName}
useModalOverlay={table.options.meta?.useModalOverlay}
provider={provider}
/>
</>
)
Expand Down

0 comments on commit 5f4ea05

Please sign in to comment.