diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-09-06 15:32:31 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-09-06 15:32:31 +0100 |
commit | d2309ac606e008123d42fcea0819f80fe2204f70 (patch) | |
tree | 2dd085c8cec56d9b0f3d14d8975cc10a2bc179ad /lib/mauve/notifiers/templates | |
parent | 76e9883e5408e30d74187ef7b272312eb7479c50 (diff) |
Update to suppression code.
XMPP interface fixed.
Diffstat (limited to 'lib/mauve/notifiers/templates')
-rw-r--r-- | lib/mauve/notifiers/templates/email.html.erb | 4 | ||||
-rw-r--r-- | lib/mauve/notifiers/templates/email.txt.erb | 4 | ||||
-rw-r--r--[l---------] | lib/mauve/notifiers/templates/email_subject.txt.erb | 23 | ||||
-rw-r--r--[l---------] | lib/mauve/notifiers/templates/sms.txt.erb | 23 | ||||
-rw-r--r-- | lib/mauve/notifiers/templates/xmpp.html.erb | 16 | ||||
-rw-r--r-- | lib/mauve/notifiers/templates/xmpp.txt.erb | 8 |
6 files changed, 61 insertions, 17 deletions
diff --git a/lib/mauve/notifiers/templates/email.html.erb b/lib/mauve/notifiers/templates/email.html.erb index fb33de6..d63f837 100644 --- a/lib/mauve/notifiers/templates/email.html.erb +++ b/lib/mauve/notifiers/templates/email.html.erb @@ -19,9 +19,9 @@ end <h2>Detail</h2> <div><%= RedCloth.new(alert.detail).to_html %></div> <hr /> -<% if was_suppressed and not is_suppressed %> +<% if was_suppressed and not will_suppress %> <p><strong>Better now. Your notifications have now restarted.</strong></p> -<% elsif is_suppressed and not was_suppressed %> +<% elsif will_suppress and not was_suppressed %> <p><strong>Too noisy! Your notifications have been suppressed.</strong></p> <% end %> <address>-- <br />Love mauve<br />xxx.</address></body></html> diff --git a/lib/mauve/notifiers/templates/email.txt.erb b/lib/mauve/notifiers/templates/email.txt.erb index aab44a8..3ea7626 100644 --- a/lib/mauve/notifiers/templates/email.txt.erb +++ b/lib/mauve/notifiers/templates/email.txt.erb @@ -19,9 +19,9 @@ end ----------------------------------------------------------------------- -<% if was_suppressed and not is_suppressed +<% if was_suppressed and not will_suppress %>Better now. Your notifications have now restarted.<% -elsif is_suppressed and not was_suppressed +elsif will_suppress and not was_suppressed %>Too noisy! Your notifications have been suppressed.<% end %> -- diff --git a/lib/mauve/notifiers/templates/email_subject.txt.erb b/lib/mauve/notifiers/templates/email_subject.txt.erb index 802c711..119c742 120000..100644 --- a/lib/mauve/notifiers/templates/email_subject.txt.erb +++ b/lib/mauve/notifiers/templates/email_subject.txt.erb @@ -1 +1,22 @@ -xmpp.txt.erb
\ No newline at end of file +<%=alert.id %>: <%= alert.update_type.upcase %>: <% +case alert.update_type +when "cleared" +%><%= alert.cleared_at.to_s_relative %><% +when "acknowledged" +%><%= alert.acknowledged_at.to_s_relative %> by <%= alert.acknowledged_by %> until <%= alert.will_unacknowledge_at.to_s_human %><% +else +%><%= alert.raised_at.to_s_relative %><% +end +%>: <%= alert.subject %>: <%= alert.summary %><% +if alert.source != alert.subject +%> -- from <%= alert.source %><% +end +%>. <%=WebInterface.url_for(alert)%><% +if defined? was_suppressed and defined? will_suppress + if was_suppressed and not will_suppress +%> (Normal service has resumed.)<% + elsif will_suppress and not was_suppressed +%> (Further alerts suppressed until things calm down.)<% + end +end +%> diff --git a/lib/mauve/notifiers/templates/sms.txt.erb b/lib/mauve/notifiers/templates/sms.txt.erb index 802c711..faec37d 120000..100644 --- a/lib/mauve/notifiers/templates/sms.txt.erb +++ b/lib/mauve/notifiers/templates/sms.txt.erb @@ -1 +1,22 @@ -xmpp.txt.erb
\ No newline at end of file +<%= alert.update_type.upcase %>: <% +case alert.update_type +when "cleared" +%><%= alert.cleared_at.to_s_relative %><% +when "acknowledged" +%><%= alert.acknowledged_at.to_s_relative %> by <%= alert.acknowledged_by %> until <%= alert.will_unacknowledge_at.to_s_human %><% +else +%><%= alert.raised_at.to_s_relative %><% +end +%>: <%= alert.subject %>: <%= alert.summary %><% +if alert.source != alert.subject +%> -- from <%= alert.source %><% +end +%>. <%=WebInterface.url_for(alert)%><% +if defined? was_suppressed and defined? will_suppress + if was_suppressed and not will_suppress +%> (Normal service has resumed.)<% + elsif will_suppress and not was_suppressed +%> (Further alerts suppressed until things calm down.)<% + end +end +%> diff --git a/lib/mauve/notifiers/templates/xmpp.html.erb b/lib/mauve/notifiers/templates/xmpp.html.erb index c6bfaed..7c0bbfd 100644 --- a/lib/mauve/notifiers/templates/xmpp.html.erb +++ b/lib/mauve/notifiers/templates/xmpp.html.erb @@ -1,5 +1,5 @@ <html xmlns="http://jabber.org/protocol/xhtml-im"><body xmlns="OAhttp://www.w3.org/1999/xhtml"> -<a href="<%=WebInterface.url_for(alert)%>"><%= alert.update_type.upcase %></a>: <% +<a href="<%=WebInterface.url_for(alert)%>"><%= alert.id%>: <%= alert.update_type.upcase %></a>: <% case alert.update_type when "cleared" %><%= alert.cleared_at.to_s_relative %><% @@ -8,14 +8,16 @@ when "acknowledged" else %><%= alert.raised_at.to_s_relative %><% end -%>: <%= alert.subject %>: <%= alert.summary %><% +%>: <strong><%= alert.subject %>:</strong> <%= alert.summary %><% if alert.source != alert.subject %> -- from <%= alert.source %><% end %>.<% -if was_suppressed and not is_suppressed -%><em> Normal service has resumed.</em><% -elsif is_suppressed and not was_suppressed -%><em> Further alerts suppressed until things calm down.</em><% -end +if defined? was_suppressed and defined? will_suppress + if was_suppressed and not will_suppress +%><br /><em>Normal service has resumed.</em><% + elsif will_suppress and not was_suppressed +%><br /><em>Further alerts suppressed until things calm down.</em><% + end +end %></body></html> diff --git a/lib/mauve/notifiers/templates/xmpp.txt.erb b/lib/mauve/notifiers/templates/xmpp.txt.erb index 57f16f4..119c742 100644 --- a/lib/mauve/notifiers/templates/xmpp.txt.erb +++ b/lib/mauve/notifiers/templates/xmpp.txt.erb @@ -1,4 +1,4 @@ -<%= alert.update_type.upcase %>: <% +<%=alert.id %>: <%= alert.update_type.upcase %>: <% case alert.update_type when "cleared" %><%= alert.cleared_at.to_s_relative %><% @@ -12,10 +12,10 @@ if alert.source != alert.subject %> -- from <%= alert.source %><% end %>. <%=WebInterface.url_for(alert)%><% -if defined? was_suppressed and defined? is_suppressed - if was_suppressed and not is_suppressed +if defined? was_suppressed and defined? will_suppress + if was_suppressed and not will_suppress %> (Normal service has resumed.)<% - elsif is_suppressed and not was_suppressed + elsif will_suppress and not was_suppressed %> (Further alerts suppressed until things calm down.)<% end end |