Port commit page to Page

This commit is contained in:
Joscha 2024-05-13 00:32:47 +02:00
parent 537419c251
commit 8047814894

View file

@ -12,8 +12,8 @@ use crate::{
server::{ server::{
util, util,
web::{ web::{
base::{Base, Tab},
components, components,
page::{Page, Tab},
paths::{PathAdminQueueAdd, PathCommitByHash}, paths::{PathAdminQueueAdd, PathCommitByHash},
server_config_ext::ServerConfigExt, server_config_ext::ServerConfigExt,
}, },
@ -26,8 +26,6 @@ pub async fn get_commit_by_hash(
State(config): State<&'static ServerConfig>, State(config): State<&'static ServerConfig>,
State(db): State<SqlitePool>, State(db): State<SqlitePool>,
) -> somehow::Result<Response> { ) -> somehow::Result<Response> {
let base = Base::new(config, Tab::None);
let Some(commit) = sqlx::query!( let Some(commit) = sqlx::query!(
"\ "\
SELECT \ SELECT \
@ -93,11 +91,10 @@ pub async fn get_commit_by_hash(
let (class, title) = components::commit_class_and_title(commit.reachable); let (class, title) = components::commit_class_and_title(commit.reachable);
Ok(base let html = Page::new(config)
.html( .title(util::format_commit_summary(&commit.message))
&util::format_commit_summary(&commit.message), .nav(Tab::None)
html! {}, .body(html! {
html! {
h2 { "Commit" } h2 { "Commit" }
div .commit-like .commit { div .commit-like .commit {
span .title { "commit " (commit.hash) } span .title { "commit " (commit.hash) }
@ -128,7 +125,8 @@ pub async fn get_commit_by_hash(
(commit.message.trim_end()) (commit.message.trim_end())
} }
} }
})
.body(html!{
h2 { "Runs" } h2 { "Runs" }
@if runs.is_empty() { @if runs.is_empty() {
p { "There aren't any runs yet." } p { "There aren't any runs yet." }
@ -146,7 +144,8 @@ pub async fn get_commit_by_hash(
input id="priority" name="priority" type="number" value="10" min="-2147483648" max="2147483647"; input id="priority" name="priority" type="number" value="10" min="-2147483648" max="2147483647";
"." "."
} }
}, })
) .build();
.into_response())
Ok(html.into_response())
} }