Skip to content

Commit 098d6ae

Browse files
committed
Show at the top of the timeline when the current benchmark is expected to finish
1 parent 9b557fa commit 098d6ae

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

site/frontend/src/pages/status/commit-sha.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<script setup lang="ts">
22
import {computed} from "vue";
3+
import {tagLooksLikeSha} from "./data";
34
45
const props = defineProps<{
56
tag: string;
7+
truncate?: boolean;
68
}>();
79
8-
const looksLikeSha = computed(() => props.tag.length === 40);
10+
const looksLikeSha = computed(() => tagLooksLikeSha(props.tag));
911
</script>
1012

1113
<template>
@@ -14,7 +16,7 @@ const looksLikeSha = computed(() => props.tag.length === 40);
1416
:title="tag"
1517
:href="'https://github.com/rust-lang/rust/commit/' + tag"
1618
>
17-
{{ tag.substring(0, 13) }}
19+
{{ truncate ? tag.substring(0, 13) : tag }}
1820
</a>
1921
<template v-else>
2022
{{ tag }}

site/frontend/src/pages/status/data.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,11 @@ export type StatusResponse = {
4848
export function isJobComplete(job: BenchmarkJob): boolean {
4949
return job.status === "Failed" || job.status === "Success";
5050
}
51+
52+
export function isRequestInProgress(req: BenchmarkRequest): boolean {
53+
return req.status === "InProgress";
54+
}
55+
56+
export function tagLooksLikeSha(tag: string): boolean {
57+
return tag.length === 40;
58+
}

site/frontend/src/pages/status/page.vue

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
BenchmarkRequest,
1111
CollectorConfig,
1212
isJobComplete,
13+
isRequestInProgress,
1314
StatusResponse,
1415
} from "./data";
1516
import Collector from "./collector.vue";
@@ -104,6 +105,23 @@ function getErrorsLength(errors: Dict<string>) {
104105
return `${errorsLen} ${errorsLen > 1 ? "s" : ""}`;
105106
}
106107
108+
function ExpectedCurrentRequestCompletion() {
109+
const req = data.value.timeline.find(isRequestInProgress);
110+
if (!req) return "";
111+
if (!req.endEstimated) return "";
112+
if (!req.completedAt) return "";
113+
const formattedDate = formatISODate(req.completedAt);
114+
return (
115+
<span>
116+
Current Benchmark for{" "}
117+
<strong>
118+
<CommitSha tag={req.tag}></CommitSha>
119+
</strong>{" "}
120+
expected to end at {formattedDate}{" "}
121+
</span>
122+
);
123+
}
124+
107125
function PullRequestLink({request}: {request: BenchmarkRequest}) {
108126
if (request.requestType === "Release") {
109127
return "";
@@ -164,6 +182,7 @@ loadStatusData(loading);
164182
<div class="status-page-wrapper">
165183
<div class="timeline-wrapper">
166184
<h1>Timeline</h1>
185+
<ExpectedCurrentRequestCompletion />
167186
<div style="margin-bottom: 10px">
168187
Queue length: {{ data.queueLength }}
169188
</div>
@@ -188,7 +207,7 @@ loadStatusData(loading);
188207
<tr :class="getRequestRowClassName(req)">
189208
<td><PullRequestLink :request="req" /></td>
190209
<td>{{ req.requestType }}</td>
191-
<td><CommitSha :tag="req.tag"></CommitSha></td>
210+
<td><CommitSha :truncate="true" :tag="req.tag"></CommitSha></td>
192211
<td>
193212
{{ formatStatus(req)
194213
}}{{

0 commit comments

Comments
 (0)