move multi-used strings to common

This commit is contained in:
mfrances 2021-03-29 21:03:26 -04:00
parent 9166212720
commit 0b0e474caf
19 changed files with 45 additions and 47 deletions

View file

@ -146,7 +146,7 @@ export const RoleMappingForm = () => {
return ( return (
<> <>
<ViewHeader <ViewHeader
titleKey="client-scopes:addMapper" titleKey="common:addMapper"
subKey="client-scopes:addMapperExplain" subKey="client-scopes:addMapperExplain"
/> />
<PageSection variant="light"> <PageSection variant="light">
@ -156,11 +156,11 @@ export const RoleMappingForm = () => {
role="manage-clients" role="manage-clients"
> >
<FormGroup <FormGroup
label={t("protocolMapper")} label={t("common:mapperType")}
labelIcon={ labelIcon={
<HelpItem <HelpItem
helpText="client-scopes-help:protocolMapper" helpText="client-scopes-help:protocolMapper"
forLabel={t("protocolMapper")} forLabel={t("common:mapperType")}
forID="protocolMapper" forID="protocolMapper"
/> />
} }

View file

@ -75,9 +75,12 @@ export const MapperList = ({ clientScope, refresh }: MapperListProps) => {
mappers as ProtocolMapperRepresentation[] mappers as ProtocolMapperRepresentation[]
); );
refresh(); refresh();
addAlert(t("mappingCreatedSuccess"), AlertVariant.success); addAlert(t("common:mappingCreatedSuccess"), AlertVariant.success);
} catch (error) { } catch (error) {
addAlert(t("mappingCreatedError", { error }), AlertVariant.danger); addAlert(
t("common:mappingCreatedError", { error }),
AlertVariant.danger
);
} }
} }
}; };
@ -119,7 +122,7 @@ export const MapperList = ({ clientScope, refresh }: MapperListProps) => {
key={key} key={key}
loader={loader} loader={loader}
ariaLabelKey="client-scopes:clientScopeList" ariaLabelKey="client-scopes:clientScopeList"
searchPlaceholderKey="client-scopes:mappersSearchFor" searchPlaceholderKey="common:searchForMapper"
toolbarItem={ toolbarItem={
<Dropdown <Dropdown
onSelect={() => setMapperAction(false)} onSelect={() => setMapperAction(false)}
@ -130,7 +133,7 @@ export const MapperList = ({ clientScope, refresh }: MapperListProps) => {
onToggle={() => setMapperAction(!mapperAction)} onToggle={() => setMapperAction(!mapperAction)}
toggleIndicator={CaretDownIcon} toggleIndicator={CaretDownIcon}
> >
{t("addMapper")} {t("common:addMapper")}
</DropdownToggle> </DropdownToggle>
} }
isOpen={mapperAction} isOpen={mapperAction}
@ -159,11 +162,14 @@ export const MapperList = ({ clientScope, refresh }: MapperListProps) => {
id: clientScope.id!, id: clientScope.id!,
mapperId: mapper.id!, mapperId: mapper.id!,
}); });
addAlert(t("mappingDeletedSuccess"), AlertVariant.success); addAlert(
t("common:mappingDeletedSuccess"),
AlertVariant.success
);
refresh(); refresh();
} catch (error) { } catch (error) {
addAlert( addAlert(
t("mappingDeletedError", { error }), t("common:mappingDeletedError", { error }),
AlertVariant.danger AlertVariant.danger
); );
} }

View file

@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useHistory, useParams, useRouteMatch } from "react-router-dom"; import { useHistory, useParams } from "react-router-dom";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useErrorHandler } from "react-error-boundary"; import { useErrorHandler } from "react-error-boundary";
import { import {
@ -109,8 +109,8 @@ export const MappingDetails = () => {
}, []); }, []);
const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({ const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({
titleKey: "client-scopes:deleteMappingTitle", titleKey: "common:deleteMappingTitle",
messageKey: "client-scopes:deleteMappingConfirm", messageKey: "common:deleteMappingConfirm",
continueButtonLabel: "common:delete", continueButtonLabel: "common:delete",
continueButtonVariant: ButtonVariant.danger, continueButtonVariant: ButtonVariant.danger,
onConfirm: async () => { onConfirm: async () => {
@ -119,10 +119,13 @@ export const MappingDetails = () => {
id, id,
mapperId: mapperId, mapperId: mapperId,
}); });
addAlert(t("mappingDeletedSuccess"), AlertVariant.success); addAlert(t("common:mappingDeletedSuccess"), AlertVariant.success);
history.push(`/${realm}/client-scopes/${id}/mappers`); history.push(`/${realm}/client-scopes/${id}/mappers`);
} catch (error) { } catch (error) {
addAlert(t("mappingDeletedError", { error }), AlertVariant.danger); addAlert(
t("common:mappingDeletedError", { error }),
AlertVariant.danger
);
} }
}, },
}); });
@ -150,7 +153,7 @@ export const MappingDetails = () => {
<> <>
<DeleteConfirm /> <DeleteConfirm />
<ViewHeader <ViewHeader
titleKey={mapping ? mapping.name! : t("addMapper")} titleKey={mapping ? mapping.name! : t("common:addMapper")}
subKey={mapperId.match(isGuid) ? mapperId : ""} subKey={mapperId.match(isGuid) ? mapperId : ""}
badge={mapping?.protocol} badge={mapping?.protocol}
dropdownItems={ dropdownItems={

View file

@ -9,11 +9,6 @@
"deletedSuccess": "The client scope has been deleted", "deletedSuccess": "The client scope has been deleted",
"deleteError": "Could not delete client scope: {{error}}", "deleteError": "Could not delete client scope: {{error}}",
"includeInTokenScope": "Include in token scope", "includeInTokenScope": "Include in token scope",
"mappingDetails": "Mapper details",
"mappingCreatedSuccess": "Mapping successfully created",
"mappingCreatedError": "Could not create mapping: '{{error}}'",
"deleteMappingTitle": "Delete mapping?",
"deleteMappingConfirm": "Are you sure you want to delete this mapping?",
"mappingUpdatedSuccess": "Mapping successfully updated", "mappingUpdatedSuccess": "Mapping successfully updated",
"mappingUpdatedError": "Could not update mapping: '{{error}}'", "mappingUpdatedError": "Could not update mapping: '{{error}}'",
"realmRolePrefix": "Realm role prefix", "realmRolePrefix": "Realm role prefix",
@ -28,10 +23,7 @@
"createError": "Could not create client scope: '{{error}}'", "createError": "Could not create client scope: '{{error}}'",
"updateSuccess": "Client scope updated", "updateSuccess": "Client scope updated",
"updateError": "Could not update client scope: '{{error}}'", "updateError": "Could not update client scope: '{{error}}'",
"mappersSearchFor": "Search for mapper",
"addMapper": "Add mapper",
"addMapperExplain": "If you want more fine-grain control, you can create protocol mapper on this client", "addMapperExplain": "If you want more fine-grain control, you can create protocol mapper on this client",
"protocolMapper": "Mapper type",
"realmRoles": "Realm roles", "realmRoles": "Realm roles",
"selectARole": "Select a role", "selectARole": "Select a role",
"clientRoles": "Client roles", "clientRoles": "Client roles",
@ -48,8 +40,6 @@
"emptyBuiltInMappersInstructions": "All built in mappers were added to this client", "emptyBuiltInMappersInstructions": "All built in mappers were added to this client",
"emptyPrimaryAction": "Add predefined mapper", "emptyPrimaryAction": "Add predefined mapper",
"emptySecondaryAction": "Configure a new mapper", "emptySecondaryAction": "Configure a new mapper",
"mappingDeletedSuccess": "Mapping successfully deleted",
"mappingDeletedError": "Could not delete mapping: '{{error}}'",
"displayOnConsentScreen": "Display on consent screen", "displayOnConsentScreen": "Display on consent screen",
"consentScreenText": "Consent screen text", "consentScreenText": "Consent screen text",
"guiOrder": "Display Order", "guiOrder": "Display Order",

View file

@ -22,11 +22,11 @@ export const ClientDescription = () => {
labelIcon={ labelIcon={
<HelpItem <HelpItem
helpText="clients-help:clientID" helpText="clients-help:clientID"
forLabel={t("clientID")} forLabel={t("common:clientID")}
forID="kc-client-id" forID="kc-client-id"
/> />
} }
label={t("clientID")} label={t("common:clientID")}
fieldId="kc-client-id" fieldId="kc-client-id"
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
validated={ validated={

View file

@ -144,7 +144,7 @@ export const ClientsSection = () => {
columns={[ columns={[
{ {
name: "clientId", name: "clientId",
displayKey: "clients:clientID", displayKey: "common:clientID",
cellRenderer: ClientDetailLink, cellRenderer: ClientDetailLink,
}, },
{ name: "protocol", displayKey: "common:type" }, { name: "protocol", displayKey: "common:type" },

View file

@ -74,7 +74,7 @@ export const InitialAccessTokenList = () => {
columns={[ columns={[
{ {
name: "id", name: "id",
displayKey: "clients:id", displayKey: "common:id",
}, },
{ {
name: "timestamp", name: "timestamp",

View file

@ -5,7 +5,6 @@
"implicitFlow": "Implicit flow", "implicitFlow": "Implicit flow",
"createClient": "Create client", "createClient": "Create client",
"importClient": "Import client", "importClient": "Import client",
"clientID": "Client ID",
"homeURL": "Home URL", "homeURL": "Home URL",
"webOrigins": "Web origins", "webOrigins": "Web origins",
"addWebOrigins": "Add web origins", "addWebOrigins": "Add web origins",
@ -86,7 +85,6 @@
"tokenDeleteConfirmTitle": "Delete initial access token?", "tokenDeleteConfirmTitle": "Delete initial access token?",
"tokenDeleteSuccess": "initial access token created successfully", "tokenDeleteSuccess": "initial access token created successfully",
"tokenDeleteError": "Could not delete initial access token: '{{error}}'", "tokenDeleteError": "Could not delete initial access token: '{{error}}'",
"id": "ID",
"timestamp": "Created date", "timestamp": "Created date",
"expires": "Expires", "expires": "Expires",
"count": "Count", "count": "Count",

View file

@ -105,6 +105,11 @@
"searchForMapper": "Search for mapper", "searchForMapper": "Search for mapper",
"mapperType": "Mapper type", "mapperType": "Mapper type",
"mappingDeletedSuccess": "Mapping successfully deleted", "mappingDeletedSuccess": "Mapping successfully deleted",
"mappingDeletedError": "Could not delete mapping: '{{error}}'" "mappingDeletedError": "Could not delete mapping: '{{error}}'",
"mappingDetails": "Mapper details",
"mappingCreatedSuccess": "Mapping successfully created",
"mappingCreatedError": "Could not create mapping: '{{error}}'",
"deleteMappingTitle": "Delete mapping?",
"deleteMappingConfirm": "Are you sure you want to delete this mapping?"
} }
} }

View file

@ -107,7 +107,7 @@ export type DataListProps<T> = {
* <KeycloakDataTable columns={[ * <KeycloakDataTable columns={[
* { * {
* name: "clientId", //name of the field from the array of object the loader returns to display in this column * name: "clientId", //name of the field from the array of object the loader returns to display in this column
* displayKey: "clients:clientID", //i18n key to use to lookup the name of the column header * displayKey: "common:clientID", //i18n key to use to lookup the name of the column header
* cellRenderer: ClientDetailLink, //optionally you can use a component to render the column when you don't want just the content of the field, the whole row / entire object is passed in. * cellRenderer: ClientDetailLink, //optionally you can use a component to render the column when you don't want just the content of the field, the whole row / entire object is passed in.
* } * }
* ]} * ]}

View file

@ -174,7 +174,7 @@ export const GroupsSection = () => {
<Tab <Tab
data-testid="attributes" data-testid="attributes"
eventKey={2} eventKey={2}
title={<TabTitleText>{t("attributes")}</TabTitleText>} title={<TabTitleText>{t("common:attributes")}</TabTitleText>}
> >
<GroupAttributes /> <GroupAttributes />
</Tab> </Tab>

View file

@ -327,7 +327,7 @@ export const RealmRoleTabs = () => {
) : null} ) : null}
<Tab <Tab
eventKey="attributes" eventKey="attributes"
title={<TabTitleText>{t("attributes")}</TabTitleText>} title={<TabTitleText>{t("common:attributes")}</TabTitleText>}
> >
<AttributesForm <AttributesForm
form={form} form={form}

View file

@ -1,6 +1,5 @@
{ {
"roles": { "roles": {
"attributes": "Attributes",
"addAttributeText": "Add an attribute", "addAttributeText": "Add an attribute",
"deleteAttributeText": "Delete an attribute", "deleteAttributeText": "Delete an attribute",
"associatedRolesText": "Associated roles", "associatedRolesText": "Associated roles",
@ -59,7 +58,6 @@
"noDirectUsers": "No direct users", "noDirectUsers": "No direct users",
"noUsersEmptyStateDescription": "Only the users with this role directly assigned will appear under this tab. If you need to find users assigned to this role, go to", "noUsersEmptyStateDescription": "Only the users with this role directly assigned will appear under this tab. If you need to find users assigned to this role, go to",
"noUsersEmptyStateDescriptionContinued": "to find them. Users that already have this role as an effective role cannot be added here.", "noUsersEmptyStateDescriptionContinued": "to find them. Users that already have this role as an effective role cannot be added here.",
"id": "ID",
"groups": "Groups", "groups": "Groups",
"or": "or", "or": "or",
"users": "Users", "users": "Users",

View file

@ -96,13 +96,13 @@ export const routes: RoutesFn = (t: TFunction) => [
{ {
path: "/:realm/client-scopes/:id/mappers/oidc-role-name-mapper", path: "/:realm/client-scopes/:id/mappers/oidc-role-name-mapper",
component: RoleMappingForm, component: RoleMappingForm,
breadcrumb: t("client-scopes:mappingDetails"), breadcrumb: t("common:mappingDetails"),
access: "view-clients", access: "view-clients",
}, },
{ {
path: "/:realm/client-scopes/:id/mappers/:mapperId", path: "/:realm/client-scopes/:id/mappers/:mapperId",
component: MappingDetails, component: MappingDetails,
breadcrumb: t("client-scopes:mappingDetails"), breadcrumb: t("common:mappingDetails"),
access: "view-clients", access: "view-clients",
}, },
{ {
@ -228,7 +228,7 @@ export const routes: RoutesFn = (t: TFunction) => [
{ {
path: "/:realm/user-federation/ldap/:id/:tab/:mapperId", path: "/:realm/user-federation/ldap/:id/:tab/:mapperId",
component: LdapMappingDetails, component: LdapMappingDetails,
breadcrumb: t("client-scopes:mappingDetails"), breadcrumb: t("common:mappingDetails"),
access: "view-realm", access: "view-realm",
}, },
{ {

View file

@ -26,7 +26,7 @@ SimpleList.args = {
ariaLabelKey: "clients:clientList", ariaLabelKey: "clients:clientList",
searchPlaceholderKey: "common:search", searchPlaceholderKey: "common:search",
columns: [ columns: [
{ name: "clientId", displayKey: "clients:clientID" }, { name: "clientId", displayKey: "common:clientID" },
{ name: "protocol", displayKey: "common:type" }, { name: "protocol", displayKey: "common:type" },
{ {
name: "description", name: "description",

View file

@ -146,7 +146,7 @@ export const RoleMappingForm = () => {
return ( return (
<> <>
<ViewHeader <ViewHeader
titleKey="client-scopes:addMapper" titleKey="common:addMapper"
subKey="client-scopes:addMapperExplain" subKey="client-scopes:addMapperExplain"
/> />
<PageSection variant="light"> <PageSection variant="light">
@ -156,11 +156,11 @@ export const RoleMappingForm = () => {
role="manage-clients" role="manage-clients"
> >
<FormGroup <FormGroup
label={t("protocolMapper")} label={t("common:mapperType")}
labelIcon={ labelIcon={
<HelpItem <HelpItem
helpText="client-scopes-help:protocolMapper" helpText="client-scopes-help:protocolMapper"
forLabel={t("protocolMapper")} forLabel={t("common:mapperType")}
forID="protocolMapper" forID="protocolMapper"
/> />
} }

View file

@ -157,7 +157,6 @@
"roleObjectClasses": "Role object classes", "roleObjectClasses": "Role object classes",
"userRolesRetrieveStrategy": "User roles retrieve strategy", "userRolesRetrieveStrategy": "User roles retrieve strategy",
"useRealmRolesMapping": "Use realm roles mapping", "useRealmRolesMapping": "Use realm roles mapping",
"clientId": "Client ID",
"ldapAttributeName": "LDAP attribute name", "ldapAttributeName": "LDAP attribute name",
"ldapAttributeValue": "LDAP attribute value", "ldapAttributeValue": "LDAP attribute value",

View file

@ -100,7 +100,7 @@ export const UserForm = ({
{editMode ? ( {editMode ? (
<> <>
<FormGroup <FormGroup
label={t("id")} label={t("common:id")}
fieldId="kc-id" fieldId="kc-id"
isRequired isRequired
validated={errors.id ? "error" : "default"} validated={errors.id ? "error" : "default"}

View file

@ -19,7 +19,6 @@
"removedGroupMembershipError": "Error removing group membership", "removedGroupMembershipError": "Error removing group membership",
"path": "Path", "path": "Path",
"emptyInstructions": "Change your search criteria or add a user", "emptyInstructions": "Change your search criteria or add a user",
"id": "ID",
"createdAt": "Created at", "createdAt": "Created at",
"username": "Username", "username": "Username",
"email": "Email", "email": "Email",