Skip to content

Commit

Permalink
Fix some styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Yatekii committed Jan 17, 2025
1 parent 23db989 commit 5b4a788
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
4 changes: 4 additions & 0 deletions assets/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ video {
display: table;
}

.h-full {
height: 100%;
}

.w-full {
width: 100%;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/navbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion src/github/webhook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
33 changes: 24 additions & 9 deletions src/views/run.rs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -34,7 +46,9 @@ pub fn Run(run: i64) -> Element {
}

#[server]
pub async fn get_benchmark_measurements(run: i64) -> Result<Vec<Benchmark>, ServerFnError> {
pub async fn get_benchmark_measurements(
run: i64,
) -> Result<(RunMappedModel, Vec<Benchmark>), ServerFnError> {
let mut results = DB
.query(
r#"SELECT * FROM run
Expand Down Expand Up @@ -88,5 +102,6 @@ pub async fn get_benchmark_measurements(run: i64) -> Result<Vec<Benchmark>, Serv
}
});

Ok(benchmarks.collect())
let benchmarks = benchmarks.collect();
Ok((current_run, benchmarks))
}
2 changes: 1 addition & 1 deletion src/views/runs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 5b4a788

Please sign in to comment.