From 74daf1e46afcc997304f15f2844ebad74c140d9d Mon Sep 17 00:00:00 2001 From: Ran Byron Date: Tue, 24 Sep 2019 11:52:07 +0300 Subject: [PATCH] State to uppercase, removed time, fixed attrs --- client/app/pages/alert/components/NotificationTemplate.jsx | 1 - redash/models/__init__.py | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/client/app/pages/alert/components/NotificationTemplate.jsx b/client/app/pages/alert/components/NotificationTemplate.jsx index bced388534..d3c1178436 100644 --- a/client/app/pages/alert/components/NotificationTemplate.jsx +++ b/client/app/pages/alert/components/NotificationTemplate.jsx @@ -19,7 +19,6 @@ function normalizeCustomTemplateData(alert, query, columnNames, resultValues) { return { ALERT_STATUS: 'TRIGGERED', - ALERT_EVALUATION_TIME: new Date(), ALERT_CONDITION: alert.options.op, ALERT_THRESHOLD: alert.options.value, ALERT_NAME: alert.name, diff --git a/redash/models/__init__.py b/redash/models/__init__.py index 33753b55b8..5673c4366c 100644 --- a/redash/models/__init__.py +++ b/redash/models/__init__.py @@ -837,8 +837,7 @@ def render_template(self, template): context = { 'ALERT_NAME': self.name, 'ALERT_URL': '{host}/alerts/{alert_id}'.format(host=host, alert_id=self.id), - 'ALERT_STATUS': self.state, - 'ALERT_EVALUATION_TIME': datetime.datetime.now(), # could be problematic cuz utc? + 'ALERT_STATUS': self.state.upper(), 'ALERT_CONDITION': self.options['op'], 'ALERT_THRESHOLD': self.options['value'], 'QUERY_NAME': self.query_rel.name, @@ -851,11 +850,11 @@ def render_template(self, template): @property def custom_body(self): - return self.render_template(self.options.custom_body) + return self.render_template(self.options['custom_body']) @property def custom_subject(self): - return self.render_template(self.options.custom_subject) + return self.render_template(self.options['custom_subject']) @property def groups(self):