Skip to content

Commit ca66133

Browse files
authored
SSO LDAP - Address pending PR review comments (grafana#92368)
* Address pending PR review comments * Update i18n
1 parent 494376c commit ca66133

File tree

3 files changed

+26
-23
lines changed

3 files changed

+26
-23
lines changed

public/app/features/admin/ldap/LdapDrawer.tsx

+20-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { css } from '@emotion/css';
2+
import { useId } from 'react';
23
import { useFormContext } from 'react-hook-form';
34

45
import { GrafanaTheme2, SelectableValue } from '@grafana/data';
@@ -31,6 +32,12 @@ export const LdapDrawerComponent = ({ onClose }: Props) => {
3132
const styles = useStyles2(getStyles);
3233
const { register, setValue, watch } = useFormContext<LdapPayload>();
3334

35+
const nameId = useId();
36+
const surnameId = useId();
37+
const usernameId = useId();
38+
const memberOfId = useId();
39+
const emailId = useId();
40+
3441
const groupMappingsLabel = (
3542
<Label
3643
className={styles.sectionLabel}
@@ -52,7 +59,7 @@ export const LdapDrawerComponent = ({ onClose }: Props) => {
5259
);
5360

5461
return (
55-
<Drawer title={t('ldap-drawer.title', 'Advanced Settings')} onClose={onClose}>
62+
<Drawer title={t('ldap-drawer.title', 'Advanced settings')} onClose={onClose}>
5663
<CollapsableSection label={t('ldap-drawer.misc-section.label', 'Misc')} isOpen={true}>
5764
<Field
5865
label={t('ldap-drawer.misc-section.allow-sign-up.label', 'Allow sign up')}
@@ -72,7 +79,7 @@ export const LdapDrawerComponent = ({ onClose }: Props) => {
7279
>
7380
<Input
7481
id="port"
75-
placeholder={t('ldap-drawer.misc-section.port.placeholder', '389')}
82+
placeholder="389"
7683
type="number"
7784
{...register('settings.config.servers.0.port', { valueAsNumber: true })}
7885
/>
@@ -86,7 +93,7 @@ export const LdapDrawerComponent = ({ onClose }: Props) => {
8693
>
8794
<Input
8895
id="timeout"
89-
placeholder={t('ldap-drawer.misc-section.timeout.placeholder', '389')}
96+
placeholder="10"
9097
type="number"
9198
{...register('settings.config.servers.0.timeout', { valueAsNumber: true })}
9299
/>
@@ -99,20 +106,20 @@ export const LdapDrawerComponent = ({ onClose }: Props) => {
99106
the application correctly retrieves and displays user information.
100107
</Trans>
101108
</Text>
102-
<Field htmlFor="name" label={t('ldap-drawer.attributes-section.name.label', 'Name')}>
103-
<Input id="name" {...register('settings.config.servers.0.attributes.name')} />
109+
<Field label={t('ldap-drawer.attributes-section.name.label', 'Name')}>
110+
<Input id={nameId} {...register('settings.config.servers.0.attributes.name')} />
104111
</Field>
105-
<Field htmlFor="surname" label={t('ldap-drawer.attributes-section.surname.label', 'Surname')}>
106-
<Input id="surname" {...register('settings.config.servers.0.attributes.surname')} />
112+
<Field label={t('ldap-drawer.attributes-section.surname.label', 'Surname')}>
113+
<Input id={surnameId} {...register('settings.config.servers.0.attributes.surname')} />
107114
</Field>
108-
<Field htmlFor="username" label={t('ldap-drawer.attributes-section.username.label', 'Username')}>
109-
<Input id="username" {...register('settings.config.servers.0.attributes.username')} />
115+
<Field label={t('ldap-drawer.attributes-section.username.label', 'Username')}>
116+
<Input id={usernameId} {...register('settings.config.servers.0.attributes.username')} />
110117
</Field>
111-
<Field htmlFor="member-of" label={t('ldap-drawer.attributes-section.member-of.label', 'Member Of')}>
112-
<Input id="member-of" {...register('settings.config.servers.0.attributes.member_of')} />
118+
<Field label={t('ldap-drawer.attributes-section.member-of.label', 'Member Of')}>
119+
<Input id={memberOfId} {...register('settings.config.servers.0.attributes.member_of')} />
113120
</Field>
114-
<Field htmlFor="email" label={t('ldap-drawer.attributes-section.email.label', 'Email')}>
115-
<Input id="email" {...register('settings.config.servers.0.attributes.email')} />
121+
<Field label={t('ldap-drawer.attributes-section.email.label', 'Email')}>
122+
<Input id={emailId} {...register('settings.config.servers.0.attributes.email')} />
116123
</Field>
117124
</CollapsableSection>
118125
<CollapsableSection label={groupMappingsLabel} isOpen={true}>

public/locales/en-US/grafana.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -1053,16 +1053,14 @@
10531053
"label": "Misc",
10541054
"port": {
10551055
"description": "Default port is 389 without SSL or 636 with SSL",
1056-
"label": "Port",
1057-
"placeholder": "389"
1056+
"label": "Port"
10581057
},
10591058
"timeout": {
10601059
"description": "Timeout in seconds for the connection to the LDAP server",
1061-
"label": "Timeout",
1062-
"placeholder": "389"
1060+
"label": "Timeout"
10631061
}
10641062
},
1065-
"title": "Advanced Settings"
1063+
"title": "Advanced settings"
10661064
},
10671065
"ldap-settings-page": {
10681066
"advanced-settings-section": {

public/locales/pseudo-LOCALE/grafana.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -1053,16 +1053,14 @@
10531053
"label": "Mįşč",
10541054
"port": {
10551055
"description": "Đęƒäūľŧ pőřŧ įş 389 ŵįŧĥőūŧ ŜŜĿ őř 636 ŵįŧĥ ŜŜĿ",
1056-
"label": "Pőřŧ",
1057-
"placeholder": "389"
1056+
"label": "Pőřŧ"
10581057
},
10591058
"timeout": {
10601059
"description": "Ŧįmęőūŧ įʼn şęčőʼnđş ƒőř ŧĥę čőʼnʼnęčŧįőʼn ŧő ŧĥę ĿĐÅP şęřvęř",
1061-
"label": "Ŧįmęőūŧ",
1062-
"placeholder": "389"
1060+
"label": "Ŧįmęőūŧ"
10631061
}
10641062
},
1065-
"title": "Åđväʼnčęđ Ŝęŧŧįʼnģş"
1063+
"title": "Åđväʼnčęđ şęŧŧįʼnģş"
10661064
},
10671065
"ldap-settings-page": {
10681066
"advanced-settings-section": {

0 commit comments

Comments
 (0)