Auth: Translate Auth provider form fields (#105059)
* first pass at translating all of auth config * rename variables * translate missing phrases * add more
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState } from 'react';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
|
||||
import { AppEvents } from '@grafana/data';
|
||||
@@ -22,7 +22,7 @@ import { FormPrompt } from '../../core/components/FormPrompt/FormPrompt';
|
||||
import { Page } from '../../core/components/Page/Page';
|
||||
|
||||
import { FieldRenderer } from './FieldRenderer';
|
||||
import { sectionFields } from './fields';
|
||||
import { getSectionFields } from './fields';
|
||||
import { SSOProvider, SSOProviderDTO } from './types';
|
||||
import { dataToDTO, dtoToData } from './utils/data';
|
||||
|
||||
@@ -49,7 +49,7 @@ export const ProviderConfigForm = ({ config, provider, isLoading }: ProviderConf
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [submitError, setSubmitError] = useState(false);
|
||||
const dataSubmitted = isSubmitted && !submitError;
|
||||
const sections = sectionFields[provider];
|
||||
const sections = useMemo(() => getSectionFields()[provider], [provider]);
|
||||
const [resetConfig, setResetConfig] = useState(false);
|
||||
|
||||
const additionalActionsMenu = (
|
||||
@@ -211,7 +211,13 @@ export const ProviderConfigForm = ({ config, provider, isLoading }: ProviderConf
|
||||
onClick={() => onSaveAttempt(true)}
|
||||
variant={isEnabled ? 'secondary' : undefined}
|
||||
>
|
||||
{isSaving ? (isEnabled ? 'Disabling...' : 'Saving...') : isEnabled ? 'Disable' : 'Save and enable'}
|
||||
{isSaving
|
||||
? isEnabled
|
||||
? t('auth-config.provider-config-form.disabling', 'Disabling...')
|
||||
: t('auth-config.provider-config-form.saving', 'Saving...')
|
||||
: isEnabled
|
||||
? t('auth-config.provider-config-form.disable', 'Disable')
|
||||
: t('auth-config.provider-config-form.save-and-enable', 'Save and enable')}
|
||||
</Button>
|
||||
|
||||
<Button type={'submit'} disabled={isSaving} variant={'secondary'} onClick={() => onSaveAttempt(false)}>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
|
||||
import { fieldMap, sectionFields } from '../fields';
|
||||
import { fieldMap, getSectionFields } from '../fields';
|
||||
import { FieldData, SSOProvider, SSOProviderDTO } from '../types';
|
||||
|
||||
import { isSelectableValue } from './guards';
|
||||
@@ -86,7 +86,7 @@ const valuesToString = (values: Array<SelectableValue<string>>) => {
|
||||
};
|
||||
|
||||
const getFieldsForProvider = (provider: string) => {
|
||||
const sections = sectionFields[provider];
|
||||
const sections = getSectionFields()[provider];
|
||||
|
||||
// include the enabled field because it is not part of the fields defined for providers
|
||||
const fields = ['enabled'];
|
||||
@@ -133,5 +133,5 @@ export function dtoToData(dto: SSOProviderDTO, provider: string) {
|
||||
export function getArrayFields(obj: Record<string, FieldData>, providerFields: string[]): Array<keyof SSOProviderDTO> {
|
||||
return Object.entries(obj)
|
||||
.filter(([key, value]) => providerFields.includes(key) && value.type === 'select')
|
||||
.map(([key]) => key as keyof SSOProviderDTO);
|
||||
.map(([key]) => key as keyof SSOProviderDTO); // TODO: replace this with a type guard
|
||||
}
|
||||
|
||||
@@ -2628,16 +2628,109 @@
|
||||
"refer-documentation-configure-authentication": "Refer to the documentation on how to configure authentication"
|
||||
},
|
||||
"fields": {
|
||||
"allow-assign-grafana-admin-description": "If enabled, it will automatically sync the Grafana server administrator role.",
|
||||
"allow-assign-grafana-admin-label": "Allow assign Grafana admin",
|
||||
"allow-sign-up-description": "If not enabled, only existing Grafana users can log in using OAuth.",
|
||||
"allow-sign-up-label": "Allow sign up",
|
||||
"allowed-domains-description": "List of comma- or space-separated domains. The user should belong to at least \none domain to log in.",
|
||||
"allowed-domains-label": "Allowed domains",
|
||||
"allowed-groups-description": "List of comma- or space-separated groups. The user should be a member of at least one group to log in.",
|
||||
"allowed-groups-description-oauth": "If you configure \"Allowed groups\", you must also configure \"Groups attribute path\".",
|
||||
"allowed-groups-description-oauth": "If you configure \"{{ allowedGroupsLabel }}\", you must also configure \"{{ groupsAttributePathLabel }}\".",
|
||||
"allowed-groups-label": "Allowed groups",
|
||||
"allowed-groups-object-ids": "{{ allowedGroupsLabel }} must be {{ objectIDsField }}.",
|
||||
"allowed-organizations-description": "List of comma- or space-separated organizations. The user should be a member \nof at least one organization to log in.",
|
||||
"allowed-organizations-label": "Allowed organizations",
|
||||
"allowed-organizations-placeholder": "Enter organizations (my-team, myteam...) and press Enter to add",
|
||||
"api-url-description": "The user information endpoint of your OAuth2 provider. Information returned by this endpoint must be compatible with <2>OpenID UserInfo</2>.",
|
||||
"api-url-required": "This field must be a valid URL if set.",
|
||||
"auth-style-description": "It determines how \"{{ clientIDLabel }}\" and \"{{ clientSecretLabel }}\" are sent to Oauth2 provider. Default is AutoDetect.",
|
||||
"auth-style-label": "Auth style",
|
||||
"auth-url-description": "The authorization endpoint of your OAuth2 provider.",
|
||||
"auth-url-required": "This field is required and must be a valid URL.",
|
||||
"auto-login-description": "Log in automatically, skipping the login screen.",
|
||||
"auto-login-label": "Auto login",
|
||||
"client-authentication-description": "The client authentication method used to authenticate to the token endpoint.",
|
||||
"client-authentication-label": "Client authentication",
|
||||
"client-authentication-none": "None",
|
||||
"client-id-description": "The {{ clientIDLabel }} of your OAuth2 app.",
|
||||
"client-secret-description": "The {{ clientSecretLabel }} of your OAuth2 app.",
|
||||
"define-allowed-groups-label": "Define allowed groups",
|
||||
"define-allowed-teams-ids-label": "Define allowed teams IDs",
|
||||
"display-name-description": "Will be displayed on the login page as \"Sign in with ...\". Helpful if you use more than one identity providers or SSO protocols.",
|
||||
"display-name-label": "Display name",
|
||||
"email-attribute-name-description": "Name of the key to use for user email lookup within the attributes map of OAuth2 ID token.",
|
||||
"email-attribute-name-label": "Email attribute name",
|
||||
"email-attribute-path-description": "JMESPath expression to use for user email lookup from the user information.",
|
||||
"email-attribute-path-label": "Email attribute path",
|
||||
"federated-credential-audience-description": "The audience of the federated identity credential of your OAuth2 app.",
|
||||
"federated-credential-audience-label": "FIC audience",
|
||||
"force-use-graph-api-description": "If enabled, Grafana will fetch the users' groups using the Microsoft Graph API.",
|
||||
"force-use-graph-api-label": "Force use Graph API",
|
||||
"groups-attribute-path-description": "JMESPath expression to use for user group lookup. If you configure \"{{ allowedGroupsLabel }}\", \nyou must also configure \"{{ groupsAttributePathLabel }}\".",
|
||||
"groups-attribute-path-label": "Groups attribute path",
|
||||
"hosted-domain-description": "The domain under which Grafana is hosted and accessible.",
|
||||
"hosted-domain-label": "Hosted domain",
|
||||
"id-token-attribute-name-description": "The name of the key used to extract the ID token from the returned OAuth2 token.",
|
||||
"id-token-attribute-name-label": "ID token attribute name",
|
||||
"login-attribute-path-description": "JMESPath expression to use for user login lookup from the user ID token.",
|
||||
"login-attribute-path-label": "Login attribute path",
|
||||
"managed-identity-client-id-description": "The managed identity client ID of the federated identity credential of your OAuth2 app.",
|
||||
"managed-identity-client-id-label": "FIC managed identity client ID",
|
||||
"name-attribute-path-description": "JMESPath expression to use for user name lookup from the user ID token. \nThis name will be used as the user's display name.",
|
||||
"name-attribute-path-label": "Name attribute path",
|
||||
"org-mapping-description-azuread": "List of \"<GroupID>:<OrgIdOrName>:<Role>\" mappings.",
|
||||
"org-mapping-description-generic": "List of \"<ExternalName>:<OrgIdOrName>:<Role>\" mappings.",
|
||||
"org-mapping-description-github": "List of \"<GitHubTeamName>:<OrgIdOrName>:<Role>\" mappings.",
|
||||
"org-mapping-description-gitlab": "List of \"<GitlabGroupName>:<OrgIdOrName>:<Role>\" mappings.",
|
||||
"org-mapping-description-google": "List of \"<GoogleGroupName>:<OrgIdOrName>:<Role>\" mappings.",
|
||||
"organization-attribute-path-description": "JMESPath expression to use for organization lookup. If you configure \"{{ orgMappingLabel }}\", you must also configure \"{{ orgAttributePathLabel }}\".",
|
||||
"organization-attribute-path-label": "Organization attribute path",
|
||||
"organization-mapping-label": "Organization mapping",
|
||||
"organization-mapping-placeholder": "Enter mappings (my-team:1:Viewer...) and press Enter to add",
|
||||
"required": "This field is required",
|
||||
"role-attribute-path-description": "{{ jmesPathLabel }} expression to use for Grafana role lookup.",
|
||||
"role-attribute-path-label": "Role attribute path",
|
||||
"role-attribute-strict-description": "If enabled, denies user login if the Grafana role cannot be extracted using Role attribute path.",
|
||||
"role-attribute-strict-label": "Role attribute strict mode",
|
||||
"scopes-description": "List of comma- or space-separated OAuth2 {{ scopesLabel }}.",
|
||||
"section-extra-security": "Extra security measures",
|
||||
"section-general-settings": "General settings",
|
||||
"section-user-mapping": "User mapping",
|
||||
"server-discovery-url-description": "The .well-known/openid-configuration endpoint for your IdP. The info extracted from this URL will be used to populate the \"{{ authURLLabel }}\", \"{{ tokenURLLabel }}\" and \"{{ apiURLLabel }}\" fields.",
|
||||
"signout-redirect-url-description": "The URL to redirect the user to after signing out from Grafana.",
|
||||
"signout-redirect-url-label": "Sign out redirect URL",
|
||||
"skip-org-role-sync-description": "Prevent synchronizing users' organization roles from your IdP.",
|
||||
"skip-org-role-sync-label": "Skip organization role sync",
|
||||
"team-ids-attribute-path-description": "The JMESPath expression to use for Grafana Team ID lookup within the results returned by the \"{{ teamsURLLabel }}\" endpoint.",
|
||||
"team-ids-attribute-path-label": "Team IDs attribute path",
|
||||
"team-ids-attribute-path-required": "This field must be set if \"{{ teamIDsLabel }}\" are configured.",
|
||||
"team-ids-description": "If set, the user must be a member of one of the given teams to log in.",
|
||||
"team-ids-description-oauth": "If you configure \"{{teamIds}}\", you must also configure \"{{teamsUrl}}\" and \"{{teamIdsAttributePath}}\".",
|
||||
"team-ids-github": "Integer list of Team Ids.",
|
||||
"team-ids-description-oauth": "If you configure \"{{ teamIDsLabel }}\", you must also configure \"{{ teamsURLLabel }}\" and \"{{ teamIDsAttributePathLabel }}\".",
|
||||
"team-ids-github": "Integer list of Team IDs.",
|
||||
"team-ids-label": "Team IDs",
|
||||
"team-ids-numbers": "Team IDs must be numbers.",
|
||||
"team-ids-other": "String list of Team Ids.",
|
||||
"teams-url-description": "The URL used to query for Team Ids. If not set, the default value is /teams.",
|
||||
"teams-url-description-oauth": "If you configure \"Teams URL\", you must also configure \"Team Ids attribute path\".",
|
||||
"use-pkce-description": "If enabled, Grafana will use <2>Proof Key for Code Exchange (PKCE)</2> with the OAuth2 Authorization Code Grant."
|
||||
"team-ids-placeholder": "Enter Team IDs and press Enter to add",
|
||||
"teams-url-description": "The URL used to query for Team IDs. If not set, the default value is /teams.",
|
||||
"teams-url-description-oauth": "If you configure \"{{ teamsURLLabel }}\", you must also configure \"{{ teamIDsAttributePathLabel }}\".",
|
||||
"teams-url-label": "Teams URL",
|
||||
"teams-url-required": "This field must be set if \"{{ teamIDsLabel }}\" are configured and must be a valid URL.",
|
||||
"tls-client-ca-description": "The file path to the trusted certificate authority list. Is not applicable on Grafana Cloud.",
|
||||
"tls-client-ca-label": "TLS client CA",
|
||||
"tls-client-cert-description": "The file path to the certificate. Is not applicable on Grafana Cloud.",
|
||||
"tls-client-cert-label": "TLS client cert",
|
||||
"tls-client-key-description": "The file path to the key. Is not applicable on Grafana Cloud.",
|
||||
"tls-client-key-label": "TLS client key",
|
||||
"tls-skip-verify-description": "If enabled, the client accepts any certificate presented by the server and any host \nname in that certificate. You should only use this for testing, because this mode leaves \nSSL/TLS susceptible to man-in-the-middle attacks.",
|
||||
"tls-skip-verify-label": "TLS skip verify",
|
||||
"token-url-description": "The token endpoint of your OAuth2 provider.",
|
||||
"token-url-required": "This field is required and must be a valid URL.",
|
||||
"use-pkce-description": "If enabled, Grafana will use <2>Proof Key for Code Exchange (PKCE)</2> with the OAuth2 Authorization Code Grant.",
|
||||
"use-pkce-label": "Use PKCE",
|
||||
"use-refresh-token-description": "If enabled, Grafana will fetch a new access token using the refresh token provided by the OAuth2 provider.",
|
||||
"use-refresh-token-label": "Use refresh token",
|
||||
"validate-hosted-domain-description": "If enabled, Grafana will match the Hosted Domain retrieved from the Google ID Token against the \"{{ allowedDomainsLabel }}\" list specified by the user.",
|
||||
"validate-hosted-domain-label": "Validate hosted domain"
|
||||
},
|
||||
"provider-card": {
|
||||
"text-badge-enabled": "Enabled",
|
||||
@@ -2647,12 +2740,15 @@
|
||||
"additional-actions-menu": {
|
||||
"label-reset-to-default-values": "Reset to default values"
|
||||
},
|
||||
"disable": "Disable",
|
||||
"disabling": "Disabling...",
|
||||
"discard": "Discard",
|
||||
"enabled-label-enabled": "Enabled",
|
||||
"label-enabled": "Enabled",
|
||||
"reset-configuration": "Are you sure you want to reset this configuration?",
|
||||
"reset-configuration-description": "After resetting these settings Grafana will use the provider configuration from the system (config file/environment variables) if any.",
|
||||
"save": "Save",
|
||||
"save-and-enable": "Save and enable",
|
||||
"saving": "Saving...",
|
||||
"title-more-actions": "More actions",
|
||||
"title-reset": "Reset",
|
||||
|
||||
Reference in New Issue
Block a user