Skip to content

Commit 35e1246

Browse files
committed
Add category filter to compare page
1 parent 6f5ab18 commit 35e1246

File tree

1 file changed

+57
-8
lines changed

1 file changed

+57
-8
lines changed

site/static/compare.html

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,29 +106,32 @@
106106
font-weight: bold;
107107
}
108108

109-
#states-list {
109+
.states-list {
110110
display: flex;
111111
flex-direction: column;
112112
align-items: start;
113113
list-style: none;
114114
margin: 0;
115115
padding: 0;
116116
}
117-
.section-scenarios {
117+
.section-list-wrapper {
118118
flex-direction: column;
119119
}
120120

121121
@media (min-width: 760px) {
122-
#states-list {
123-
justify-content: space-around;
122+
.states-list {
123+
justify-content: start;
124124
flex-direction: row;
125125
align-items: center;
126126
width: 80%;
127127
}
128-
.section-scenarios {
128+
.section-list-wrapper {
129129
flex-direction: row;
130130
}
131131
}
132+
.states-list > li {
133+
margin-right: 15px;
134+
}
132135

133136
.tooltip {
134137
position: relative;
@@ -349,7 +352,7 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
349352
<div class="section-heading">Filter</div>
350353
<input id="filter" type="text" v-model="filter.name" />
351354
</div>
352-
<div class="section section-scenarios">
355+
<div class="section section-list-wrapper">
353356
<div class="section-heading">
354357
<div style="width: 160px;">
355358
<span>Scenarios</span>
@@ -360,7 +363,7 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
360363
</span>
361364
</div>
362365
</div>
363-
<ul id="states-list">
366+
<ul class="states-list">
364367
<li>
365368
<label>
366369
<input type="checkbox" id="build-full" v-model="filter.scenario.full" />
@@ -412,6 +415,42 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
412415
</li>
413416
</ul>
414417
</div>
418+
<div class="section section-list-wrapper">
419+
<div class="section-heading">
420+
<div style="width: 160px;">
421+
<span>Categories</span>
422+
<span class="tooltip">?
423+
<span class="tooltiptext">
424+
Select benchmarks based on their category (primary or secondary).
425+
</span>
426+
</span>
427+
</div>
428+
</div>
429+
<ul class="states-list">
430+
<li>
431+
<label>
432+
<input type="checkbox" v-model="filter.category.primary" />
433+
<span class="cache-label">primary</span>
434+
</label>
435+
<div class="tooltip">?
436+
<span class="tooltiptext">
437+
Real-world benchmarks.
438+
</span>
439+
</div>
440+
</li>
441+
<li>
442+
<label>
443+
<input type="checkbox" v-model="filter.category.secondary" />
444+
<span class="cache-label">secondary</span>
445+
</label>
446+
<div class="tooltip">?
447+
<span class="tooltiptext">
448+
Artificial benchmarks and stress-tests.
449+
</span>
450+
</div>
451+
</li>
452+
</ul>
453+
</div>
415454
<div class="section">
416455
<div class="section-heading"><span>Show only significant changes</span>
417456
<span class="tooltip">?
@@ -663,6 +702,10 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
663702
incrFull: true,
664703
incrUnchanged: true,
665704
incrPatched: true
705+
},
706+
category: {
707+
primary: true,
708+
secondary: true
666709
}
667710
},
668711
showRawData: false,
@@ -702,6 +745,12 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
702745
}
703746
}
704747

748+
function categoryFilter(category) {
749+
if (category === 'primary' && !filter.category.primary) return false;
750+
if (category === 'secondary' && !filter.category.secondary) return false;
751+
return true;
752+
}
753+
705754
function shouldShowTestCase(testCase) {
706755
const name = `${testCase.benchmark} ${testCase.profile} ${testCase.scenario}`;
707756
let nameFilter = filter.name && filter.name.trim();
@@ -711,7 +760,7 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
711760

712761
const magnitudeFilter = filter.filterVerySmall ? testCase.magnitude != "very small" : true;
713762

714-
return scenarioFilter(testCase.scenario) && significanceFilter && nameFilter && magnitudeFilter;
763+
return scenarioFilter(testCase.scenario) && categoryFilter(testCase.category) && significanceFilter && nameFilter && magnitudeFilter;
715764
}
716765

717766
let testCases =

0 commit comments

Comments
 (0)