Skip to content

Commit 23bc698

Browse files
committed
fix: Update resource acquisition notation elements. (#2945)
resolves #2946 **Changes:** - Improved decimal precision in percentage displays by adding `.toFixed(1)` to ensure consistent one decimal place - Increased network traffic (TX/RX) decimal precision from 1 to 2 places for more accurate readings **Impact:** These changes provide more precise numerical representations in the Agent Detail Modal, particularly for percentage values and network traffic measurements, leading to better monitoring accuracy. **How to test:** 1. Visit Resources page. 2. Click the info icon of any agent. **Checklist:** - [x] Mention to the original issue - [ ] Documentation - [x] Minium required manager version: 24.09 - [x] Specific setting for review - [ ] Minimum requirements to check during review - [ ] Test case(s) to demonstrate the difference of before/after
1 parent 3afb0d3 commit 23bc698

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

react/src/components/AgentDetailModal.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { convertBinarySizeUnit, convertDecimalSizeUnit } from '../helper';
1+
import {
2+
convertBinarySizeUnit,
3+
convertDecimalSizeUnit,
4+
toFixedFloorWithoutTrailingZeros,
5+
} from '../helper';
26
import { useResourceSlotsDetails } from '../hooks/backendai';
37
import BAIModal, { BAIModalProps } from './BAIModal';
48
import BAIProgressWithLabel from './BAIProgressWithLabel';
@@ -78,7 +82,9 @@ const AgentDetailModal: React.FC<AgentDetailModalProps> = ({
7882
</Typography.Text>
7983
<BAIProgressWithLabel
8084
percent={value?.pct}
81-
valueLabel={value?.pct + '%'}
85+
valueLabel={
86+
toFixedFloorWithoutTrailingZeros(value?.pct, 1) + '%'
87+
}
8288
/>
8389
</Flex>
8490
))}
@@ -124,7 +130,7 @@ const AgentDetailModal: React.FC<AgentDetailModalProps> = ({
124130
convertDecimalSizeUnit(
125131
parsedLiveStat?.node?.net_tx?.current,
126132
'm',
127-
1,
133+
2,
128134
)?.numberUnit
129135
}
130136
B
@@ -137,7 +143,7 @@ const AgentDetailModal: React.FC<AgentDetailModalProps> = ({
137143
convertDecimalSizeUnit(
138144
parsedLiveStat?.node?.net_rx?.current,
139145
'm',
140-
1,
146+
2,
141147
)?.numberUnit
142148
}
143149
B
@@ -177,7 +183,12 @@ const AgentDetailModal: React.FC<AgentDetailModalProps> = ({
177183
</Typography.Text>
178184
<BAIProgressWithLabel
179185
percent={_.toFinite((value?.[1] as LiveStat)?.pct)}
180-
valueLabel={(value?.[1] as LiveStat)?.pct + '%'}
186+
valueLabel={
187+
toFixedFloorWithoutTrailingZeros(
188+
(value?.[1] as LiveStat)?.pct,
189+
1,
190+
) + '%'
191+
}
181192
/>
182193
</Flex>
183194
),
@@ -211,7 +222,12 @@ const AgentDetailModal: React.FC<AgentDetailModalProps> = ({
211222
</Typography.Text>
212223
<BAIProgressWithLabel
213224
percent={_.toFinite((value?.[1] as LiveStat)?.pct)}
214-
valueLabel={(value?.[1] as LiveStat)?.pct + '%'}
225+
valueLabel={
226+
toFixedFloorWithoutTrailingZeros(
227+
(value?.[1] as LiveStat)?.pct,
228+
1,
229+
) + '%'
230+
}
215231
/>
216232
</Flex>
217233
),

0 commit comments

Comments
 (0)