Skip to content

Commit fb22792

Browse files
authored
Merge pull request #2238 from Jamesbarford/fix/queue-ordering
Fix; queue ordering and errors formatting
2 parents 00984b2 + 6913885 commit fb22792

File tree

1 file changed

+34
-3
lines changed
  • site/frontend/src/pages/status_new

1 file changed

+34
-3
lines changed

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

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {getJson} from "../../utils/requests";
55
import {STATUS_DATA_NEW_URL} from "../../urls";
66
import {withLoading} from "../../utils/loading";
77
import {formatSecondsAsDuration} from "../../utils/formatting";
8+
import {useExpandedStore} from "../../utils/expansion";
89
import {
910
BenchmarkRequest,
1011
BenchmarkRequestStatus,
@@ -97,6 +98,15 @@ function formatStatus(status: BenchmarkRequestStatus): string {
9798
}
9899
}
99100
101+
function hasErrors(errors: Dict<string>) {
102+
return Object.keys(errors).length !== 0;
103+
}
104+
105+
function getErrorsLength(errors: Dict<string>) {
106+
const errorsLen = Object.keys(errors).length;
107+
return `${errorsLen} ${errorsLen > 1 ? "s" : ""}`;
108+
}
109+
100110
function PullRequestLink({request}: {request: BenchmarkRequest}) {
101111
if (request.requestType === "Release") {
102112
return "";
@@ -108,6 +118,9 @@ function PullRequestLink({request}: {request: BenchmarkRequest}) {
108118
);
109119
}
110120
121+
const {toggleExpanded: toggleExpandedErrors, isExpanded: hasExpandedErrors} =
122+
useExpandedStore();
123+
111124
loadStatusData(loading);
112125
</script>
113126

@@ -145,10 +158,28 @@ loadStatusData(loading);
145158
req.status === "Completed" && req.hasPendingJobs ? "*" : ""
146159
}}
147160
</td>
148-
<td v-html="req.createdAt"></td>
161+
<td v-html="req.completedAt"></td>
149162
<td v-html="getDuration(req)"></td>
150-
<td>
151-
<pre>{{ req.errors }}</pre>
163+
164+
<td v-if="hasErrors(req.errors)">
165+
<button @click="toggleExpandedErrors(req.tag)">
166+
{{ hasExpandedErrors(req.tag) ? "Hide" : "Show" }}
167+
{{ getErrorsLength(req.errors) }}
168+
</button>
169+
</td>
170+
<td v-else></td>
171+
</tr>
172+
173+
<tr v-if="hasExpandedErrors(req.tag)">
174+
<td colspan="7" style="padding: 10px 0">
175+
<div v-for="benchmark in Object.entries(req.errors)">
176+
<div>
177+
<details open>
178+
<summary>{{ benchmark[0] }}</summary>
179+
<pre class="error">{{ benchmark[1] }}</pre>
180+
</details>
181+
</div>
182+
</div>
152183
</td>
153184
</tr>
154185
</template>

0 commit comments

Comments
 (0)