Replaced tooltip for adding a translations to an attribute with Info Alert (#29051)
* replaced tooltip with info alert Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * replaced tooltip with info alert Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> --------- Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com>
This commit is contained in:
parent
c4d82d4d41
commit
b8cdd81718
2 changed files with 12 additions and 11 deletions
|
@ -3084,7 +3084,7 @@ sendIdTokenOnLogoutHelp=If the 'id_token_hint' parameter should be sent in logou
|
||||||
sendClientIdOnLogout=Send 'client_id' in logout requests
|
sendClientIdOnLogout=Send 'client_id' in logout requests
|
||||||
sendClientIdOnLogoutHelp=If the 'client_id' parameter should be sent in logout requests.
|
sendClientIdOnLogoutHelp=If the 'client_id' parameter should be sent in logout requests.
|
||||||
addAttributeTranslationBtn=Add translation button
|
addAttributeTranslationBtn=Add translation button
|
||||||
addAttributeTranslationTooltip=Add translations for this field value.
|
addAttributeTranslationInfo=Add translations for this field using the icon next to the "Display name" field.
|
||||||
addTranslationsModalTitle=Add translations
|
addTranslationsModalTitle=Add translations
|
||||||
addTranslationsModalSubTitle=You are able to translate the "Display name" based on your locale or preferred languages. In addition, you are also able to create or edit the "Display name" translations in the
|
addTranslationsModalSubTitle=You are able to translate the "Display name" based on your locale or preferred languages. In addition, you are also able to create or edit the "Display name" translations in the
|
||||||
addTranslationsModalSubTitleBolded=Realm settings > Localization > Realm overrides.
|
addTranslationsModalSubTitleBolded=Realm settings > Localization > Realm overrides.
|
||||||
|
|
|
@ -2,6 +2,7 @@ import type ClientScopeRepresentation from "@keycloak/keycloak-admin-client/lib/
|
||||||
import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation";
|
import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation";
|
||||||
import type { UserProfileConfig } from "@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata";
|
import type { UserProfileConfig } from "@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata";
|
||||||
import {
|
import {
|
||||||
|
Alert,
|
||||||
Button,
|
Button,
|
||||||
Divider,
|
Divider,
|
||||||
FormGroup,
|
FormGroup,
|
||||||
|
@ -10,7 +11,6 @@ import {
|
||||||
Radio,
|
Radio,
|
||||||
Switch,
|
Switch,
|
||||||
TextInput,
|
TextInput,
|
||||||
Tooltip,
|
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
import {
|
import {
|
||||||
Select,
|
Select,
|
||||||
|
@ -19,7 +19,7 @@ import {
|
||||||
} from "@patternfly/react-core/deprecated";
|
} from "@patternfly/react-core/deprecated";
|
||||||
import { GlobeRouteIcon } from "@patternfly/react-icons";
|
import { GlobeRouteIcon } from "@patternfly/react-icons";
|
||||||
import { isEqual } from "lodash-es";
|
import { isEqual } from "lodash-es";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Controller, useFormContext, useWatch } from "react-hook-form";
|
import { Controller, useFormContext, useWatch } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { FormErrorText, HelpItem } from "@keycloak/keycloak-ui-shared";
|
import { FormErrorText, HelpItem } from "@keycloak/keycloak-ui-shared";
|
||||||
|
@ -65,7 +65,6 @@ export const AttributeGeneralSettings = ({
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { realm: realmName } = useRealm();
|
const { realm: realmName } = useRealm();
|
||||||
const form = useFormContext();
|
const form = useFormContext();
|
||||||
const tooltipRef = useRef();
|
|
||||||
const [clientScopes, setClientScopes] =
|
const [clientScopes, setClientScopes] =
|
||||||
useState<ClientScopeRepresentation[]>();
|
useState<ClientScopeRepresentation[]>();
|
||||||
const [config, setConfig] = useState<UserProfileConfig>();
|
const [config, setConfig] = useState<UserProfileConfig>();
|
||||||
|
@ -90,12 +89,10 @@ export const AttributeGeneralSettings = ({
|
||||||
value: string,
|
value: string,
|
||||||
) => {
|
) => {
|
||||||
setNewAttributeName(value);
|
setNewAttributeName(value);
|
||||||
|
|
||||||
const newDisplayName =
|
const newDisplayName =
|
||||||
value !== "" && realm?.internationalizationEnabled
|
value !== "" && realm?.internationalizationEnabled
|
||||||
? "${profile.attributes." + `${value}}`
|
? "${profile.attributes." + `${value}}`
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
setGeneratedDisplayName(newDisplayName);
|
setGeneratedDisplayName(newDisplayName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -248,11 +245,19 @@ export const AttributeGeneralSettings = ({
|
||||||
}
|
}
|
||||||
{...form.register("displayName")}
|
{...form.register("displayName")}
|
||||||
/>
|
/>
|
||||||
|
{generatedDisplayName && (
|
||||||
|
<Alert
|
||||||
|
className="pf-v5-u-mt-sm"
|
||||||
|
variant="info"
|
||||||
|
isInline
|
||||||
|
isPlain
|
||||||
|
title={t("addAttributeTranslationInfo")}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</GridItem>
|
</GridItem>
|
||||||
{realm?.internationalizationEnabled && (
|
{realm?.internationalizationEnabled && (
|
||||||
<GridItem span={1}>
|
<GridItem span={1}>
|
||||||
<Button
|
<Button
|
||||||
ref={tooltipRef}
|
|
||||||
variant="link"
|
variant="link"
|
||||||
className="pf-m-plain kc-attribute-display-name-iconBtn"
|
className="pf-m-plain kc-attribute-display-name-iconBtn"
|
||||||
data-testid="addAttributeTranslationBtn"
|
data-testid="addAttributeTranslationBtn"
|
||||||
|
@ -263,10 +268,6 @@ export const AttributeGeneralSettings = ({
|
||||||
}}
|
}}
|
||||||
icon={<GlobeRouteIcon />}
|
icon={<GlobeRouteIcon />}
|
||||||
/>
|
/>
|
||||||
<Tooltip
|
|
||||||
content={t("addAttributeTranslationTooltip")}
|
|
||||||
triggerRef={tooltipRef}
|
|
||||||
/>
|
|
||||||
</GridItem>
|
</GridItem>
|
||||||
)}
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
Loading…
Reference in a new issue