-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
feat(alerts): Select tabs to send backend #17749
Merged
graceguo-supercat
merged 16 commits into
apache:master
from
m-ajay:feat/alerts-select-tabs-to-send-backend
Jan 11, 2022
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d749ae1
Adding the extra config and validation
m-ajay 861ddd3
wip
m-ajay 00077fb
reports working
m-ajay f2e20c4
Tests working
m-ajay 91f7b93
fix type
m-ajay 31c0fe6
fix conflict
m-ajay 2fd555d
Fix lint errors
m-ajay e3fc9f8
Fixing type issues
m-ajay ba0a669
conflict resolution
m-ajay 823a8d4
add licence header
m-ajay 996fef9
fix the fixture deleting problem
m-ajay 51647a2
scope to session
m-ajay 4c70f49
Merge branch 'master' into feat/alerts-select-tabs-to-send-backend
m-ajay 4683f5c
fix integration test
d954835
fix review comments
ae4699e
fix review comments patch 2
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 | ||||
---|---|---|---|---|---|---|
|
@@ -69,10 +69,15 @@ def _get_content(self) -> EmailContent: | |||||
return EmailContent(body=self._error_template(self._content.text)) | ||||||
# Get the domain from the 'From' address .. | ||||||
# and make a message id without the < > in the end | ||||||
image = None | ||||||
csv_data = None | ||||||
domain = self._get_smtp_domain() | ||||||
msgid = make_msgid(domain)[1:-1] | ||||||
images = {} | ||||||
|
||||||
if self._content.screenshots: | ||||||
images = { | ||||||
make_msgid(domain)[1:-1]: screenshot | ||||||
for screenshot in self._content.screenshots | ||||||
} | ||||||
|
||||||
# Strip any malicious HTML from the description | ||||||
description = bleach.clean(self._content.description or "") | ||||||
|
@@ -89,11 +94,15 @@ def _get_content(self) -> EmailContent: | |||||
html_table = "" | ||||||
|
||||||
call_to_action = __("Explore in Superset") | ||||||
img_tag = ( | ||||||
f'<img width="1000px" src="cid:{msgid}">' | ||||||
if self._content.screenshot | ||||||
else "" | ||||||
) | ||||||
img_tag = "" | ||||||
for msgid, _ in images.items(): | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit:
Suggested change
(Or just |
||||||
img_tag = img_tag + ( | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit, it's more idiomatic to do this by img_tags = []
for msgid in images.keys():
img_tags.append('<div ...>')
img_tag = ''.join(img_tags) |
||||||
f"""<div class="image"> | ||||||
<img width="1000px" src="cid:{msgid}"> | ||||||
</div> | ||||||
< | ||||||
""" | ||||||
) | ||||||
body = textwrap.dedent( | ||||||
f""" | ||||||
<html> | ||||||
|
@@ -105,6 +114,9 @@ def _get_content(self) -> EmailContent: | |||||
color: rgb(42, 63, 95); | ||||||
padding: 4px 8px; | ||||||
}} | ||||||
.image{{ | ||||||
margin-bottom: 18px; | ||||||
}} | ||||||
</style> | ||||||
</head> | ||||||
<body> | ||||||
|
@@ -116,11 +128,10 @@ def _get_content(self) -> EmailContent: | |||||
</html> | ||||||
""" | ||||||
) | ||||||
if self._content.screenshot: | ||||||
image = {msgid: self._content.screenshot} | ||||||
|
||||||
if self._content.csv: | ||||||
csv_data = {__("%(name)s.csv", name=self._content.name): self._content.csv} | ||||||
return EmailContent(body=body, images=image, data=csv_data) | ||||||
return EmailContent(body=body, images=images, data=csv_data) | ||||||
|
||||||
def _get_subject(self) -> str: | ||||||
return __( | ||||||
|
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: