Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dan product notifications#1524

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
chillenberger merged 13 commits intomasterfromdan-product-notifications
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
13 commits
Select commitHold shift + click to select a range
a2a4ce2
checkpoint product notifications
chillenbergerJun 7, 2024
a555f4e
Merge branch 'master' into dan-product-notifications
chillenbergerJun 11, 2024
c9fefe0
checkpoint
chillenbergerJun 12, 2024
c432f03
Merge branch 'master' into dan-product-notifications
chillenbergerJun 12, 2024
495de99
backend working, front end design working
chillenbergerJun 12, 2024
c5b9932
add top level notices to layout
chillenbergerJun 12, 2024
4f5fdb2
add ability to show/hide modal with events and use this feature
chillenbergerJun 12, 2024
11c455b
all for many high level notifications
chillenbergerJun 14, 2024
aa26bc3
clean up code, prevent modal collision
chillenbergerJun 14, 2024
d6c598c
fmt
chillenbergerJun 14, 2024
ff02bb7
Merge branch 'master' into dan-product-notifications
chillenbergerJun 14, 2024
270032a
add product marketing banner to layout
chillenbergerJun 14, 2024
2a67b62
adn new line
chillenbergerJun 14, 2024
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
NextNext commit
checkpoint product notifications
  • Loading branch information
@chillenberger
chillenberger committedJun 7, 2024
commita2a4ce2df366ad7b8df94f9dbefcd8dfb6823b3f
13 changes: 7 additions & 6 deletionspgml-dashboard/src/api/deployment/deployment_models.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ use rocket::route::Route;
use sailfish::TemplateOnce;

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

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

let tabs = vec![tabs::Tab {
Expand All@@ -28,16 +29,16 @@ pub async fn deployment_models(cluster: ConnectedCluster<'_>) -> Result<Response

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

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

// Returns models page
#[get("/models/<model_id>")]
pub async fn model(cluster:ConnectedCluster<'_>, model_id: i64) -> Result<ResponseOk, Error> {
pub async fn model(cluster:&Cluster, 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.inner.context);
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
layout.breadcrumbs(vec![
NavLink::new("Models", &urls::deployment_models()),
NavLink::new(&project.name, &urls::deployment_project_by_id(project.id)),
Expand All@@ -51,7 +52,7 @@ pub async fn model(cluster: ConnectedCluster<'_>, model_id: i64) -> Result<Respo

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

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

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

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

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

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

// Returns the specified notebook page.
#[get("/notebooks/<notebook_id>")]
pub async fn notebook(cluster:ConnectedCluster<'_>, notebook_id: i64) -> Result<ResponseOk, Error> {
pub async fn notebook(cluster:&Cluster, 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.inner.context);
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
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: ConnectedCluster<'_>, notebook_id: i64) -> Result

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

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

// Returns all the notebooks for a deployment in a turbo frame.
Expand Down
13 changes: 7 additions & 6 deletionspgml-dashboard/src/api/deployment/projects.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ use rocket::route::Route;
use sailfish::TemplateOnce;

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

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

let tabs = vec![tabs::Tab {
Expand All@@ -26,15 +27,15 @@ pub async fn projects(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error

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

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

// Return the specified project page.
#[get("/projects/<project_id>")]
pub async fn project(cluster:ConnectedCluster<'_>, project_id: i64) -> Result<ResponseOk, Error> {
pub async fn project(cluster:&Cluster, 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.inner.context);
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
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@@ -47,7 +48,7 @@ pub async fn project(cluster: ConnectedCluster<'_>, project_id: i64) -> Result<R

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

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

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

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

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

let tabs = vec![tabs::Tab {
Expand All@@ -27,15 +28,15 @@ pub async fn snapshots(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Erro

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

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

// Returns the specific snapshot page
#[get("/snapshots/<snapshot_id>")]
pub async fn snapshot(cluster:ConnectedCluster<'_>, snapshot_id: i64) -> Result<ResponseOk, Error> {
pub async fn snapshot(cluster:&Cluster, 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.inner.context);
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster);
layout.breadcrumbs(vec![
NavLink::new("Snapshots", &urls::deployment_snapshots()),
NavLink::new(&snapshot.relation_name, &urls::deployment_snapshot_by_id(snapshot.id)).active(),
Expand All@@ -48,7 +49,7 @@ pub async fn snapshot(cluster: ConnectedCluster<'_>, snapshot_id: i64) -> Result

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

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

// Returns all snapshots for the deployment in a turboframe.
Expand Down
7 changes: 4 additions & 3 deletionspgml-dashboard/src/api/deployment/uploader.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@ use rocket::route::Route;
use sailfish::TemplateOnce;

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

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

let tabs = vec![tabs::Tab {
Expand All@@ -29,7 +30,7 @@ pub async fn uploader(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error

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

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

// Returns uploader module in a turboframe.
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff 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%>&alert=true">
<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">
<span class="material-symbols-outlined <% if notification.level == NotificationLevel::Level2 {%>close-light<% } else {%>close-dark<% } %>">
close
</span></a>
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@
<% let notification = notification.unwrap(); %>
<div data-controller="notifications-marketing-feature-banner">

<div class="<%- notification.level.to_string() %> <% if notification.level == NotificationLevel::Feature3 {%>main-gradient-border-card<% } %> rounded-3 W-100">
<div class="<%- notification.level.to_string() %> <% if notification.level == NotificationLevel::Feature3 {%>main-gradient-border-card<% } %> rounded-2 W-100">
<div class="banner d-flex container">

<% let content = format!(
Expand All@@ -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%>&alert=false">
<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">
<span class="material-symbols-outlined close">
close
</span></a>
Expand Down
3 changes: 3 additions & 0 deletionspgml-dashboard/src/components/notifications/mod.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,3 +3,6 @@

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

// src/components/notifications/product
pub mod product;
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
// This file is automatically generated.
// You shouldn't modify it manually.

// src/components/notifications/product/product_banner
pub mod product_banner;
pub use product_banner::ProductBanner;
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
use crate::Notification;
use pgml_components::component;
use sailfish::TemplateOnce;

#[derive(TemplateOnce, Default, Clone)]
#[template(path = "notifications/product/product_banner/template.html")]
pub struct ProductBanner {
pub notification: Option<Notification>,
pub location_id: String,
pub url: String,
}

impl ProductBanner {
pub fn from_notification(notification: Option<&Notification>) -> ProductBanner {
let mut location_id = format!("product-banner");
let mut url = format!("/dashboard/notifications/product/remove_banner");
if notification.is_some() {
let notification = notification.clone().unwrap();
location_id.push_str(&format!("-{}", notification.level.to_string()));
url.push_str(&format!("?id={}", notification.id));

if notification.deployment.is_some() {
let deployment = notification.deployment.clone().unwrap();
location_id.push_str(&format!("-{}", deployment));
url.push_str(&format!("&deployment_id={}", deployment));
}
}

match notification {
Some(notification) => {
return ProductBanner {
notification: Some(notification.clone()),
location_id,
url,
}
}
None => {
return ProductBanner {
notification: None,
location_id,
url,
}
}
}
}

pub fn get_location_id(&self) -> String {
self.location_id.clone()
}

pub fn get_url(&self) -> String {
self.url.clone()
}
}

component!(ProductBanner);
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
div[data-controller="notifications-product-product-banner"] {
margin-top: 3rem;
margin-bottom: 3rem;

.product1, .product2, .product3 {
background-color: #{$gray-600};
margin: 2px 0px;
}

.close {
color: #{$gray-100};
}

.more-info {
color: #{$gray-100}
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
import { Controller } from '@hotwired/stimulus'

export default class extends Controller {
static targets = [];
static outlets = [];

initialize() {
console.log("Initialized notifications-product-product-banner");
}

connect() {}

disconnect() {}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
<%
use crate::NotificationLevel;
%>

<div class="<%- location_id %>">
<% if notification.is_some() {%>
<% let notification = notification.unwrap(); %>
<div data-controller="notifications-product-product-banner">
<%
let border_color = {
if notification.level == NotificationLevel::ProductHigh {
"red-gradient-border-card"
} else if notification.level == NotificationLevel::ProductMedium {
"orange-gradient-border-card"
} else {
"green-gradient-border-card"
}
};
%>
<div class="<%- border_color %> rounded-2 W-100">
<div class="banner d-flex container">

<% let content = format!(
r#"
<{} class="{} flex-grow-1 d-flex flex-column flex-md-row justify-content-center align-items-center row-gap-0 column-gap-3 fw-semibold overflow-hidden">
<div class="px-3 py-3 py-sm-0 overflow-hidden">
<p class="m-0 text-center">{} {}</p>
</div>
</{}>
"#,
if notification.link.is_some() { format!(r#"a href="{}" data-turbo="false" "#, notification.link.clone().unwrap()) } else { "div".to_string() },
if notification.link.is_some() { "btn btn-tertiary p-0 goto-arrow-hover-trigger" } else { "" },
notification.message,
if notification.link.is_some() { r#"<span class="material-symbols-outlined more-info position-relative goto-arrow-shift-animation" style="top: 2px;">arrow_forward</span>"# } else { "" },
if notification.link.is_some() { "a" } else { "div" },
); %>

<%- 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="<%- url %>" >
<span class="material-symbols-outlined close">
close
</span>
</a>
<% } %>
</div>
</div>
</div>

<% } %>
</div>
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp