You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/08/04 00:46:47 UTC

[GitHub] [incubator-superset] JasonD28 opened a new pull request #10512: feat: updated email format for SQL-based email alerts

JasonD28 opened a new pull request #10512:
URL: https://github.com/apache/incubator-superset/pull/10512


   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   Added the relevant SQL statement and a link to the relevant slice for SQL-based email alerts.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   Before:
   ![Screen Shot 2020-08-03 at 5 36 24 PM](https://user-images.githubusercontent.com/32852580/89240382-cc7e2180-d5b0-11ea-82a7-c9fda21193e4.png)
   After:
   ![Screen Shot 2020-08-03 at 5 39 28 PM](https://user-images.githubusercontent.com/32852580/89240395-d142d580-d5b0-11ea-9e08-a26ef28042d7.png)
   
   
   ### TEST PLAN
   <!--- What steps should be taken to verify the changes -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Changes UI
   - [ ] Requires DB Migration.
   - [ ] Confirm DB Migration upgrade and downgrade tested.
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] bkyryliuk commented on a change in pull request #10512: feat: updated email format for SQL-based email alerts

Posted by GitBox <gi...@apache.org>.
bkyryliuk commented on a change in pull request #10512:
URL: https://github.com/apache/incubator-superset/pull/10512#discussion_r465287309



##########
File path: superset/tasks/schedules.py
##########
@@ -598,14 +600,11 @@ def deliver_alert(alert: Alert, recipients: Optional[str] = None) -> None:
     data = None
     if img_data:
         images = {"screenshot": img_data}
-    body = __(
-        textwrap.dedent(
-            """\
-            <h2>Alert: %(label)s</h2>
-            <img src="cid:screenshot" alt="%(label)s" />
-        """
-        ),
+    body = render_template(

Review comment:
       add a todo to show results

##########
File path: superset/templates/email/alert.txt
##########
@@ -0,0 +1,26 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<h2 style="color: red;">Alert: {{label}} &#x26A0;</h2>
+<p><b>SQL Statement: </b>
+<code><mark style="background-color: LightGrey; font-size: 1.1em">{{sql}}</mark></code></p>
+<p><a href="{{alert_url}}">View Alert Details</a></p>

Review comment:
       let's have sql in a new line e.g. for the sql queries that are larger




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] JasonD28 commented on a change in pull request #10512: feat: updated email format for SQL-based email alerts

Posted by GitBox <gi...@apache.org>.
JasonD28 commented on a change in pull request #10512:
URL: https://github.com/apache/incubator-superset/pull/10512#discussion_r465252074



##########
File path: superset/tasks/schedules.py
##########
@@ -602,10 +604,16 @@ def deliver_alert(alert: Alert, recipients: Optional[str] = None) -> None:
         textwrap.dedent(
             """\
             <h2>Alert: %(label)s</h2>
-            <img src="cid:screenshot" alt="%(label)s" />
+            <p><b>SQL Statement: </b>%(sql)s</p>
+            <p>Click <a href="%(image_url)s">here</a> or the image below 

Review comment:
       I'll leave `show the result returned` as a TODO




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] bkyryliuk commented on a change in pull request #10512: feat: updated email format for SQL-based email alerts

Posted by GitBox <gi...@apache.org>.
bkyryliuk commented on a change in pull request #10512:
URL: https://github.com/apache/incubator-superset/pull/10512#discussion_r464739788



##########
File path: superset/tasks/schedules.py
##########
@@ -602,10 +604,16 @@ def deliver_alert(alert: Alert, recipients: Optional[str] = None) -> None:
         textwrap.dedent(
             """\
             <h2>Alert: %(label)s</h2>
-            <img src="cid:screenshot" alt="%(label)s" />
+            <p><b>SQL Statement: </b>%(sql)s</p>
+            <p>Click <a href="%(image_url)s">here</a> or the image below 

Review comment:
       also template may live separately, e.g. https://github.com/apache/incubator-superset/blob/master/superset/templates/email/role_extended.txt




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] bkyryliuk merged pull request #10512: feat: updated email format for SQL-based email alerts

Posted by GitBox <gi...@apache.org>.
bkyryliuk merged pull request #10512:
URL: https://github.com/apache/incubator-superset/pull/10512


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] bkyryliuk commented on a change in pull request #10512: feat: updated email format for SQL-based email alerts

Posted by GitBox <gi...@apache.org>.
bkyryliuk commented on a change in pull request #10512:
URL: https://github.com/apache/incubator-superset/pull/10512#discussion_r464739123



##########
File path: superset/tasks/schedules.py
##########
@@ -602,10 +604,16 @@ def deliver_alert(alert: Alert, recipients: Optional[str] = None) -> None:
         textwrap.dedent(
             """\
             <h2>Alert: %(label)s</h2>
-            <img src="cid:screenshot" alt="%(label)s" />
+            <p><b>SQL Statement: </b>%(sql)s</p>
+            <p>Click <a href="%(image_url)s">here</a> or the image below 

Review comment:
       you can probably do even better here: 
   https://stackoverflow.com/questions/17245895/how-to-format-text-in-email-when-using-smtp
   
   e.g. 
   * highlight sql section & use separate font
   * show the result returned
   * use red color
   * have a link to the alert history

##########
File path: superset/tasks/schedules.py
##########
@@ -602,10 +604,16 @@ def deliver_alert(alert: Alert, recipients: Optional[str] = None) -> None:
         textwrap.dedent(
             """\
             <h2>Alert: %(label)s</h2>
-            <img src="cid:screenshot" alt="%(label)s" />
+            <p><b>SQL Statement: </b>%(sql)s</p>
+            <p>Click <a href="%(image_url)s">here</a> or the image below 
+            to view the Slice related to this alert.</p>

Review comment:
       s/Slice/ chart




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org