Skip to content
Merged
Changes from 3 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
43 changes: 40 additions & 3 deletions site/frontend/src/pages/status_new/page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {getJson} from "../../utils/requests";
import {STATUS_DATA_NEW_URL} from "../../urls";
import {withLoading} from "../../utils/loading";
import {formatSecondsAsDuration} from "../../utils/formatting";
import {useExpandedStore} from "../../utils/expansion";
import {
BenchmarkRequest,
BenchmarkRequestStatus,
Expand Down Expand Up @@ -97,6 +98,21 @@ function formatStatus(status: BenchmarkRequestStatus): string {
}
}

function hasErrors(errors: Dict<string>) {
// This is a bit odd but if the error object has values the loop will be
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already use Object.keys(errors).length in getErrorsLength, you can use the same here :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6913885 👍

// hit and thus return true.
for (const key in errors) {
console.log(key);
return true;
}
return false;
}

function getErrorsLength(errors: Dict<string>) {
const errorsLen = Object.keys(errors).length;
return `${errorsLen} ${errorsLen > 1 ? "s" : ""}`;
}

function PullRequestLink({request}: {request: BenchmarkRequest}) {
if (request.requestType === "Release") {
return "";
Expand All @@ -108,6 +124,9 @@ function PullRequestLink({request}: {request: BenchmarkRequest}) {
);
}

const {toggleExpanded: toggleExpandedErrors, isExpanded: hasExpandedErrors} =
useExpandedStore();

loadStatusData(loading);
</script>

Expand Down Expand Up @@ -145,10 +164,28 @@ loadStatusData(loading);
req.status === "Completed" && req.hasPendingJobs ? "*" : ""
}}
</td>
<td v-html="req.createdAt"></td>
<td v-html="req.completedAt"></td>
<td v-html="getDuration(req)"></td>
<td>
<pre>{{ req.errors }}</pre>

<td v-if="hasErrors(req.errors)">
<button @click="toggleExpandedErrors(req.tag)">
{{ hasExpandedErrors(req.tag) ? "Hide" : "Show" }}
{{ getErrorsLength(req.errors) }}
</button>
</td>
<td v-else></td>
</tr>

<tr v-if="hasExpandedErrors(req.tag)">
<td colspan="7" style="padding: 10px 0">
<div v-for="benchmark in Object.entries(req.errors)">
<div>
<details open>
<summary>{{ benchmark[0] }}</summary>
<pre class="error">{{ benchmark[1] }}</pre>
</details>
</div>
</div>
</td>
</tr>
</template>
Expand Down
Loading