-
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-22196] add clickhouse, mssql, mysql connection types (#50)
* [DOP-22196] add clickhouse, mssql, mysql connection types * [DOP-22196] fix after review --------- Co-authored-by: Zabilsya <[email protected]>
- Loading branch information
Showing
32 changed files
with
385 additions
and
12 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
29 changes: 29 additions & 0 deletions
29
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import { Form, Input, InputNumber } from 'antd'; | ||
|
||
import { useSensitiveFields } from '../../hooks'; | ||
import { MAX_ALLOWED_PORT, MIN_ALLOWED_PORT } from '../../constants'; | ||
|
||
export const ConnectionClickhouse = () => { | ||
const { isRequired } = useSensitiveFields(); | ||
|
||
return ( | ||
<> | ||
<Form.Item label="Database name" name="database_name" rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Host" name="host" rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Port" name="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> | ||
</> | ||
); | ||
}; |
29 changes: 29 additions & 0 deletions
29
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import { Form, Input, InputNumber } from 'antd'; | ||
|
||
import { useSensitiveFields } from '../../hooks'; | ||
import { MAX_ALLOWED_PORT, MIN_ALLOWED_PORT } from '../../constants'; | ||
|
||
export const ConnectionMsSql = () => { | ||
const { isRequired } = useSensitiveFields(); | ||
|
||
return ( | ||
<> | ||
<Form.Item label="Database name" name="database_name" rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Host" name="host" rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Port" name="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> | ||
</> | ||
); | ||
}; |
29 changes: 29 additions & 0 deletions
29
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import { Form, Input, InputNumber } from 'antd'; | ||
|
||
import { useSensitiveFields } from '../../hooks'; | ||
import { MAX_ALLOWED_PORT, MIN_ALLOWED_PORT } from '../../constants'; | ||
|
||
export const ConnectionMySql = () => { | ||
const { isRequired } = useSensitiveFields(); | ||
|
||
return ( | ||
<> | ||
<Form.Item label="Database name" name="database_name" rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Host" name="host" rules={[{ required: true }]}> | ||
<Input size="large" /> | ||
</Form.Item> | ||
<Form.Item label="Port" name="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> | ||
</> | ||
); | ||
}; |
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
20 changes: 20 additions & 0 deletions
20
src/entities/connection/utils/adaptConnectionClickhouse/index.ts
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 { ConnectionClickhouse } from '../../api'; | ||
|
||
import { AdaptConnectionClickhouseProps } from './types'; | ||
|
||
/* Util for creating a ConnectionData object for "Clickhouse" connection by its fields */ | ||
export const adaptConnectionClickhouse = (data: AdaptConnectionClickhouseProps): ConnectionClickhouse => { | ||
return { | ||
auth_data: { | ||
type: data.type, | ||
user: data.user, | ||
password: data.password, | ||
}, | ||
connection_data: { | ||
type: data.type, | ||
database_name: data.database_name, | ||
host: data.host, | ||
port: data.port, | ||
}, | ||
}; | ||
}; |
4 changes: 4 additions & 0 deletions
4
src/entities/connection/utils/adaptConnectionClickhouse/types.ts
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,4 @@ | ||
import { ConnectionClickhouse } from '../../api'; | ||
|
||
export type AdaptConnectionClickhouseProps = ConnectionClickhouse['auth_data'] & | ||
ConnectionClickhouse['connection_data']; |
20 changes: 20 additions & 0 deletions
20
src/entities/connection/utils/adaptConnectionMsSql/index.ts
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 { ConnectionMsSql } from '../../api'; | ||
|
||
import { AdaptConnectionMsSqlProps } from './types'; | ||
|
||
/* Util for creating a ConnectionData object for "MsSQL" connection by its fields */ | ||
export const adaptConnectionMsSql = (data: AdaptConnectionMsSqlProps): ConnectionMsSql => { | ||
return { | ||
auth_data: { | ||
type: data.type, | ||
user: data.user, | ||
password: data.password, | ||
}, | ||
connection_data: { | ||
type: data.type, | ||
database_name: data.database_name, | ||
host: data.host, | ||
port: data.port, | ||
}, | ||
}; | ||
}; |
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,3 @@ | ||
import { ConnectionMsSql } from '../../api'; | ||
|
||
export type AdaptConnectionMsSqlProps = ConnectionMsSql['auth_data'] & ConnectionMsSql['connection_data']; |
20 changes: 20 additions & 0 deletions
20
src/entities/connection/utils/adaptConnectionMySql/index.ts
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 { ConnectionMySql } from '../../api'; | ||
|
||
import { AdaptConnectionMySqlProps } from './types'; | ||
|
||
/* Util for creating a ConnectionData object for "MySQL" connection by its fields */ | ||
export const adaptConnectionMySql = (data: AdaptConnectionMySqlProps): ConnectionMySql => { | ||
return { | ||
auth_data: { | ||
type: data.type, | ||
user: data.user, | ||
password: data.password, | ||
}, | ||
connection_data: { | ||
type: data.type, | ||
database_name: data.database_name, | ||
host: data.host, | ||
port: data.port, | ||
}, | ||
}; | ||
}; |
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,3 @@ | ||
import { ConnectionMySql } from '../../api'; | ||
|
||
export type AdaptConnectionMySqlProps = ConnectionMySql['auth_data'] & ConnectionMySql['connection_data']; |
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
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
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
Oops, something went wrong.