Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9247a6b

Browse files
committedMar 11, 2025·
fix: auth pages
1 parent 03e5fc9 commit 9247a6b

File tree

5 files changed

+61
-25
lines changed

5 files changed

+61
-25
lines changed
 

‎ui/src/components/ui/device-table/device-table.module.css

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.tableWrapper {
2-
overflow: auto hidden;
32
padding: 12px;
43
}
54

‎ui/src/components/ui/table-column-visibility/table-column-visibility.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ type RowsGroupProps = {
2323
}
2424

2525
const RowsGroup = observer(({ columns, groupName }: RowsGroupProps) => {
26+
const { t } = useTranslation()
2627
const onCheckboxChange = (id: string) => {
2728
deviceTableState.setColumnVisibility((prevVisibility) => ({ ...prevVisibility, [id]: !prevVisibility[id] }))
2829
}
2930

3031
return (
3132
<FormLayoutGroup>
32-
<FormItem className={styles.group} top={groupName}>
33+
<FormItem className={styles.group} top={t(groupName)}>
3334
{columns?.map(({ id, meta }) =>
3435
id ? (
3536
<Checkbox
@@ -38,7 +39,7 @@ const RowsGroup = observer(({ columns, groupName }: RowsGroupProps) => {
3839
value={id}
3940
onChange={() => onCheckboxChange(id)}
4041
>
41-
{meta?.columnName}
42+
{t(meta?.columnName || 'Unknown column')}
4243
</Checkbox>
4344
) : null
4445
)}

‎ui/src/components/views/auth/auth-ldap-page.tsx

+30-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { useGetAuthContact } from '@/lib/hooks/use-get-auth-contact.hook'
1212

1313
import styles from './auth-page.module.css'
1414

15-
import type { FormEvent } from 'react'
15+
import type { ChangeEvent, FormEvent } from 'react'
1616

1717
export const AuthLdapPage = () => {
1818
const { t } = useTranslation()
@@ -30,6 +30,20 @@ export const AuthLdapPage = () => {
3030
auth({ username, password })
3131
}
3232

33+
const onUsernameChange = (event: ChangeEvent<HTMLInputElement>) => {
34+
setUsernameError('')
35+
setFormError('')
36+
37+
setUsername(event.target.value)
38+
}
39+
40+
const onPasswordChange = (event: ChangeEvent<HTMLInputElement>) => {
41+
setPasswordError('')
42+
setFormError('')
43+
44+
setPassword(event.target.value)
45+
}
46+
3347
useEffect(() => {
3448
if (isSuccess) {
3549
authStore.login(authData.jwt)
@@ -74,32 +88,36 @@ export const AuthLdapPage = () => {
7488
<FormItem bottom={usernameError} status={usernameError ? 'error' : undefined} top={t('Username')}>
7589
<Input
7690
before={<Icon20UserOutline />}
77-
placeholder='Please enter your Single Sign-On login'
91+
placeholder={t('Please enter your login')}
7892
value={username}
79-
onChange={(event) => setUsername(event.target.value)}
93+
onChange={onUsernameChange}
8094
/>
8195
</FormItem>
8296
<FormItem bottom={passwordError} status={passwordError ? 'error' : undefined} top={t('Password')}>
8397
<Input
8498
before={<Icon20MailOutline />}
85-
placeholder='Please enter your Single Sign-On password'
86-
type='email'
99+
placeholder={t('Please enter your password')}
87100
value={password}
88-
onChange={(event) => setPassword(event.target.value)}
101+
onChange={onPasswordChange}
89102
/>
90103
</FormItem>
104+
<ConditionalRender conditions={[!!formError]}>
105+
<Div>
106+
<FormStatus mode='error'>{formError}</FormStatus>
107+
</Div>
108+
</ConditionalRender>
91109
<Spacing size='xl' />
92110
<FormItem>
93-
<Button disabled={!username || !password} size='l' type='submit' stretched>
111+
<Button
112+
disabled={!username || !password || !!usernameError || !!passwordError || !!formError}
113+
size='l'
114+
type='submit'
115+
stretched
116+
>
94117
{t('Log In')}
95118
</Button>
96119
</FormItem>
97120
</FormLayoutGroup>
98-
<ConditionalRender conditions={[!!formError]}>
99-
<Div>
100-
<FormStatus mode='error'>{formError}</FormStatus>
101-
</Div>
102-
</ConditionalRender>
103121
<Button className={styles.contactButton} href={authContact} mode='link'>
104122
{t('Contact Support')}
105123
</Button>

‎ui/src/components/views/auth/auth-mock-page.tsx

+27-9
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { useGetAuthContact } from '@/lib/hooks/use-get-auth-contact.hook'
1313

1414
import styles from './auth-page.module.css'
1515

16-
import type { FormEvent } from 'react'
16+
import type { ChangeEvent, FormEvent } from 'react'
1717

1818
export const AuthMockPage = () => {
1919
const { t } = useTranslation()
@@ -31,6 +31,19 @@ export const AuthMockPage = () => {
3131
auth({ name, email })
3232
}
3333

34+
const onNameChange = (event: ChangeEvent<HTMLInputElement>) => {
35+
setNameError('')
36+
setFormError('')
37+
38+
setName(event.target.value)
39+
}
40+
41+
const onEmailChange = (value: string) => {
42+
setFormError('')
43+
44+
setEmail(value)
45+
}
46+
3447
useEffect(() => {
3548
if (isSuccess) {
3649
authStore.login(authData.jwt)
@@ -77,30 +90,35 @@ export const AuthMockPage = () => {
7790
before={<Icon20UserOutline />}
7891
placeholder='Please enter your name'
7992
value={name}
80-
onChange={(event) => setName(event.target.value)}
93+
onChange={onNameChange}
8194
/>
8295
</FormItem>
8396
<FormItem bottom={emailError} status={emailError ? 'error' : undefined} top={t('Email')}>
8497
<EmailInput
8598
before={<Icon20MailOutline />}
8699
placeholder='Please enter your email'
87100
value={email}
88-
onChange={(value) => setEmail(value)}
101+
onChange={onEmailChange}
89102
onError={(error) => setEmailError(error)}
90103
/>
91104
</FormItem>
105+
<ConditionalRender conditions={[!!formError]}>
106+
<Div>
107+
<FormStatus mode='error'>{formError}</FormStatus>
108+
</Div>
109+
</ConditionalRender>
92110
<Spacing size='xl' />
93111
<FormItem>
94-
<Button disabled={!name || !email || !!emailError} size='l' type='submit' stretched>
112+
<Button
113+
disabled={!name || !email || !!nameError || !!emailError || !!formError}
114+
size='l'
115+
type='submit'
116+
stretched
117+
>
95118
{t('Log In')}
96119
</Button>
97120
</FormItem>
98121
</FormLayoutGroup>
99-
<ConditionalRender conditions={[!!formError]}>
100-
<Div>
101-
<FormStatus mode='error'>{formError}</FormStatus>
102-
</Div>
103-
</ConditionalRender>
104122
<Button className={styles.contactButton} href={authContact} mode='link'>
105123
{t('Contact Support')}
106124
</Button>

‎ui/src/types/column-group.type.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export enum ColumnGroup {
2-
DEVICE_INFO = 'DeviceInfo',
2+
DEVICE_INFO = 'Device Info',
33
OS_HARDWARE = 'OS & Hardware',
44
NETWORK_CONNECTIVITY = 'Network & Connectivity',
55
BATTERY = 'Battery',

0 commit comments

Comments
 (0)
Please sign in to comment.