From d2309ac606e008123d42fcea0819f80fe2204f70 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Tue, 6 Sep 2011 15:32:31 +0100 Subject: Update to suppression code. XMPP interface fixed. --- lib/mauve/notifiers/templates/email.html.erb | 4 ++-- lib/mauve/notifiers/templates/email.txt.erb | 4 ++-- .../notifiers/templates/email_subject.txt.erb | 23 +++++++++++++++++++++- lib/mauve/notifiers/templates/sms.txt.erb | 23 +++++++++++++++++++++- lib/mauve/notifiers/templates/xmpp.html.erb | 16 ++++++++------- lib/mauve/notifiers/templates/xmpp.txt.erb | 8 ++++---- 6 files changed, 61 insertions(+), 17 deletions(-) mode change 120000 => 100644 lib/mauve/notifiers/templates/email_subject.txt.erb mode change 120000 => 100644 lib/mauve/notifiers/templates/sms.txt.erb (limited to 'lib/mauve/notifiers/templates') 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

Detail

<%= RedCloth.new(alert.detail).to_html %>

-<% 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 %>
--
Love mauve
xxx.
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 deleted file mode 120000 index 802c711..0000000 --- a/lib/mauve/notifiers/templates/email_subject.txt.erb +++ /dev/null @@ -1 +0,0 @@ -xmpp.txt.erb \ No newline at end of file diff --git a/lib/mauve/notifiers/templates/email_subject.txt.erb b/lib/mauve/notifiers/templates/email_subject.txt.erb new file mode 100644 index 0000000..119c742 --- /dev/null +++ b/lib/mauve/notifiers/templates/email_subject.txt.erb @@ -0,0 +1,22 @@ +<%=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 deleted file mode 120000 index 802c711..0000000 --- a/lib/mauve/notifiers/templates/sms.txt.erb +++ /dev/null @@ -1 +0,0 @@ -xmpp.txt.erb \ No newline at end of file diff --git a/lib/mauve/notifiers/templates/sms.txt.erb b/lib/mauve/notifiers/templates/sms.txt.erb new file mode 100644 index 0000000..faec37d --- /dev/null +++ b/lib/mauve/notifiers/templates/sms.txt.erb @@ -0,0 +1,22 @@ +<%= 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 @@ -<%= alert.update_type.upcase %>: <% +<%= alert.id%>: <%= alert.update_type.upcase %>: <% 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 %><% +%>: <%= alert.subject %>: <%= alert.summary %><% if alert.source != alert.subject %> -- from <%= alert.source %><% end %>.<% -if was_suppressed and not is_suppressed -%> Normal service has resumed.<% -elsif is_suppressed and not was_suppressed -%> Further alerts suppressed until things calm down.<% -end +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.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 -- cgit v1.2.3