Skip to content

Revert "Dan product notifications" #1533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions pgml-dashboard/src/api/deployment/deployment_models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use rocket::route::Route;
use sailfish::TemplateOnce;

use crate::{
guards::Cluster,
guards::ConnectedCluster,
responses::{Error, ResponseOk},
};
Expand All @@ -18,8 +17,8 @@ use std::collections::HashMap;

// Returns models page
#[get("/models")]
pub async fn deployment_models(cluster: &Cluster) -> Result<ResponseOk, Error> {
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
pub async fn deployment_models(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error> {
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 {
Expand All @@ -29,16 +28,16 @@ pub async fn deployment_models(cluster: &Cluster) -> Result<ResponseOk, Error> {

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/<model_id>")]
pub async fn model(cluster: &Cluster, model_id: i64) -> Result<ResponseOk, Error> {
pub async fn model(cluster: ConnectedCluster<'_>, model_id: i64) -> Result<ResponseOk, Error> {
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)),
Expand All @@ -52,7 +51,7 @@ pub async fn model(cluster: &Cluster, model_id: i64) -> Result<ResponseOk, Error

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 })))
}

#[get("/models_turboframe")]
Expand Down
12 changes: 6 additions & 6 deletions pgml-dashboard/src/api/deployment/notebooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use crate::utils::urls;

// Returns notebook page
#[get("/notebooks")]
pub async fn notebooks(cluster: &Cluster) -> Result<ResponseOk, Error> {
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
pub async fn notebooks(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error> {
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 {
Expand All @@ -31,15 +31,15 @@ pub async fn notebooks(cluster: &Cluster) -> Result<ResponseOk, Error> {

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/<notebook_id>")]
pub async fn notebook(cluster: &Cluster, notebook_id: i64) -> Result<ResponseOk, Error> {
pub async fn notebook(cluster: ConnectedCluster<'_>, notebook_id: i64) -> Result<ResponseOk, Error> {
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(),
Expand All @@ -52,7 +52,7 @@ pub async fn notebook(cluster: &Cluster, notebook_id: i64) -> Result<ResponseOk,

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 all the notebooks for a deployment in a turbo frame.
Expand Down
13 changes: 6 additions & 7 deletions pgml-dashboard/src/api/deployment/projects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use rocket::route::Route;
use sailfish::TemplateOnce;

use crate::{
guards::Cluster,
guards::ConnectedCluster,
responses::{Error, ResponseOk},
};
Expand All @@ -16,8 +15,8 @@ use crate::utils::urls;

// Returns the deployments projects page.
#[get("/projects")]
pub async fn projects(cluster: &Cluster) -> Result<ResponseOk, Error> {
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
pub async fn projects(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error> {
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 {
Expand All @@ -27,15 +26,15 @@ pub async fn projects(cluster: &Cluster) -> Result<ResponseOk, Error> {

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/<project_id>")]
pub async fn project(cluster: &Cluster, project_id: i64) -> Result<ResponseOk, Error> {
pub async fn project(cluster: ConnectedCluster<'_>, project_id: i64) -> Result<ResponseOk, Error> {
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(),
Expand All @@ -48,7 +47,7 @@ pub async fn project(cluster: &Cluster, project_id: i64) -> Result<ResponseOk, E

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

Ok(ResponseOk(layout.render(templates::Dashboard::new(nav_tabs))))
Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs })))
}

// Returns all the deployments for the project in a turbo frame.
Expand Down
13 changes: 6 additions & 7 deletions pgml-dashboard/src/api/deployment/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use rocket::route::Route;
use sailfish::TemplateOnce;

use crate::{
guards::Cluster,
guards::ConnectedCluster,
responses::{Error, ResponseOk},
};
Expand All @@ -17,8 +16,8 @@ use std::collections::HashMap;

// Returns snapshots page
#[get("/snapshots")]
pub async fn snapshots(cluster: &Cluster) -> Result<ResponseOk, Error> {
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
pub async fn snapshots(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error> {
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 {
Expand All @@ -28,15 +27,15 @@ pub async fn snapshots(cluster: &Cluster) -> Result<ResponseOk, Error> {

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/<snapshot_id>")]
pub async fn snapshot(cluster: &Cluster, snapshot_id: i64) -> Result<ResponseOk, Error> {
pub async fn snapshot(cluster: ConnectedCluster<'_>, snapshot_id: i64) -> Result<ResponseOk, Error> {
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(),
Expand All @@ -49,7 +48,7 @@ pub async fn snapshot(cluster: &Cluster, snapshot_id: i64) -> Result<ResponseOk,

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 all snapshots for the deployment in a turboframe.
Expand Down
7 changes: 3 additions & 4 deletions pgml-dashboard/src/api/deployment/uploader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use rocket::route::Route;
use sailfish::TemplateOnce;

use crate::{
guards::Cluster,
guards::ConnectedCluster,
responses::{BadRequest, Error, ResponseOk},
};
Expand All @@ -19,8 +18,8 @@ use crate::utils::urls;

// Returns the uploader page.
#[get("/uploader")]
pub async fn uploader(cluster: &Cluster) -> Result<ResponseOk, Error> {
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
pub async fn uploader(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error> {
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 {
Expand All @@ -30,7 +29,7 @@ pub async fn uploader(cluster: &Cluster) -> Result<ResponseOk, Error> {

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.
Expand Down
10 changes: 0 additions & 10 deletions pgml-dashboard/src/components/modal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub struct Modal {
pub header: Option<Component>,
pub body: Component,
pub default_style: bool,
static_backdrop: String,
}

component!(Modal);
Expand Down Expand Up @@ -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)]
Expand Down
8 changes: 1 addition & 7 deletions pgml-dashboard/src/components/modal/template.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<div
class="modal <%- size_class %>"
id="<%= id %>"
data-controller="modal" tabindex="-1" aria-modal="true" role="dialog" data-modal-target="modal"
data-action="show->modal#show hide->modal#hide"
<%- static_backdrop %>
>
<div class="modal <%- size_class %>" id="<%= id %>" data-controller="modal" tabindex="-1" aria-modal="true" role="dialog" data-modal-target="modal" >
<div class="modal-dialog">
<div class="modal-content">
<% if let Some(header) = header { %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</div>

<% if notification.dismissible && notification.level != NotificationLevel::Level3 {%>
<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">
<a class="w-0 overflow-visible d-flex align-items-center" style="right: 4vw" href="/dashboard/notifications/remove_banner?id=<%- notification.id%>&alert=true">
<span class="material-symbols-outlined <% if notification.level == NotificationLevel::Level2 {%>close-light<% } else {%>close-dark<% } %>">
close
</span></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ div[data-controller="notifications-marketing-feature-banner"] {
color: #{$slate-shade-100}
}
}

.feature1, .feature2, .feature3 {
border-radius: $border-radius-xl;
}

.message-area {
max-width: 75vw;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<%- content %>

<% if notification.dismissible {%>
<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">
<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">
<span class="material-symbols-outlined close">
close
</span></a>
Expand Down
3 changes: 0 additions & 3 deletions pgml-dashboard/src/components/notifications/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@

// src/components/notifications/marketing
pub mod marketing;

// src/components/notifications/product
pub mod product;
6 changes: 0 additions & 6 deletions pgml-dashboard/src/components/notifications/product/mod.rs

This file was deleted.

This file was deleted.

Loading
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