Skip to content

Commit 6a325d5

Browse files
committed
Fix metricPropsJSON value
- Since react setState method does not not mutate the state immediately, use API call with async directly. - Increase the pagination - Remove unused variables fixes: automation/issues/582 Signed-off-by: Lan Xia <Lan_Xia@ca.ibm.com>
1 parent 57c81c8 commit 6a325d5

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

test-result-summary-client/src/TrafficLight/TrafficLight.jsx

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ function TrafficLight() {
1919
const [baselineBuild, setBaselineBuild] = useState();
2020
const [buildOptions, setBuildOptions] = useState([]);
2121
const [tableData, settableData] = useState([]);
22-
const [metricsProps, setMetricsProps] = useState({});
2322
const iconRed = (
2423
<CloseCircleOutlined
2524
style={{ color: 'rgb(255, 85, 0)', fontSize: 23 }}
@@ -76,9 +75,6 @@ function TrafficLight() {
7675
element.buildType = 'baseline';
7776
});
7877
const metricPropsJSON = await fetchData(`/api/getBenchmarkMetricProps`);
79-
if (metricPropsJSON) {
80-
setMetricsProps(metricPropsJSON);
81-
}
8278
const modifiedData = [...testData, ...baselineData]
8379
.map(
8480
({
@@ -90,23 +86,16 @@ function TrafficLight() {
9086
const { benchmarkName, benchmarkVariant, buildName } =
9187
aggregateInfo;
9288
const benchmark = benchmarkName.split('-')[0];
93-
const {
94-
jdkVersion,
95-
jdkImpl,
96-
level,
97-
group,
98-
platform,
99-
rerun,
100-
} = getInfoFromBuildName(buildName);
89+
const { platform } = getInfoFromBuildName(buildName);
10190
const buildNameTitle = parentBuildName.slice(
10291
0,
10392
parentBuildName.lastIndexOf('_')
10493
);
10594
return aggregateInfo.metrics.map(
10695
({ name: metricsName, statValues, rawValues }) => {
10796
let higherbetter = true;
108-
const benchmarchMetric = metricsProps[benchmark]
109-
? metricsProps[benchmark].metrics
97+
const benchmarchMetric = metricPropsJSON[benchmark]
98+
? metricPropsJSON[benchmark].metrics
11099
: null;
111100
if (
112101
benchmarchMetric &&
@@ -366,7 +355,11 @@ function TrafficLight() {
366355
</Space>
367356
<br />
368357
{tableData ? (
369-
<Table dataSource={tableData} columns={columns} />
358+
<Table
359+
pagination={{ defaultPageSize: 100 }}
360+
dataSource={tableData}
361+
columns={columns}
362+
/>
370363
) : (
371364
''
372365
)}

0 commit comments

Comments
 (0)