Skip to content

Commit c6e4235

Browse files
committed
feat(FR-1764): add data-testid to agent live stats to hide it easily (#4773)
resolves #4772 (FR-1764) In this pr, I added data-testid attribute to agent live stat to hide it easily. **Checklist:** (if applicable) - [ ] Documentation - [ ] Minium required manager version - [ ] Specific setting for review (eg., KB link, endpoint or how to setup) - [ ] Minimum requirements to check during review - [ ] Test case(s) to demonstrate the difference of before/after
1 parent 1fe4b47 commit c6e4235

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

react/src/components/AgentList.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ const AgentList: React.FC<AgentListProps> = ({
482482
// CPU
483483
justify="between"
484484
style={{ minWidth: 200, width: '100%' }}
485+
data-testid="live-stat-cpu"
485486
>
486487
<Typography.Text>
487488
{mergedResourceSlots?.cpu?.human_readable_name}
@@ -501,6 +502,7 @@ const AgentList: React.FC<AgentListProps> = ({
501502
// MEM
502503
justify="between"
503504
style={{ minWidth: 200, width: '100%' }}
505+
data-testid="live-stat-mem"
504506
>
505507
<Typography.Text>
506508
{mergedResourceSlots?.mem?.human_readable_name}
@@ -533,6 +535,7 @@ const AgentList: React.FC<AgentListProps> = ({
533535
justify="between"
534536
style={{ minWidth: 200, width: '100%' }}
535537
gap="xxs"
538+
data-testid={`live-stat-${statKey}`}
536539
>
537540
<Typography.Text>
538541
{mergedResourceSlots?.[deviceName]?.human_readable_name}
@@ -574,6 +577,7 @@ const AgentList: React.FC<AgentListProps> = ({
574577
justify="between"
575578
style={{ minWidth: 200, width: '100%' }}
576579
gap="xxs"
580+
data-testid={`live-stat-${statKey}`}
577581
>
578582
<Typography.Text>
579583
{mergedResourceSlots?.[deviceName]?.human_readable_name}
@@ -619,6 +623,7 @@ const AgentList: React.FC<AgentListProps> = ({
619623
justify="between"
620624
style={{ minWidth: 200, width: '100%' }}
621625
gap="xxs"
626+
data-testid={`live-stat-${statKey}`}
622627
>
623628
<BAIText>{`${humanReadableName}(power)`}</BAIText>
624629
<BAIText>{`${toFixedFloorWithoutTrailingZeros(parsedValue.node[statKey]?.current, 2)} ${parsedValue.node[statKey].unit_hint}`}</BAIText>
@@ -636,6 +641,7 @@ const AgentList: React.FC<AgentListProps> = ({
636641
justify="between"
637642
style={{ minWidth: 200, width: '100%' }}
638643
gap="xxs"
644+
data-testid={`live-stat-${statKey}`}
639645
>
640646
<BAIText>{`${humanReadableName}(temp)`}</BAIText>
641647
<BAIText>{`${toFixedFloorWithoutTrailingZeros(parsedValue.node[statKey]?.current, 2)} °C`}</BAIText>
@@ -653,6 +659,7 @@ const AgentList: React.FC<AgentListProps> = ({
653659
justify="between"
654660
style={{ minWidth: 200, width: '100%' }}
655661
gap="xxs"
662+
data-testid={`live-stat-${statKey}`}
656663
>
657664
<BAIText>
658665
{statKey === 'net_rx' ? 'Net Rx' : 'Net Tx'}
@@ -669,6 +676,7 @@ const AgentList: React.FC<AgentListProps> = ({
669676
justify="between"
670677
style={{ minWidth: 200, width: '100%' }}
671678
gap="xxs"
679+
data-testid={`live-stat-${statKey}`}
672680
>
673681
<BAIText>{statKey}</BAIText>
674682
<BAIText>{`${toFixedFloorWithoutTrailingZeros(parsedValue.node[statKey]?.current ?? 0, 2)}${parsedValue.node[statKey]?.unit_hint ? ` ${parsedValue.node[statKey].unit_hint}` : ''}`}</BAIText>
@@ -841,7 +849,12 @@ const AgentList: React.FC<AgentListProps> = ({
841849
useHiddenColumnKeysSetting('AgentList');
842850

843851
return (
844-
<BAIFlex direction="column" align="stretch" gap="sm">
852+
<BAIFlex
853+
direction="column"
854+
align="stretch"
855+
gap="sm"
856+
data-testid="agent-list"
857+
>
845858
<BAIFlex justify="between" align="start" wrap="wrap" {...headerProps}>
846859
<BAIFlex
847860
direction="row"

0 commit comments

Comments
 (0)