aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/web_interface.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-08-19 16:28:37 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-08-19 16:28:37 +0100
commitcdb78656916abe5adb946a25b913cda7785a42de (patch)
tree0f656d639868c2ac8d8a14a5370ab8f2263092dc /lib/mauve/web_interface.rb
parent8d209c0f6a1b3c47f9bc55b6f63cb14bfa935162 (diff)
HTML now sanitised on save.
Added History tests Default polling interval now 5s, 0s for Timer/UDPServer Fixed note entry for alert page.
Diffstat (limited to 'lib/mauve/web_interface.rb')
-rw-r--r--lib/mauve/web_interface.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/mauve/web_interface.rb b/lib/mauve/web_interface.rb
index 82dc654..fb82f2e 100644
--- a/lib/mauve/web_interface.rb
+++ b/lib/mauve/web_interface.rb
@@ -216,8 +216,6 @@ EOF
next
end
- logger.debug "arse"
-
begin
a.acknowledge!(@person, ack_until)
succeeded << a
@@ -228,9 +226,10 @@ EOF
end
end
#
- # Add a note
+ # Add the note
#
unless note.to_s.empty?
+ note = Alert.remove_html(note)
h = History.new(:alerts => succeeded, :type => "note", :event => session['username']+" noted "+note.to_s)
logger.debug h.errors unless h.save
end
@@ -337,6 +336,7 @@ EOF
ack_until = params[:ack_until].to_i
n_hours = params[:n_hours].to_i
type_hours = params[:type_hours].to_s
+ note = params[:note] || nil
if ack_until == 0
ack_until = Time.now.in_x_hours(n_hours, type_hours)
@@ -346,6 +346,14 @@ EOF
alert.acknowledge!(@person, ack_until)
+ #
+ # Add the note
+ #
+ unless note.to_s.empty?
+ h = History.new(:alerts => [alert], :type => "note", :event => session['username']+" noted "+note.to_s)
+ logger.debug h.errors unless h.save
+ end
+
flash['notice'] = "Successfully acknowledged alert <em>#{alert.alert_id}</em> from source #{alert.source}."
redirect "/alert/#{alert.id}"
end