Skip to content

Display "No relevant results" on compare page where there are filtered non-relevant results #1525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions site/static/compare.html
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
</div>
<test-cases-table
title="Primary"
:cases="testCases.filter(c => c.category === 'primary')"
:cases="primaryCases"
:has-non-relevant="testCasesWithNonRelevant.filter(c => c.category === 'primary').length > 0"
:show-raw-data="filter.showRawData"
:commit-a="data.a"
:commit-b="data.b"
Expand All @@ -328,7 +329,8 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
<hr />
<test-cases-table
title="Secondary"
:cases="testCases.filter(c => c.category === 'secondary')"
:cases="secondaryCases"
:has-non-relevant="testCasesWithNonRelevant.filter(c => c.category === 'secondary').length > 0"
:show-raw-data="filter.showRawData"
:commit-a="data.a"
:commit-b="data.b"
Expand Down
25 changes: 19 additions & 6 deletions site/static/compare/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ const app = Vue.createApp({
compareLink() {
return `https://github.com/rust-lang/rust/compare/${this.data.a.commit}...${this.data.b.commit}`;
},
testCases() {
testCasesWithNonRelevant() {
let data = this.data;
const filter = this.filter;
const benchmarkMap = this.benchmarkMap;
Expand Down Expand Up @@ -197,13 +197,10 @@ const app = Vue.createApp({
let nameFilter = filter.name && filter.name.trim();
nameFilter = !nameFilter || name.includes(nameFilter);

const relevanceFilter = filter.nonRelevant ? true : testCase.isRelevant;

return (
profileFilter(testCase.profile) &&
scenarioFilter(testCase.scenario) &&
categoryFilter(testCase.category) &&
relevanceFilter &&
nameFilter
);
}
Expand Down Expand Up @@ -237,6 +234,15 @@ const app = Vue.createApp({

return testCases;
},
testCases() {
return this.filterNonRelevant(this.testCasesWithNonRelevant);
},
primaryCases() {
return this.testCases.filter(c => c.category === "primary");
},
secondaryCases() {
return this.testCases.filter(c => c.category === "secondary");
},
bootstrapTotals() {
const a = this.data.a.bootstrap_total / 1e9;
const b = this.data.b.bootstrap_total / 1e9;
Expand Down Expand Up @@ -377,13 +383,20 @@ const app = Vue.createApp({
},
exportToMarkdown() {
exportToMarkdown(this.testCases);
},
filterNonRelevant(cases) {
if (this.filter.nonRelevant) {
return cases;
}
return cases.filter(c => c.isRelevant);
}
},
});

app.component('test-cases-table', {
props: {
cases: Array,
hasNonRelevant: Boolean,
showRawData: Boolean,
commitA: Object,
commitB: Object,
Expand Down Expand Up @@ -433,7 +446,7 @@ app.component('test-cases-table', {
</span>
</div>
<div v-if="cases.length === 0" style="text-align: center;">
No results
{{ hasNonRelevant ? "No relevant results" : "No results" }}
</div>
<table v-else class="benches compare">
<thead>
Expand Down Expand Up @@ -555,7 +568,7 @@ const SummaryCount = {
`
};

app.component('summary-table', {
app.component("summary-table", {
props: {
summary: Object,
withLegend: {
Expand Down