Use alias for title name (#3369)

This commit is contained in:
Erik Jan de Wit 2022-09-21 16:46:22 +02:00 committed by GitHub
parent 5dd606e726
commit 4ad8689b6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,13 +2,7 @@ import { useState } from "react";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat"; import { Link, useNavigate } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { import { Controller, FormProvider, useForm } from "react-hook-form";
Controller,
FormProvider,
useForm,
useFormContext,
useWatch,
} from "react-hook-form";
import { import {
ActionGroup, ActionGroup,
AlertVariant, AlertVariant,
@ -74,14 +68,7 @@ type IdPWithMapperAttributes = IdentityProviderMapperRepresentation & {
const Header = ({ onChange, value, save, toggleDeleteDialog }: HeaderProps) => { const Header = ({ onChange, value, save, toggleDeleteDialog }: HeaderProps) => {
const { t } = useTranslation("identity-providers"); const { t } = useTranslation("identity-providers");
const { alias } = useParams<{ alias: string }>(); const { alias: displayName } = useParams<{ alias: string }>();
const { control } = useFormContext();
const displayName = useWatch({
name: "displayName",
control,
defaultValue: alias,
});
const [toggleDisableDialog, DisableConfirm] = useConfirmDialog({ const [toggleDisableDialog, DisableConfirm] = useConfirmDialog({
titleKey: "identity-providers:disableProvider", titleKey: "identity-providers:disableProvider",