File tree Expand file tree Collapse file tree 3 files changed +30
-4
lines changed
site/frontend/src/pages/status_new Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Original file line number Diff line number Diff line change 22import {h , ref , Ref } from " vue" ;
33import {parseISO , differenceInHours } from " date-fns" ;
44import {formatISODate , shortenTag } from " ../../utils/formatting" ;
5- import {CollectorConfig , BenchmarkJobStatus } from " ./data" ;
5+ import {CollectorConfig , BenchmarkJobStatus , isJobComplete } from " ./data" ;
66
77const props = defineProps <{
88 collector: CollectorConfig ;
@@ -56,9 +56,7 @@ function ActiveStatus({collector}: {collector: CollectorConfig}) {
5656 statusText = " Offline" ;
5757 statusClass = " offline" ;
5858 } else {
59- const allJobsComplete = collector .jobs .every (
60- (job ) => job .status === " Failed" || job .status === " Success"
61- );
59+ const allJobsComplete = collector .jobs .every (isJobComplete );
6260 if (allJobsComplete ) {
6361 statusText = " Waiting" ;
6462 statusClass = " waiting" ;
Original file line number Diff line number Diff line change @@ -42,3 +42,7 @@ export type StatusResponse = {
4242 requests : BenchmarkRequest [ ] ;
4343 collectors : CollectorConfig [ ] ;
4444} ;
45+
46+ export function isJobComplete ( job : BenchmarkJob ) : boolean {
47+ return job . status === "Failed" || job . status === "Success" ;
48+ }
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {
1515 BenchmarkRequestStatus ,
1616 CollectorConfig ,
1717 StatusResponse ,
18+ isJobComplete ,
1819} from " ./data" ;
1920import Collector from " ./collector.vue" ;
2021
@@ -122,6 +123,25 @@ function PullRequestLink({request}: {request: BenchmarkRequest}) {
122123 );
123124}
124125
126+ function getJobCompletion(
127+ req : BenchmarkRequest ,
128+ collectors : CollectorConfig []
129+ ) {
130+ const jobs = collectors
131+ .flatMap ((c ) => c .jobs )
132+ .filter ((j ) => j .requestTag === req .tag );
133+ if (jobs .length === 0 ) {
134+ return " " ;
135+ }
136+ const completed = jobs .reduce ((acc , job ) => {
137+ if (isJobComplete (job )) {
138+ acc += 1 ;
139+ }
140+ return acc ;
141+ }, 0 );
142+ return ` ${completed } / ${jobs .length } ` ;
143+ }
144+
125145const {toggleExpanded : toggleExpandedErrors, isExpanded : hasExpandedErrors} =
126146 useExpandedStore ();
127147
@@ -143,6 +163,7 @@ loadStatusData(loading);
143163 <th >Kind</th >
144164 <th >Tag</th >
145165 <th >Status</th >
166+ <th >Jobs Complete</th >
146167 <th >Completed At</th >
147168 <th >Duration</th >
148169 <th >Errors</th >
@@ -162,6 +183,9 @@ loadStatusData(loading);
162183 req.status === "Completed" && req.hasPendingJobs ? "*" : ""
163184 }}
164185 </td >
186+ <td >
187+ {{ getJobCompletion(req, data.collectors) }}
188+ </td >
165189 <td >
166190 {{ formatISODate(req.completedAt) }}
167191 <span v-if =" req.endEstimated" >(est.)</span >
You can’t perform that action at this time.
0 commit comments