Skip to content

Commit b14dd02

Browse files
committed
Use radio buttons instead of selects for protocols
1 parent 70b5fb2 commit b14dd02

File tree

9 files changed

+46
-55
lines changed

9 files changed

+46
-55
lines changed

src/entities/connection/constants.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,3 @@ export const CONNECTION_TYPE_SELECT_OPTIONS = prepareOptionsForSelect({
6969
renderLabel: (data) => data.label,
7070
renderValue: (data) => data.value,
7171
});
72-
73-
export const CONNECTION_BUCKET_STYLE_SELECT_OPTIONS = prepareOptionsForSelect<ConnectionBucketStyle>({
74-
data: ['domain', 'path'],
75-
renderLabel: (data) => data,
76-
renderValue: (data) => data,
77-
});
78-
79-
export const CONNECTION_PROTOCOL_SELECT_OPTIONS = prepareOptionsForSelect<ConnectionProtocol>({
80-
data: ['https', 'http'],
81-
renderLabel: (data) => data,
82-
renderValue: (data) => data,
83-
});

src/entities/connection/ui/ConnectionTypeForm/components/ConnectionAuthSamba/constants.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/entities/connection/ui/ConnectionTypeForm/components/ConnectionAuthSamba/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import React from 'react';
2-
import { Form, Input } from 'antd';
3-
import { Select } from '@shared/ui';
2+
import { Form, Input, Radio } from 'antd';
43
import { useTranslation } from 'react-i18next';
54

65
import { useSensitiveFields } from '../../hooks';
76

8-
import { CONNECTION_SAMBA_AUTH_TYPE_SELECT_OPTIONS } from './constants';
9-
107
export const ConnectionAuthSamba = () => {
118
const { t } = useTranslation('connection');
129
const { isRequired } = useSensitiveFields();
@@ -32,8 +29,12 @@ export const ConnectionAuthSamba = () => {
3229
<Form.Item
3330
label={t('samba.authType')}
3431
name={['auth_data', 'auth_type']}
32+
initialValue="NTLMv2"
3533
>
36-
<Select size="large" options={CONNECTION_SAMBA_AUTH_TYPE_SELECT_OPTIONS} placeholder={t('samba.selectAuthType')} />
34+
<Radio.Group>
35+
<Radio.Button value="NTLMv1">NTLMv1</Radio.Button>
36+
<Radio.Button value="NTLMv2">NTLMv2</Radio.Button>
37+
</Radio.Group>
3738
</Form.Item>
3839
</>
3940
);

src/entities/connection/ui/ConnectionTypeForm/components/ConnectionS3/index.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import React from 'react';
2-
import { Form, Input, InputNumber } from 'antd';
3-
import { CONNECTION_BUCKET_STYLE_SELECT_OPTIONS, CONNECTION_PROTOCOL_SELECT_OPTIONS } from '@entities/connection';
4-
import { Select } from '@shared/ui';
2+
import { Form, Input, InputNumber, Radio } from 'antd';
53
import { useTranslation } from 'react-i18next';
64

75
import { MAX_ALLOWED_PORT, MIN_ALLOWED_PORT } from '../../constants';
@@ -15,14 +13,25 @@ export const ConnectionS3 = () => {
1513
<Form.Item label={t('host')} name={['connection_data', 'host']} rules={[{ required: true }]}>
1614
<Input size="large" placeholder="s3.mycompany.com" />
1715
</Form.Item>
18-
<Form.Item label={t('protocol')} name={['connection_data', 'protocol']}>
19-
<Select size="large" options={CONNECTION_PROTOCOL_SELECT_OPTIONS} placeholder={t('selectProtocol')} />
16+
<Form.Item
17+
label={t('protocol')}
18+
name={['connection_data', 'protocol']}
19+
rules={[{ required: true }]}
20+
initialValue="https"
21+
>
22+
<Radio.Group>
23+
<Radio.Button value="http">HTTP</Radio.Button>
24+
<Radio.Button value="httpS">HTTPS</Radio.Button>
25+
</Radio.Group>
2026
</Form.Item>
2127
<Form.Item label={t('port')} name={['connection_data', 'port']}>
2228
<InputNumber size="large" min={MIN_ALLOWED_PORT} max={MAX_ALLOWED_PORT} placeholder="443" />
2329
</Form.Item>
24-
<Form.Item label={t('s3.bucketStyle')} name={['connection_data', 'bucket_style']}>
25-
<Select size="large" options={CONNECTION_BUCKET_STYLE_SELECT_OPTIONS} placeholder={t('s3.selectBucketStyle')} />
30+
<Form.Item label={t('s3.bucketStyle')} name={['connection_data', 'bucket_style']} rules={[{ required: true }]} initialValue="domain">
31+
<Radio.Group>
32+
<Radio.Button value="domain">bucket.s3.mycompany.com</Radio.Button>
33+
<Radio.Button value="path">s3.mycompany.com/bucket</Radio.Button>
34+
</Radio.Group>
2635
</Form.Item>
2736
<Form.Item label={t('s3.bucket')} name={['connection_data', 'bucket']} rules={[{ required: true }]}>
2837
<Input size="large" />

src/entities/connection/ui/ConnectionTypeForm/components/ConnectionSamba/constants.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/entities/connection/ui/ConnectionTypeForm/components/ConnectionSamba/index.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import React from 'react';
2-
import { Form, Input, InputNumber } from 'antd';
3-
import { Select } from '@shared/ui';
2+
import { Form, Input, InputNumber, Radio } from 'antd';
43
import { useTranslation } from 'react-i18next';
54

65
import { MAX_ALLOWED_PORT, MIN_ALLOWED_PORT } from '../../constants';
76
import { ConnectionAuthSamba } from '../ConnectionAuthSamba';
87

9-
import { CONNECTION_SAMBA_PROTOCOL_SELECT_OPTIONS } from './constants';
10-
118
export const ConnectionSamba = () => {
129
const { t } = useTranslation('connection');
1310

@@ -16,8 +13,16 @@ export const ConnectionSamba = () => {
1613
<Form.Item label={t('host')} name={['connection_data', 'host']} rules={[{ required: true }]}>
1714
<Input size="large" placeholder="myserver.mycompany.com" />
1815
</Form.Item>
19-
<Form.Item label={t('protocol')} name={['connection_data', 'protocol']}>
20-
<Select size="large" options={CONNECTION_SAMBA_PROTOCOL_SELECT_OPTIONS} placeholder={t('selectProtocol')} />
16+
<Form.Item
17+
label={t('protocol')}
18+
name={['connection_data', 'protocol']}
19+
rules={[{ required: true }]}
20+
initialValue="SMB"
21+
>
22+
<Radio.Group>
23+
<Radio.Button value="NetBIOS">NetBIOS</Radio.Button>
24+
<Radio.Button value="SMB">SMB</Radio.Button>
25+
</Radio.Group>
2126
</Form.Item>
2227
<Form.Item label={t('port')} name={['connection_data', 'port']}>
2328
<InputNumber size="large" min={MIN_ALLOWED_PORT} max={MAX_ALLOWED_PORT} placeholder="445" />

src/entities/connection/ui/ConnectionTypeForm/components/ConnectionWebdav/index.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import React from 'react';
2-
import { Form, Input, InputNumber } from 'antd';
3-
import { Select } from '@shared/ui';
4-
import { CONNECTION_PROTOCOL_SELECT_OPTIONS } from '@entities/connection';
2+
import { Form, Input, InputNumber, Radio } from 'antd';
53
import { useTranslation } from 'react-i18next';
64

75
import { MAX_ALLOWED_PORT, MIN_ALLOWED_PORT } from '../../constants';
@@ -15,8 +13,16 @@ export const ConnectionWebdav = () => {
1513
<Form.Item label={t('host')} name={['connection_data', 'host']} rules={[{ required: true }]}>
1614
<Input size="large" placeholder="myserver.mycompany.com" />
1715
</Form.Item>
18-
<Form.Item label={t('protocol')} name={['connection_data', 'protocol']}>
19-
<Select size="large" options={CONNECTION_PROTOCOL_SELECT_OPTIONS} placeholder={t('selectProtocol')} />
16+
<Form.Item
17+
label={t('protocol')}
18+
name={['connection_data', 'protocol']}
19+
rules={[{ required: true }]}
20+
initialValue="https"
21+
>
22+
<Radio.Group>
23+
<Radio.Button value="http">HTTP</Radio.Button>
24+
<Radio.Button value="httpS">HTTPS</Radio.Button>
25+
</Radio.Group>
2026
</Form.Item>
2127
<Form.Item label={t('port')} name={['connection_data', 'port']}>
2228
<InputNumber size="large" min={MIN_ALLOWED_PORT} max={MAX_ALLOWED_PORT} placeholder="443" />

src/shared/config/i18n/translations/en.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@
6969
},
7070
"s3": {
7171
"bucketStyle": "Bucket style",
72-
"bucket": "Bucket",
72+
"bucket": "Bucket name",
7373
"region": "Region",
74-
"selectBucketStyle": "Select bucket style",
7574
"accessKey": "Access key",
7675
"secretKey": "Secret key"
7776
},

src/shared/config/i18n/translations/ru.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@
7070
},
7171
"s3": {
7272
"bucketStyle": "Стиль бакета",
73-
"bucket": "Бакет",
73+
"bucket": "Название бакета",
7474
"region": "Регион",
75-
"selectBucketStyle": "Выберите стиль бакета",
7675
"accessKey": "Ключ доступа",
7776
"secretKey": "Секретный ключ"
7877
},

0 commit comments

Comments
 (0)