11<script setup lang="tsx">
22import {h , ref , Ref } from " vue" ;
3+ import {differenceInSeconds } from " date-fns" ;
34
45import {getJson } from " ../../utils/requests" ;
56import {STATUS_DATA_URL } from " ../../urls" ;
67import {withLoading } from " ../../utils/loading" ;
7- import {formatISODate , formatSecondsAsDuration } from " ../../utils/formatting" ;
8+ import {
9+ formatISODate ,
10+ formatSecondsAsDuration ,
11+ parseDateIsoStringOrNull ,
12+ } from " ../../utils/formatting" ;
813import {useExpandedStore } from " ../../utils/expansion" ;
914import {
1015 BenchmarkRequest ,
1116 CollectorConfig ,
1217 isJobComplete ,
18+ isRequestInProgress ,
1319 StatusResponse ,
1420} from " ./data" ;
1521import Collector from " ./collector.vue" ;
@@ -104,6 +110,46 @@ function getErrorsLength(errors: Dict<string>) {
104110 return ` ${errorsLen } ${errorsLen > 1 ? " s" : " " } ` ;
105111}
106112
113+ function ExpectedCurrentRequestCompletion() {
114+ const req = data .value .timeline .find (isRequestInProgress );
115+ if (! req ) return " " ;
116+ if (! req .endEstimated ) return " " ;
117+ if (! req .completedAt ) return " " ;
118+ const estimatedCompleted = parseDateIsoStringOrNull (req .completedAt );
119+ if (! estimatedCompleted ) {
120+ return null ;
121+ }
122+
123+ const now = new Date ();
124+ const diffSeconds = differenceInSeconds (estimatedCompleted , now );
125+ const prettyDisplay = formatSecondsAsDuration (diffSeconds );
126+
127+ if (req .requestType === " Release" ) {
128+ return (
129+ <span >
130+ Current Benchmark for{ " " }
131+ <strong >
132+ <CommitSha tag = { req .tag } ></CommitSha >
133+ </strong >{ " " }
134+ expected to end in approximately { prettyDisplay }
135+ </span >
136+ );
137+ } else {
138+ const url = ` https://github.com/rust-lang/rust/pull/${req .pr } ` ;
139+ return (
140+ <span >
141+ Current Benchmark for PR{ " " }
142+ <strong >
143+ <a href = { url } target = " _blank" >
144+ #{ req .pr }
145+ </a >{ " " }
146+ </strong >
147+ expected to end in approximately { prettyDisplay }
148+ </span >
149+ );
150+ }
151+ }
152+
107153function PullRequestLink({request }: {request: BenchmarkRequest }) {
108154 if (request .requestType === " Release" ) {
109155 return " " ;
@@ -164,7 +210,12 @@ loadStatusData(loading);
164210 <div class =" status-page-wrapper" >
165211 <div class =" timeline-wrapper" >
166212 <h1 >Timeline</h1 >
167- <strong >Times are local.</strong >
213+ <span class =" small-padding-bottom" >
214+ <strong >Times are local.</strong >
215+ </span >
216+ <span class =" small-padding-bottom" >
217+ <ExpectedCurrentRequestCompletion />
218+ </span >
168219 <div style =" margin-bottom : 10px " >
169220 Queue length: {{ data.queueLength }}
170221 </div >
@@ -189,7 +240,7 @@ loadStatusData(loading);
189240 <tr :class =" getRequestRowClassName(req)" >
190241 <td ><PullRequestLink :request =" req" /></td >
191242 <td >{{ req.requestType }}</td >
192- <td ><CommitSha :tag =" req.tag" ></CommitSha ></td >
243+ <td ><CommitSha :truncate = " true " : tag =" req.tag" ></CommitSha ></td >
193244 <td >
194245 {{ formatStatus(req)
195246 }}{{
@@ -364,4 +415,8 @@ loadStatusData(loading);
364415 grid-template-columns : repeat (auto-fill , minmax (800px , 1fr ));
365416 grid-gap : 20px ;
366417}
418+
419+ .small-padding-bottom {
420+ padding-bottom : 8px ;
421+ }
367422 </style >
0 commit comments