Skip to content

Commit 89ec60d

Browse files
committed
Add button to reset filters in compare page
1 parent 536d52c commit 89ec60d

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-20
lines changed

site/static/compare.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
275275
<input type="checkbox" v-model="showRawData" style="margin-left: 20px;" />
276276
</div>
277277
</div>
278+
<button @click="resetFilter">Reset filters</button>
278279
</fieldset>
279280
<p v-if="dataLoading && !data">Loading ...</p>
280281
<div v-if="data" id="content" style="margin-top: 15px">

site/static/compare/script.js

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,29 @@ function findQueryParam(name) {
66
}
77
}
88

9+
function createDefaultFilter() {
10+
return {
11+
name: null,
12+
showNonRelevant: false,
13+
profile: {
14+
check: true,
15+
debug: true,
16+
opt: true,
17+
doc: true
18+
},
19+
scenario: {
20+
full: true,
21+
incrFull: true,
22+
incrUnchanged: true,
23+
incrPatched: true
24+
},
25+
category: {
26+
primary: true,
27+
secondary: true
28+
}
29+
};
30+
}
31+
932
const app = Vue.createApp({
1033
mounted() {
1134
const app = this;
@@ -20,26 +43,7 @@ const app = Vue.createApp({
2043
},
2144
data() {
2245
return {
23-
filter: {
24-
name: null,
25-
showNonRelevant: false,
26-
profile: {
27-
check: true,
28-
debug: true,
29-
opt: true,
30-
doc: true
31-
},
32-
scenario: {
33-
full: true,
34-
incrFull: true,
35-
incrUnchanged: true,
36-
incrPatched: true
37-
},
38-
category: {
39-
primary: true,
40-
secondary: true
41-
}
42-
},
46+
filter: createDefaultFilter(),
4347
showRawData: false,
4448
data: null,
4549
dataLoading: false
@@ -278,6 +282,9 @@ const app = Vue.createApp({
278282

279283
return createUrlFromParams(createSearchParamsForMetric(metric, start, end));
280284
},
285+
resetFilter() {
286+
this.filter = createDefaultFilter();
287+
}
281288
},
282289
});
283290

0 commit comments

Comments
 (0)