From daed684e3d95cfa9d8b13f493b6e20d916a2547b Mon Sep 17 00:00:00 2001 From: James Barford-Evans Date: Wed, 3 Sep 2025 10:55:44 +0100 Subject: [PATCH 1/4] Fix; queue ordering and errors formatting --- site/frontend/src/pages/status_new/page.vue | 11 +++++++++-- site/src/request_handlers/status_page_new.rs | 3 +-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/site/frontend/src/pages/status_new/page.vue b/site/frontend/src/pages/status_new/page.vue index 1487ec1d9..e7bd18925 100644 --- a/site/frontend/src/pages/status_new/page.vue +++ b/site/frontend/src/pages/status_new/page.vue @@ -97,6 +97,13 @@ function formatStatus(status: BenchmarkRequestStatus): string { } } +function formatErrors(errors: Dict) { + return Object.entries(errors).reduce( + (acc, e) => (acc += `${e[0]}: ${e[1]}\n`), + "" + ); +} + function PullRequestLink({request}: {request: BenchmarkRequest}) { if (request.requestType === "Release") { return ""; @@ -145,10 +152,10 @@ loadStatusData(loading); req.status === "Completed" && req.hasPendingJobs ? "*" : "" }} - + -
{{ req.errors }}
+
{{ formatErrors(req.errors) }}
diff --git a/site/src/request_handlers/status_page_new.rs b/site/src/request_handlers/status_page_new.rs index f14def2cc..9b3fbd3d8 100644 --- a/site/src/request_handlers/status_page_new.rs +++ b/site/src/request_handlers/status_page_new.rs @@ -15,13 +15,12 @@ pub async fn handle_status_page_new(ctxt: Arc) -> anyhow::Result = build_queue(&*conn, &index) .await? .into_iter() .map(|req| request_to_ui(&req, HashMap::new())) .collect(); - queue.reverse(); + // And then we add N most recently completed requests to it let completed = conn.get_last_n_completed_benchmark_requests(10).await?; queue.extend( From d77fc26c49c214c406d7a7fb0d627f654f8e4428 Mon Sep 17 00:00:00 2001 From: James Barford-Evans Date: Wed, 3 Sep 2025 12:08:24 +0100 Subject: [PATCH 2/4] PR Feedback; add back collapsable errors --- site/frontend/src/pages/status_new/page.vue | 44 +++++++++++++++++---- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/site/frontend/src/pages/status_new/page.vue b/site/frontend/src/pages/status_new/page.vue index e7bd18925..ef750c1b2 100644 --- a/site/frontend/src/pages/status_new/page.vue +++ b/site/frontend/src/pages/status_new/page.vue @@ -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, @@ -97,11 +98,19 @@ function formatStatus(status: BenchmarkRequestStatus): string { } } -function formatErrors(errors: Dict) { - return Object.entries(errors).reduce( - (acc, e) => (acc += `${e[0]}: ${e[1]}\n`), - "" - ); +function hasErrors(errors: Dict) { + // This is a bit odd but if the error object has values the loop will be + // hit and thus return true. + for (const key in errors) { + console.log(key); + return true; + } + return false; +} + +function getErrorsLength(errors: Dict) { + const errorsLen = Object.keys(errors).length; + return `${errorsLen} ${errorsLen > 1 ? "s" : ""}`; } function PullRequestLink({request}: {request: BenchmarkRequest}) { @@ -115,6 +124,9 @@ function PullRequestLink({request}: {request: BenchmarkRequest}) { ); } +const {toggleExpanded: toggleExpandedErrors, isExpanded: hasExpandedErrors} = + useExpandedStore(); + loadStatusData(loading); @@ -154,8 +166,26 @@ loadStatusData(loading); - -
{{ formatErrors(req.errors) }}
+ + + + + + + + + +
+
+
+ {{ benchmark[0] }} +
{{ benchmark[1] }}
+
+
+
From e7a337a2ffa39cc5f4e5a76663d815bc5b904409 Mon Sep 17 00:00:00 2001 From: James Barford-Evans Date: Wed, 3 Sep 2025 12:27:46 +0100 Subject: [PATCH 3/4] revert removal of queue ordering --- site/src/request_handlers/status_page_new.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/site/src/request_handlers/status_page_new.rs b/site/src/request_handlers/status_page_new.rs index 9b3fbd3d8..f14def2cc 100644 --- a/site/src/request_handlers/status_page_new.rs +++ b/site/src/request_handlers/status_page_new.rs @@ -15,12 +15,13 @@ pub async fn handle_status_page_new(ctxt: Arc) -> anyhow::Result = build_queue(&*conn, &index) .await? .into_iter() .map(|req| request_to_ui(&req, HashMap::new())) .collect(); - + queue.reverse(); // And then we add N most recently completed requests to it let completed = conn.get_last_n_completed_benchmark_requests(10).await?; queue.extend( From 6913885c263c5febfb6cdb241c7b5a8098a4b681 Mon Sep 17 00:00:00 2001 From: James Barford-Evans Date: Wed, 3 Sep 2025 13:28:28 +0100 Subject: [PATCH 4/4] PR Feedback; use `Object.keys(errors).length !== 0` --- site/frontend/src/pages/status_new/page.vue | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/site/frontend/src/pages/status_new/page.vue b/site/frontend/src/pages/status_new/page.vue index ef750c1b2..49754ee35 100644 --- a/site/frontend/src/pages/status_new/page.vue +++ b/site/frontend/src/pages/status_new/page.vue @@ -99,13 +99,7 @@ function formatStatus(status: BenchmarkRequestStatus): string { } function hasErrors(errors: Dict) { - // This is a bit odd but if the error object has values the loop will be - // hit and thus return true. - for (const key in errors) { - console.log(key); - return true; - } - return false; + return Object.keys(errors).length !== 0; } function getErrorsLength(errors: Dict) {