aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-06-16 13:41:04 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-06-16 13:41:04 +0100
commit0b553879d0606b3f24047302e8958f9610341f2b (patch)
treeba24e5f1ee4219ebaa03a95ba36bf7980aa30a87 /views
parent6910aeda9ee2b05f95817921a67c1a3c5f7dbfd0 (diff)
Added alert sorting and grouping in the web interface.
Diffstat (limited to 'views')
-rw-r--r--views/_alerts_table_alert_summary.haml1
-rw-r--r--views/_alerts_table_group.haml22
2 files changed, 13 insertions, 10 deletions
diff --git a/views/_alerts_table_alert_summary.haml b/views/_alerts_table_alert_summary.haml
index a06ccb8..24162c6 100644
--- a/views/_alerts_table_alert_summary.haml
+++ b/views/_alerts_table_alert_summary.haml
@@ -1,4 +1,5 @@
- alert = alerts_table_alert_summary if defined? alerts_table_alert_summary
+- row_class = (row_class || []) + [ cycle(nil, "hilight"), alert.raised? && "triggered", alert.acknowledged? && "acknowledged", alert.level]
%tr{ :class => row_class, :id => ["tr", "summary", alert.id] }
%td
%input{ :type => "checkbox", :id => "alerts[#{alert.id}]", :name => "alerts[#{alert.id}]", :class => 'alert' }
diff --git a/views/_alerts_table_group.haml b/views/_alerts_table_group.haml
index 8bc73b4..6507377 100644
--- a/views/_alerts_table_group.haml
+++ b/views/_alerts_table_group.haml
@@ -1,14 +1,16 @@
-# Sanity checking.
- group, alerts = alerts_table_group unless alerts_table_group.nil?
-- hilight = cycle(nil,"hilight")
-- row_class = [ hilight, alerts.first.raised? && "triggered", alerts.first.acknowledged? && "acknowledged", alerts.first.level]
-=partial("alerts_table_alert_summary", :locals => {:alert => alerts.pop, :row_class => row_class })
-- if alerts.length > 1
- %tr{ :class => [ hilight, alerts.first.raised? && "triggered", alerts.first.acknowledged? && "acknowledged"]}
+- if alerts.length <= 2
+ =partial("alerts_table_alert_summary", :collection => alerts)
+- else
+ =partial("alerts_table_alert_summary", :collection => [alerts.first])
+ =partial("alerts_table_alert_summary", :collection => alerts[1..-1], :locals => {:row_class => ["hidden"]})
+ %tr{:id => ["tr","group",group]}
%td &nbsp;
%td{:colspan => 2}
- - if alerts.length == 2
- There is one more alert in this group.
- - else
- There is #{alerts.length - 1} more alerts in this group.
- =partial("alerts_table_alert_summary", :collection => alerts[1..-1], :locals => { :row_class => row_class + ["hidden"] })
+ There are
+ %a{:onclick => alerts[1..-1].collect{|a| "$('#tr_summary_#{a.id}').toggle();"}.join + " return false;", :href => "#"}
+ =alerts.length - 1
+ more alerts
+ for the #{@group_by} <em>#{group}</em>.
+