-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOP-23004] refactor connection types and forms (#55)
Co-authored-by: Zabilsya <kvcherniko@mts.ru>
- Loading branch information
Showing
49 changed files
with
198 additions
and
532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
export * from './api'; | ||
export * from './constants'; | ||
export * from './ui'; | ||
export * from './utils'; |
20 changes: 20 additions & 0 deletions
20
src/entities/connection/ui/ConnectionTypeForm/components/ConnectionAuthBasic/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import { Form, Input } from 'antd'; | ||
|
||
import { useSensitiveFields } from '../../hooks'; | ||
|
||
export const ConnectionAuthBasic = () => { | ||
const { isRequired } = useSensitiveFields(); | ||
|
||
return ( | ||
<> | ||
<Form.Item name={['auth_data', 'type']} hidden /> | ||
<Form.Item label="User" name={['auth_data', 'user']} rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Password" name={['auth_data', 'password']} rules={[{ required: isRequired }]}> | ||
<Input.Password size="large" /> | ||
</Form.Item> | ||
</> | ||
); | ||
}; |
20 changes: 20 additions & 0 deletions
20
src/entities/connection/ui/ConnectionTypeForm/components/ConnectionAuthS3/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import { Form, Input } from 'antd'; | ||
|
||
import { useSensitiveFields } from '../../hooks'; | ||
|
||
export const ConnectionAuthS3 = () => { | ||
const { isRequired } = useSensitiveFields(); | ||
|
||
return ( | ||
<> | ||
<Form.Item name={['auth_data', 'type']} hidden /> | ||
<Form.Item label="Access key" name={['auth_data', 'access_key']} rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Secret key" name={['auth_data', 'secret_key']} rules={[{ required: isRequired }]}> | ||
<Input.Password size="large" /> | ||
</Form.Item> | ||
</> | ||
); | ||
}; |
17 changes: 5 additions & 12 deletions
17
src/entities/connection/ui/ConnectionTypeForm/components/ConnectionClickhouse/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,22 @@ | ||
import React from 'react'; | ||
import { Form, Input, InputNumber } from 'antd'; | ||
|
||
import { useSensitiveFields } from '../../hooks'; | ||
import { MAX_ALLOWED_PORT, MIN_ALLOWED_PORT } from '../../constants'; | ||
import { ConnectionAuthBasic } from '../ConnectionAuthBasic'; | ||
|
||
export const ConnectionClickhouse = () => { | ||
const { isRequired } = useSensitiveFields(); | ||
|
||
return ( | ||
<> | ||
<Form.Item label="Database name" name="database_name" rules={[{ required: true }]}> | ||
<Form.Item label="Database name" name={['connection_data', 'database_name']} rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Host" name="host" rules={[{ required: true }]}> | ||
<Form.Item label="Host" name={['connection_data', 'host']} rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Port" name="port" rules={[{ required: true }]}> | ||
<Form.Item label="Port" name={['connection_data', 'port']} rules={[{ required: true }]}> | ||
<InputNumber size="large" min={MIN_ALLOWED_PORT} max={MAX_ALLOWED_PORT} /> | ||
</Form.Item> | ||
<Form.Item label="User" name="user" rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Password" name="password" rules={[{ required: isRequired }]}> | ||
<Input.Password size="large" /> | ||
</Form.Item> | ||
<ConnectionAuthBasic /> | ||
</> | ||
); | ||
}; |
13 changes: 3 additions & 10 deletions
13
src/entities/connection/ui/ConnectionTypeForm/components/ConnectionHdfs/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,15 @@ | ||
import React from 'react'; | ||
import { Form, Input } from 'antd'; | ||
|
||
import { useSensitiveFields } from '../../hooks'; | ||
import { ConnectionAuthBasic } from '../ConnectionAuthBasic'; | ||
|
||
export const ConnectionHdfs = () => { | ||
const { isRequired } = useSensitiveFields(); | ||
|
||
return ( | ||
<> | ||
<Form.Item label="Cluster" name="cluster" rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="User" name="user" rules={[{ required: true }]}> | ||
<Form.Item label="Cluster" name={['connection_data', 'cluster']} rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Password" name="password" rules={[{ required: isRequired }]}> | ||
<Input.Password size="large" /> | ||
</Form.Item> | ||
<ConnectionAuthBasic /> | ||
</> | ||
); | ||
}; |
13 changes: 3 additions & 10 deletions
13
src/entities/connection/ui/ConnectionTypeForm/components/ConnectionHive/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,15 @@ | ||
import React from 'react'; | ||
import { Form, Input } from 'antd'; | ||
|
||
import { useSensitiveFields } from '../../hooks'; | ||
import { ConnectionAuthBasic } from '../ConnectionAuthBasic'; | ||
|
||
export const ConnectionHive = () => { | ||
const { isRequired } = useSensitiveFields(); | ||
|
||
return ( | ||
<> | ||
<Form.Item label="Cluster" name="cluster" rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="User" name="user" rules={[{ required: true }]}> | ||
<Form.Item label="Cluster" name={['connection_data', 'cluster']} rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Password" name="password" rules={[{ required: isRequired }]}> | ||
<Input.Password size="large" /> | ||
</Form.Item> | ||
<ConnectionAuthBasic /> | ||
</> | ||
); | ||
}; |
17 changes: 5 additions & 12 deletions
17
src/entities/connection/ui/ConnectionTypeForm/components/ConnectionMsSql/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,22 @@ | ||
import React from 'react'; | ||
import { Form, Input, InputNumber } from 'antd'; | ||
|
||
import { useSensitiveFields } from '../../hooks'; | ||
import { MAX_ALLOWED_PORT, MIN_ALLOWED_PORT } from '../../constants'; | ||
import { ConnectionAuthBasic } from '../ConnectionAuthBasic'; | ||
|
||
export const ConnectionMsSql = () => { | ||
const { isRequired } = useSensitiveFields(); | ||
|
||
return ( | ||
<> | ||
<Form.Item label="Database name" name="database_name" rules={[{ required: true }]}> | ||
<Form.Item label="Database name" name={['connection_data', 'database_name']} rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Host" name="host" rules={[{ required: true }]}> | ||
<Form.Item label="Host" name={['connection_data', 'host']} rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Port" name="port" rules={[{ required: true }]}> | ||
<Form.Item label="Port" name={['connection_data', 'port']} rules={[{ required: true }]}> | ||
<InputNumber size="large" min={MIN_ALLOWED_PORT} max={MAX_ALLOWED_PORT} /> | ||
</Form.Item> | ||
<Form.Item label="User" name="user" rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Password" name="password" rules={[{ required: isRequired }]}> | ||
<Input.Password size="large" /> | ||
</Form.Item> | ||
<ConnectionAuthBasic /> | ||
</> | ||
); | ||
}; |
17 changes: 5 additions & 12 deletions
17
src/entities/connection/ui/ConnectionTypeForm/components/ConnectionMySql/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,22 @@ | ||
import React from 'react'; | ||
import { Form, Input, InputNumber } from 'antd'; | ||
|
||
import { useSensitiveFields } from '../../hooks'; | ||
import { MAX_ALLOWED_PORT, MIN_ALLOWED_PORT } from '../../constants'; | ||
import { ConnectionAuthBasic } from '../ConnectionAuthBasic'; | ||
|
||
export const ConnectionMySql = () => { | ||
const { isRequired } = useSensitiveFields(); | ||
|
||
return ( | ||
<> | ||
<Form.Item label="Database name" name="database_name" rules={[{ required: true }]}> | ||
<Form.Item label="Database name" name={['connection_data', 'database_name']} rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Host" name="host" rules={[{ required: true }]}> | ||
<Form.Item label="Host" name={['connection_data', 'host']} rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Port" name="port" rules={[{ required: true }]}> | ||
<Form.Item label="Port" name={['connection_data', 'port']} rules={[{ required: true }]}> | ||
<InputNumber size="large" min={MIN_ALLOWED_PORT} max={MAX_ALLOWED_PORT} /> | ||
</Form.Item> | ||
<Form.Item label="User" name="user" rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Password" name="password" rules={[{ required: isRequired }]}> | ||
<Input.Password size="large" /> | ||
</Form.Item> | ||
<ConnectionAuthBasic /> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.