diff --git a/pgml-dashboard/src/api/deployment/deployment_models.rs b/pgml-dashboard/src/api/deployment/deployment_models.rs index 8f88a3f91..3fe66c8a7 100644 --- a/pgml-dashboard/src/api/deployment/deployment_models.rs +++ b/pgml-dashboard/src/api/deployment/deployment_models.rs @@ -18,7 +18,7 @@ use std::collections::HashMap; // Returns models page #[get("/models")] -pub async fn deployment_models(cluster: &Cluster) -> Result { +pub async fn deployment_models(cluster: &Cluster, _connected: ConnectedCluster<'_>) -> Result { let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); layout.breadcrumbs(vec![NavLink::new("Models", &urls::deployment_models()).active()]); @@ -34,7 +34,7 @@ pub async fn deployment_models(cluster: &Cluster) -> Result { // Returns models page #[get("/models/")] -pub async fn model(cluster: &Cluster, model_id: i64) -> Result { +pub async fn model(cluster: &Cluster, model_id: i64, _connected: ConnectedCluster<'_>) -> 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?; diff --git a/pgml-dashboard/src/api/deployment/notebooks.rs b/pgml-dashboard/src/api/deployment/notebooks.rs index c376995f6..25701c0ca 100644 --- a/pgml-dashboard/src/api/deployment/notebooks.rs +++ b/pgml-dashboard/src/api/deployment/notebooks.rs @@ -20,7 +20,7 @@ use crate::utils::urls; // Returns notebook page #[get("/notebooks")] -pub async fn notebooks(cluster: &Cluster) -> Result { +pub async fn notebooks(cluster: &Cluster, _connected: ConnectedCluster<'_>) -> Result { let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); layout.breadcrumbs(vec![NavLink::new("Notebooks", &urls::deployment_notebooks()).active()]); @@ -36,7 +36,11 @@ pub async fn notebooks(cluster: &Cluster) -> Result { // Returns the specified notebook page. #[get("/notebooks/")] -pub async fn notebook(cluster: &Cluster, notebook_id: i64) -> Result { +pub async fn notebook( + cluster: &Cluster, + notebook_id: i64, + _connected: ConnectedCluster<'_>, +) -> Result { let notebook = models::Notebook::get_by_id(cluster.pool(), notebook_id).await?; let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); diff --git a/pgml-dashboard/src/api/deployment/projects.rs b/pgml-dashboard/src/api/deployment/projects.rs index 9204d52e4..3a1e060e0 100644 --- a/pgml-dashboard/src/api/deployment/projects.rs +++ b/pgml-dashboard/src/api/deployment/projects.rs @@ -16,7 +16,7 @@ use crate::utils::urls; // Returns the deployments projects page. #[get("/projects")] -pub async fn projects(cluster: &Cluster) -> Result { +pub async fn projects(cluster: &Cluster, _connected: ConnectedCluster<'_>) -> Result { let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); layout.breadcrumbs(vec![NavLink::new("Projects", &urls::deployment_projects()).active()]); @@ -32,7 +32,11 @@ pub async fn projects(cluster: &Cluster) -> Result { // Return the specified project page. #[get("/projects/")] -pub async fn project(cluster: &Cluster, project_id: i64) -> Result { +pub async fn project( + cluster: &Cluster, + project_id: i64, + _connected: ConnectedCluster<'_>, +) -> Result { let project = models::Project::get_by_id(cluster.pool(), project_id).await?; let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); diff --git a/pgml-dashboard/src/api/deployment/snapshots.rs b/pgml-dashboard/src/api/deployment/snapshots.rs index 2240cef90..ed87d48e7 100644 --- a/pgml-dashboard/src/api/deployment/snapshots.rs +++ b/pgml-dashboard/src/api/deployment/snapshots.rs @@ -17,7 +17,7 @@ use std::collections::HashMap; // Returns snapshots page #[get("/snapshots")] -pub async fn snapshots(cluster: &Cluster) -> Result { +pub async fn snapshots(cluster: &Cluster, _connected: ConnectedCluster<'_>) -> Result { let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); layout.breadcrumbs(vec![NavLink::new("Snapshots", &urls::deployment_snapshots()).active()]); @@ -33,7 +33,11 @@ pub async fn snapshots(cluster: &Cluster) -> Result { // Returns the specific snapshot page #[get("/snapshots/")] -pub async fn snapshot(cluster: &Cluster, snapshot_id: i64) -> Result { +pub async fn snapshot( + cluster: &Cluster, + snapshot_id: i64, + _connected: ConnectedCluster<'_>, +) -> Result { let snapshot = models::Snapshot::get_by_id(cluster.pool(), snapshot_id).await?; let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); diff --git a/pgml-dashboard/src/api/deployment/uploader.rs b/pgml-dashboard/src/api/deployment/uploader.rs index fdad1665d..41f148007 100644 --- a/pgml-dashboard/src/api/deployment/uploader.rs +++ b/pgml-dashboard/src/api/deployment/uploader.rs @@ -19,7 +19,7 @@ use crate::utils::urls; // Returns the uploader page. #[get("/uploader")] -pub async fn uploader(cluster: &Cluster) -> Result { +pub async fn uploader(cluster: &Cluster, _connected: ConnectedCluster<'_>) -> Result { let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster); layout.breadcrumbs(vec![NavLink::new("Upload Data", &urls::deployment_uploader()).active()]); diff --git a/pgml-dashboard/src/guards.rs b/pgml-dashboard/src/guards.rs index e7b48bf60..3e8d4fb94 100644 --- a/pgml-dashboard/src/guards.rs +++ b/pgml-dashboard/src/guards.rs @@ -82,6 +82,7 @@ pub struct ConnectedCluster<'a> { pub inner: &'a Cluster, } +// 404 rather than 500 if the cluster is not connected. #[rocket::async_trait] impl<'r> FromRequest<'r> for ConnectedCluster<'r> { type Error = (); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy