From f367f18d6ff8a5f66e0911b4793b3d28ca692a35 Mon Sep 17 00:00:00 2001 From: Dan <39170265+chillenberger@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:14:40 -0700 Subject: [PATCH 1/4] updates for orgs --- .../src/components/breadcrumbs/mod.rs | 16 +++-- .../src/components/breadcrumbs/template.html | 19 +++++- .../navigation/left_nav/web_app/mod.rs | 14 ++-- .../navigation/left_nav/web_app/template.html | 7 +- pgml-dashboard/src/guards.rs | 31 +++++---- pgml-dashboard/src/lib.rs | 11 ++-- pgml-dashboard/src/templates/mod.rs | 65 +++++++++++++++++-- .../templates/layout/web_app_base.html | 6 +- 8 files changed, 134 insertions(+), 35 deletions(-) diff --git a/pgml-dashboard/src/components/breadcrumbs/mod.rs b/pgml-dashboard/src/components/breadcrumbs/mod.rs index 8f026b046..3c9977576 100644 --- a/pgml-dashboard/src/components/breadcrumbs/mod.rs +++ b/pgml-dashboard/src/components/breadcrumbs/mod.rs @@ -1,16 +1,24 @@ +use crate::components::dropdown::{Dropdown, DropdownItems}; use crate::components::NavLink; +use crate::components::StaticNavLink; use pgml_components::component; use sailfish::TemplateOnce; -#[derive(TemplateOnce)] +#[derive(TemplateOnce, Clone, Default)] #[template(path = "breadcrumbs/template.html")] pub struct Breadcrumbs<'a> { - pub links: Vec>, + pub organizations: Vec, + pub databases: Vec, + pub path: Vec>, } impl<'a> Breadcrumbs<'a> { - pub fn render(links: Vec>) -> String { - Breadcrumbs { links }.render_once().unwrap() + pub fn new(path: Vec>, organizations: Vec, databases: Vec) -> Self { + Breadcrumbs { + path, + databases, + organizations, + } } } diff --git a/pgml-dashboard/src/components/breadcrumbs/template.html b/pgml-dashboard/src/components/breadcrumbs/template.html index d4c3c1515..593385b31 100644 --- a/pgml-dashboard/src/components/breadcrumbs/template.html +++ b/pgml-dashboard/src/components/breadcrumbs/template.html @@ -1,6 +1,7 @@ <% use crate::utils::config; use crate::utils::urls; + use crate::components::dropdown::Dropdown; let home_uri = if config::standalone_dashboard() { urls::deployment_notebooks() @@ -12,18 +13,30 @@