@@ -330,18 +330,18 @@ const GroupByTopics = (groupProps: {
330330 const assignedMember = allAssignments . find (
331331 ( e ) => e . topicName === topicLag . topic && e . partitions . includes ( partLag . partitionId )
332332 ) ;
333-
333+ const isUnconsumed = partLag . groupOffset === null ;
334334 return {
335335 topicName : topicLag . topic ,
336336 partitionId : partLag . partitionId ,
337337 groupOffset : partLag . groupOffset ,
338- highWaterMark : partLag . highWaterMark ,
339- lag : partLag . lag ,
340-
338+ highWaterMark : partLag . highWaterMark as number | null ,
339+ lag : isUnconsumed ? null : ( partLag . lag as number | null ) ,
341340 assignedMember : assignedMember ?. member ,
342341 id : assignedMember ?. member . id ,
343342 clientId : assignedMember ?. member . clientId ,
344343 host : assignedMember ?. member . clientHost ,
344+ isUnconsumed,
345345 } ;
346346 } )
347347 ) ;
@@ -356,12 +356,16 @@ const GroupByTopics = (groupProps: {
356356 const totalLagAll = g . partitions . sum ( ( c ) => c . lag ?? 0 ) ;
357357 const partitionsAssigned = g . partitions . filter ( ( c ) => c . assignedMember ) . length ;
358358
359- const partitions = groupProps . onlyShowPartitionsWithLag ? g . partitions . filter ( ( e ) => e . lag !== 0 ) : g . partitions ;
359+ const partitions = groupProps . onlyShowPartitionsWithLag
360+ ? g . partitions . filter ( ( e ) => e . isUnconsumed || ( e . lag !== null && e . lag !== 0 ) )
361+ : g . partitions ;
360362
361363 if ( partitions . length === 0 ) {
362364 return null ;
363365 }
364366
367+ const consumedPartitions = g . partitions . filter ( ( p ) => ! p . isUnconsumed ) ;
368+
365369 return {
366370 heading : (
367371 < Flex flexDirection = "column" gap = { 4 } >
@@ -373,18 +377,22 @@ const GroupByTopics = (groupProps: {
373377
374378 < Flex gap = { 2 } >
375379 < IconButton
376- disabledReason = { cannotEditGroupReason ( groupProps . group , featurePatchGroup ) }
380+ disabledReason = { cannotEditGroupReason ( groupProps . group , featurePatchGroup , consumedPartitions ) }
377381 onClick = { ( e ) => {
378- groupProps . onEditOffsets ( g . partitions ) ;
382+ groupProps . onEditOffsets ( consumedPartitions ) ;
379383 e . stopPropagation ( ) ;
380384 } }
381385 >
382386 < EditIcon />
383387 </ IconButton >
384388 < IconButton
385- disabledReason = { cannotDeleteGroupOffsetsReason ( groupProps . group , featureDeleteGroupOffsets ) }
389+ disabledReason = { cannotDeleteGroupOffsetsReason (
390+ groupProps . group ,
391+ featureDeleteGroupOffsets ,
392+ consumedPartitions
393+ ) }
386394 onClick = { ( e ) => {
387- groupProps . onDeleteOffsets ( g . partitions , 'topic' ) ;
395+ groupProps . onDeleteOffsets ( consumedPartitions , 'topic' ) ;
388396 e . stopPropagation ( ) ;
389397 } }
390398 >
@@ -409,13 +417,14 @@ const GroupByTopics = (groupProps: {
409417 < DataTable < {
410418 topicName : string ;
411419 partitionId : number ;
412- groupOffset : number ;
413- highWaterMark : number ;
414- lag : number ;
420+ groupOffset : number | null ;
421+ highWaterMark : number | null ;
422+ lag : number | null ;
415423 assignedMember : GroupMemberDescription | undefined ;
416424 id : string | undefined ;
417425 clientId : string | undefined ;
418426 host : string | undefined ;
427+ isUnconsumed : boolean ;
419428 } >
420429 columns = { [
421430 {
@@ -458,19 +467,22 @@ const GroupByTopics = (groupProps: {
458467 size : 120 ,
459468 header : 'Log End Offset' ,
460469 accessorKey : 'highWaterMark' ,
461- cell : ( { row : { original } } ) => numberToThousandsString ( original . highWaterMark ) ,
470+ cell : ( { row : { original } } ) =>
471+ original . highWaterMark !== null ? numberToThousandsString ( original . highWaterMark ) : '—' ,
462472 } ,
463473 {
464474 size : 120 ,
465475 header : 'Group Offset' ,
466476 accessorKey : 'groupOffset' ,
467- cell : ( { row : { original } } ) => numberToThousandsString ( original . groupOffset ) ,
477+ cell : ( { row : { original } } ) =>
478+ original . groupOffset !== null ? numberToThousandsString ( original . groupOffset ) : '—' ,
468479 } ,
469480 {
470481 size : 80 ,
471482 header : 'Lag' ,
472483 accessorKey : 'lag' ,
473- cell : ( { row : { original } } ) => ShortNum ( { value : original . lag , tooltip : true } ) ,
484+ cell : ( { row : { original } } ) =>
485+ original . lag !== null ? ShortNum ( { value : original . lag , tooltip : true } ) : '—' ,
474486 } ,
475487 {
476488 size : 1 ,
@@ -479,13 +491,23 @@ const GroupByTopics = (groupProps: {
479491 cell : ( { row : { original } } ) => (
480492 < Flex gap = { 1 } pr = { 2 } >
481493 < IconButton
482- disabledReason = { cannotEditGroupReason ( groupProps . group , featurePatchGroup ) }
494+ data-testid = { `partition-edit-${ original . partitionId } ` }
495+ disabledReason = { cannotEditGroupReason (
496+ groupProps . group ,
497+ featurePatchGroup ,
498+ original . isUnconsumed ? [ ] : undefined
499+ ) }
483500 onClick = { ( ) => groupProps . onEditOffsets ( [ original ] ) }
484501 >
485502 < EditIcon />
486503 </ IconButton >
487504 < IconButton
488- disabledReason = { cannotDeleteGroupOffsetsReason ( groupProps . group , featureDeleteGroupOffsets ) }
505+ data-testid = { `partition-delete-${ original . partitionId } ` }
506+ disabledReason = { cannotDeleteGroupOffsetsReason (
507+ groupProps . group ,
508+ featureDeleteGroupOffsets ,
509+ original . isUnconsumed ? [ ] : undefined
510+ ) }
489511 onClick = { ( ) => groupProps . onDeleteOffsets ( [ original ] , 'partition' ) }
490512 >
491513 < TrashIcon />
@@ -612,7 +634,14 @@ const ProtocolType = (p: { group: GroupDescription }) => {
612634 return < Statistic title = "Protocol" value = { protocol } /> ;
613635} ;
614636
615- function cannotEditGroupReason ( group : GroupDescription , featurePatchGroup : boolean ) : string | undefined {
637+ function cannotEditGroupReason (
638+ group : GroupDescription ,
639+ featurePatchGroup : boolean ,
640+ consumedPartitions ?: readonly unknown [ ]
641+ ) : string | undefined {
642+ if ( consumedPartitions !== undefined && consumedPartitions . length === 0 ) {
643+ return 'No committed offsets' ;
644+ }
616645 if ( group . noEditPerms ) {
617646 return "You don't have 'editConsumerGroup' permissions for this group" ;
618647 }
@@ -638,8 +667,12 @@ function cannotDeleteGroupReason(group: GroupDescription, featureDeleteGroup: bo
638667
639668function cannotDeleteGroupOffsetsReason (
640669 group : GroupDescription ,
641- featureDeleteGroupOffsets : boolean
670+ featureDeleteGroupOffsets : boolean ,
671+ consumedPartitions ?: readonly unknown [ ]
642672) : string | undefined {
673+ if ( consumedPartitions !== undefined && consumedPartitions . length === 0 ) {
674+ return 'No committed offsets' ;
675+ }
643676 if ( group . noEditPerms ) {
644677 return "You don't have 'deleteConsumerGroup' permissions for this group" ;
645678 }
0 commit comments