diff --git a/pgml-dashboard/src/api/docs.rs b/pgml-dashboard/src/api/docs.rs index 10fc5d948..34cfbc0f4 100644 --- a/pgml-dashboard/src/api/docs.rs +++ b/pgml-dashboard/src/api/docs.rs @@ -53,7 +53,15 @@ async fn doc_handler(path: PathBuf, cluster: &Cluster) -> Result", rank = 10)] diff --git a/pgml-dashboard/src/components/inputs/select/mod.rs b/pgml-dashboard/src/components/inputs/select/mod.rs index 30f2e5805..5bfbe3dc1 100644 --- a/pgml-dashboard/src/components/inputs/select/mod.rs +++ b/pgml-dashboard/src/components/inputs/select/mod.rs @@ -1,9 +1,9 @@ use crate::components::stimulus::stimulus_action::{StimulusAction, StimulusEvents}; use crate::components::stimulus::stimulus_target::StimulusTarget; +use crate::types::CustomOption; use pgml_components::component; use pgml_components::Component; use sailfish::TemplateOnce; -use crate::types::CustomOption; #[derive(TemplateOnce, Default)] #[template(path = "inputs/select/template.html")] diff --git a/pgml-dashboard/src/components/nav/template.html b/pgml-dashboard/src/components/nav/template.html index 8e45cc818..f2488b703 100644 --- a/pgml-dashboard/src/components/nav/template.html +++ b/pgml-dashboard/src/components/nav/template.html @@ -26,14 +26,14 @@ <% if link.nav.is_some() { %> - + <% } %> <% } %> diff --git a/pgml-dashboard/src/lib.rs b/pgml-dashboard/src/lib.rs index e28af9206..5e329501d 100644 --- a/pgml-dashboard/src/lib.rs +++ b/pgml-dashboard/src/lib.rs @@ -13,7 +13,6 @@ use sailfish::TemplateOnce; use sqlx::PgPool; use std::collections::HashMap; -pub mod types; pub mod api; pub mod components; pub mod fairings; @@ -22,6 +21,7 @@ pub mod guards; pub mod models; pub mod responses; pub mod templates; +pub mod types; pub mod utils; use guards::{Cluster, ConnectedCluster}; diff --git a/pgml-dashboard/src/main.rs b/pgml-dashboard/src/main.rs index 6e7e14df9..d958f3e76 100644 --- a/pgml-dashboard/src/main.rs +++ b/pgml-dashboard/src/main.rs @@ -285,10 +285,7 @@ mod test { #[rocket::async_test] async fn test_docs() { let client = Client::tracked(rocket().await).await.unwrap(); - let response = client - .get("/docs/guides/README") - .dispatch() - .await; + let response = client.get("/docs/guides/README").dispatch().await; assert_eq!(response.status().code, 200); } diff --git a/pgml-dashboard/src/templates/docs.rs b/pgml-dashboard/src/templates/docs.rs index 458666548..311b02ca1 100644 --- a/pgml-dashboard/src/templates/docs.rs +++ b/pgml-dashboard/src/templates/docs.rs @@ -42,8 +42,8 @@ impl NavLink { /// Automatically expand the link and it's parents /// when one of the children is visible. pub fn should_open(&mut self, path: &str) -> bool { + self.open = self.href.contains(&path); let open = if self.children.is_empty() { - self.open = self.href.contains(&path); self.open } else { for child in self.children.iter_mut() { diff --git a/pgml-dashboard/src/utils/markdown.rs b/pgml-dashboard/src/utils/markdown.rs index 89b3144ea..7547d6d87 100644 --- a/pgml-dashboard/src/utils/markdown.rs +++ b/pgml-dashboard/src/utils/markdown.rs @@ -26,13 +26,11 @@ use url::Url; use crate::templates::docs::NavLink; use std::fmt; -pub struct MarkdownHeadings { -} +pub struct MarkdownHeadings {} impl MarkdownHeadings { pub fn new() -> Self { - Self { - } + Self {} } } @@ -583,7 +581,7 @@ pub fn get_sub_links(list: &markdown::mdast::List) -> Result> { .unwrap(); let parent = NavLink::new(text.value.as_str()) .href(&url); - links.push(parent) + links.push(parent); } _ => error!("unhandled link child: {:?}", node), } @@ -1074,8 +1072,8 @@ pub fn mkdocs<'a>(root: &'a AstNode<'a>, arena: &'a Arena>) -> anyho r#"