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::{
util,
web::{
base::{Base, Tab},
components,
page::{Page, Tab},
paths::{PathAdminQueueAdd, PathCommitByHash},
server_config_ext::ServerConfigExt,
},
@ -26,8 +26,6 @@ pub async fn get_commit_by_hash(
State(config): State<&'static ServerConfig>,
State(db): State<SqlitePool>,
) -> somehow::Result<Response> {
let base = Base::new(config, Tab::None);
let Some(commit) = sqlx::query!(
"\
SELECT \
@ -93,11 +91,10 @@ pub async fn get_commit_by_hash(
let (class, title) = components::commit_class_and_title(commit.reachable);
Ok(base
.html(
&util::format_commit_summary(&commit.message),
html! {},
html! {
let html = Page::new(config)
.title(util::format_commit_summary(&commit.message))
.nav(Tab::None)
.body(html! {
h2 { "Commit" }
div .commit-like .commit {
span .title { "commit " (commit.hash) }
@ -128,7 +125,8 @@ pub async fn get_commit_by_hash(
(commit.message.trim_end())
}
}
})
.body(html!{
h2 { "Runs" }
@if runs.is_empty() {
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";
"."
}
},
)
.into_response())
})
.build();
Ok(html.into_response())
}