From 0b0e474cafee5931f0a642c9e53a333e22eb95ae Mon Sep 17 00:00:00 2001 From: mfrances Date: Mon, 29 Mar 2021 21:03:26 -0400 Subject: [PATCH] move multi-used strings to common --- src/client-scopes/add/RoleMappingForm.tsx | 6 +++--- src/client-scopes/details/MapperList.tsx | 18 ++++++++++++------ src/client-scopes/details/MappingDetails.tsx | 15 +++++++++------ src/client-scopes/messages.json | 10 ---------- src/clients/ClientDescription.tsx | 4 ++-- src/clients/ClientsSection.tsx | 2 +- .../initial-access/InitialAccessTokenList.tsx | 2 +- src/clients/messages.json | 2 -- src/common-messages.json | 7 ++++++- .../table-toolbar/KeycloakDataTable.tsx | 2 +- src/groups/GroupsSection.tsx | 2 +- src/realm-roles/RealmRoleTabs.tsx | 2 +- src/realm-roles/messages.json | 2 -- src/route-config.ts | 6 +++--- src/stories/KeycloakDataTable.stories.tsx | 2 +- .../ldap/mappers/LdapRoleMappingForm.tsx | 6 +++--- src/user-federation/messages.json | 1 - src/user/UserForm.tsx | 2 +- src/user/messages.json | 1 - 19 files changed, 45 insertions(+), 47 deletions(-) diff --git a/src/client-scopes/add/RoleMappingForm.tsx b/src/client-scopes/add/RoleMappingForm.tsx index c9fc142f74..e98be38c1c 100644 --- a/src/client-scopes/add/RoleMappingForm.tsx +++ b/src/client-scopes/add/RoleMappingForm.tsx @@ -146,7 +146,7 @@ export const RoleMappingForm = () => { return ( <> @@ -156,11 +156,11 @@ export const RoleMappingForm = () => { role="manage-clients" > } diff --git a/src/client-scopes/details/MapperList.tsx b/src/client-scopes/details/MapperList.tsx index 8aeabd2f8a..ba5344d498 100644 --- a/src/client-scopes/details/MapperList.tsx +++ b/src/client-scopes/details/MapperList.tsx @@ -75,9 +75,12 @@ export const MapperList = ({ clientScope, refresh }: MapperListProps) => { mappers as ProtocolMapperRepresentation[] ); refresh(); - addAlert(t("mappingCreatedSuccess"), AlertVariant.success); + addAlert(t("common:mappingCreatedSuccess"), AlertVariant.success); } 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} loader={loader} ariaLabelKey="client-scopes:clientScopeList" - searchPlaceholderKey="client-scopes:mappersSearchFor" + searchPlaceholderKey="common:searchForMapper" toolbarItem={ setMapperAction(false)} @@ -130,7 +133,7 @@ export const MapperList = ({ clientScope, refresh }: MapperListProps) => { onToggle={() => setMapperAction(!mapperAction)} toggleIndicator={CaretDownIcon} > - {t("addMapper")} + {t("common:addMapper")} } isOpen={mapperAction} @@ -159,11 +162,14 @@ export const MapperList = ({ clientScope, refresh }: MapperListProps) => { id: clientScope.id!, mapperId: mapper.id!, }); - addAlert(t("mappingDeletedSuccess"), AlertVariant.success); + addAlert( + t("common:mappingDeletedSuccess"), + AlertVariant.success + ); refresh(); } catch (error) { addAlert( - t("mappingDeletedError", { error }), + t("common:mappingDeletedError", { error }), AlertVariant.danger ); } diff --git a/src/client-scopes/details/MappingDetails.tsx b/src/client-scopes/details/MappingDetails.tsx index c52528cb60..0ab64c48d9 100644 --- a/src/client-scopes/details/MappingDetails.tsx +++ b/src/client-scopes/details/MappingDetails.tsx @@ -1,5 +1,5 @@ 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 { useErrorHandler } from "react-error-boundary"; import { @@ -109,8 +109,8 @@ export const MappingDetails = () => { }, []); const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({ - titleKey: "client-scopes:deleteMappingTitle", - messageKey: "client-scopes:deleteMappingConfirm", + titleKey: "common:deleteMappingTitle", + messageKey: "common:deleteMappingConfirm", continueButtonLabel: "common:delete", continueButtonVariant: ButtonVariant.danger, onConfirm: async () => { @@ -119,10 +119,13 @@ export const MappingDetails = () => { id, mapperId: mapperId, }); - addAlert(t("mappingDeletedSuccess"), AlertVariant.success); + addAlert(t("common:mappingDeletedSuccess"), AlertVariant.success); history.push(`/${realm}/client-scopes/${id}/mappers`); } catch (error) { - addAlert(t("mappingDeletedError", { error }), AlertVariant.danger); + addAlert( + t("common:mappingDeletedError", { error }), + AlertVariant.danger + ); } }, }); @@ -150,7 +153,7 @@ export const MappingDetails = () => { <> { labelIcon={ } - label={t("clientID")} + label={t("common:clientID")} fieldId="kc-client-id" helperTextInvalid={t("common:required")} validated={ diff --git a/src/clients/ClientsSection.tsx b/src/clients/ClientsSection.tsx index 76f5b17054..fcb04e00af 100644 --- a/src/clients/ClientsSection.tsx +++ b/src/clients/ClientsSection.tsx @@ -144,7 +144,7 @@ export const ClientsSection = () => { columns={[ { name: "clientId", - displayKey: "clients:clientID", + displayKey: "common:clientID", cellRenderer: ClientDetailLink, }, { name: "protocol", displayKey: "common:type" }, diff --git a/src/clients/initial-access/InitialAccessTokenList.tsx b/src/clients/initial-access/InitialAccessTokenList.tsx index 1de09066df..7a7e4577c7 100644 --- a/src/clients/initial-access/InitialAccessTokenList.tsx +++ b/src/clients/initial-access/InitialAccessTokenList.tsx @@ -74,7 +74,7 @@ export const InitialAccessTokenList = () => { columns={[ { name: "id", - displayKey: "clients:id", + displayKey: "common:id", }, { name: "timestamp", diff --git a/src/clients/messages.json b/src/clients/messages.json index 1748d40efb..33e38ee174 100644 --- a/src/clients/messages.json +++ b/src/clients/messages.json @@ -5,7 +5,6 @@ "implicitFlow": "Implicit flow", "createClient": "Create client", "importClient": "Import client", - "clientID": "Client ID", "homeURL": "Home URL", "webOrigins": "Web origins", "addWebOrigins": "Add web origins", @@ -86,7 +85,6 @@ "tokenDeleteConfirmTitle": "Delete initial access token?", "tokenDeleteSuccess": "initial access token created successfully", "tokenDeleteError": "Could not delete initial access token: '{{error}}'", - "id": "ID", "timestamp": "Created date", "expires": "Expires", "count": "Count", diff --git a/src/common-messages.json b/src/common-messages.json index 4d03319e1b..66a4c28397 100644 --- a/src/common-messages.json +++ b/src/common-messages.json @@ -105,6 +105,11 @@ "searchForMapper": "Search for mapper", "mapperType": "Mapper type", "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?" } } diff --git a/src/components/table-toolbar/KeycloakDataTable.tsx b/src/components/table-toolbar/KeycloakDataTable.tsx index 58619a203e..04e5486a4a 100644 --- a/src/components/table-toolbar/KeycloakDataTable.tsx +++ b/src/components/table-toolbar/KeycloakDataTable.tsx @@ -107,7 +107,7 @@ export type DataListProps = { * { {t("attributes")}} + title={{t("common:attributes")}} > diff --git a/src/realm-roles/RealmRoleTabs.tsx b/src/realm-roles/RealmRoleTabs.tsx index 5d1a7b8dd0..7e915eca09 100644 --- a/src/realm-roles/RealmRoleTabs.tsx +++ b/src/realm-roles/RealmRoleTabs.tsx @@ -327,7 +327,7 @@ export const RealmRoleTabs = () => { ) : null} {t("attributes")}} + title={{t("common:attributes")}} > [ { path: "/:realm/client-scopes/:id/mappers/oidc-role-name-mapper", component: RoleMappingForm, - breadcrumb: t("client-scopes:mappingDetails"), + breadcrumb: t("common:mappingDetails"), access: "view-clients", }, { path: "/:realm/client-scopes/:id/mappers/:mapperId", component: MappingDetails, - breadcrumb: t("client-scopes:mappingDetails"), + breadcrumb: t("common:mappingDetails"), access: "view-clients", }, { @@ -228,7 +228,7 @@ export const routes: RoutesFn = (t: TFunction) => [ { path: "/:realm/user-federation/ldap/:id/:tab/:mapperId", component: LdapMappingDetails, - breadcrumb: t("client-scopes:mappingDetails"), + breadcrumb: t("common:mappingDetails"), access: "view-realm", }, { diff --git a/src/stories/KeycloakDataTable.stories.tsx b/src/stories/KeycloakDataTable.stories.tsx index 58fdfbe23e..95bf1e45ed 100644 --- a/src/stories/KeycloakDataTable.stories.tsx +++ b/src/stories/KeycloakDataTable.stories.tsx @@ -26,7 +26,7 @@ SimpleList.args = { ariaLabelKey: "clients:clientList", searchPlaceholderKey: "common:search", columns: [ - { name: "clientId", displayKey: "clients:clientID" }, + { name: "clientId", displayKey: "common:clientID" }, { name: "protocol", displayKey: "common:type" }, { name: "description", diff --git a/src/user-federation/ldap/mappers/LdapRoleMappingForm.tsx b/src/user-federation/ldap/mappers/LdapRoleMappingForm.tsx index 1e8b2e5e02..cf0e9a4a70 100644 --- a/src/user-federation/ldap/mappers/LdapRoleMappingForm.tsx +++ b/src/user-federation/ldap/mappers/LdapRoleMappingForm.tsx @@ -146,7 +146,7 @@ export const RoleMappingForm = () => { return ( <> @@ -156,11 +156,11 @@ export const RoleMappingForm = () => { role="manage-clients" > } diff --git a/src/user-federation/messages.json b/src/user-federation/messages.json index b7c33f933b..c5b0ae5a74 100644 --- a/src/user-federation/messages.json +++ b/src/user-federation/messages.json @@ -157,7 +157,6 @@ "roleObjectClasses": "Role object classes", "userRolesRetrieveStrategy": "User roles retrieve strategy", "useRealmRolesMapping": "Use realm roles mapping", - "clientId": "Client ID", "ldapAttributeName": "LDAP attribute name", "ldapAttributeValue": "LDAP attribute value", diff --git a/src/user/UserForm.tsx b/src/user/UserForm.tsx index bb8e4e2f4a..3f7bfcf2ac 100644 --- a/src/user/UserForm.tsx +++ b/src/user/UserForm.tsx @@ -100,7 +100,7 @@ export const UserForm = ({ {editMode ? ( <>