From 7b2e0c383020ce0a445f46903df85eee3ae80676 Mon Sep 17 00:00:00 2001 From: Jeroen De Wilde <52921312+jeroendewilde@users.noreply.github.com> Date: Wed, 22 Feb 2023 13:53:09 +0100 Subject: [PATCH] Add thTooltipText prop to DraggableTable component (#4444) This commit adds a new prop called thTooltipText to the DraggableTable component, which allows users to add a tooltip next to the column name in the th of the table. --- .../public/resources/en/authentication-help.json | 3 ++- .../src/authentication/RequiredActions.tsx | 1 + .../authentication/components/DraggableTable.tsx | 14 +++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/admin-ui/public/resources/en/authentication-help.json b/apps/admin-ui/public/resources/en/authentication-help.json index d1c739d143..dff77dce8d 100644 --- a/apps/admin-ui/public/resources/en/authentication-help.json +++ b/apps/admin-ui/public/resources/en/authentication-help.json @@ -7,6 +7,7 @@ "addExecution": "Execution can have a wide range of actions, from sending a reset email to validating an OTP", "addSubFlow": "Sub-Flows can be either generic or form. The form type is used to construct a sub-flow that generates a single flow for the user. Sub-flows are a special type of execution that evaluate as successful depending on how the executions they contain evaluate.", "alias": "Name of the configuration", + "authDefaultActionTooltip": "If enabled, any new user will have this required action assigned to it.", "otpType": "totp is Time-Based One Time Password. 'hotp' is a counter base one time password in which the server keeps a counter to hash against.", "webAuthnPolicyRpEntityName": "Human-readable server name as WebAuthn Relying Party", "otpHashAlgorithm": "What hashing algorithm should be used to generate the OTP.", @@ -47,4 +48,4 @@ "cibaExpiresIn": "The expiration time of the \"auth_req_id\" in seconds since the authentication request was received.", "cibaInterval": "The minimum amount of time in seconds that the CD (Consumption Device) must wait between polling requests to the token endpoint. If set to 0, the CD must use 5 as the default value according to the CIBA specification.", "cibaAuthRequestedUserHint": "The way of identifying the end-user for whom authentication is being requested. Currently only \"login_hint\" is supported." -} \ No newline at end of file +} diff --git a/apps/admin-ui/src/authentication/RequiredActions.tsx b/apps/admin-ui/src/authentication/RequiredActions.tsx index 3531f23c8c..e097337b51 100644 --- a/apps/admin-ui/src/authentication/RequiredActions.tsx +++ b/apps/admin-ui/src/authentication/RequiredActions.tsx @@ -152,6 +152,7 @@ export const RequiredActions = () => { { name: "default", displayKey: "authentication:setAsDefaultAction", + thTooltipText: "authentication-help:authDefaultActionTooltip", cellRenderer: (row) => ( = { name: string; displayKey?: string; cellRenderer?: (row: T) => ReactNode; + thTooltipText?: string; }; export type Action = IAction & { isActionable?: (item: T) => boolean }; @@ -179,6 +181,14 @@ export function DraggableTable({ }); }; + const thInfo = (column: Field): ThInfoType | undefined => { + if (!column.thTooltipText) return undefined; + return { + popover:
{t(column.thTooltipText)}
, + ariaLabel: t(column.thTooltipText), + }; + }; + return ( ({ {columns.map((column) => ( - {t(column.displayKey || column.name)} + + {t(column.displayKey || column.name)} + ))}