-
Notifications
You must be signed in to change notification settings - Fork 1
[DOP-22300] add increment_by field #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,3 +1,2 @@ | ||
| export * from './api'; | ||
| export * from './constants'; | ||
| export * from './ui'; |
24 changes: 24 additions & 0 deletions
24
...ransfer/MutateTransferForm/components/StrategyParams/components/IncrementByForm/index.tsx
This file contains hidden or 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,24 @@ | ||
| import React from 'react'; | ||
| import { ConnectionType } from '@shared/types'; | ||
| import { Form, Input } from 'antd'; | ||
|
|
||
| import { IncrementByFormProps } from './types'; | ||
|
|
||
| export const IncrementByForm = ({ sourceConnectionType }: IncrementByFormProps) => { | ||
| switch (sourceConnectionType) { | ||
| case ConnectionType.CLICKHOUSE: | ||
| case ConnectionType.HIVE: | ||
| case ConnectionType.MS_SQL: | ||
| case ConnectionType.MY_SQL: | ||
| case ConnectionType.ORACLE: | ||
| case ConnectionType.POSTGRES: | ||
| return ( | ||
| <Form.Item label="Increment by" name={['strategy_params', 'increment_by']} rules={[{ required: true }]}> | ||
| <Input size="large" /> | ||
| </Form.Item> | ||
| ); | ||
| case ConnectionType.HDFS: | ||
| case ConnectionType.S3: | ||
| return null; | ||
| } | ||
| }; |
5 changes: 5 additions & 0 deletions
5
...transfer/MutateTransferForm/components/StrategyParams/components/IncrementByForm/types.ts
This file contains hidden or 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,5 @@ | ||
| import { ConnectionType } from '@shared/types'; | ||
|
|
||
| export interface IncrementByFormProps { | ||
| sourceConnectionType: ConnectionType; | ||
| } |
3 changes: 1 addition & 2 deletions
3
src/entities/transfer/constants.ts → .../components/StrategyTypeForm/constants.ts
This file contains hidden or 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
40 changes: 40 additions & 0 deletions
40
...ansfer/MutateTransferForm/components/StrategyParams/components/StrategyTypeForm/index.tsx
This file contains hidden or 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,40 @@ | ||
| import React, { useLayoutEffect, useState } from 'react'; | ||
| import { Select } from '@shared/ui'; | ||
| import { Form } from 'antd'; | ||
| import { ConnectionType } from '@shared/types'; | ||
|
|
||
| import { TRANSFER_STRATEGY_PARAMS_SELECT_OPTIONS } from './constants'; | ||
| import { StrategyTypeFormProps } from './types'; | ||
|
|
||
| export const StrategyTypeForm = ({ sourceConnectionType }: StrategyTypeFormProps) => { | ||
| const [isDisabled, setDisabled] = useState(false); | ||
| const formInstance = Form.useFormInstance(); | ||
|
|
||
| // change strategy_params type value and disabled field state depending on source connection type | ||
| useLayoutEffect(() => { | ||
| switch (sourceConnectionType) { | ||
| case ConnectionType.HDFS: | ||
| case ConnectionType.S3: | ||
| setDisabled(true); | ||
| return formInstance.setFieldValue(['strategy_params', 'type'], 'full'); | ||
| case ConnectionType.CLICKHOUSE: | ||
| case ConnectionType.HIVE: | ||
| case ConnectionType.MS_SQL: | ||
| case ConnectionType.MY_SQL: | ||
| case ConnectionType.ORACLE: | ||
| case ConnectionType.POSTGRES: | ||
| return setDisabled(false); | ||
| } | ||
| }, [formInstance, sourceConnectionType]); | ||
|
|
||
| return ( | ||
| <Form.Item label="Strategy params" name={['strategy_params', 'type']} rules={[{ required: true }]}> | ||
| <Select | ||
| size="large" | ||
| options={TRANSFER_STRATEGY_PARAMS_SELECT_OPTIONS} | ||
| placeholder="Select strategy" | ||
| disabled={isDisabled} | ||
| /> | ||
| </Form.Item> | ||
| ); | ||
| }; |
5 changes: 5 additions & 0 deletions
5
...ransfer/MutateTransferForm/components/StrategyParams/components/StrategyTypeForm/types.ts
This file contains hidden or 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,5 @@ | ||
| import { ConnectionType } from '@shared/types'; | ||
|
|
||
| export interface StrategyTypeFormProps { | ||
| sourceConnectionType: ConnectionType; | ||
| } |
2 changes: 2 additions & 0 deletions
2
src/features/transfer/MutateTransferForm/components/StrategyParams/components/index.ts
This file contains hidden or 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,2 @@ | ||
| export * from './IncrementByForm'; | ||
| export * from './StrategyTypeForm'; |
28 changes: 28 additions & 0 deletions
28
src/features/transfer/MutateTransferForm/components/StrategyParams/index.tsx
This file contains hidden or 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,28 @@ | ||
| import React from 'react'; | ||
| import { Fieldset } from '@shared/ui'; | ||
| import { Form } from 'antd'; | ||
| import { TransferStrategyParams } from '@entities/transfer'; | ||
| import { ConnectionType } from '@shared/types'; | ||
|
|
||
| import { IncrementByForm, StrategyTypeForm } from './components'; | ||
|
|
||
| export const StrategyParams = () => { | ||
| const formInstance = Form.useFormInstance(); | ||
|
|
||
| /* useWatch takes a value from Form.Item, but useFormInstance takes one from general form state | ||
| * useWatch returns undefined when Form.Item has not rendered yet | ||
| * https://github.com/ant-design/ant-design/issues/49010 | ||
| */ | ||
| Form.useWatch(['source_params', 'type']); | ||
| Form.useWatch(['strategy_params', 'type']); | ||
|
|
||
| const sourceConnectionType = formInstance.getFieldValue(['source_params', 'type']) as ConnectionType; | ||
| const strategyParamsType = formInstance.getFieldValue(['strategy_params', 'type']) as TransferStrategyParams['type']; | ||
|
|
||
| return ( | ||
| <Fieldset title="Strategy params"> | ||
| <StrategyTypeForm sourceConnectionType={sourceConnectionType} /> | ||
| {strategyParamsType === 'incremental' && <IncrementByForm sourceConnectionType={sourceConnectionType} />} | ||
| </Fieldset> | ||
| ); | ||
| }; |
This file contains hidden or 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 hidden or 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
19 changes: 19 additions & 0 deletions
19
src/features/transfer/TransferDetailInfo/components/TransferStrategyParams/index.tsx
This file contains hidden or 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,19 @@ | ||
| import React from 'react'; | ||
| import { Descriptions } from 'antd'; | ||
|
|
||
| import { TransferStrategyParamsProps } from './types'; | ||
|
|
||
| export const TransferStrategyParams = ({ data, ...props }: TransferStrategyParamsProps) => { | ||
| return ( | ||
| <Descriptions {...props}> | ||
| <Descriptions.Item label="Type" span={3}> | ||
| {data.type} | ||
| </Descriptions.Item> | ||
| {data.increment_by && ( | ||
| <Descriptions.Item label="Increment by" span={3}> | ||
| {data.increment_by} | ||
| </Descriptions.Item> | ||
| )} | ||
| </Descriptions> | ||
| ); | ||
| }; |
6 changes: 6 additions & 0 deletions
6
src/features/transfer/TransferDetailInfo/components/TransferStrategyParams/types.ts
This file contains hidden or 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,6 @@ | ||
| import { Transfer } from '@entities/transfer'; | ||
| import { DescriptionsProps } from 'antd'; | ||
|
|
||
| export interface TransferStrategyParamsProps extends DescriptionsProps { | ||
| data: Transfer['strategy_params']; | ||
| } |
This file contains hidden or 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,2 +1,3 @@ | ||
| export * from './TransferParams'; | ||
| export * from './TransferFileFormatData'; | ||
| export * from './TransferStrategyParams'; |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.