-
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-20065] transfer list and transfer detail (#40)
Co-authored-by: Zabilsya <[email protected]>
- Loading branch information
Showing
48 changed files
with
620 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
API_URL="https://localhost:8000/v1/" | ||
API_URL="http://localhost:8000/v1/" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './useGetTransfer'; |
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,13 @@ | ||
import { useSuspenseQuery, UseSuspenseQueryResult } from '@tanstack/react-query'; | ||
|
||
import { transferService } from '../../transferService'; | ||
import { GetTransferRequest, Transfer } from '../../types'; | ||
import { TransferQueryKey } from '../../keys'; | ||
|
||
/** Hook for getting transfer info from backend */ | ||
export const useGetTransfer = ({ id }: GetTransferRequest): UseSuspenseQueryResult<Transfer> => { | ||
return useSuspenseQuery({ | ||
queryKey: [TransferQueryKey.GET_TRANSFER, id], | ||
queryFn: () => transferService.getTransfer({ id }), | ||
}); | ||
}; |
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 @@ | ||
export * from './transferService'; | ||
export * from './types'; | ||
export * from './keys'; | ||
export * from './hooks'; |
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 @@ | ||
export const TransferQueryKey = { | ||
GET_TRANSFERS: 'GET_TRANSFERS', | ||
GET_TRANSFER: 'GET_TRANSFER', | ||
} as const; |
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,14 @@ | ||
import { axiosInstance } from '@shared/config'; | ||
import { PaginationResponse } from '@shared/types'; | ||
|
||
import { GetTransferRequest, GetTransfersRequest, Transfer } from './types'; | ||
|
||
export const transferService = { | ||
getTransfers: (params: GetTransfersRequest): Promise<PaginationResponse<Transfer>> => { | ||
return axiosInstance.get('transfers', { params }); | ||
}, | ||
|
||
getTransfer: ({ id }: GetTransferRequest): Promise<Transfer> => { | ||
return axiosInstance.get(`transfers/${id}`); | ||
}, | ||
}; |
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,81 @@ | ||
import { ConnectionType, FileFormat, FileFormatCsv, FileFormatJsonLine, PaginationRequest } from '@shared/types'; | ||
|
||
export interface Transfer { | ||
id: number; | ||
group_id: number; | ||
name: string; | ||
source_connection_id: number; | ||
target_connection_id: number; | ||
description: string; | ||
is_scheduled: boolean; | ||
schedule: string; | ||
queue_id: number; | ||
source_params: | ||
| TransferParamsHive | ||
| TransferParamsOracle | ||
| TransferParamsPostgres | ||
| TransferSourceParamsHdfs | ||
| TransferSourceParamsS3; | ||
target_params: | ||
| TransferParamsHive | ||
| TransferParamsOracle | ||
| TransferParamsPostgres | ||
| TransferTargetParamsHdfs | ||
| TransferTargetParamsS3; | ||
strategy_params: TransferStrategyParams; | ||
} | ||
|
||
interface TransferStrategyParams { | ||
type: 'full' | 'incremental'; | ||
} | ||
|
||
interface TransferParamsHive { | ||
type: ConnectionType.HIVE; | ||
table_name: string; | ||
} | ||
|
||
interface TransferParamsOracle { | ||
type: ConnectionType.ORACLE; | ||
table_name: string; | ||
} | ||
|
||
interface TransferParamsPostgres { | ||
type: ConnectionType.POSTGRES; | ||
table_name: string; | ||
} | ||
|
||
interface TransferParamsHdfs { | ||
type: ConnectionType.HDFS; | ||
directory_path: string; | ||
options: object; | ||
} | ||
|
||
interface TransferSourceParamsHdfs extends TransferParamsHdfs { | ||
file_format: FileFormat; | ||
} | ||
|
||
interface TransferTargetParamsHdfs extends TransferParamsHdfs { | ||
file_format: FileFormatCsv | FileFormatJsonLine; | ||
} | ||
|
||
interface TransferParamsS3 { | ||
type: ConnectionType.S3; | ||
directory_path: string; | ||
options: object; | ||
} | ||
|
||
interface TransferSourceParamsS3 extends TransferParamsS3 { | ||
file_format: FileFormat; | ||
} | ||
|
||
interface TransferTargetParamsS3 extends TransferParamsS3 { | ||
file_format: FileFormatCsv | FileFormatJsonLine; | ||
} | ||
|
||
export interface GetTransfersRequest extends PaginationRequest { | ||
group_id: number; | ||
} | ||
|
||
export interface GetTransferRequest { | ||
id: number; | ||
} |
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 @@ | ||
export * from './api'; |
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
9 changes: 6 additions & 3 deletions
9
...ion/ConnectionDetailInfo/components/ConnectionAuthData/utils/getDescriptionItems/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
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
20 changes: 20 additions & 0 deletions
20
src/features/transfer/TransferDetailInfo/components/TransferFileFormatData/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 { Descriptions } from 'antd'; | ||
|
||
import { TransferFileFormatDataProps } from './types'; | ||
import { getDescriptionItems } from './utils'; | ||
|
||
export const TransferFileFormatData = ({ data, ...props }: TransferFileFormatDataProps) => { | ||
return ( | ||
<Descriptions {...props}> | ||
<Descriptions.Item label="Type" span={3}> | ||
{data.type} | ||
</Descriptions.Item> | ||
{getDescriptionItems({ data }).map((item, index) => ( | ||
<Descriptions.Item label={item.label} span={3} key={index}> | ||
{item.content} | ||
</Descriptions.Item> | ||
))} | ||
</Descriptions> | ||
); | ||
}; |
6 changes: 6 additions & 0 deletions
6
src/features/transfer/TransferDetailInfo/components/TransferFileFormatData/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,6 @@ | ||
import { FileFormat } from '@shared/types'; | ||
import { DescriptionsProps } from 'antd'; | ||
|
||
export interface TransferFileFormatDataProps extends DescriptionsProps { | ||
data: FileFormat; | ||
} |
Oops, something went wrong.