@@ -35,10 +35,13 @@ const app = Vue.createApp({
35
35
loadState ( state => makeData ( state , app ) ) ;
36
36
37
37
document . getElementById ( "filters-toggle" ) . onclick = ( e ) => {
38
- toggleFilters ( "filters-content" , "filters-toggle-indicator" ) ;
38
+ toggleSection ( "filters-content" , "filters-toggle-indicator" ) ;
39
39
} ;
40
40
document . getElementById ( "search-toggle" ) . onclick = ( e ) => {
41
- toggleFilters ( "search-content" , "search-toggle-indicator" ) ;
41
+ toggleSection ( "search-content" , "search-toggle-indicator" ) ;
42
+ } ;
43
+ document . getElementById ( "aggregations-toggle" ) . onclick = ( e ) => {
44
+ toggleSection ( "aggregations-content" , "aggregations-toggle-indicator" ) ;
42
45
} ;
43
46
} ,
44
47
data ( ) {
@@ -420,7 +423,7 @@ const SummaryRange = {
420
423
<div v-if="range.length > 0">
421
424
[<SummaryPercentValue :value="range[0]" :padWidth="6" />, <SummaryPercentValue :value="range[1]" :padWidth="6" />]
422
425
</div>
423
- <div v-else>-</div>
426
+ <div v-else style="text-align: center;" >-</div>
424
427
` , components : { SummaryPercentValue}
425
428
} ;
426
429
const SummaryCount = {
@@ -434,39 +437,107 @@ const SummaryCount = {
434
437
} ;
435
438
436
439
app . component ( 'summary-table' , {
437
- props : [ 'cases' ] ,
440
+ props : {
441
+ summary : Object ,
442
+ withLegend : {
443
+ type : Boolean ,
444
+ default : true
445
+ }
446
+ } ,
438
447
template : `
439
- <table class="summary-table">
440
- <thead>
448
+ <div v-if="summary.all.count === 0" style="flex-grow: 1; display: flex; flex-direction: column; justify-content: center;">
449
+ <span>No results</span>
450
+ </div>
451
+ <table v-else class="summary-table">
452
+ <thead v-if="withLegend">
441
453
<th><!-- icon --></th>
442
454
<th>Range</th>
443
455
<th>Mean</th>
444
456
<th>Count</th>
445
457
</thead>
446
458
<tbody>
447
459
<tr class="positive">
448
- <td title="Regresions">❌</td>
449
- <td><SummaryRange :range="cases.regressions.range" /></td>
450
- <td><SummaryPercentValue :value="cases.regressions.average" /></td>
451
- <td><SummaryCount :cases="cases.regressions.count" :benchmarks="cases.regressions.benchmarks" /></td>
460
+ <td title="Regressions" v-if="withLegend">❌</td>
461
+ <template v-if="summary.regressions.count !== 0">
462
+ <td><SummaryRange :range="summary.regressions.range" /></td>
463
+ <td><SummaryPercentValue :value="summary.regressions.average" /></td>
464
+ <td><SummaryCount :cases="summary.regressions.count" :benchmarks="summary.regressions.benchmarks" /></td>
465
+ </template>
466
+ <template v-else>
467
+ <td colspan="3" style="text-align: center;">No regressions</td>
468
+ </template>
452
469
</tr>
453
470
<tr class="negative">
454
- <td title="Improvements">✅</td>
455
- <td><SummaryRange :range="cases.improvements.range" /></td>
456
- <td><SummaryPercentValue :value="cases.improvements.average" /></td>
457
- <td><SummaryCount :cases="cases.improvements.count" :benchmarks="cases.improvements.benchmarks" /></td>
471
+ <td title="Improvements" v-if="withLegend">✅</td>
472
+ <template v-if="summary.improvements.count !== 0">
473
+ <td><SummaryRange :range="summary.improvements.range" /></td>
474
+ <td><SummaryPercentValue :value="summary.improvements.average" /></td>
475
+ <td><SummaryCount :cases="summary.improvements.count" :benchmarks="summary.improvements.benchmarks" /></td>
476
+ </template>
477
+ <template v-else>
478
+ <td colspan="3" style="text-align: center;">No improvements</td>
479
+ </template>
458
480
</tr>
459
481
<tr>
460
- <td title="All changes">❌,✅</td>
461
- <td><SummaryRange :range="cases .all.range" /></td>
462
- <td><SummaryPercentValue :value="cases .all.average" /></td>
463
- <td><SummaryCount :cases="cases .all.count" :benchmarks="cases .all.benchmarks" /></td>
482
+ <td title="All changes" v-if="withLegend" >❌,✅</td>
483
+ <td><SummaryRange :range="summary .all.range" /></td>
484
+ <td><SummaryPercentValue :value="summary .all.average" /></td>
485
+ <td><SummaryCount :cases="summary .all.count" :benchmarks="summary .all.benchmarks" /></td>
464
486
</tr>
465
487
</tbody>
466
488
</table>
467
489
` ,
468
490
components : { SummaryRange, SummaryPercentValue, SummaryCount}
469
491
} ) ;
492
+
493
+ app . component ( "aggregations" , {
494
+ props : {
495
+ cases : Array
496
+ } ,
497
+ template : `
498
+ <div>
499
+ <div class="aggregation-section">
500
+ <div class="header">Profile</div>
501
+ <div class="groups">
502
+ <div class="group" v-for="profile in ['check', 'debug', 'opt', 'doc']">
503
+ <div class="group-header">{{ profile }}</div>
504
+ <summary-table :summary="calculateSummary('profile', profile)" :withLegend="false"></summary-table>
505
+ </div>
506
+ </div>
507
+ </div>
508
+ <div class="aggregation-section">
509
+ <div class="header">Scenario</div>
510
+ <div class="groups">
511
+ <div class="group" v-for="scenario in ['full', 'incr-full', 'incr-unchanged', 'incr-patched']">
512
+ <div class="group-header">{{ scenario }}</div>
513
+ <summary-table :summary="calculateSummary('scenario', scenario)" :withLegend="false"></summary-table>
514
+ </div>
515
+ </div>
516
+ </div>
517
+ <div class="aggregation-section">
518
+ <div class="header">Category</div>
519
+ <div class="groups">
520
+ <div class="group" v-for="category in ['primary', 'secondary']">
521
+ <div class="group-header">{{ category }}</div>
522
+ <summary-table :summary="calculateSummary('category', category)" :withLegend="false"></summary-table>
523
+ </div>
524
+ </div>
525
+ </div>
526
+ </div>
527
+ ` ,
528
+ methods : {
529
+ calculateSummary ( keyAttribute , keyValue ) {
530
+ const benchmarks = [ ] ;
531
+ for ( const benchmark of this . cases ) {
532
+ if ( benchmark [ keyAttribute ] === keyValue ) {
533
+ benchmarks . push ( benchmark ) ;
534
+ }
535
+ }
536
+ return computeSummary ( benchmarks ) ;
537
+ }
538
+ }
539
+ } ) ;
540
+
470
541
app . mixin ( {
471
542
methods : {
472
543
percentClass ( pct ) {
@@ -491,7 +562,7 @@ app.mixin({
491
562
}
492
563
} ) ;
493
564
494
- function toggleFilters ( id , toggle ) {
565
+ function toggleSection ( id , toggle ) {
495
566
let styles = document . getElementById ( id ) . style ;
496
567
let indicator = document . getElementById ( toggle ) ;
497
568
if ( styles . display != "none" ) {
@@ -503,12 +574,9 @@ function toggleFilters(id, toggle) {
503
574
}
504
575
}
505
576
506
- toggleFilters ( "filters-content" , "filters-toggle-indicator" ) ;
507
- toggleFilters ( "search-content" , "search-toggle-indicator" ) ;
508
-
509
- function testCaseString ( testCase ) {
510
- return testCase . benchmark + "-" + testCase . profile + "-" + testCase . scenario ;
511
- }
577
+ toggleSection ( "filters-content" , "filters-toggle-indicator" ) ;
578
+ toggleSection ( "search-content" , "search-toggle-indicator" ) ;
579
+ toggleSection ( "aggregations-content" , "aggregations-toggle-indicator" ) ;
512
580
513
581
/**
514
582
* Computes summaries of improvements, regressions and all changes from the given `comparisons`.
0 commit comments