JasonD28 commented on a change in pull request #10476:
URL:
https://github.com/apache/incubator-superset/pull/10476#discussion_r462624105
##########
File path: superset/views/alerts.py
##########
@@ -95,5 +105,47 @@ class AlertModelView(SupersetModelView): # pylint:
disable=too-many-ancestors
"Superset nags you again."
),
}
+
+ add_form_extra_fields = {
+ "test_alert": BooleanField(
+ "Send Test Alert",
+ default=False,
+ description="If enabled, a test alert will be sent on the creation
/ update of active alerts. "
+ "All alerts after will be sent only if the SQL statement defined
above returns True.",
+ ),
+ "test_email_recipients": StringField(
+ "Test Email Recipients",
+ default=None,
+ description="List of recipients to send test email to. "
+ "If empty, an email will be sent to the original recipients.",
+ ),
+ }
+ edit_form_extra_fields = add_form_extra_fields
edit_columns = add_columns
related_views = [AlertLogModelView]
+
+ def process_form(self, form: Form, is_created: bool) -> None:
+ test_email_recipients = None
+ if form.test_email_recipients.data:
+ test_email_recipients = get_email_address_str(
+ form.test_email_recipients.data
+ )
+
+ self._extra_data["test_alert"] = form.test_alert.data
+ self._extra_data["test_email_recipients"] = test_email_recipients #
type: ignore
Review comment:
mypy was complaining: `Incompatible types in assignment (expression has
type "Optional[str]", target has type "Optional[bool]")`
All other type definitions matched
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]