- Notifications
You must be signed in to change notification settings - Fork328
Dan product notifications#1534
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
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
27 commits Select commitHold shift + click to select a range
a2a4ce2
checkpoint product notifications
chillenbergera555f4e
Merge branch 'master' into dan-product-notifications
chillenbergerc9fefe0
checkpoint
chillenbergerc432f03
Merge branch 'master' into dan-product-notifications
chillenberger495de99
backend working, front end design working
chillenbergerc5b9932
add top level notices to layout
chillenberger4f5fdb2
add ability to show/hide modal with events and use this feature
chillenberger11c455b
all for many high level notifications
chillenbergeraa26bc3
clean up code, prevent modal collision
chillenbergerd6c598c
fmt
chillenbergerff02bb7
Merge branch 'master' into dan-product-notifications
chillenberger270032a
add product marketing banner to layout
chillenberger2a67b62
adn new line
chillenberger0e11743
404 rather than 500 on misisng pool, add comment
chillenbergerce2a0ee
fmt
chillenbergera4b3e74
make session backwards compatible
chillenbergere1f64d6
add tests
chillenberger61cb28c
clean
chillenberger3bfee36
Session cookie deserializaiton
levkk23fb688
safely unwrap context notification
chillenberger7bc6f65
Merge remote-tracking branch 'origin/levkk-cookie-test' into dan-noti…
chillenbergerc641b70
clean up tests
chillenberger9611e77
Merge branch 'dan-patch' into dan-product-notifications
chillenberger8db0e2f
Merge branch 'dan-notificatioins-backwards-compatible' into dan-produ…
chillenbergerae54142
Merge branch 'master' into dan-product-notifications
chillenberger5f612ff
add test if notification is none
chillenberger62aa76a
fmt
chillenbergerFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
NextNext commit
checkpoint product notifications
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commita2a4ce2df366ad7b8df94f9dbefcd8dfb6823b3f
There are no files selected for viewing
13 changes: 7 additions & 6 deletionspgml-dashboard/src/api/deployment/deployment_models.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletionspgml-dashboard/src/api/deployment/notebooks.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
13 changes: 7 additions & 6 deletionspgml-dashboard/src/api/deployment/projects.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
13 changes: 7 additions & 6 deletionspgml-dashboard/src/api/deployment/snapshots.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletionspgml-dashboard/src/api/deployment/uploader.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionpgml-dashboard/src/components/notifications/marketing/alert_banner/template.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletionspgml-dashboard/src/components/notifications/marketing/feature_banner/template.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletionspgml-dashboard/src/components/notifications/mod.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -3,3 +3,6 @@ | ||
// src/components/notifications/marketing | ||
pub mod marketing; | ||
// src/components/notifications/product | ||
pub mod product; |
6 changes: 6 additions & 0 deletionspgml-dashboard/src/components/notifications/product/mod.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff 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; |
56 changes: 56 additions & 0 deletionspgml-dashboard/src/components/notifications/product/product_banner/mod.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff 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); |
17 changes: 17 additions & 0 deletionspgml-dashboard/src/components/notifications/product/product_banner/product_banner.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff 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} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions...ashboard/src/components/notifications/product/product_banner/product_banner_controller.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff 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() {} | ||
} |
52 changes: 52 additions & 0 deletionspgml-dashboard/src/components/notifications/product/product_banner/template.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff 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> |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.