@@ -10,6 +10,9 @@ import {
1010 Button ,
1111 Alert ,
1212 AlertVariant ,
13+ ModalHeader ,
14+ ModalBody ,
15+ ModalFooter ,
1316} from '@patternfly/react-core' ;
1417import {
1518 Table ,
@@ -19,25 +22,31 @@ import {
1922 Tbody ,
2023 Td ,
2124} from '@patternfly/react-table' ;
22- import { OffsetResetResult } from '@/api/types' ;
25+ import { OffsetAndMetadata , OffsetResetResult } from '@/api/types' ;
26+ import { CliCommandDisplay } from './CliCommandDisplay' ;
2327
2428interface DryRunResultsProps {
2529 isOpen : boolean ;
2630 results : OffsetResetResult [ ] ;
31+ currentOffsets ?: OffsetAndMetadata [ ] | null ;
32+ command : string ;
2733 onClose : ( ) => void ;
28- onApply : ( ) => void ;
29- isApplying ?: boolean ;
3034}
3135
3236export function DryRunResults ( {
3337 isOpen,
3438 results,
39+ currentOffsets,
40+ command,
3541 onClose,
36- onApply,
37- isApplying = false ,
3842} : DryRunResultsProps ) {
3943 const { t } = useTranslation ( ) ;
4044
45+ const currentOffsetsByPartition = ( currentOffsets || [ ] ) . reduce ( ( acc , offset ) => {
46+ acc [ `${ offset . topicName } -${ offset . partition } ` ] = offset . offset ;
47+ return acc ;
48+ } , { } as Record < string , number | null > ) ;
49+
4150 // Group results by topic
4251 const resultsByTopic = results . reduce ( ( acc , result ) => {
4352 const topicName = result . topicName ;
@@ -50,12 +59,12 @@ export function DryRunResults({
5059
5160 return (
5261 < Modal
53- variant = { ModalVariant . large }
54- title = { t ( 'groups.resetOffset.dryRunResults.title' ) }
62+ variant = { ModalVariant . medium }
5563 isOpen = { isOpen }
5664 onClose = { onClose }
5765 >
58- < div style = { { padding : '1.5rem' } } >
66+ < ModalHeader title = { t ( 'groups.resetOffset.dryRunResults.title' ) } />
67+ < ModalBody >
5968 < Alert
6069 variant = { AlertVariant . info }
6170 isInline
@@ -79,6 +88,7 @@ export function DryRunResults({
7988 < Thead >
8089 < Tr >
8190 < Th > { t ( 'groups.resetOffset.dryRunResults.partition' ) } </ Th >
91+ < Th > { t ( 'groups.resetOffset.dryRunResults.currentOffset' ) } </ Th >
8292 < Th > { t ( 'groups.resetOffset.dryRunResults.newOffset' ) } </ Th >
8393 </ Tr >
8494 </ Thead >
@@ -88,6 +98,9 @@ export function DryRunResults({
8898 < Td dataLabel = { t ( 'groups.resetOffset.dryRunResults.partition' ) } >
8999 { result . partition }
90100 </ Td >
101+ < Td dataLabel = { t ( 'groups.resetOffset.dryRunResults.currentOffset' ) } >
102+ { currentOffsetsByPartition [ `${ result . topicName } -${ result . partition } ` ] ?? t ( 'common.notAvailable' ) }
103+ </ Td >
91104 < Td dataLabel = { t ( 'groups.resetOffset.dryRunResults.newOffset' ) } >
92105 { result . offset !== null
93106 ? result . offset
@@ -100,24 +113,16 @@ export function DryRunResults({
100113 </ div >
101114 ) )
102115 ) }
103- </ div >
104- < div style = { { padding : '1.5rem' , paddingTop : '0' , display : 'flex' , gap : '0.5rem' } } >
105- < Button
106- variant = "primary"
107- onClick = { onApply }
108- isDisabled = { isApplying || results . length === 0 }
109- isLoading = { isApplying }
110- >
111- { t ( 'groups.resetOffset.dryRunResults.apply' ) }
112- </ Button >
116+ < CliCommandDisplay command = { command } />
117+ </ ModalBody >
118+ < ModalFooter >
113119 < Button
114120 variant = "link"
115121 onClick = { onClose }
116- isDisabled = { isApplying }
117122 >
118123 { t ( 'groups.resetOffset.dryRunResults.cancel' ) }
119124 </ Button >
120- </ div >
125+ </ ModalFooter >
121126 </ Modal >
122127 ) ;
123128}
0 commit comments