Skip to content

Commit cacc2f6

Browse files
authored
Merge pull request #1403 from rust-lang/compare-links
Add buttons to move between categories quickly to compare page
2 parents 45ee9e4 + 87e1255 commit cacc2f6

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

site/static/compare.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,11 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
315315
:commit-b="data.b"
316316
:stat="stat"
317317
:before="before"
318-
:after="after"></test-cases-table>
318+
:after="after"
319+
id="primary-benchmarks"
320+
section-link="secondary"
321+
:section-link-up="false"
322+
></test-cases-table>
319323
<hr />
320324
<test-cases-table
321325
title="Secondary"
@@ -325,7 +329,11 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
325329
:commit-b="data.b"
326330
:stat="stat"
327331
:before="before"
328-
:after="after"></test-cases-table>
332+
:after="after"
333+
id="secondary-benchmarks"
334+
section-link="primary"
335+
:section-link-up="true"
336+
></test-cases-table>
329337
<br />
330338
<hr />
331339
<div>

site/static/compare/script.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,19 @@ const app = Vue.createApp({
292292
});
293293

294294
app.component('test-cases-table', {
295-
props: ['cases', 'showRawData', 'commitA', 'commitB', 'before', 'after', 'title', 'stat'],
295+
props: {
296+
cases: Array,
297+
showRawData: Boolean,
298+
commitA: Object,
299+
commitB: Object,
300+
before: Date,
301+
after: Date,
302+
title: String,
303+
stat: String,
304+
id: String,
305+
sectionLink: String,
306+
sectionLinkUp: Boolean
307+
},
296308
methods: {
297309
detailedQueryLink(commit, testCase) {
298310
return `/detailed-query.html?commit=${commit.commit}&benchmark=${testCase.benchmark + "-" + testCase.profile}&scenario=${testCase.scenario}`;
@@ -320,8 +332,16 @@ app.component('test-cases-table', {
320332
},
321333
},
322334
template: `
323-
<div class="bench-table">
324-
<div class="category-title">{{ title }} benchmarks</div>
335+
<div class="bench-table" :id="id">
336+
<div class="category-title">
337+
{{ title }} benchmarks
338+
<span :title="'To ' + sectionLink + ' benchmarks'">
339+
<a :href="'#' + sectionLink + '-benchmarks'">
340+
<template v-if="sectionLinkUp">⮭</template>
341+
<template v-else>⮯</template>
342+
</a>
343+
</span>
344+
</div>
325345
<div v-if="cases.length === 0" style="text-align: center;">
326346
No results
327347
</div>

0 commit comments

Comments
 (0)