1- import { Flex , Text } from '@gravity-ui/uikit' ;
1+ import { Flex , Label , Text } from '@gravity-ui/uikit' ;
22
3- import { AsyncReplicationState } from '../../../../../components/AsyncReplicationState' ;
43import { YDBSyntaxHighlighter } from '../../../../../components/SyntaxHighlighter/YDBSyntaxHighlighter' ;
54import type { YDBDefinitionListItem } from '../../../../../components/YDBDefinitionList/YDBDefinitionList' ;
65import { YDBDefinitionList } from '../../../../../components/YDBDefinitionList/YDBDefinitionList' ;
@@ -40,12 +39,32 @@ export function TransferInfo({path, database, data}: TransferProps) {
4039 ) ;
4140}
4241
42+ function transferState ( state : DescribeReplicationResult | undefined ) {
43+ if ( ! state ) {
44+ return null ;
45+ }
46+
47+ if ( 'running' in state ) {
48+ return < Label theme = "info" > Running</ Label > ;
49+ }
50+ if ( 'paused' in state ) {
51+ return < Label theme = "info" > Paused</ Label > ;
52+ }
53+ if ( 'done' in state ) {
54+ return < Label theme = "success" > Done</ Label > ;
55+ }
56+ if ( 'error' in state ) {
57+ return < Label theme = "danger" > Error</ Label > ;
58+ }
59+
60+ return < Label size = "s" > Unknown</ Label > ;
61+ }
62+
4363function prepareTransferItems (
4464 data : TEvDescribeSchemeResult ,
4565 replicationData : DescribeReplicationResult | undefined ,
4666) {
4767 const transferDescription = data . PathDescription ?. ReplicationDescription || { } ;
48- const state = transferDescription . State ;
4968 const srcConnectionParams = transferDescription . Config ?. SrcConnectionParams || { } ;
5069 const { Endpoint, Database} = srcConnectionParams ;
5170 const target = transferDescription . Config ?. TransferSpecific ?. Target ;
@@ -55,10 +74,10 @@ function prepareTransferItems(
5574
5675 const info : YDBDefinitionListItem [ ] = [ ] ;
5776
58- if ( state ) {
77+ if ( replicationData ) {
5978 info . push ( {
6079 name : i18n ( 'state.label' ) ,
61- content : < AsyncReplicationState state = { state } /> ,
80+ content : transferState ( replicationData ) ,
6281 } ) ;
6382 }
6483
0 commit comments