SSO: Add GitHub auth configuration page (#78933)

* Setup route

* Set up the page

* Add orgs

* Load settings

* Make API call

* Remove log

* Add FormPrompt

* Update types

* Add tests

* Fix tests

* Cleanup

* Load settings

* Fix naming

* Switch to PUT endpoint

* Switch to CSS object

* Setup fields

* Render fields

* Extend types

* Dynamic provider page

* Rename page

* Filter out non-implemented providers

* Fix types

* Add teamIDs validation

* Update tests

* Fix URL

* Update name

* Send full data

* Add password input

* Update test

* Expand default values

* Fix test

* Use SecretInput

* Remove dev mode for the feature toggle

* Convert fields

* Remove fieldFormat utils

* Update fields logic

* Update tests

* Update betterer

* SSO: Make client secret not required

* Update field name

* Revert feature toggle to dev mode

* Use provider endpoint

* Fix form state check

* Update tests

* Fix URL redirect after form submit

* Mock locationService

* Separate Form component

* Fix trailing slash
This commit is contained in:
Alex Khomenko
2023-12-21 15:26:42 +02:00
committed by GitHub
parent 05d1ce4026
commit fde8a00721
16 changed files with 834 additions and 37 deletions
@@ -2,7 +2,7 @@ import * as React from 'react';
import { Button } from '../Button';
import { Input } from '../Input/Input';
import { HorizontalGroup } from '../Layout/Layout';
import { Stack } from '../Layout/Stack/Stack';
export type Props = React.ComponentProps<typeof Input> & {
/** TRUE if the secret was already configured. (It is needed as often the backend doesn't send back the actual secret, only the information that it was configured) */
@@ -15,13 +15,15 @@ export const CONFIGURED_TEXT = 'configured';
export const RESET_BUTTON_TEXT = 'Reset';
export const SecretInput = ({ isConfigured, onReset, ...props }: Props) => (
<HorizontalGroup>
<Stack>
{!isConfigured && <Input {...props} type="password" />}
{isConfigured && <Input {...props} type="text" disabled={true} value={CONFIGURED_TEXT} />}
{isConfigured && (
<Button onClick={onReset} variant="secondary">
{RESET_BUTTON_TEXT}
</Button>
<>
<Input {...props} type="text" disabled={true} value={CONFIGURED_TEXT} />
<Button onClick={onReset} variant="secondary">
{RESET_BUTTON_TEXT}
</Button>
</>
)}
</HorizontalGroup>
</Stack>
);