From fc0327f91fb134e1df994143a78c22df7d8f62e4 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Wed, 15 Jun 2011 19:47:24 +0100 Subject: Big interface clear up --- views/_acknowledge.haml | 6 -- views/_acknowledge_input.haml | 31 ++++++++ views/_alert_counts.haml | 16 ----- views/_alert_strips_group.haml | 37 ---------- views/_alert_summary.haml | 7 -- views/_alerts_table.haml | 19 +++++ views/_alerts_table_alert_detail.haml | 14 ++++ views/_alerts_table_alert_summary.haml | 10 +++ views/_alerts_table_group.haml | 14 ++++ views/_detail.haml | 3 - views/_get_alerts.haml | 43 ----------- views/_get_list.haml | 40 ----------- views/_head.haml | 30 +++----- views/_head2.haml | 20 ------ views/_head3.haml | 17 ----- views/_jqChangeStatus.haml | 21 ------ views/_jqModalScript.haml | 22 ------ views/_navbar.haml | 16 +++-- views/_navigation.haml | 14 ---- views/_treecontrol.haml | 9 --- views/_unacknowledged.haml | 6 -- views/alert.haml | 126 ++++++++++++++++++++------------- views/alerts.haml | 72 +++---------------- views/alerts2.haml | 18 ----- views/events.haml | 23 +----- views/login.haml | 38 ++++------ views/not_implemented.haml | 7 ++ views/preferences.haml | 25 +------ 28 files changed, 215 insertions(+), 489 deletions(-) delete mode 100644 views/_acknowledge.haml create mode 100644 views/_acknowledge_input.haml delete mode 100644 views/_alert_counts.haml delete mode 100644 views/_alert_strips_group.haml delete mode 100644 views/_alert_summary.haml create mode 100644 views/_alerts_table.haml create mode 100644 views/_alerts_table_alert_detail.haml create mode 100644 views/_alerts_table_alert_summary.haml create mode 100644 views/_alerts_table_group.haml delete mode 100644 views/_detail.haml delete mode 100644 views/_get_alerts.haml delete mode 100644 views/_get_list.haml delete mode 100644 views/_head2.haml delete mode 100644 views/_head3.haml delete mode 100644 views/_jqChangeStatus.haml delete mode 100644 views/_jqModalScript.haml delete mode 100644 views/_navigation.haml delete mode 100644 views/_treecontrol.haml delete mode 100644 views/_unacknowledged.haml delete mode 100644 views/alerts2.haml mode change 100644 => 120000 views/events.haml create mode 100644 views/not_implemented.haml mode change 100644 => 120000 views/preferences.haml (limited to 'views') diff --git a/views/_acknowledge.haml b/views/_acknowledge.haml deleted file mode 100644 index cc0ea71..0000000 --- a/views/_acknowledge.haml +++ /dev/null @@ -1,6 +0,0 @@ -%h4 Acknowledged alerts -#treecontrolAck= partial("treecontrol") -%ul{:id => "blackAck", :class => "treeview-black-ack"} - = partial("get_list", :locals => {:level => "urgent", :alertsList => @grouped_ack_urgent}) - = partial("get_list", :locals => {:level => "normal", :alertsList => @grouped_ack_normal}) - = partial("get_list", :locals => {:level => "low", :alertsList => @grouped_ack_low}) diff --git a/views/_acknowledge_input.haml b/views/_acknowledge_input.haml new file mode 100644 index 0000000..b6fc24b --- /dev/null +++ b/views/_acknowledge_input.haml @@ -0,0 +1,31 @@ +Acknowledge these alerts for +%input#n_hours{ :name => 'n_hours', :type => "number", :min => 0, :max => 48, :value => 2, :style => "min-width: 6ex;"} +%select#type_hours{:name => 'type_of_hours' } + -# Default to daytime hours + %option{ :value => "working" } working + %option{ :value => "daytime", :selected => "selected"} daytime + %option{ :value => "wallclock" } wall-clock +hours +%span#ack_until_text +%input#ack_until{ :value => '', :type => :hidden, :name => 'ack_until' } +%input{ :type => 'submit', :value => 'Go!' } +:javascript + // Change of value in the hours box + $('#n_hours').change( function() { + updateDate(); + }); + // As above, but on keypress, with a delay + $('#n_hours').keyup( function() { + clearTimeout($.data(this, 'timer')); + var wait = setTimeout(updateDate, 500); + $(this).data('timer', wait); + }); + // Same as the n_hours change function + $('#type_hours').change( function() { + $('#n_hours').change(); + }); + // Setup the ack text on load. + $(document).ready( function() { + $('#n_hours').change(); + }); + diff --git a/views/_alert_counts.haml b/views/_alert_counts.haml deleted file mode 100644 index 6dcecc0..0000000 --- a/views/_alert_counts.haml +++ /dev/null @@ -1,16 +0,0 @@ -.colmask.threecol - .colmid - .colleft - .urgent.col1 - Urgent - .unacknowledged{:title=>"Urgent alert unacknowledged"} #{@urgent.length - @count_ack[:urgent]} - .acknowledged{:title=>"Urgent alert acknowledged"} #{@count_ack[:urgent]} - .normal.col2 - Normal - .unacknowledged{:title=>"Normal alert unacknowledged"} #{@normal.length - @count_ack[:normal]} - .acknowledged{:title=>"Normal alert acknowledged"} #{@count_ack[:normal]} - .low.col3 - Low - .unacknowledged{:title=>"Low alert unacknowledged"} #{@low.length - @count_ack[:low]} - .acknowledged{:title=>"Low alert acknowledged"} #{@count_ack[:low]} - diff --git a/views/_alert_strips_group.haml b/views/_alert_strips_group.haml deleted file mode 100644 index 0a6f3bf..0000000 --- a/views/_alert_strips_group.haml +++ /dev/null @@ -1,37 +0,0 @@ -//- alerts.each_pair do |subject, alerts| -// .grouped_folder{:id=>subject} -// - lst = Array.new() -// - count = 0 -// - alerts.sort.each do |alert| -// - if count > 0 -// - displayFolding = (false == session[:display_folding][subject])? 'display:none' : '' -// - else -// - count += 1 -// - lst.push("whole_alert_#{alert.id}") -// .alert_whole{:id=>"whole_alert_#{alert.id}", :style => "#{displayFolding}"} -// .alert_strip{:id => "alert_#{alert.id}"} -// %a.acknowledge{:href => "javascript:toggleAcknowledge(#{alert.id});", :onClick => "toggleDetailView(#{alert.id});"} -// - if alert.acknowledged? -// //%img.acknowledged.auto_hover{:src => "/images/acknowledge_acknowledged.png" :title=>"Unacknowledge alert"} -// %img.acknowledged{:src => "/images/acknowledge_acknowledged.png" :title=>"Unacknowledge alert"} -// - else -// //%img.unacknowledged.auto_hover{:src => "/images/acknowledge_unacknowledged.png" :title=>"Acknowledge alert"} -// %img.unacknowledged{:src => "/images/acknowledge_unacknowledged.png" :title=>"Acknowledge alert"} -// - if alert.source != alert.subject -// .source= alert.source -// .subject= alert.subject + ": " -// .summary= alert.summary -// //- if alert.detail -// %a.expand{:href => "javascript:", :onClick => "toggleDetailView(#{alert.id}); $('alert_#{alert.id}').next().toggle();"} -// %img.zoom{:src => "/images/zoom.png" :title => "Show details"} -// %a.full{:href => "/alert/#{alert.id}"} -// %img.hourglass{:src => "/images/hourglass.png" :title => "Show history"} -// - displayDetails = (false == session[:display_alerts][alert.id])? 'display:none' : '' -// .detail_strip{:id => "detail_#{alert.id}", :style => "#{displayDetails}"} -// = alert.detail -// - lst.shift() -// - displaySummary = (1 > lst.size())? 'display:none' : '' -// .control{:id=>subject, :style=>"#{displaySummary}"} -// There are #{lst.size() + 1} alarms in this block... -// %a.expand{:href => "javascript:", :onClick => "toggleFoldingView('#{subject}'); [$('#{lst.join("'), $('")}')].invoke('toggle');"} -// %img.toggle{:src => "/images/toggle_alerts.png" :title => "toggle display of alerts"} diff --git a/views/_alert_summary.haml b/views/_alert_summary.haml deleted file mode 100644 index 1798ec1..0000000 --- a/views/_alert_summary.haml +++ /dev/null @@ -1,7 +0,0 @@ -// See feature #1051: UI sorting order. -.urgent= partial("alert_strips_group", :locals => {:alerts => @grouped_new_urgent}) -.normal= partial("alert_strips_group", :locals => {:alerts => @grouped_new_normal}) -.low= partial("alert_strips_group", :locals => {:alerts => @grouped_new_low}) -.urgent= partial("alert_strips_group", :locals => {:alerts => @grouped_ack_urgent}) -.normal= partial("alert_strips_group", :locals => {:alerts => @grouped_ack_normal}) -.low= partial("alert_strips_group", :locals => {:alerts => @grouped_ack_low}) diff --git a/views/_alerts_table.haml b/views/_alerts_table.haml new file mode 100644 index 0000000..aa0c437 --- /dev/null +++ b/views/_alerts_table.haml @@ -0,0 +1,19 @@ +%form#alerts{:method => :post, :action => '/alerts/acknowledge'} + %table + %tr + %th#selector + %input#toggle_all{ :type => "checkbox" } + :javascript + // This just toggles all the checkboxes. + $('#toggle_all').change( function() { + $('input.alert').each( function(index) { + this.checked = !this.checked; + }); + }); + %th#time At + %th#summary Summary + = partial("alerts_table_group", :collection => @grouped_alerts) + %tr + %td   + %td{:colspan => 2} + = partial("acknowledge_input") diff --git a/views/_alerts_table_alert_detail.haml b/views/_alerts_table_alert_detail.haml new file mode 100644 index 0000000..73185c6 --- /dev/null +++ b/views/_alerts_table_alert_detail.haml @@ -0,0 +1,14 @@ +%tr{:class => %w(detail) + row_class, :id => ["tr", "detail", alert.id] } + %td   + %td{:colspan => 2} + .detail + = alert.detail + %address + - if alert.raised? or alert.acknowledged? + Raised at #{alert.raised_at.to_s_human} • + - if alert.acknowledged? + Ack'd at #{alert.acknowledged_at.to_s_human} by #{alert.acknowledged_by} • + Source: #{alert.source} • + %a{ :href => "/alert/#{alert.id}" } More details + • + %a{ :href => "#", :onclick => "$('#tr_detail_#{alert.id}').hide(); return false;"} Hide details diff --git a/views/_alerts_table_alert_summary.haml b/views/_alerts_table_alert_summary.haml new file mode 100644 index 0000000..06f1dc2 --- /dev/null +++ b/views/_alerts_table_alert_summary.haml @@ -0,0 +1,10 @@ +- alert = alerts_table_alert_summary if defined? alerts_table_alert_summary +%tr{ :class => row_class, :id => ["tr", "summary", alert.id] } + %td + %input{ :type => "checkbox", :id => "alerts[#{alert.id}]", :name => "alerts[#{alert.id}]", :class => 'alert' } + %td + %label{ :for => "alerts[#{alert.id}]" } + %strong= alert.subject + = alert.summary + %a{ :id => ["a","detail", alert.id], :href => "/alert/#{alert.id}", :onclick => "fetchDetail('#{alert.id}'); return false;"} Details ↓ + %td= alert.raised_at.to_s_relative diff --git a/views/_alerts_table_group.haml b/views/_alerts_table_group.haml new file mode 100644 index 0000000..f3af4b2 --- /dev/null +++ b/views/_alerts_table_group.haml @@ -0,0 +1,14 @@ +-# 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.first, :row_class => row_class }) +- if alerts.length > 1 + %tr{ :class => [ hilight, alerts.first.raised? && "triggered", alerts.first.acknowledged? && "acknowledged"]} + %td   + %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"] }) diff --git a/views/_detail.haml b/views/_detail.haml deleted file mode 100644 index 282e454..0000000 --- a/views/_detail.haml +++ /dev/null @@ -1,3 +0,0 @@ -.detail - :textile - #{alert.detail} diff --git a/views/_get_alerts.haml b/views/_get_alerts.haml deleted file mode 100644 index 8abff2e..0000000 --- a/views/_get_alerts.haml +++ /dev/null @@ -1,43 +0,0 @@ -- alerts.each do |alert| - %li{:id=>"alert#{alert.id}"} - .alert - - if "urgent" == level - .levelUrgent - %a{:href=>"javascript:", :onClick=>"showAcknowledgeStatus(event, #{alert.id}, #{alert.get_default_acknowledge_time()});"} - Urgent - - elsif "normal" == level - .levelNormal - %a{:href=>"javascript:", :onClick=>"showAcknowledgeStatus(event, #{alert.id}, #{alert.get_default_acknowledge_time()});"} - Normal - -else - .levelLow - %a{:href=>"javascript:", :onClick=>"showAcknowledgeStatus(event, #{alert.id}, #{alert.get_default_acknowledge_time()});"} - Low - .subject= alert.get_safe_html_subject - .summary= alert.get_safe_html_summary - %a{:href=>"/alert/#{alert.id}"} - History - //%a{:href=>"javascript:", :onClick=>"$(furtherInformation#{alert.id}).toggle();"} - %a{:href=>"javascript:", :onClick=>"$(\"#furtherInformation#{alert.id}.furtherInformation\").toggle();"} - Extra - //%a{:href=>"javascript:", :onClick=>"$(inlineDetails#{alert.id}).toggle();"} - %a{:href=>"javascript:", :onClick=>"$(\"#inlineDetails#{alert.id}.inlineDetails\").toggle();"} - Details - .inlineDetails{:id=>"inlineDetails#{alert.id}", :style=>"display: none"} - %h5 Alert details - #{alert.get_details} - //.furtherInformation{:id=>"furtherInformation#{alert.id}"} - .furtherInformation{:id=>"furtherInformation#{alert.id}", :style=>"display: none"} - Alert group is '#{AlertGroup.matches(alert)[0].name}'. - - if alert.source != alert.subject - .source= "Source is '#{alert.get_safe_html_source}'." - - if alert.acknowledged? - .ackDetails - Acknowledged by user - %strong= "#{alert.get_acknowledged_by()} " - and will #{alert.get_unacknowledge_at_string()}. - - else - .time - Last updated on - %em= "#{alert.get_updated_at()}." - diff --git a/views/_get_list.haml b/views/_get_list.haml deleted file mode 100644 index cc8fb9b..0000000 --- a/views/_get_list.haml +++ /dev/null @@ -1,40 +0,0 @@ -//- alerts.each_pair do |subject, alerts| -- alertsList.keys.sort.each do |subject| - - alerts = alertsList[subject] - - if 1 < alerts.length() - %li{:id=>"firstAlert#{alerts[0].id}"} - - if "urgent" == level - %span.levelUrgent Urgent - - elsif "normal" == level - %span.levelNormal Normal - -else - %span.levelLow Low - .conglomerate - %span.subject= alerts[0].subject - - if alerts[0].acknowledged? - There are #{alerts.length} alerts in this conglomerate. - - else - - shortestAckTime = 9223372036854775807 - - lst = Array.new - - alerts.each do |alert| - - shortestAckTime = alert.get_default_acknowledge_time() if alert.get_default_acknowledge_time() < shortestAckTime - - lst << alert.id - %a{:href=>"javascript:", :onClick=>"showBulkAcknowledgeStatus(event, #{"['#{lst.join('\',\'')}']"}, #{shortestAckTime});"} - [Bulk acknowledge #{alerts.length} alerts for - - hrs = shortestAckTime / 3600 - - if 1 == hrs - one hour. - - elsif 24 > hrs and 1 > hrs - #{hrs} hours - - elsif 24 == hrs - one day. - - elsif 24 < hrs and 168 > hrs - #{hrs/24} days. - - elsif 168 == hrs - one week - - else - #{hrs/168} weeks - ] - %ul= partial("get_alerts", :locals => {:level => level, :alerts => alerts}) - - else - = partial("get_alerts", :locals => {:level => level, :alerts => alerts}) diff --git a/views/_head.haml b/views/_head.haml index db2125e..276680d 100644 --- a/views/_head.haml +++ b/views/_head.haml @@ -1,22 +1,8 @@ -.colmask.threecol - .colmid - .colleft - .col1 - .countdown{:id=>"reloadPage"} - %span.count - %span.urgent - Urgent - %span.nbrUnacknowledged{:title=>"Urgent alert unacknowledged"} #{@urgent.length - @count_ack[:urgent]} - %span.nbrAcknowledged{:title=>"Urgent alert acknowledged"} (Seen #{@count_ack[:urgent]}) - %span.normal - Normal - %span.nbrUnacknowledged{:title=>"Normal alert unacknowledged"} #{@normal.length - @count_ack[:normal]} - %span.nbrAcknowledged{:title=>"Normal alert acknowledged"} (Seen #{@count_ack[:normal]}) - %span.low - Low - %span.nbrUnacknowledged{:title=>"Low alert unacknowledged"} #{@low.length - @count_ack[:low]} - %span.nbrAcknowledged{:title=>"Low alert acknowledged"} (Seen #{@count_ack[:low]}) - .col2 - .title #{@title} - .col3 - %img{:src => "/images/logo.png"} +%head + %title= @title + %meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=yes"}/ + %link{:rel => "stylesheet", :href => "/stylesheets/bytemark.css"}/ + %link{:rel => "stylesheet", :href => "/stylesheets/mauve.css", :media => "all", :type => "text/css"}/ + %link{:rel => "stylesheet", :href => "/stylesheets/mauve-handheld.css", :media => "handheld, only screen and (max-width: 1000px), only screen and (max-device-width: 1000px)", :type => "text/css" }/ + %script{:src => '/javascript/jquery/jquery.min.js', :type => 'text/javascript'} + %script{:src => '/mauve_utils.js', :type => 'text/javascript'} diff --git a/views/_head2.haml b/views/_head2.haml deleted file mode 100644 index a37d6c4..0000000 --- a/views/_head2.haml +++ /dev/null @@ -1,20 +0,0 @@ -#main - #mainleft - .title #{@title} - #maincenter - .countdown{:id=>"reloadPage"} - %span.count - %span.urgent - Urgent - %span.nbrUnacknowledged{:title=>"Urgent alert unacknowledged"} #{@urgent.length - @count_ack[:urgent]} - %span.nbrAcknowledged{:title=>"Urgent alert acknowledged"} (Seen #{@count_ack[:urgent]}) - %span.normal - Normal - %span.nbrUnacknowledged{:title=>"Normal alert unacknowledged"} #{@normal.length - @count_ack[:normal]} - %span.nbrAcknowledged{:title=>"Normal alert acknowledged"} (Seen #{@count_ack[:normal]}) - %span.low - Low - %span.nbrUnacknowledged{:title=>"Low alert unacknowledged"} #{@low.length - @count_ack[:low]} - %span.nbrAcknowledged{:title=>"Low alert acknowledged"} (Seen #{@count_ack[:low]}) - #mainright - %img{:src => "/images/logo.png"} diff --git a/views/_head3.haml b/views/_head3.haml deleted file mode 100644 index 1a2b00f..0000000 --- a/views/_head3.haml +++ /dev/null @@ -1,17 +0,0 @@ -%h1 - Mauve Alert Panel -.alertsSummary - %span.urgent - Urgent - %span.nbrUnacknowledged{:title=>"Urgent alert unacknowledged"} #{@urgent.length - @count_ack[:urgent]} - %span.nbrAcknowledged{:title=>"Urgent alert acknowledged"} (Seen #{@count_ack[:urgent]}) - %span.normal - Normal - %span.nbrUnacknowledged{:title=>"Normal alert unacknowledged"} #{@normal.length - @count_ack[:normal]} - %span.nbrAcknowledged{:title=>"Normal alert acknowledged"} (Seen #{@count_ack[:normal]}) - %span.low - Low - %span.nbrUnacknowledged{:title=>"Low alert unacknowledged"} #{@low.length - @count_ack[:low]} - %span.nbrAcknowledged{:title=>"Low alert acknowledged"} (Seen #{@count_ack[:low]}) - %a{:href=>"/logout"} - [Logout] diff --git a/views/_jqChangeStatus.haml b/views/_jqChangeStatus.haml deleted file mode 100644 index 1b00c17..0000000 --- a/views/_jqChangeStatus.haml +++ /dev/null @@ -1,21 +0,0 @@ -%form{:name=>"changeAlertStatusForm", :action=>"html_form_action", :method=>"post"} - %input{:type=>"hidden", :name=>"AlertID", :value=>"Null"} - %input{:type=>"hidden", :name=>"AlertDefaultAcknowledgeTime", :value=>"Null"} - %input{:type=>"button", :name=>"statusAcknowledgedFor", :value=>"Acknowledge this alert for", - :onclick=>"changeAcknowledgeStatus(this.form.AlertID.value, this.form.timeStamp.value)", - :class=>"buttonAcknowledgeAlert"} - %select{:name=>"timeStamp", :id=>"sample", :class=>"timeList"} - %option{:value=>"0"}default... - %option{:value=>"3600"}1 hour - %option{:value=>"7200"}2 hours - %option{:value=>"7560"}3 hours - %option{:value=>"18000"}5 hours - %option{:value=>"25200"}7 hours - %option{:value=>"86400"}1 day - %option{:value=>"172800"}2 days - %option{:value=>"604800"}1 week - %option{:value=>"0"}Forever - %input{:type=>"button", :name=>"raise", :value=>"Unacknowledged", :onClick=>"raiseAlert(this.form.AlertID.value);", :class=>"raiseAlert"} - %input{:type=>"button", :name=>"clear", :value=>"Trash alert", :onClick=>"clearAlert(this.form.AlertID.value);", :class=>"trashAlert"} -%em - Please be careful what you chose and err on the side of shorter times scales. diff --git a/views/_jqModalScript.haml b/views/_jqModalScript.haml deleted file mode 100644 index 00cc298..0000000 --- a/views/_jqModalScript.haml +++ /dev/null @@ -1,22 +0,0 @@ -.jdHandle.jqDrag -%strong - Acknowledge alert! -%em - Please be careful what you chose and err on the side of shorter times scales. -%form{:name=>"input", :action=>"html_form_action", :method=>"post"} - //%a{:href=>"javascript:toogleAcknowledge(#{alert.id})"} - %a{:href=>"javascript:toogleAcknowledge"} - Acknowledge this alert for - %select - %option{:value=>"1"}1 hour - %option{:value=>"2"}2 hour - %option{:value=>"3"}3 hours - %option{:value=>"5"}5 hours - %option{:value=>"7"}7 hours - %option{:value=>"24"}1 day - %option{:value=>"48"}2 days - %option{:value=>"168"}1 week - %option{:value=>"0"}Forever -%a{:href=>"#", :class=>"jqmClose"} - Close -.jqHandle.jqResize diff --git a/views/_navbar.haml b/views/_navbar.haml index 2384baf..4f81450 100644 --- a/views/_navbar.haml +++ b/views/_navbar.haml @@ -1,15 +1,21 @@ #navbar %ul - %li + %li#nav_index %a{:href => "/"} Mauve - if @person - %li{:id => [ @alert_type == "raised" && "nav_selected"]} + %li{:class => [ @alert_type == "raised" && "nav_selected"]} %a{:href => '/alerts/raised/'+@group_by} Raised (#{@alerts_raised.length}) - %li{:id => [ @alert_type == "acknowledged" && "nav_selected"]} + %li{:class => [ @alert_type == "acknowledged" && "nav_selected"]} %a{:href => '/alerts/acknowledged/'+@group_by} Ack'd (#{@alerts_ackd.length}) - %li{:id => [ @alert_type == "cleared" && "nav_selected"]} + %li{:class => [ @alert_type == "cleared" && "nav_selected"]} %a{:href => '/alerts/cleared/'+@group_by} Cleared (#{@alerts_cleared.length}) %li %a{:href => '/logout'} Log out %br - +- %w(notice error).each do |klass| + - unless flash[klass].to_s.empty? + %div{:class => ["flash", klass]} + :textile + #{flash[klass]} + :javascript + $(document).ready(function () { $('div.flash').delay(1000).fadeOut(2000);}); diff --git a/views/_navigation.haml b/views/_navigation.haml deleted file mode 100644 index c3301b2..0000000 --- a/views/_navigation.haml +++ /dev/null @@ -1,14 +0,0 @@ -- if @person - %a{:href => "/alerts"} Current alerts - %a{:href => "/events"} Last day - %a{:href => "/preferences"} My preferences - %a{:href => "/logout"} Logout (#{@person.username}) -- else - %form{:action => '/login', :method => :POST} - UsernameArse - %input{:name => 'username', :type => 'text', :size => 10} - Password - %input{:name => 'password', :type => 'password', :size => 10} - %input{:type => 'submit', :value => 'Log in'} -- if flash['error'] - .error= flash['error'] diff --git a/views/_treecontrol.haml b/views/_treecontrol.haml deleted file mode 100644 index caf3a89..0000000 --- a/views/_treecontrol.haml +++ /dev/null @@ -1,9 +0,0 @@ -%a{:title=>"Collapse the entire tree below", :href=>"#"} - %img{:src=>"/images/minus.png"} - Collapse All -%a{:title=>"Expand the entire tree below", :href=>"#"} - %img{:src=>"/images/plus.png"} - Expand All -%a{:title=>"Toggle collapse/expand of tree below", :href=>"#"} - %img{:src=>"/images/toggle.png"} - Toggle All diff --git a/views/_unacknowledged.haml b/views/_unacknowledged.haml deleted file mode 100644 index 77ed657..0000000 --- a/views/_unacknowledged.haml +++ /dev/null @@ -1,6 +0,0 @@ -%h4 Unacknowledged alerts -#treecontrolNew= partial("treecontrol") -%ul{:id => "blackNew", :class => "treeview-black"} - = partial("get_list", :locals => {:level => "urgent", :alertsList => @grouped_new_urgent}) - = partial("get_list", :locals => {:level => "normal", :alertsList => @grouped_new_normal}) - = partial("get_list", :locals => {:level => "low", :alertsList => @grouped_new_low}) diff --git a/views/alert.haml b/views/alert.haml index 9d25c47..41de29a 100644 --- a/views/alert.haml +++ b/views/alert.haml @@ -1,56 +1,80 @@ -!!! +!!!5 %html - %head - %title #{@title}: Alert #{@alert.id}: #{@alert.get_safe_html_summary} - %link{:rel => "stylesheet", :href => "/alerts2.css"}/ - %link{:rel => "stylesheet", :href => "/alerts-mobil.css", :media => "handheld"} / - %script{:type => "text/javascript", :src => "/prototype.js"}/ - %script{:type => "text/javascript", :src => "/mauve_utils.js"}/ - %script{:type => "text/javascript", :src => "/datadumper.js"}/ - %body{:onLoad => "addAutoHover(); addRefresh();"} - .head= partial("head3") - #about_alert - %h1.summary #{@alert.get_safe_html_subject}: #{@alert.get_safe_html_summary} - %h2.details Alert Details - - if @alert.detail - .arse= partial("detail") - - if @alert.source != @alert.subject - %h2.source Source - .source= @alert.get_safe_html_source - %h2.external Alert ID external - = @alert.get_safe_html_alert_id - %h2.internal Alert ID internal - = @alert.id - %h2.raised_at Last raised - = @alert.raised? ? @alert.raised_at : "Not yet raised" - %h2.acknowledged_at Acknowledged - = @alert.acknowledged? ? @alert.acknowledged_at : "Not acknowledged" - %h2.cleared_at Cleared - = @alert.cleared? ? @alert.cleared_at : "Not cleared" - %h2.alert_group Alert group - The first matching one is used: - = AlertGroup.matches(@alert).map{|g| g.name}.join("; ") - %h2.changes Notifications sent out - .changes - %ul - - @alert.changes.each do |change| - - if change.was_relevant? - %li - %strong= change.level - = change.update_type - notification to - = change.person - at - = change.at - %h2.actions Actions (ugly) + = partial('head') + %body + =partial("navbar") + .container + %h1 Alert detail + %table + %tr + %th.summary{:title => "Text for humans describing the nature of the alert, first 100 characters are only ones guaranteed to make it to pagers, twitter, SMS etc."} Summary + %td= @alert.summary + %tr + %th.summary{:title => "The server/entity that this alert concerns"} Subject + %td= @alert.subject + %tr + %th{:title => "The server/entitiy that originated the alert"} Source + %td= @alert.source + %tr + %th{:title => "HTML fragment describing the alert in more detail, no limit on length."} Detail + %td= @alert.detail + %tr + %th{:title => "ID set by the source of the alert."} Alert ID + %td= @alert.alert_id + %tr + %th{:title => "The groups in the Mauve server configuration that match this alert"} Alert groups + %td= Mauve::AlertGroup.matches(@alert).map{|g| g.name}.join("; ") + %tr + %th{:title => "The level of the first group in the Mauve server configuration that matched this alert"} Alert level + %td= @alert.level.to_s.upcase + -if @alert.raised? + %tr + %th{:title => "The time at which the alert was raised"} Raised at + %td= @alert.raised_at.to_s_human + -if @alert.acknowledged? + %tr + %th{:title => "The time at which the alert was acknowledged"} Acknowledged at + %td= @alert.acknowledged_at.to_s_human + " by " + @alert.acknowledged_by + " until " + @alert.will_unacknowledge_at.to_s_human + -if @alert.will_raise_at + %tr + %th{:title => "The time at which the alert will be automatically raised"} Will raise at + %td= @alert.will_raise_at.to_s_human + -if @alert.cleared_at + %tr + %th{:title => "The time at which the alert was last cleared"} Last cleared at + %td= @alert.cleared_at.to_s_human + -if @alert.will_clear_at + %tr + %th{:title => "The time at which the alert will be automatically cleared"} Will clear + %td= @alert.will_raise_at.to_s_human + %tr + %th Notifications sent out + %td + %ul + - @alert.changes.each do |change| + - if change.was_relevant? + %li + %strong= change.level + = change.update_type + notification to + = change.person + at + = change.at.to_s_human + + %h2 Actions - if !@alert.acknowledged? %form{:method => :post, :action => "/alert/#{@alert.id}/acknowledge"} - %input{:type => :submit, :value => "Acknowledge this alert"} - %h2.actions_dangerous Dangerous actions (also ugly) - - if @alert.raised? - %form{:method => :post, :action => "/alert/#{@alert.id}/clear"} - %input.dangerous{:type => :submit, :value => "Clear this alert"} + =partial("acknowledge_input") + - else + %form.hidden{:method => :post, :action => "/alert/#{@alert.id}/unacknowledge"} + %input{:type => :submit, :value => "Unacknowledge this alert"} + %a#hide{:onclick => "$('form.hidden').toggle(); return false", :href=>"#"} Show other actions - if @alert.cleared? - %form{:method => :post, :action => "/alert/#{@alert.id}/raise"} - %input.dangerous{:type => :submit, :value => "Raise this alert"} + %form.hidden{:method => :post, :action => "/alert/#{@alert.id}/raise"} + %input{:type => :submit, :value => "Raise this alert"} + - if @alert.raised? + %form.hidden{:method => :post, :action => "/alert/#{@alert.id}/clear"} + %input{:type => :submit, :value => "Clear this alert"} + %form.hidden{:method => :post, :action => "/alert/#{@alert.id}/destroy"} + %input{:type => :submit, :value => "Destroy this alert"} diff --git a/views/alerts.haml b/views/alerts.haml index e2a8c82..2d871cc 100644 --- a/views/alerts.haml +++ b/views/alerts.haml @@ -1,64 +1,12 @@ -!!! HTML5 +!!! 5 %html - %head - %meta{:name=>"viewport", :content=>"width=device-width"}/ - %title #{@title}: Alerts - %link{:rel => "stylesheet", :href => "/stylesheets/bytemark.css"}/ - %link{:rel => "stylesheet", :href => "/stylesheets/mauve.css"}/ - %script{:src => '/javascript/prototype/prototype.js', :type => 'text/javascript'} - %script{:src => '/javascript/scriptaculous/scriptaculous.js', :type => 'text/javascript'} + = partial('head') %body - = partial('navbar') - %h1 Mauve Alerts - %form - %table - %tr - %th - %input{ :type => "checkbox", :name => "all" } - %th Lvl - %th Subject - %th Summary - %th Raised at - %th Actions - - count = 0 - - @grouped_alerts.each do |group, alerts| - - count += 1 - - row_class = [ count % 2 == 0 && "hilight", alerts.first.raised? && "triggered", alerts.first.acknowledged? && "acknowledged"] - - first_n = (alerts.length > 2 ? 1 : 2) - - alerts.first(first_n).each do |alert| - %tr{ :class => row_class, :id => ["summary", alert.id] } - %td - %input{ :type => "checkbox", :name => alert.id } - %td #{alert.level} - %td #{alert.subject} - %td - #{alert.summary} - %a{ :href => "/alert/#{alert.id}", :onclick => "$('detail_#{alert.id}').toggle(); return false;"} show details ↓ - %td #{alert.raised_at} - %td arse - %tr{ :class => %w(detail) + row_class, :id => ["detail", alert.id], :style => "display: none;" } - %td   - %td{:colspan => 5} - = partial(:detail, :locals => {:alert => alert}) - %p - Source: #{alert.source} • - %a{ :href => "/alert/#{alert.id}" } More details - • - %a{ :href => "#", :onclick => "$('detail_#{alert.id}').hide(); return false;"} Hide details ↑ - - if alerts.length > 2 - %tr{ :class => [ count % 2 == 0 && "hilight", alerts.first.raised? && "triggered", alerts.first.acknowledged? && "acknowledged"]} - %td   - %td{:colspan => 5} There are #{alerts.length - 1} more alerts in this group. - %tr - %td{:colspan => 6} - Acknowledge these alerts for - %input{ :name => 'hours', :type => "number", :min => 1, :max => 24, :value => 2} - %select - %option{ :value => "daytime" } daytime - %option{ :value => "working" } working - %option{ :value => "wall" } wall - hours (until - %span{:id => "ack_until"} - = Time.now + 2 - ) - %input{ :type => 'submit' } + =partial("navbar") + .container + - if @grouped_alerts.length > 0 + = partial('alerts_table') + - else + .notice + %p No alerts to display. + diff --git a/views/alerts2.haml b/views/alerts2.haml deleted file mode 100644 index ad0f0d3..0000000 --- a/views/alerts2.haml +++ /dev/null @@ -1,18 +0,0 @@ -!!! -%html - %head - %meta{:name=>"viewport", :content=>"width=device-width"} - %title Current alerts (logged in as #{@person.username}) - %link{:rel => "stylesheet", :href => "/alerts2.css"} - %script{:type => "text/javascript", :src => "/jquery-1.4.2.min.js"} - %script{:type => "text/javascript", :src => "/jquery.treeview.pack.js"} - %script{:type => "text/javascript", :src => "/jquery.cookie.js"} - %script{:type => "text/javascript", :src => "/jquery.pop.js"} - //%script{:type => "text/javascript", :src => "/jquery.countdown.js"} - %script{:type => "text/javascript", :src => "/mauve.js"} - %body - .darkMask - .head= partial("head3") - .unacknowledged= partial("unacknowledged") - .acknowledge= partial("acknowledge") - .updateAlertStatus= partial("jqChangeStatus") diff --git a/views/events.haml b/views/events.haml deleted file mode 100644 index 324e3b5..0000000 --- a/views/events.haml +++ /dev/null @@ -1,22 +0,0 @@ -!!! -%html - %head - %title #{@title}: Last events (logged in as #{@person.username}) - %link{:rel => "stylesheet", :href => "/alerts.css"} - %script{:type => "text/javascript", :src => "/prototype.js"} - %script{:type => "text/javascript", :src => "/mauve_utils.js"} - %body{:onLoad => "addAutoHover(); addRefresh();"} - #header - %h1= @title - #errors{:style => "display: none;"} - %h1 - Trouble! - ( - %a{:href=>"#", :onClick => "clearErrors();"} hide - ) - %ul#errors_list - %p Either the alert server or your internet connection is malfunctioning, so you may want to try refreshing the page. - #alert_counts= partial("alert_counts") - #navigation= partial("navigation") - #event_list= partial("event_list", :locals => {:alerts => @alerts}) - diff --git a/views/events.haml b/views/events.haml new file mode 120000 index 0000000..3b8d2e2 --- /dev/null +++ b/views/events.haml @@ -0,0 +1 @@ +not_implemented.haml \ No newline at end of file diff --git a/views/login.haml b/views/login.haml index 225c2e8..06e5320 100644 --- a/views/login.haml +++ b/views/login.haml @@ -1,27 +1,17 @@ -!!! XML -!!! +!!! 5 %html - %head - %meta{:name=>"viewport", :content=>"width=device-width"}/ - %title #{@title}: Authentication required - %link{:rel => "stylesheet", :href => "/stylesheets/bytemark.css"}/ - %link{:rel => "stylesheet", :href => "/stylesheets/mauve.css"}/ - %script{:src => 'javascript/jquery/jquery.js', :type => 'text/javascript'} + =partial("head") %body = partial('navbar') - %h1 Mauve Alerts - - if flash['error'] - %p.error= flash['error'] - %form{:action => '/login', :method => :POST} - %fieldset - %legend Please log in - %label{:for => "username"} Username - %input{:name => 'username', :type => 'text'}/ - %br - %label{:for => "password", :title => "This is either your Single Sign On password or a PIN."} Password / PIN - %input{:name => 'password', :type => 'password'}/ - %br - %input{:type => 'hidden', :name => 'next_page', :value => @next_page}/ - %input{:type => 'submit', :value => 'Log in'}/ - - + .container + %form{:action => '/login', :method => :POST} + %fieldset + %legend Please log in + %label{:for => "username"} Username + %input{:name => 'username', :type => 'text', :autocorrect => "off", :autocapitalize => "off"}/ + %br + %label{:for => "password", :title => "This is either your Single Sign On password or a PIN."} Password / PIN + %input{:name => 'password', :type => 'password'}/ + %br + %input{:type => 'hidden', :name => 'next_page', :value => @next_page}/ + %input{:type => 'submit', :value => 'Log in'}/ diff --git a/views/not_implemented.haml b/views/not_implemented.haml new file mode 100644 index 0000000..a07b00d --- /dev/null +++ b/views/not_implemented.haml @@ -0,0 +1,7 @@ +!!! 5 +%html + = partial('head') + %body + =partial("navbar") + .container + .error Not implemented diff --git a/views/preferences.haml b/views/preferences.haml deleted file mode 100644 index c39c108..0000000 --- a/views/preferences.haml +++ /dev/null @@ -1,24 +0,0 @@ -!!! -%html - %head - %title #{@title}: My preferences (logged in as #{@person.username}) - %link{:rel => "stylesheet", :href => "/alerts.css"} - %script{:type => "text/javascript", :src => "/prototype.js"} - %script{:type => "text/javascript", :src => "/mauve_utils.js"} - %script{:type => "text/javascript", :src => "/datadumper.js"} - %body{:onLoad => "addAutoHover(); addRefresh();"} - #header - %h1= @title - #errors{:style => "display: none;"} - %h1 - Trouble! - ( - %a{:href=>"#", :onClick => "clearErrors();"} hide - ) - %ul#errors_list - %p Either the alert server or your internet connection is malfunctioning, so you may want to try refreshing the page. - #alert_counts= partial("alert_counts") - #navigation= partial("navigation") - %h1 Not implemented yet - - diff --git a/views/preferences.haml b/views/preferences.haml new file mode 120000 index 0000000..3b8d2e2 --- /dev/null +++ b/views/preferences.haml @@ -0,0 +1 @@ +not_implemented.haml \ No newline at end of file -- cgit v1.2.1