Skip to content

Commit 571e604

Browse files
Revert "Dan product notifications" (#1533)
1 parent db76aa7 commit 571e604

File tree

24 files changed

+77
-739
lines changed

24 files changed

+77
-739
lines changed

pgml-dashboard/src/api/deployment/deployment_models.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use rocket::route::Route;
22
use sailfish::TemplateOnce;
33

44
use crate::{
5-
guards::Cluster,
65
guards::ConnectedCluster,
76
responses::{Error, ResponseOk},
87
};
@@ -18,8 +17,8 @@ use std::collections::HashMap;
1817

1918
// Returns models page
2019
#[get("/models")]
21-
pub async fn deployment_models(cluster: &Cluster) -> Result<ResponseOk, Error> {
22-
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
20+
pub async fn deployment_models(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error> {
21+
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context);
2322
layout.breadcrumbs(vec![NavLink::new("Models", &urls::deployment_models()).active()]);
2423

2524
let tabs = vec![tabs::Tab {
@@ -29,16 +28,16 @@ pub async fn deployment_models(cluster: &Cluster) -> Result<ResponseOk, Error> {
2928

3029
let nav_tabs = tabs::Tabs::new(tabs, Some("Models"), Some("Models"))?;
3130

32-
Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs))))
31+
Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs })))
3332
}
3433

3534
// Returns models page
3635
#[get("/models/<model_id>")]
37-
pub async fn model(cluster: &Cluster, model_id: i64) -> Result<ResponseOk, Error> {
36+
pub async fn model(cluster: ConnectedCluster<'_>, model_id: i64) -> Result<ResponseOk, Error> {
3837
let model = models::Model::get_by_id(cluster.pool(), model_id).await?;
3938
let project = models::Project::get_by_id(cluster.pool(), model.project_id).await?;
4039

41-
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
40+
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context);
4241
layout.breadcrumbs(vec![
4342
NavLink::new("Models", &urls::deployment_models()),
4443
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<ResponseOk, Error
5251

5352
let nav_tabs = tabs::Tabs::new(tabs, Some("Models"), Some("Models"))?;
5453

55-
Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs))))
54+
Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs })))
5655
}
5756

5857
#[get("/models_turboframe")]

pgml-dashboard/src/api/deployment/notebooks.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use crate::utils::urls;
2020

2121
// Returns notebook page
2222
#[get("/notebooks")]
23-
pub async fn notebooks(cluster: &Cluster) -> Result<ResponseOk, Error> {
24-
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
23+
pub async fn notebooks(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error> {
24+
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context);
2525
layout.breadcrumbs(vec![NavLink::new("Notebooks", &urls::deployment_notebooks()).active()]);
2626

2727
let tabs = vec![tabs::Tab {
@@ -31,15 +31,15 @@ pub async fn notebooks(cluster: &Cluster) -> Result<ResponseOk, Error> {
3131

3232
let nav_tabs = tabs::Tabs::new(tabs, Some("Notebooks"), Some("Notebooks"))?;
3333

34-
Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs))))
34+
Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs })))
3535
}
3636

3737
// Returns the specified notebook page.
3838
#[get("/notebooks/<notebook_id>")]
39-
pub async fn notebook(cluster: &Cluster, notebook_id: i64) -> Result<ResponseOk, Error> {
39+
pub async fn notebook(cluster: ConnectedCluster<'_>, notebook_id: i64) -> Result<ResponseOk, Error> {
4040
let notebook = models::Notebook::get_by_id(cluster.pool(), notebook_id).await?;
4141

42-
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
42+
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context);
4343
layout.breadcrumbs(vec![
4444
NavLink::new("Notebooks", &urls::deployment_notebooks()),
4545
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<ResponseOk,
5252

5353
let nav_tabs = tabs::Tabs::new(tabs, Some("Notebooks"), Some("Notebooks"))?;
5454

55-
Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs))))
55+
Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs })))
5656
}
5757

5858
// Returns all the notebooks for a deployment in a turbo frame.

pgml-dashboard/src/api/deployment/projects.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use rocket::route::Route;
22
use sailfish::TemplateOnce;
33

44
use crate::{
5-
guards::Cluster,
65
guards::ConnectedCluster,
76
responses::{Error, ResponseOk},
87
};
@@ -16,8 +15,8 @@ use crate::utils::urls;
1615

1716
// Returns the deployments projects page.
1817
#[get("/projects")]
19-
pub async fn projects(cluster: &Cluster) -> Result<ResponseOk, Error> {
20-
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
18+
pub async fn projects(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error> {
19+
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context);
2120
layout.breadcrumbs(vec![NavLink::new("Projects", &urls::deployment_projects()).active()]);
2221

2322
let tabs = vec![tabs::Tab {
@@ -27,15 +26,15 @@ pub async fn projects(cluster: &Cluster) -> Result<ResponseOk, Error> {
2726

2827
let nav_tabs = tabs::Tabs::new(tabs, Some("Notebooks"), Some("Projects"))?;
2928

30-
Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs))))
29+
Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs })))
3130
}
3231

3332
// Return the specified project page.
3433
#[get("/projects/<project_id>")]
35-
pub async fn project(cluster: &Cluster, project_id: i64) -> Result<ResponseOk, Error> {
34+
pub async fn project(cluster: ConnectedCluster<'_>, project_id: i64) -> Result<ResponseOk, Error> {
3635
let project = models::Project::get_by_id(cluster.pool(), project_id).await?;
3736

38-
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
37+
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context);
3938
layout.breadcrumbs(vec![
4039
NavLink::new("Projects", &urls::deployment_projects()),
4140
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<ResponseOk, E
4847

4948
let nav_tabs = tabs::Tabs::new(tabs, Some("Projects"), Some("Projects"))?;
5049

51-
Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs))))
50+
Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs })))
5251
}
5352

5453
// Returns all the deployments for the project in a turbo frame.

pgml-dashboard/src/api/deployment/snapshots.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use rocket::route::Route;
22
use sailfish::TemplateOnce;
33

44
use crate::{
5-
guards::Cluster,
65
guards::ConnectedCluster,
76
responses::{Error, ResponseOk},
87
};
@@ -17,8 +16,8 @@ use std::collections::HashMap;
1716

1817
// Returns snapshots page
1918
#[get("/snapshots")]
20-
pub async fn snapshots(cluster: &Cluster) -> Result<ResponseOk, Error> {
21-
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
19+
pub async fn snapshots(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error> {
20+
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context);
2221
layout.breadcrumbs(vec![NavLink::new("Snapshots", &urls::deployment_snapshots()).active()]);
2322

2423
let tabs = vec![tabs::Tab {
@@ -28,15 +27,15 @@ pub async fn snapshots(cluster: &Cluster) -> Result<ResponseOk, Error> {
2827

2928
let nav_tabs = tabs::Tabs::new(tabs, Some("Snapshots"), Some("Snapshots"))?;
3029

31-
Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs))))
30+
Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs })))
3231
}
3332

3433
// Returns the specific snapshot page
3534
#[get("/snapshots/<snapshot_id>")]
36-
pub async fn snapshot(cluster: &Cluster, snapshot_id: i64) -> Result<ResponseOk, Error> {
35+
pub async fn snapshot(cluster: ConnectedCluster<'_>, snapshot_id: i64) -> Result<ResponseOk, Error> {
3736
let snapshot = models::Snapshot::get_by_id(cluster.pool(), snapshot_id).await?;
3837

39-
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
38+
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context);
4039
layout.breadcrumbs(vec![
4140
NavLink::new("Snapshots", &urls::deployment_snapshots()),
4241
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<ResponseOk,
4948

5049
let nav_tabs = tabs::Tabs::new(tabs, Some("Snapshots"), Some("Snapshots"))?;
5150

52-
Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs))))
51+
Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs })))
5352
}
5453

5554
// Returns all snapshots for the deployment in a turboframe.

pgml-dashboard/src/api/deployment/uploader.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use rocket::route::Route;
55
use sailfish::TemplateOnce;
66

77
use crate::{
8-
guards::Cluster,
98
guards::ConnectedCluster,
109
responses::{BadRequest, Error, ResponseOk},
1110
};
@@ -19,8 +18,8 @@ use crate::utils::urls;
1918

2019
// Returns the uploader page.
2120
#[get("/uploader")]
22-
pub async fn uploader(cluster: &Cluster) -> Result<ResponseOk, Error> {
23-
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
21+
pub async fn uploader(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error> {
22+
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context);
2423
layout.breadcrumbs(vec![NavLink::new("Upload Data", &urls::deployment_uploader()).active()]);
2524

2625
let tabs = vec![tabs::Tab {
@@ -30,7 +29,7 @@ pub async fn uploader(cluster: &Cluster) -> Result<ResponseOk, Error> {
3029

3130
let nav_tabs = tabs::Tabs::new(tabs, Some("Upload Data"), Some("Upload Data"))?;
3231

33-
Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs))))
32+
Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs })))
3433
}
3534

3635
// Returns uploader module in a turboframe.

pgml-dashboard/src/components/modal/mod.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pub struct Modal {
1010
pub header: Option<Component>,
1111
pub body: Component,
1212
pub default_style: bool,
13-
static_backdrop: String,
1413
}
1514

1615
component!(Modal);
@@ -64,15 +63,6 @@ impl Modal {
6463
self.default_style = false;
6564
self
6665
}
67-
68-
pub fn set_static_backdrop(mut self, set_static: bool) -> Modal {
69-
if set_static {
70-
self.static_backdrop = r#"data-bs-backdrop="static""#.into();
71-
} else {
72-
self.static_backdrop = String::new();
73-
}
74-
self
75-
}
7666
}
7767

7868
#[cfg(test)]

pgml-dashboard/src/components/modal/template.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
<div
2-
class="modal <%- size_class %>"
3-
id="<%= id %>"
4-
data-controller="modal" tabindex="-1" aria-modal="true" role="dialog" data-modal-target="modal"
5-
data-action="show->modal#show hide->modal#hide"
6-
<%- static_backdrop %>
7-
>
1+
<div class="modal <%- size_class %>" id="<%= id %>" data-controller="modal" tabindex="-1" aria-modal="true" role="dialog" data-modal-target="modal" >
82
<div class="modal-dialog">
93
<div class="modal-content">
104
<% if let Some(header) = header { %>

pgml-dashboard/src/components/notifications/marketing/alert_banner/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</div>
1313

1414
<% if notification.dismissible && notification.level != NotificationLevel::Level3 {%>
15-
<a class="w-0 overflow-visible d-flex align-items-center" style="right: 4vw" href="/dashboard/notifications/remove_banner?id=<%- notification.id%>&notification_type=alert">
15+
<a class="w-0 overflow-visible d-flex align-items-center" style="right: 4vw" href="/dashboard/notifications/remove_banner?id=<%- notification.id%>&alert=true">
1616
<span class="material-symbols-outlined <% if notification.level == NotificationLevel::Level2 {%>close-light<% } else {%>close-dark<% } %>">
1717
close
1818
</span></a>

pgml-dashboard/src/components/notifications/marketing/feature_banner/feature_banner.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ div[data-controller="notifications-marketing-feature-banner"] {
4141
color: #{$slate-shade-100}
4242
}
4343
}
44+
45+
.feature1, .feature2, .feature3 {
46+
border-radius: $border-radius-xl;
47+
}
4448

4549
.message-area {
4650
max-width: 75vw;

pgml-dashboard/src/components/notifications/marketing/feature_banner/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<%- content %>
2626

2727
<% if notification.dismissible {%>
28-
<a class="w-0 btn btn-tertiary overflow-visible d-flex align-items-start p-2" style="height: fit-content" href="/dashboard/notifications/remove_banner?id=<%- notification.id%>&notification_type=feature">
28+
<a class="w-0 btn btn-tertiary overflow-visible d-flex align-items-start p-2" style="height: fit-content" href="/dashboard/notifications/remove_banner?id=<%- notification.id%>&alert=false">
2929
<span class="material-symbols-outlined close">
3030
close
3131
</span></a>

pgml-dashboard/src/components/notifications/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@
33

44
// src/components/notifications/marketing
55
pub mod marketing;
6-
7-
// src/components/notifications/product
8-
pub mod product;

pgml-dashboard/src/components/notifications/product/mod.rs

Lines changed: 0 additions & 6 deletions
This file was deleted.

pgml-dashboard/src/components/notifications/product/product_banner/mod.rs

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)
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