@@ -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,94 @@ 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
448
<table class="summary-table">
440
- <thead>
449
+ <thead v-if="withLegend" >
441
450
<th><!-- icon --></th>
442
451
<th>Range</th>
443
452
<th>Mean</th>
444
453
<th>Count</th>
445
454
</thead>
446
455
<tbody>
447
456
<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>
457
+ <td title="Regresions" v-if="withLegend" >❌</td>
458
+ <td><SummaryRange :range="summary .regressions.range" /></td>
459
+ <td><SummaryPercentValue :value="summary .regressions.average" /></td>
460
+ <td><SummaryCount :cases="summary .regressions.count" :benchmarks="summary .regressions.benchmarks" /></td>
452
461
</tr>
453
462
<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>
463
+ <td title="Improvements" v-if="withLegend" >✅</td>
464
+ <td><SummaryRange :range="summary .improvements.range" /></td>
465
+ <td><SummaryPercentValue :value="summary .improvements.average" /></td>
466
+ <td><SummaryCount :cases="summary .improvements.count" :benchmarks="summary .improvements.benchmarks" /></td>
458
467
</tr>
459
468
<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>
469
+ <td title="All changes" v-if="withLegend" >❌,✅</td>
470
+ <td><SummaryRange :range="summary .all.range" /></td>
471
+ <td><SummaryPercentValue :value="summary .all.average" /></td>
472
+ <td><SummaryCount :cases="summary .all.count" :benchmarks="summary .all.benchmarks" /></td>
464
473
</tr>
465
474
</tbody>
466
475
</table>
467
476
` ,
468
477
components : { SummaryRange, SummaryPercentValue, SummaryCount}
469
478
} ) ;
479
+
480
+ app . component ( "aggregations" , {
481
+ props : {
482
+ cases : Array
483
+ } ,
484
+ template : `
485
+ <div>
486
+ <div class="aggregation-section">
487
+ <div class="header">Profile</div>
488
+ <div class="groups">
489
+ <div class="group" v-for="profile in ['check', 'debug', 'opt', 'doc']">
490
+ <div class="group-header">{{ profile }}</div>
491
+ <summary-table :summary="calculateSummary('profile', profile)" :withLegend="false"></summary-table>
492
+ </div>
493
+ </div>
494
+ </div>
495
+ <div class="aggregation-section">
496
+ <div class="header">Scenario</div>
497
+ <div class="groups">
498
+ <div class="group" v-for="scenario in ['full', 'incr-full', 'incr-unchanged', 'incr-patched']">
499
+ <div class="group-header">{{ scenario }}</div>
500
+ <summary-table :summary="calculateSummary('scenario', scenario)" :withLegend="false"></summary-table>
501
+ </div>
502
+ </div>
503
+ </div>
504
+ <div class="aggregation-section">
505
+ <div class="header">Category</div>
506
+ <div class="groups">
507
+ <div class="group" v-for="category in ['primary', 'secondary']">
508
+ <div class="group-header">{{ category }}</div>
509
+ <summary-table :summary="calculateSummary('category', category)" :withLegend="false"></summary-table>
510
+ </div>
511
+ </div>
512
+ </div>
513
+ </div>
514
+ ` ,
515
+ methods : {
516
+ calculateSummary ( keyAttribute , keyValue ) {
517
+ const benchmarks = [ ] ;
518
+ for ( const benchmark of this . cases ) {
519
+ if ( benchmark [ keyAttribute ] === keyValue ) {
520
+ benchmarks . push ( benchmark ) ;
521
+ }
522
+ }
523
+ return computeSummary ( benchmarks ) ;
524
+ }
525
+ }
526
+ } ) ;
527
+
470
528
app . mixin ( {
471
529
methods : {
472
530
percentClass ( pct ) {
@@ -491,7 +549,7 @@ app.mixin({
491
549
}
492
550
} ) ;
493
551
494
- function toggleFilters ( id , toggle ) {
552
+ function toggleSection ( id , toggle ) {
495
553
let styles = document . getElementById ( id ) . style ;
496
554
let indicator = document . getElementById ( toggle ) ;
497
555
if ( styles . display != "none" ) {
@@ -503,12 +561,9 @@ function toggleFilters(id, toggle) {
503
561
}
504
562
}
505
563
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
- }
564
+ toggleSection ( "filters-content" , "filters-toggle-indicator" ) ;
565
+ toggleSection ( "search-content" , "search-toggle-indicator" ) ;
566
+ toggleSection ( "aggregations-content" , "aggregations-toggle-indicator" ) ;
512
567
513
568
/**
514
569
* Computes summaries of improvements, regressions and all changes from the given `comparisons`.
0 commit comments