@@ -2,6 +2,7 @@ use rocket::route::Route;
22use sailfish:: TemplateOnce ;
33
44use crate :: {
5+ guards:: Cluster ,
56 guards:: ConnectedCluster ,
67 responses:: { Error , ResponseOk } ,
78} ;
@@ -16,8 +17,8 @@ use std::collections::HashMap;
1617
1718// Returns snapshots page
1819#[ get( "/snapshots" ) ]
19- pub async fn snapshots ( cluster : ConnectedCluster < ' _ > ) -> Result < ResponseOk , Error > {
20- let mut layout = crate :: templates:: WebAppBase :: new ( "Dashboard" , & cluster. inner . context ) ;
20+ pub async fn snapshots ( cluster : & Cluster , _connected : ConnectedCluster < ' _ > ) -> Result < ResponseOk , Error > {
21+ let mut layout = crate :: templates:: WebAppBase :: new ( "Dashboard" , & cluster) ;
2122 layout. breadcrumbs ( vec ! [ NavLink :: new( "Snapshots" , & urls:: deployment_snapshots( ) ) . active( ) ] ) ;
2223
2324 let tabs = vec ! [ tabs:: Tab {
@@ -27,15 +28,19 @@ pub async fn snapshots(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Erro
2728
2829 let nav_tabs = tabs:: Tabs :: new ( tabs, Some ( "Snapshots" ) , Some ( "Snapshots" ) ) ?;
2930
30- Ok ( ResponseOk ( layout. render ( templates:: Dashboard { tabs : nav_tabs } ) ) )
31+ Ok ( ResponseOk ( layout. render ( templates:: Dashboard :: new ( nav_tabs) ) ) )
3132}
3233
3334// Returns the specific snapshot page
3435#[ get( "/snapshots/<snapshot_id>" ) ]
35- pub async fn snapshot ( cluster : ConnectedCluster < ' _ > , snapshot_id : i64 ) -> Result < ResponseOk , Error > {
36+ pub async fn snapshot (
37+ cluster : & Cluster ,
38+ snapshot_id : i64 ,
39+ _connected : ConnectedCluster < ' _ > ,
40+ ) -> Result < ResponseOk , Error > {
3641 let snapshot = models:: Snapshot :: get_by_id ( cluster. pool ( ) , snapshot_id) . await ?;
3742
38- let mut layout = crate :: templates:: WebAppBase :: new ( "Dashboard" , & cluster. inner . context ) ;
43+ let mut layout = crate :: templates:: WebAppBase :: new ( "Dashboard" , & cluster) ;
3944 layout. breadcrumbs ( vec ! [
4045 NavLink :: new( "Snapshots" , & urls:: deployment_snapshots( ) ) ,
4146 NavLink :: new( & snapshot. relation_name, & urls:: deployment_snapshot_by_id( snapshot. id) ) . active( ) ,
@@ -48,7 +53,7 @@ pub async fn snapshot(cluster: ConnectedCluster<'_>, snapshot_id: i64) -> Result
4853
4954 let nav_tabs = tabs:: Tabs :: new ( tabs, Some ( "Snapshots" ) , Some ( "Snapshots" ) ) ?;
5055
51- Ok ( ResponseOk ( layout. render ( templates:: Dashboard { tabs : nav_tabs } ) ) )
56+ Ok ( ResponseOk ( layout. render ( templates:: Dashboard :: new ( nav_tabs) ) ) )
5257}
5358
5459// Returns all snapshots for the deployment in a turboframe.
0 commit comments