diff --git a/assets/tailwind.css b/assets/tailwind.css index f1d1b58..5548015 100644 --- a/assets/tailwind.css +++ b/assets/tailwind.css @@ -570,6 +570,10 @@ video { display: table; } +.h-full { + height: 100%; +} + .w-full { width: 100%; } diff --git a/src/components/navbar.rs b/src/components/navbar.rs index 44d060e..3310cd0 100644 --- a/src/components/navbar.rs +++ b/src/components/navbar.rs @@ -8,7 +8,7 @@ pub fn Navbar() -> Element { rsx! { document::Link { rel: "stylesheet", href: NAVBAR_CSS } - div { class: "bg-slate-700 p-5", + div { class: "h-full bg-slate-700 p-5", div { id: "navbar", Link { to: Route::Home {}, "Home" } Link { to: Route::Runs {}, "Runs" } diff --git a/src/github/webhook.rs b/src/github/webhook.rs index ab6a2d4..e8c7b36 100644 --- a/src/github/webhook.rs +++ b/src/github/webhook.rs @@ -54,7 +54,7 @@ pub async fn webhook(GithubWebhook(hook): GithubWebhook) -> Result<(), AppError> let run_id = body.workflow_run["id"].as_i64().unwrap(); let pr = pr["number"].as_i64().unwrap(); - let benchmarks = get_benchmark_measurements(run_id).await.unwrap(); + let (_run, benchmarks) = get_benchmark_measurements(run_id).await.unwrap(); create_gh_comment(octocrab, pr, run_id, benchmarks) .await .unwrap(); diff --git a/src/views/run.rs b/src/views/run.rs index 27af2a7..1ded56c 100644 --- a/src/views/run.rs +++ b/src/views/run.rs @@ -1,22 +1,34 @@ use crate::components::benchmark_list_entry::{Benchmark, BenchmarkListEntry}; +use crate::helpers::read_env_var; use crate::models::run::RunMappedModel; use crate::DB; use dioxus::prelude::*; #[component] pub fn Run(run: i64) -> Element { - let runs = use_server_future(move || get_benchmark_measurements(run))?; - let runs = runs.value(); - let runs = runs.read(); + let benchmarks = use_server_future(move || get_benchmark_measurements(run))?; + let benchmarks = benchmarks.value(); + let benchmarks = benchmarks.read(); - let benchmarks = match &*runs { - Some(Ok(runs)) => runs, - Some(Err(err)) => return rsx!("Unable to load runs: {err}"), + let (run, benchmarks) = match &*benchmarks { + Some(Ok(benchmarks)) => benchmarks, + Some(Err(err)) => return rsx!( "Unable to load benchmarks: {err}" ), None => unreachable!(), }; + let org = read_env_var("GITHUB_ORG"); + let repo = read_env_var("GITHUB_REPO"); + rsx! { - div { class: "p-5", + div { + h1 { class: "m-y-2 text-4xl text-white", + "Run for " + a { + class: "hover:underline", + href: "https://github.com/{org}/{repo}/pull/{run.pr}/commits/{run.commit}", + "{run.commit}" + } + } table { class: "w-full border-collapse", { benchmarks @@ -34,7 +46,9 @@ pub fn Run(run: i64) -> Element { } #[server] -pub async fn get_benchmark_measurements(run: i64) -> Result, ServerFnError> { +pub async fn get_benchmark_measurements( + run: i64, +) -> Result<(RunMappedModel, Vec), ServerFnError> { let mut results = DB .query( r#"SELECT * FROM run @@ -88,5 +102,6 @@ pub async fn get_benchmark_measurements(run: i64) -> Result, Serv } }); - Ok(benchmarks.collect()) + let benchmarks = benchmarks.collect(); + Ok((current_run, benchmarks)) } diff --git a/src/views/runs.rs b/src/views/runs.rs index 0ff4f5d..c9c7144 100644 --- a/src/views/runs.rs +++ b/src/views/runs.rs @@ -17,7 +17,7 @@ pub fn Runs() -> Element { rsx! { div { - h1 { class: "m-2 text-4xl text-white", "Runs" } + h1 { class: "m-y-2 text-4xl text-white", "Runs" } table { class: "w-full border-collapse", {runs.iter().enumerate().map(|(i, run)| rsx! { tr { class: "w-full border-probe-rs-green border-solid border-[1px] hover:bg-slate-600 rounded-sm text-probe-rs-green",