Changed unspecified to "" (#3367)

This commit is contained in:
Erik Jan de Wit 2022-09-21 16:50:10 +02:00 committed by GitHub
parent 5c57e5103b
commit 6c57312273
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,13 +16,13 @@ import { TextField } from "../component/TextField";
import { FormGroupField } from "../component/FormGroupField"; import { FormGroupField } from "../component/FormGroupField";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
const promptOptions = [ const promptOptions = {
"unspecified", unspecified: "",
"none", none: "none",
"consent", consent: "consent",
"login", login: "login",
"select_account", select_account: "select_account",
]; };
export const ExtendedNonDiscoverySettings = () => { export const ExtendedNonDiscoverySettings = () => {
const { t } = useTranslation("identity-providers"); const { t } = useTranslation("identity-providers");
@ -50,7 +50,7 @@ export const ExtendedNonDiscoverySettings = () => {
<FormGroupField label="prompt"> <FormGroupField label="prompt">
<Controller <Controller
name="config.prompt" name="config.prompt"
defaultValue={promptOptions[0]} defaultValue=""
control={control} control={control}
render={({ onChange, value }) => ( render={({ onChange, value }) => (
<Select <Select
@ -61,18 +61,14 @@ export const ExtendedNonDiscoverySettings = () => {
onChange(value as string); onChange(value as string);
setPromptOpen(false); setPromptOpen(false);
}} }}
selections={value} selections={value || t(`prompts.unspecified`)}
variant={SelectVariant.single} variant={SelectVariant.single}
aria-label={t("prompt")} aria-label={t("prompt")}
isOpen={promptOpen} isOpen={promptOpen}
> >
{promptOptions.map((option) => ( {Object.entries(promptOptions).map(([key, val]) => (
<SelectOption <SelectOption selected={val === value} key={key} value={val}>
selected={option === value} {t(`prompts.${key}`)}
key={option}
value={option}
>
{t(`prompts.${option}`)}
</SelectOption> </SelectOption>
))} ))}
</Select> </Select>