Skip to content

Commit abdc125

Browse files
authored
Sort columns and add scroll bar in the traffic light table (#1082)
Signed-off-by: Lan Xia <Lan_Xia@ca.ibm.com>
1 parent bcfa367 commit abdc125

1 file changed

Lines changed: 28 additions & 11 deletions

File tree

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

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ function TrafficLight() {
8787
aggregateInfo;
8888
const benchmark = benchmarkName.split('-')[0];
8989
const { platform } = getInfoFromBuildName(buildName);
90-
const buildNameTitle = parentBuildName.slice(
91-
0,
92-
parentBuildName.lastIndexOf('_')
93-
);
90+
const buildNameTitle = parentBuildName
91+
.slice(0, parentBuildName.lastIndexOf('_'))
92+
.replace('Perf_open', '');
93+
9494
return aggregateInfo.metrics.map(
9595
({ name: metricsName, statValues, rawValues }) => {
9696
let higherbetter = true;
@@ -252,6 +252,15 @@ function TrafficLight() {
252252
{
253253
title: 'Benchmark Name',
254254
key: 'benchmarkName',
255+
sorter: {
256+
compare: (a, b) =>
257+
a.benchmarkName.localeCompare(b.benchmarkName, undefined, {
258+
numeric: true,
259+
sensitivity: 'base',
260+
}),
261+
},
262+
width: '350px',
263+
fixed: 'left',
255264
render: (_, { benchmarkName, metricsName }) => {
256265
return (
257266
<div>
@@ -262,13 +271,20 @@ function TrafficLight() {
262271
);
263272
},
264273
},
265-
...buildNameTitles.map((title, i) => {
266-
return {
267-
title,
268-
key: i,
269-
render: renderCell.bind(null, title),
270-
};
271-
}),
274+
...buildNameTitles
275+
.sort((a, b) =>
276+
a.localeCompare(b, undefined, {
277+
numeric: true,
278+
sensitivity: 'base',
279+
})
280+
)
281+
.map((title, i) => {
282+
return {
283+
title,
284+
key: i,
285+
render: renderCell.bind(null, title),
286+
};
287+
}),
272288
];
273289
const setBuildOptionsOnChange = async (buildName) => {
274290
setTopBuild(buildName);
@@ -359,6 +375,7 @@ function TrafficLight() {
359375
pagination={{ defaultPageSize: 100 }}
360376
dataSource={tableData}
361377
columns={columns}
378+
scroll={{ x: 'max-content' }}
362379
/>
363380
) : (
364381
''

0 commit comments

Comments
 (0)