@@ -71,6 +71,12 @@ function _cmp_cell(r::ModelResult, results_root::String, csv_max_size_mb::Int)
7171 end
7272end
7373
74+ function _cmp_status (r:: ModelResult ):: String
75+ r. cmp_total == 0 && r. cmp_skip == 0 && return " na"
76+ r. cmp_pass == r. cmp_total && return " pass"
77+ return " fail"
78+ end
79+
7480function rel_log_file_or_nothing (results_root:: String , model:: String ,
7581 phase:: String ):: Union{String,Nothing}
7682 path = joinpath (results_root, " files" , model, " $(model) _$(phase) .log" )
@@ -108,7 +114,7 @@ function generate_report(results::Vector{ModelResult}, results_root::String,
108114 cmp_summary_row = n_cmp_models > 0 ? """
109115 <tr><td>Reference Comparison (MAP-LIB)</td><td>$n_cmp_pass </td><td>$n_cmp_models </td><td>$(pct (n_cmp_pass,n_cmp_models)) </td></tr>""" : " "
110116
111- rows = join ([""" <tr>
117+ rows = join ([""" <tr data-exp=" $(r . export_success ? " pass " : " fail " ) " data-par=" $(r . parse_success ? " pass " : " fail " ) " data-sim=" $(r . sim_success ? " pass " : " fail " ) " data-cmp=" $( _cmp_status (r)) " >
112118 <td><a href="files/$(r. name) /$(r. name) .bmo">$(r. name) .bmo</a></td>
113119 $(_status_cell (r. export_success, r. export_time, rel_log_file_or_nothing (results_root, r. name, " export" )))
114120 $(_status_cell (r. parse_success, r. parse_time, rel_log_file_or_nothing (results_root, r. name, " parsing" )))
@@ -141,6 +147,10 @@ function generate_report(results::Vector{ModelResult}, results_root::String,
141147 td.na { color: #888; }
142148 a { color: #0366d6; text-decoration: none; }
143149 a:hover { text-decoration: underline; }
150+ .filter-row th { background: #f5f5f5; }
151+ .filter-row select { font-size: 12px; padding: 1px 4px; }
152+ .filter-row input { font-size: 12px; padding: 1px 4px; width: 16em; box-sizing: border-box; }
153+ .filter-row input.invalid { outline: 2px solid #c00; }
144154 </style>
145155</head>
146156<body>
@@ -162,16 +172,54 @@ Total run time: $(time_str)</p>
162172 <tr><td>Simulation (MTK.jl)</td> <td>$n_sim </td><td>$n_par </td><td>$(pct (n_sim,n_par)) </td></tr>$cmp_summary_row
163173</table>
164174
165- <table>
166- <tr>
167- <th>Model</th>
168- <th>BM Export</th>
169- <th>BM Parse</th>
170- <th>MTK Sim</th>
171- <th>Ref Cmp</th>
172- </tr>
175+ <table id="model-table">
176+ <thead>
177+ <tr>
178+ <th>Model</th>
179+ <th>BM Export</th>
180+ <th>BM Parse</th>
181+ <th>MTK Sim</th>
182+ <th>Ref Cmp</th>
183+ </tr>
184+ <tr class="filter-row">
185+ <th><input id="f-name" type="text" placeholder="regex…" oninput="applyFilters()"/></th>
186+ <th><select id="f-exp" onchange="applyFilters()"><option value="all">All</option><option value="pass">Pass</option><option value="fail">Fail</option></select></th>
187+ <th><select id="f-par" onchange="applyFilters()"><option value="all">All</option><option value="pass">Pass</option><option value="fail">Fail</option></select></th>
188+ <th><select id="f-sim" onchange="applyFilters()"><option value="all">All</option><option value="pass">Pass</option><option value="fail">Fail</option></select></th>
189+ <th><select id="f-cmp" onchange="applyFilters()"><option value="all">All</option><option value="pass">Pass</option><option value="fail">Fail</option></select></th>
190+ </tr>
191+ </thead>
192+ <tbody id="model-rows">
173193$rows
194+ </tbody>
174195</table>
196+ <script>
197+ function applyFilters() {
198+ var nameInput = document.getElementById('f-name');
199+ var nameVal = nameInput.value;
200+ var nameRe = null;
201+ try {
202+ nameRe = nameVal ? new RegExp(nameVal, 'i') : null;
203+ nameInput.classList.remove('invalid');
204+ } catch(e) {
205+ nameInput.classList.add('invalid');
206+ return;
207+ }
208+ var exp = document.getElementById('f-exp').value;
209+ var par = document.getElementById('f-par').value;
210+ var sim = document.getElementById('f-sim').value;
211+ var cmp = document.getElementById('f-cmp').value;
212+ document.querySelectorAll('#model-rows tr').forEach(function(row) {
213+ var name = row.cells[0] ? row.cells[0].textContent : '';
214+ var show = (!nameRe || nameRe.test(name)) &&
215+ (exp === 'all' || row.dataset.exp === exp) &&
216+ (par === 'all' || row.dataset.par === par) &&
217+ (sim === 'all' || row.dataset.sim === sim) &&
218+ (cmp === 'all' || row.dataset.cmp === cmp);
219+ row.style.display = show ? '' : 'none';
220+ });
221+ }
222+ </script>
175223</body>
176224</html>"""
177225
0 commit comments