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 /lib | |
| parent | 13c75e73812927359ca8a1d606ed33bd6a75eea5 (diff) | |
  * Alert detail now has default message.
  * It is now interpreted as textile.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mauve/alert.rb | 49 | 
1 files changed, 1 insertions, 48 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 | 
