From 760b3757540e624dc54b8c3cf776de6a4f94118b Mon Sep 17 00:00:00 2001 From: Dan <39170265+chillenberger@users.noreply.github.com> Date: Mon, 17 Jun 2024 11:25:28 -0600 Subject: [PATCH] Revert "Dan product notifications (#1524)" This reverts commit d1c7351108c38c43b181d7f57185bc041719b3f2. --- .../src/api/deployment/deployment_models.rs | 13 +- .../src/api/deployment/notebooks.rs | 12 +- pgml-dashboard/src/api/deployment/projects.rs | 13 +- .../src/api/deployment/snapshots.rs | 13 +- pgml-dashboard/src/api/deployment/uploader.rs | 7 +- pgml-dashboard/src/components/modal/mod.rs | 10 - .../src/components/modal/template.html | 8 +- .../marketing/alert_banner/template.html | 2 +- .../feature_banner/feature_banner.scss | 4 + .../marketing/feature_banner/template.html | 2 +- .../src/components/notifications/mod.rs | 3 - .../components/notifications/product/mod.rs | 6 - .../product/product_banner/mod.rs | 96 ------ .../product_banner/product_banner.scss | 47 --- .../product_banner_controller.js | 34 --- .../product/product_banner/template.html | 98 ------ pgml-dashboard/src/lib.rs | 287 ++---------------- pgml-dashboard/src/responses.rs | 55 +--- pgml-dashboard/src/templates/mod.rs | 42 +-- pgml-dashboard/src/utils/cookies.rs | 40 +-- pgml-dashboard/static/css/modules.scss | 1 - .../static/css/scss/abstracts/variables.scss | 5 - .../static/css/scss/components/_cards.scss | 12 - .../templates/layout/web_app_base.html | 6 +- 24 files changed, 77 insertions(+), 739 deletions(-) delete mode 100644 pgml-dashboard/src/components/notifications/product/mod.rs delete mode 100644 pgml-dashboard/src/components/notifications/product/product_banner/mod.rs delete mode 100644 pgml-dashboard/src/components/notifications/product/product_banner/product_banner.scss delete mode 100644 pgml-dashboard/src/components/notifications/product/product_banner/product_banner_controller.js delete mode 100644 pgml-dashboard/src/components/notifications/product/product_banner/template.html diff --git a/pgml-dashboard/src/api/deployment/deployment_models.rs b/pgml-dashboard/src/api/deployment/deployment_models.rs index 8f88a3f91..35e832b26 100644 --- a/pgml-dashboard/src/api/deployment/deployment_models.rs +++ b/pgml-dashboard/src/api/deployment/deployment_models.rs @@ -2,7 +2,6 @@ use rocket::route::Route; use sailfish::TemplateOnce; use crate::{ - guards::Cluster, guards::ConnectedCluster, responses::{Error, ResponseOk}, }; @@ -18,8 +17,8 @@ use std::collections::HashMap; // Returns models page #[get("/models")] -pub async fn deployment_models(cluster: &Cluster) -> Result { - let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); +pub async fn deployment_models(cluster: ConnectedCluster<'_>) -> Result { + let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context); layout.breadcrumbs(vec![NavLink::new("Models", &urls::deployment_models()).active()]); let tabs = vec![tabs::Tab { @@ -29,16 +28,16 @@ pub async fn deployment_models(cluster: &Cluster) -> Result { let nav_tabs = tabs::Tabs::new(tabs, Some("Models"), Some("Models"))?; - Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs)))) + Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs }))) } // Returns models page #[get("/models/")] -pub async fn model(cluster: &Cluster, model_id: i64) -> Result { +pub async fn model(cluster: ConnectedCluster<'_>, model_id: i64) -> Result { let model = models::Model::get_by_id(cluster.pool(), model_id).await?; let project = models::Project::get_by_id(cluster.pool(), model.project_id).await?; - let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); + let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context); layout.breadcrumbs(vec![ NavLink::new("Models", &urls::deployment_models()), NavLink::new(&project.name, &urls::deployment_project_by_id(project.id)), @@ -52,7 +51,7 @@ pub async fn model(cluster: &Cluster, model_id: i64) -> Result Result { - let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); +pub async fn notebooks(cluster: ConnectedCluster<'_>) -> Result { + let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context); layout.breadcrumbs(vec![NavLink::new("Notebooks", &urls::deployment_notebooks()).active()]); let tabs = vec![tabs::Tab { @@ -31,15 +31,15 @@ pub async fn notebooks(cluster: &Cluster) -> Result { let nav_tabs = tabs::Tabs::new(tabs, Some("Notebooks"), Some("Notebooks"))?; - Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs)))) + Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs }))) } // Returns the specified notebook page. #[get("/notebooks/")] -pub async fn notebook(cluster: &Cluster, notebook_id: i64) -> Result { +pub async fn notebook(cluster: ConnectedCluster<'_>, notebook_id: i64) -> Result { let notebook = models::Notebook::get_by_id(cluster.pool(), notebook_id).await?; - let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); + let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context); layout.breadcrumbs(vec![ NavLink::new("Notebooks", &urls::deployment_notebooks()), NavLink::new(notebook.name.as_str(), &urls::deployment_notebook_by_id(notebook_id)).active(), @@ -52,7 +52,7 @@ pub async fn notebook(cluster: &Cluster, notebook_id: i64) -> Result Result { - let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); +pub async fn projects(cluster: ConnectedCluster<'_>) -> Result { + let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context); layout.breadcrumbs(vec![NavLink::new("Projects", &urls::deployment_projects()).active()]); let tabs = vec![tabs::Tab { @@ -27,15 +26,15 @@ pub async fn projects(cluster: &Cluster) -> Result { let nav_tabs = tabs::Tabs::new(tabs, Some("Notebooks"), Some("Projects"))?; - Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs)))) + Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs }))) } // Return the specified project page. #[get("/projects/")] -pub async fn project(cluster: &Cluster, project_id: i64) -> Result { +pub async fn project(cluster: ConnectedCluster<'_>, project_id: i64) -> Result { let project = models::Project::get_by_id(cluster.pool(), project_id).await?; - let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); + let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context); layout.breadcrumbs(vec![ NavLink::new("Projects", &urls::deployment_projects()), NavLink::new(project.name.as_str(), &urls::deployment_project_by_id(project_id)).active(), @@ -48,7 +47,7 @@ pub async fn project(cluster: &Cluster, project_id: i64) -> Result Result { - let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); +pub async fn snapshots(cluster: ConnectedCluster<'_>) -> Result { + let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context); layout.breadcrumbs(vec![NavLink::new("Snapshots", &urls::deployment_snapshots()).active()]); let tabs = vec![tabs::Tab { @@ -28,15 +27,15 @@ pub async fn snapshots(cluster: &Cluster) -> Result { let nav_tabs = tabs::Tabs::new(tabs, Some("Snapshots"), Some("Snapshots"))?; - Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs)))) + Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs }))) } // Returns the specific snapshot page #[get("/snapshots/")] -pub async fn snapshot(cluster: &Cluster, snapshot_id: i64) -> Result { +pub async fn snapshot(cluster: ConnectedCluster<'_>, snapshot_id: i64) -> Result { let snapshot = models::Snapshot::get_by_id(cluster.pool(), snapshot_id).await?; - let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); + let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context); layout.breadcrumbs(vec![ NavLink::new("Snapshots", &urls::deployment_snapshots()), NavLink::new(&snapshot.relation_name, &urls::deployment_snapshot_by_id(snapshot.id)).active(), @@ -49,7 +48,7 @@ pub async fn snapshot(cluster: &Cluster, snapshot_id: i64) -> Result Result { - let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); +pub async fn uploader(cluster: ConnectedCluster<'_>) -> Result { + let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context); layout.breadcrumbs(vec![NavLink::new("Upload Data", &urls::deployment_uploader()).active()]); let tabs = vec![tabs::Tab { @@ -30,7 +29,7 @@ pub async fn uploader(cluster: &Cluster) -> Result { let nav_tabs = tabs::Tabs::new(tabs, Some("Upload Data"), Some("Upload Data"))?; - Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs)))) + Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs }))) } // Returns uploader module in a turboframe. diff --git a/pgml-dashboard/src/components/modal/mod.rs b/pgml-dashboard/src/components/modal/mod.rs index 9c93ddb08..c7dfc32f7 100644 --- a/pgml-dashboard/src/components/modal/mod.rs +++ b/pgml-dashboard/src/components/modal/mod.rs @@ -10,7 +10,6 @@ pub struct Modal { pub header: Option, pub body: Component, pub default_style: bool, - static_backdrop: String, } component!(Modal); @@ -64,15 +63,6 @@ impl Modal { self.default_style = false; self } - - pub fn set_static_backdrop(mut self, set_static: bool) -> Modal { - if set_static { - self.static_backdrop = r#"data-bs-backdrop="static""#.into(); - } else { - self.static_backdrop = String::new(); - } - self - } } #[cfg(test)] diff --git a/pgml-dashboard/src/components/modal/template.html b/pgml-dashboard/src/components/modal/template.html index 208e7b92f..f54a0ebf3 100644 --- a/pgml-dashboard/src/components/modal/template.html +++ b/pgml-dashboard/src/components/modal/template.html @@ -1,10 +1,4 @@ -