Skip to content

Commit 4bac25b

Browse files
committed
[DOP-29475] Show connection type in source/target Transfer params
1 parent 24eb003 commit 4bac25b

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

src/features/transfer/MutateTransferForm/components/SourceParams/SourceParams.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { memo } from 'react';
2-
import { ConnectionQueryKey, connectionService } from '@entities/connection';
2+
import { ConnectionQueryKey, connectionService, CONNECTION_TYPE_NAMES } from '@entities/connection';
33
import { ManagedSelect } from '@shared/ui';
44
import { Form } from 'antd';
55
import { useTranslation } from 'react-i18next';
@@ -27,7 +27,7 @@ export const SourceParams = memo(({ groupId }: SourceParamsProps) => {
2727
queryKey={[ConnectionQueryKey.GET_CONNECTIONS, groupId]}
2828
queryFunction={(params) => connectionService.getConnections({ group_id: groupId, ...params })}
2929
renderOptionValue={(connection) => connection.id}
30-
renderOptionLabel={(connection) => connection.name}
30+
renderOptionLabel={(connection) => `${connection.name} (${CONNECTION_TYPE_NAMES[connection.type]})`}
3131
onSelect={handleSelectConnection}
3232
detailQueryKey={[ConnectionQueryKey.GET_CONNECTION]}
3333
detailQueryFunction={(value) => connectionService.getConnection({ id: value })}

src/features/transfer/MutateTransferForm/components/TargetParams/TargetParams.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { memo } from 'react';
2-
import { ConnectionQueryKey, connectionService } from '@entities/connection';
2+
import { ConnectionQueryKey, connectionService, CONNECTION_TYPE_NAMES } from '@entities/connection';
33
import { ManagedSelect } from '@shared/ui';
44
import { Form } from 'antd';
55
import { useTranslation } from 'react-i18next';
@@ -27,7 +27,7 @@ export const TargetParams = memo(({ groupId }: TargetParamsProps) => {
2727
queryKey={[ConnectionQueryKey.GET_CONNECTIONS, groupId]}
2828
queryFunction={(params) => connectionService.getConnections({ group_id: groupId, ...params })}
2929
renderOptionValue={(connection) => connection.id}
30-
renderOptionLabel={(connection) => connection.name}
30+
renderOptionLabel={(connection) => `${connection.name} (${CONNECTION_TYPE_NAMES[connection.type]})`}
3131
onSelect={handleSelectConnection}
3232
detailQueryKey={[ConnectionQueryKey.GET_CONNECTION]}
3333
detailQueryFunction={(value) => connectionService.getConnection({ id: value })}

src/features/transfer/TransferDetailInfo/components/TransferParams/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
import React from 'react';
22
import { Descriptions } from 'antd';
33
import { CONNECTION_TYPE_NAMES } from '@entities/connection';
4+
import { Link } from 'react-router-dom';
45
import { useTranslation } from 'react-i18next';
56

67
import { TransferParamsProps } from './types';
78
import { getDescriptionItems } from './utils';
89

9-
export const TransferParams = ({ data, ...props }: TransferParamsProps) => {
10+
export const TransferParams = ({ data, connection, ...props }: TransferParamsProps) => {
1011
const { t } = useTranslation();
1112

1213
return (
1314
<Descriptions {...props}>
14-
<Descriptions.Item label={t('type')} span={3}>
15-
{CONNECTION_TYPE_NAMES[data.type]}
15+
<Descriptions.Item label={t('connection', { ns: 'connection' })} span={3}>
16+
<Link to={`/connections/${connection.id}`}>
17+
{connection.name} ({CONNECTION_TYPE_NAMES[data.type]})
18+
</Link>
1619
</Descriptions.Item>
1720
{getDescriptionItems({ data, t }).map((item, index) => (
1821
<Descriptions.Item label={item.label} span={3} key={index}>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { Connection } from '@entities/connection';
12
import { Transfer } from '@entities/transfer';
23
import { DescriptionsProps } from 'antd';
34

45
export interface TransferParamsProps extends DescriptionsProps {
6+
connection: Connection;
57
data: Transfer['source_params'] | Transfer['target_params'];
68
}

src/features/transfer/TransferDetailInfo/index.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,11 @@ export const TransferDetailInfo = ({
3838
<Descriptions.Item label={t('queue', { ns: 'queue' })} span={3}>
3939
<Link to={`/queues/${queue.id}`}>{queue.name}</Link>
4040
</Descriptions.Item>
41-
<Descriptions.Item label={t('sourceConnection', { ns: 'transfer' })} span={3}>
42-
<Link to={`/connections/${connectionSource.id}`}>{connectionSource.name}</Link>
43-
</Descriptions.Item>
44-
<Descriptions.Item label={t('targetConnection', { ns: 'transfer' })} span={3}>
45-
<Link to={`/connections/${connectionTarget.id}`}>{connectionTarget.name}</Link>
46-
</Descriptions.Item>
47-
<Descriptions.Item className={classes.subDescription} label={t('sourceParams', { ns: 'transfer' })} span={3}>
48-
<TransferParams data={transfer.source_params} />
41+
<Descriptions.Item className={classes.subDescription} label={t('source', { ns: 'transfer' })} span={3}>
42+
<TransferParams connection={connectionSource} data={transfer.source_params} />
4943
</Descriptions.Item>
5044
<Descriptions.Item className={classes.subDescription} label={t('targetParams', { ns: 'transfer' })} span={3}>
51-
<TransferParams data={transfer.target_params} />
45+
<TransferParams connection={connectionTarget} data={transfer.target_params} />
5246
</Descriptions.Item>
5347
<Descriptions.Item className={classes.subDescription} label={t('strategyParams', { ns: 'transfer' })} span={3}>
5448
<TransferStrategyParams data={transfer.strategy_params} />

0 commit comments

Comments
 (0)