diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-06-15 21:19:06 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-06-15 21:19:06 +0100 |
commit | 3af526a34a0d53cde184134b68f2c241efe92483 (patch) | |
tree | 8710265616ab6bef3967781f4e84f376bec4079e | |
parent | 13c75e73812927359ca8a1d606ed33bd6a75eea5 (diff) |
* Alert detail now has default message.
* It is now interpreted as textile.
-rw-r--r-- | lib/mauve/alert.rb | 49 | ||||
-rw-r--r-- | views/_alerts_table_alert_detail.haml | 3 | ||||
-rw-r--r-- | views/alert.haml | 4 |
3 files changed, 6 insertions, 50 deletions
diff --git a/lib/mauve/alert.rb b/lib/mauve/alert.rb index 6694fca..df10741 100644 --- a/lib/mauve/alert.rb +++ b/lib/mauve/alert.rb @@ -116,54 +116,6 @@ module Mauve end end - def summary_one_line - subject ? "#{subject} #{summary}" : "#{source} #{summary}" - end - - def summary_two_lines - msg = "" - msg += "from #{source} " if source != subject - if cleared_at - msg += "cleared #{time_relative(MauveTime.now - cleared_at.to_time)}" - elsif acknowledged_at - msg += "acknowledged #{time_relative(MauveTime.now - acknowledged_at.to_time)} by #{acknowledged_by}" - else - msg += "raised #{time_relative(MauveTime.now - raised_at.to_time)}" - end - [summary_one_line, msg] - end - - # Returns a better array with information about the alert. - # - # @return [Array] An array of three elements: status, message, source. - def summary_three_lines - status = String.new - if "cleared" == update_type - status += "CLEARED #{time_relative(MauveTime.now - cleared_at.to_time)}" - elsif "acknowledged" == update_type - status += "ACKNOWLEDGED #{time_relative(MauveTime.now - acknowledged_at.to_time)} by #{acknowledged_by}" - elsif "changed" == update_type - status += "CHANGED #{time_relative(MauveTime.now - updated_at.to_time)}" - else - status += "RAISED #{time_relative(MauveTime.now - raised_at.to_time)}" - end - src = (source != subject)? "from #{source}" : nil - return [status, summary_one_line, src] -=begin - status = String.new - if cleared_at - status += "CLEARED #{time_relative(MauveTime.now - cleared_at.to_time)}" - elsif acknowledged_at - status += "ACKNOWLEDGED #{time_relative(MauveTime.now - acknowledged_at.to_time)} by #{acknowledged_by}" - else - status += "RAISED #{time_relative(MauveTime.now - raised_at.to_time)}" - end - src = (source != subject)? "from #{source}" : nil - return [status, summary_one_line, src] -=end - end - - # # AlertGroup.matches must always return a an array of groups. # @@ -176,6 +128,7 @@ module Mauve end def subject; attribute_get(:subject) || attribute_get(:source) ; end + def detail; attribute_get(:detail) || "_No detail set._" ; end def subject=(subject); set_changed_if_different( :subject, subject ); end def summary=(summary); set_changed_if_different( :summary, summary ); end diff --git a/views/_alerts_table_alert_detail.haml b/views/_alerts_table_alert_detail.haml index 73185c6..b5ada45 100644 --- a/views/_alerts_table_alert_detail.haml +++ b/views/_alerts_table_alert_detail.haml @@ -2,7 +2,8 @@ %td %td{:colspan => 2} .detail - = alert.detail + :textile + #{alert.detail} %address - if alert.raised? or alert.acknowledged? Raised at #{alert.raised_at.to_s_human} • diff --git a/views/alert.haml b/views/alert.haml index 41de29a..0486770 100644 --- a/views/alert.haml +++ b/views/alert.haml @@ -17,7 +17,9 @@ %td= @alert.source %tr %th{:title => "HTML fragment describing the alert in more detail, no limit on length."} Detail - %td= @alert.detail + %td + :textile + #{@alert.detail} %tr %th{:title => "ID set by the source of the alert."} Alert ID %td= @alert.alert_id |