Port graph page to Page

This commit is contained in:
Joscha 2024-05-13 00:35:10 +02:00
parent 8047814894
commit 37b34aac37

View file

@ -12,7 +12,7 @@ use crate::{
server::{ server::{
util, util,
web::{ web::{
base::{Base, Tab}, page::{Page, Tab},
paths::{PathGraph, PathGraphCommits, PathGraphMeasurements, PathGraphMetrics}, paths::{PathGraph, PathGraphCommits, PathGraphMeasurements, PathGraphMetrics},
r#static::{GRAPH_JS, UPLOT_CSS}, r#static::{GRAPH_JS, UPLOT_CSS},
server_config_ext::ServerConfigExt, server_config_ext::ServerConfigExt,
@ -25,22 +25,23 @@ pub async fn get_graph(
_path: PathGraph, _path: PathGraph,
State(config): State<&'static ServerConfig>, State(config): State<&'static ServerConfig>,
) -> somehow::Result<impl IntoResponse> { ) -> somehow::Result<impl IntoResponse> {
let base = Base::new(config, Tab::Graph); let html = Page::new(config)
.title("graph")
Ok(base.html( .nav(Tab::Graph)
"graph", .head(html! {
html! {
link rel="stylesheet" href=(config.path(UPLOT_CSS)); link rel="stylesheet" href=(config.path(UPLOT_CSS));
script type="module" src=(config.path(GRAPH_JS)) {} script type="module" src=(config.path(GRAPH_JS)) {}
}, })
html! { .body(html! {
h2 { "Graph" } h2 { "Graph" }
div .graph-container { div .graph-container {
div #plot {} div #plot {}
div #metrics .metrics-list { "Loading metrics..." } div #metrics .metrics-list { "Loading metrics..." }
} }
}, })
)) .build();
Ok(html)
} }
#[derive(Serialize)] #[derive(Serialize)]