Skip to content

Commit

Permalink
State to uppercase, removed time, fixed attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
ranbena committed Sep 24, 2019
1 parent b8aa983 commit 74daf1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion client/app/pages/alert/components/NotificationTemplate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 3 additions & 4 deletions redash/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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):
Expand Down

0 comments on commit 74daf1e

Please sign in to comment.