diff --git a/site/frontend/package.json b/site/frontend/package.json index 133a3928d..9e0b58b40 100644 --- a/site/frontend/package.json +++ b/site/frontend/package.json @@ -39,8 +39,8 @@ "source": "src/pages/status.ts", "distDir": "dist/scripts" }, - "status_new": { - "source": "src/pages/status_new.ts", + "status_old": { + "source": "src/pages/status_old.ts", "distDir": "dist/scripts" }, "bootstrap": { diff --git a/site/frontend/src/pages/status_new/collector.vue b/site/frontend/src/pages/status/collector.vue similarity index 100% rename from site/frontend/src/pages/status_new/collector.vue rename to site/frontend/src/pages/status/collector.vue diff --git a/site/frontend/src/pages/status_new/commit-sha.vue b/site/frontend/src/pages/status/commit-sha.vue similarity index 100% rename from site/frontend/src/pages/status_new/commit-sha.vue rename to site/frontend/src/pages/status/commit-sha.vue diff --git a/site/frontend/src/pages/status/data.ts b/site/frontend/src/pages/status/data.ts index 48371985e..6bee47353 100644 --- a/site/frontend/src/pages/status/data.ts +++ b/site/frontend/src/pages/status/data.ts @@ -1,66 +1,50 @@ -export interface Commit { - sha: string; - date: string; - type: "Try" | "Master"; -} +export type BenchmarkRequestType = "Release" | "Master" | "Try"; +export type BenchmarkRequestStatus = "Queued" | "InProgress" | "Completed"; -export interface BenchmarkError { - name: string; - error: string; -} - -interface Step { - step: string; - is_done: boolean; - expected_duration: number; - current_progress: number; -} +export type BenchmarkRequest = { + tag: string; + pr: number | null; + status: BenchmarkRequestStatus; + requestType: BenchmarkRequestType; + createdAt: string; + completedAt: string | null; + endEstimated: boolean; + durationS: number | null; + errors: Dict; +}; -export type Artifact = - | { - Commit: Commit; - } - | { - Tag: string; - }; +export type BenchmarkJobStatus = "Queued" | "InProgress" | "Success" | "Failed"; +export type BenchmarkJobKind = "compiletime" | "runtimeInProgress" | "rustc"; -export type MissingReason = - | { - Master: { - pr: number; - parent_sha: string; - is_try_parent: boolean; - }; - } - | { - Try: { - pr: number; - parent_sha: string; - include: string | null; - exclude: string | null; - runs: number | null; - backends: string | null; - }; - } - | { - InProgress: MissingReason; - }; +export type BenchmarkJob = { + requestTag: string; + kind: BenchmarkJobKind; + target: string; + backend: string; + profile: string; + benchmarkSet: number; + createdAt: string; + startedAt: string | null; + completedAt: string | null; + status: BenchmarkJobStatus; + dequeCounter: number; +}; -interface CurrentState { - artifact: Artifact; - progress: Step[]; -} +export type CollectorConfig = { + name: string; + target: string; + benchmarkSet: number; + isActive: boolean; + lastHeartbeatAt: string; + dateAdded: string; + jobs: BenchmarkJob[]; +}; -export interface FinishedRun { - artifact: Artifact; - pr: number | null; - errors: BenchmarkError[]; - duration: number; - finished_at: number; -} +export type StatusResponse = { + requests: BenchmarkRequest[]; + collectors: CollectorConfig[]; +}; -export interface StatusResponse { - finished_runs: FinishedRun[]; - current: CurrentState | null; - missing: Array<[Commit, MissingReason]>; +export function isJobComplete(job: BenchmarkJob): boolean { + return job.status === "Failed" || job.status === "Success"; } diff --git a/site/frontend/src/pages/status/page.vue b/site/frontend/src/pages/status/page.vue index 06a8a4a4f..1ec7f765a 100644 --- a/site/frontend/src/pages/status/page.vue +++ b/site/frontend/src/pages/status/page.vue @@ -1,463 +1,302 @@ - diff --git a/site/frontend/src/pages/status_new/data.ts b/site/frontend/src/pages/status_new/data.ts deleted file mode 100644 index 6bee47353..000000000 --- a/site/frontend/src/pages/status_new/data.ts +++ /dev/null @@ -1,50 +0,0 @@ -export type BenchmarkRequestType = "Release" | "Master" | "Try"; -export type BenchmarkRequestStatus = "Queued" | "InProgress" | "Completed"; - -export type BenchmarkRequest = { - tag: string; - pr: number | null; - status: BenchmarkRequestStatus; - requestType: BenchmarkRequestType; - createdAt: string; - completedAt: string | null; - endEstimated: boolean; - durationS: number | null; - errors: Dict; -}; - -export type BenchmarkJobStatus = "Queued" | "InProgress" | "Success" | "Failed"; -export type BenchmarkJobKind = "compiletime" | "runtimeInProgress" | "rustc"; - -export type BenchmarkJob = { - requestTag: string; - kind: BenchmarkJobKind; - target: string; - backend: string; - profile: string; - benchmarkSet: number; - createdAt: string; - startedAt: string | null; - completedAt: string | null; - status: BenchmarkJobStatus; - dequeCounter: number; -}; - -export type CollectorConfig = { - name: string; - target: string; - benchmarkSet: number; - isActive: boolean; - lastHeartbeatAt: string; - dateAdded: string; - jobs: BenchmarkJob[]; -}; - -export type StatusResponse = { - requests: BenchmarkRequest[]; - collectors: CollectorConfig[]; -}; - -export function isJobComplete(job: BenchmarkJob): boolean { - return job.status === "Failed" || job.status === "Success"; -} diff --git a/site/frontend/src/pages/status_new/page.vue b/site/frontend/src/pages/status_new/page.vue deleted file mode 100644 index 249c35369..000000000 --- a/site/frontend/src/pages/status_new/page.vue +++ /dev/null @@ -1,348 +0,0 @@ - - - - - diff --git a/site/frontend/src/pages/status_new.ts b/site/frontend/src/pages/status_old.ts similarity index 79% rename from site/frontend/src/pages/status_new.ts rename to site/frontend/src/pages/status_old.ts index 1af392fa8..8e8c5caa3 100644 --- a/site/frontend/src/pages/status_new.ts +++ b/site/frontend/src/pages/status_old.ts @@ -1,4 +1,4 @@ -import Status from "./status_new/page.vue"; +import Status from "./status_old/page.vue"; import {createApp} from "vue"; import WithSuspense from "../components/with-suspense.vue"; diff --git a/site/frontend/src/pages/status_old/data.ts b/site/frontend/src/pages/status_old/data.ts new file mode 100644 index 000000000..48371985e --- /dev/null +++ b/site/frontend/src/pages/status_old/data.ts @@ -0,0 +1,66 @@ +export interface Commit { + sha: string; + date: string; + type: "Try" | "Master"; +} + +export interface BenchmarkError { + name: string; + error: string; +} + +interface Step { + step: string; + is_done: boolean; + expected_duration: number; + current_progress: number; +} + +export type Artifact = + | { + Commit: Commit; + } + | { + Tag: string; + }; + +export type MissingReason = + | { + Master: { + pr: number; + parent_sha: string; + is_try_parent: boolean; + }; + } + | { + Try: { + pr: number; + parent_sha: string; + include: string | null; + exclude: string | null; + runs: number | null; + backends: string | null; + }; + } + | { + InProgress: MissingReason; + }; + +interface CurrentState { + artifact: Artifact; + progress: Step[]; +} + +export interface FinishedRun { + artifact: Artifact; + pr: number | null; + errors: BenchmarkError[]; + duration: number; + finished_at: number; +} + +export interface StatusResponse { + finished_runs: FinishedRun[]; + current: CurrentState | null; + missing: Array<[Commit, MissingReason]>; +} diff --git a/site/frontend/src/pages/status/expansion.ts b/site/frontend/src/pages/status_old/expansion.ts similarity index 100% rename from site/frontend/src/pages/status/expansion.ts rename to site/frontend/src/pages/status_old/expansion.ts diff --git a/site/frontend/src/pages/status_old/page.vue b/site/frontend/src/pages/status_old/page.vue new file mode 100644 index 000000000..19c96e3c3 --- /dev/null +++ b/site/frontend/src/pages/status_old/page.vue @@ -0,0 +1,500 @@ + + + + + diff --git a/site/frontend/src/urls.ts b/site/frontend/src/urls.ts index 37c97cb54..c653f34e6 100644 --- a/site/frontend/src/urls.ts +++ b/site/frontend/src/urls.ts @@ -4,7 +4,7 @@ export const INFO_URL = `${BASE_URL}/info`; export const DASHBOARD_DATA_URL = `${BASE_URL}/dashboard`; export const STATUS_DATA_URL = `${BASE_URL}/status_page`; -export const STATUS_DATA_NEW_URL = `${BASE_URL}/status_page_new`; +export const STATUS_DATA_OLD_URL = `${BASE_URL}/status_page_old`; export const BOOTSTRAP_DATA_URL = `${BASE_URL}/bootstrap`; export const GRAPH_DATA_URL = `${BASE_URL}/graphs`; export const COMPARE_DATA_URL = `${BASE_URL}/get`; diff --git a/site/frontend/templates/layout.html b/site/frontend/templates/layout.html index 1c5b1562f..585fd6f11 100644 --- a/site/frontend/templates/layout.html +++ b/site/frontend/templates/layout.html @@ -10,14 +10,14 @@ {% block head %}{% endblock %} -
> graphs, compare, - dashboard, bootstrap, - status, status new, help. -
- {% block content %}{% endblock %} -
- Contribute on GitHub -
- {% block script %}{% endblock %} +
> graphs, compare, + dashboard, bootstrap, + status, status (old), help. +
+{% block content %}{% endblock %} +
+ Contribute on GitHub +
+{% block script %}{% endblock %} diff --git a/site/frontend/templates/pages/status_new.html b/site/frontend/templates/pages/status_old.html similarity index 58% rename from site/frontend/templates/pages/status_new.html rename to site/frontend/templates/pages/status_old.html index fb95a81fb..1715f6cd9 100644 --- a/site/frontend/templates/pages/status_new.html +++ b/site/frontend/templates/pages/status_old.html @@ -1,10 +1,10 @@ {% extends "layout.html" %} {% block head %} - + {% endblock %} {% block content %}
{% endblock %} {% block script %} - + {% endblock %} diff --git a/site/src/request_handlers.rs b/site/src/request_handlers.rs index 3efea3894..d96ca8213 100644 --- a/site/src/request_handlers.rs +++ b/site/src/request_handlers.rs @@ -19,8 +19,8 @@ pub use self_profile::{ handle_self_profile, handle_self_profile_processed_download, handle_self_profile_raw, handle_self_profile_raw_download, }; -pub use status_page::handle_status_page; -pub use status_page_new::handle_status_page_new; +pub use status_page::handle_status_page_old; +pub use status_page_new::handle_status_page; use crate::api::{info, ServerResult}; use crate::load::SiteCtxt; diff --git a/site/src/request_handlers/status_page.rs b/site/src/request_handlers/status_page.rs index 70a80a222..e5f6035f0 100644 --- a/site/src/request_handlers/status_page.rs +++ b/site/src/request_handlers/status_page.rs @@ -10,7 +10,7 @@ use database::{ArtifactId, Lookup}; // How many historical (finished) runs should be returned from the status API. const FINISHED_RUN_COUNT: u64 = 5; -pub async fn handle_status_page(ctxt: Arc) -> status::Response { +pub async fn handle_status_page_old(ctxt: Arc) -> status::Response { let missing = ctxt.missing_commits().await; // FIXME: no current builds diff --git a/site/src/request_handlers/status_page_new.rs b/site/src/request_handlers/status_page_new.rs index 3bd785bf2..8c6988015 100644 --- a/site/src/request_handlers/status_page_new.rs +++ b/site/src/request_handlers/status_page_new.rs @@ -10,7 +10,7 @@ use hashbrown::HashMap; use std::sync::Arc; use std::time::Duration; -pub async fn handle_status_page_new(ctxt: Arc) -> anyhow::Result { +pub async fn handle_status_page(ctxt: Arc) -> anyhow::Result { let conn = ctxt.conn().await; // The queue contains any in-progress request(s) and then the following requests in queue order diff --git a/site/src/server.rs b/site/src/server.rs index d494c9240..c1b52b886 100644 --- a/site/src/server.rs +++ b/site/src/server.rs @@ -378,13 +378,8 @@ async fn serve_req(server: Server, req: Request) -> Result { - return server - .handle_get_async(&req, request_handlers::handle_status_page) - .await; - } - "/perf/status_page_new" => { let ctxt: Arc = server.ctxt.read().as_ref().unwrap().clone(); - let result = request_handlers::handle_status_page_new(ctxt).await; + let result = request_handlers::handle_status_page(ctxt).await; return match result { Ok(result) => Ok(http::Response::builder() .header_typed(ContentType::json()) @@ -398,6 +393,11 @@ async fn serve_req(server: Server, req: Request) -> Result { + return server + .handle_get_async(&req, request_handlers::handle_status_page_old) + .await; + } "/perf/next_artifact" => { return server .handle_get_async(&req, request_handlers::handle_next_artifact) @@ -658,7 +658,7 @@ async fn handle_fs_path( | "/dashboard.html" | "/detailed-query.html" | "/help.html" - | "/status_new.html" + | "/status_old.html" | "/status.html" => resolve_template(relative_path).await, _ => match TEMPLATES.get_static_asset(relative_path, use_compression)? { Payload::Compressed(data) => {