Skip to content

Commit 92c74ca

Browse files
authored
Fix Perf build default value (#1070)
fixes: #1068 and #1069 Signed-off-by: Lan Xia <Lan_Xia@ca.ibm.com>
1 parent addd6b9 commit 92c74ca

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ function TrafficLight() {
277277
];
278278
const setBuildOptionsOnChange = async (buildName) => {
279279
setTopBuild(buildName);
280+
setTestBuild();
281+
setBaselineBuild();
280282
const results = await fetchData(
281283
`/api/getBuildHistory?buildName=${buildName}&status=Done&limit=120`
282284
);
@@ -288,13 +290,18 @@ function TrafficLight() {
288290
})
289291
);
290292
};
293+
294+
const defaultBuildValue = 'Perf_Pipeline';
295+
useEffect(() => {
296+
setBuildOptionsOnChange(defaultBuildValue);
297+
}, []);
291298
return (
292299
<Space direction="vertical" size="middle" style={{ display: 'flex' }}>
293300
<Select
294301
style={{
295302
width: '100%',
296303
}}
297-
defaultValue="Perf_Pipeline"
304+
defaultValue={defaultBuildValue}
298305
onChange={setBuildOptionsOnChange}
299306
options={topBuildOptions}
300307
placeholder="please select the top level performance build"
@@ -303,14 +310,18 @@ function TrafficLight() {
303310
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
304311
<Select
305312
style={{ width: '100%' }}
306-
defaultValue={testBuild}
313+
value={testBuild}
307314
onChange={setTestBuild}
308315
options={buildOptions}
309316
placeholder="please select test build"
310317
/>
311318
{testBuild && (
312319
<a
313-
href={buildOptions.find(option => option.value === testBuild)?.label}
320+
href={
321+
buildOptions.find(
322+
(option) => option.value === testBuild
323+
)?.label
324+
}
314325
target="_blank"
315326
rel="noopener noreferrer"
316327
>
@@ -322,14 +333,18 @@ function TrafficLight() {
322333
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
323334
<Select
324335
style={{ width: '100%' }}
325-
defaultValue={baselineBuild}
336+
value={baselineBuild}
326337
onChange={setBaselineBuild}
327338
options={buildOptions}
328339
placeholder="please select baseline build"
329340
/>
330341
{baselineBuild && (
331342
<a
332-
href={buildOptions.find(option => option.value === baselineBuild)?.label}
343+
href={
344+
buildOptions.find(
345+
(option) => option.value === baselineBuild
346+
)?.label
347+
}
333348
target="_blank"
334349
rel="noopener noreferrer"
335350
>

0 commit comments

Comments
 (0)