@@ -72,6 +72,22 @@ function savedata(data) {
7272 refreshContent ( ) ;
7373}
7474
75+ function updateBaselineDropdown ( ) {
76+ var $baseline = $ ( "#baseline" ) ;
77+ var current = $baseline . val ( ) ;
78+ $baseline . find ( "option:not([value='none'])" ) . remove ( ) ;
79+ $ ( "input[name='executables']:checked" ) . each ( function ( ) {
80+ var key = $ ( this ) . val ( ) ;
81+ var name = $ ( this ) . next ( 'label' ) . text ( ) . trim ( ) ;
82+ $baseline . append ( $ ( '<option>' ) . val ( key ) . text ( name ) ) ;
83+ } ) ;
84+ if ( $baseline . find ( "option[value='" + current + "']" ) . length ) {
85+ $baseline . val ( current ) ;
86+ } else {
87+ $baseline . val ( 'none' ) ;
88+ }
89+ }
90+
7591function loadData ( ) {
7692 var conf = getConfiguration ( ) ;
7793 if ( ! conf . exe || ! conf . ben ) { return ; }
@@ -399,7 +415,6 @@ function init(defaults) {
399415
400416 // Set default values
401417 $ ( "#chart_type" ) . val ( defaults . chart_type ) ;
402- $ ( "#baseline" ) . val ( defaults . baseline ) ;
403418 $ ( "#direction" ) . prop ( 'checked' , defaults . direction === "True" ) ;
404419
405420 /*
@@ -414,9 +429,23 @@ function init(defaults) {
414429 sel . filter ( "[value='" + env + "']" ) . prop ( 'checked' , true ) ;
415430 } ) ;
416431
417- // Re-fetch when exe or benchmark selection changes
418- $ ( "input[name='executables'], input[name='benchmarks']" ) . change ( loadData ) ;
419- $ ( '.checkall, .uncheckall' ) . click ( loadData ) ;
432+ // Populate baseline dropdown from initially-checked executables
433+ updateBaselineDropdown ( ) ;
434+ $ ( "#baseline" ) . val ( defaults . baseline ) ;
435+
436+ // Exe changes: rebuild baseline dropdown + re-fetch
437+ $ ( "input[name='executables']" ) . change ( function ( ) {
438+ updateBaselineDropdown ( ) ;
439+ loadData ( ) ;
440+ } ) ;
441+ $ ( "#executable .checkall, #executable .uncheckall" ) . click ( function ( ) {
442+ updateBaselineDropdown ( ) ;
443+ loadData ( ) ;
444+ } ) ;
445+
446+ // Benchmark changes: re-fetch only
447+ $ ( "input[name='benchmarks']" ) . change ( loadData ) ;
448+ $ ( "#benchmark .checkall, #benchmark .uncheckall" ) . click ( loadData ) ;
420449
421450 // Re-render without re-fetching for other controls
422451 $ ( "#chart_type, #baseline, #direction, input[name='environments']" ) . change ( refreshContent ) ;
0 commit comments