flapjack 0.7.35 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -1
  3. data/Gemfile +3 -4
  4. data/Guardfile +1 -1
  5. data/README.md +38 -19
  6. data/Rakefile +1 -3
  7. data/etc/flapjack_config.yaml.example +11 -1
  8. data/features/steps/cli_steps.rb +3 -3
  9. data/features/steps/events_steps.rb +7 -6
  10. data/features/steps/flapjack-netsaint-parser_steps.rb +8 -8
  11. data/features/steps/notifications_steps.rb +10 -10
  12. data/features/steps/packaging-lintian_steps.rb +5 -9
  13. data/features/steps/time_travel_steps.rb +1 -1
  14. data/flapjack.gemspec +4 -3
  15. data/lib/flapjack/data/contact.rb +78 -6
  16. data/lib/flapjack/data/entity.rb +11 -2
  17. data/lib/flapjack/data/notification_rule.rb +67 -59
  18. data/lib/flapjack/data/semaphore.rb +44 -0
  19. data/lib/flapjack/gateways/api.rb +24 -28
  20. data/lib/flapjack/gateways/api/contact_methods.rb +1 -2
  21. data/lib/flapjack/gateways/api/entity_methods.rb +3 -3
  22. data/lib/flapjack/gateways/jsonapi.rb +249 -0
  23. data/lib/flapjack/gateways/jsonapi/contact_methods.rb +544 -0
  24. data/lib/flapjack/gateways/jsonapi/entity_check_presenter.rb +217 -0
  25. data/lib/flapjack/gateways/jsonapi/entity_methods.rb +350 -0
  26. data/lib/flapjack/gateways/jsonapi/entity_presenter.rb +75 -0
  27. data/lib/flapjack/gateways/jsonapi/rack/json_params_parser.rb +32 -0
  28. data/lib/flapjack/gateways/web.rb +78 -12
  29. data/lib/flapjack/gateways/web/public/css/bootstrap-theme.css +397 -0
  30. data/lib/flapjack/gateways/web/public/css/bootstrap-theme.min.css +7 -0
  31. data/lib/flapjack/gateways/web/public/css/bootstrap.css +7118 -0
  32. data/lib/flapjack/gateways/web/public/css/bootstrap.min.css +6 -8
  33. data/lib/flapjack/gateways/web/public/css/font-awesome.css +1338 -0
  34. data/lib/flapjack/gateways/web/public/css/font-awesome.min.css +4 -0
  35. data/lib/flapjack/gateways/web/public/css/screen.css +80 -0
  36. data/lib/flapjack/gateways/web/public/css/select2-bootstrap.css +87 -0
  37. data/lib/flapjack/gateways/web/public/css/select2.css +615 -0
  38. data/lib/flapjack/gateways/web/public/fonts/FontAwesome.otf +0 -0
  39. data/lib/flapjack/gateways/web/public/fonts/fontawesome-webfont.eot +0 -0
  40. data/lib/flapjack/gateways/web/public/fonts/fontawesome-webfont.svg +414 -0
  41. data/lib/flapjack/gateways/web/public/fonts/fontawesome-webfont.ttf +0 -0
  42. data/lib/flapjack/gateways/web/public/fonts/fontawesome-webfont.woff +0 -0
  43. data/lib/flapjack/gateways/web/public/fonts/glyphicons-halflings-regular.eot +0 -0
  44. data/lib/flapjack/gateways/web/public/fonts/glyphicons-halflings-regular.svg +229 -0
  45. data/lib/flapjack/gateways/web/public/fonts/glyphicons-halflings-regular.ttf +0 -0
  46. data/lib/flapjack/gateways/web/public/fonts/glyphicons-halflings-regular.woff +0 -0
  47. data/lib/flapjack/gateways/web/public/img/flapjack-2013-notext-transparent-300-300.png +0 -0
  48. data/lib/flapjack/gateways/web/public/img/select2.png +0 -0
  49. data/lib/flapjack/gateways/web/public/img/select2x2.png +0 -0
  50. data/lib/flapjack/gateways/web/public/js/backbone-min.js +2 -0
  51. data/lib/flapjack/gateways/web/public/js/backbone.js +1581 -0
  52. data/lib/flapjack/gateways/web/public/js/backbone.jsonapi.js +75 -0
  53. data/lib/flapjack/gateways/web/public/js/bootstrap.js +2276 -0
  54. data/lib/flapjack/gateways/web/public/js/contacts.js +225 -0
  55. data/lib/flapjack/gateways/web/public/js/jquery-1.10.2.js +9789 -0
  56. data/lib/flapjack/gateways/web/public/js/jquery-1.10.2.min.js +6 -0
  57. data/lib/flapjack/gateways/web/public/js/select2.js +3255 -0
  58. data/lib/flapjack/gateways/web/public/js/select2.min.js +22 -0
  59. data/lib/flapjack/gateways/web/public/js/underscore-min.js +6 -0
  60. data/lib/flapjack/gateways/web/public/js/underscore.js +1276 -0
  61. data/lib/flapjack/gateways/web/views/check.html.erb +423 -193
  62. data/lib/flapjack/gateways/web/views/checks.html.erb +51 -71
  63. data/lib/flapjack/gateways/web/views/contact.html.erb +142 -164
  64. data/lib/flapjack/gateways/web/views/contacts.html.erb +20 -40
  65. data/lib/flapjack/gateways/web/views/edit_contacts.html.erb +83 -0
  66. data/lib/flapjack/gateways/web/views/entities.html.erb +18 -37
  67. data/lib/flapjack/gateways/web/views/entity.html.erb +46 -65
  68. data/lib/flapjack/gateways/web/views/index.html.erb +6 -27
  69. data/lib/flapjack/gateways/web/views/layout.erb +95 -0
  70. data/lib/flapjack/gateways/web/views/self_stats.html.erb +100 -114
  71. data/lib/flapjack/pikelet.rb +4 -2
  72. data/lib/flapjack/version.rb +1 -1
  73. data/spec/lib/flapjack/coordinator_spec.rb +120 -120
  74. data/spec/lib/flapjack/data/contact_spec.rb +66 -58
  75. data/spec/lib/flapjack/data/entity_check_spec.rb +179 -179
  76. data/spec/lib/flapjack/data/entity_spec.rb +71 -71
  77. data/spec/lib/flapjack/data/event_spec.rb +34 -30
  78. data/spec/lib/flapjack/data/message_spec.rb +6 -6
  79. data/spec/lib/flapjack/data/notification_rule_spec.rb +24 -24
  80. data/spec/lib/flapjack/data/notification_spec.rb +19 -19
  81. data/spec/lib/flapjack/data/semaphore_spec.rb +24 -0
  82. data/spec/lib/flapjack/data/tag_spec.rb +11 -10
  83. data/spec/lib/flapjack/gateways/api/contact_methods_spec.rb +201 -201
  84. data/spec/lib/flapjack/gateways/api/entity_check_presenter_spec.rb +55 -55
  85. data/spec/lib/flapjack/gateways/api/entity_methods_spec.rb +257 -257
  86. data/spec/lib/flapjack/gateways/api/entity_presenter_spec.rb +26 -26
  87. data/spec/lib/flapjack/gateways/api_spec.rb +1 -1
  88. data/spec/lib/flapjack/gateways/email_spec.rb +4 -4
  89. data/spec/lib/flapjack/gateways/jabber_spec.rb +77 -77
  90. data/spec/lib/flapjack/gateways/jsonapi/contact_methods_spec.rb +830 -0
  91. data/spec/lib/flapjack/gateways/jsonapi/entity_check_presenter_spec.rb +211 -0
  92. data/spec/lib/flapjack/gateways/jsonapi/entity_methods_spec.rb +863 -0
  93. data/spec/lib/flapjack/gateways/jsonapi/entity_presenter_spec.rb +108 -0
  94. data/spec/lib/flapjack/gateways/jsonapi_spec.rb +8 -0
  95. data/spec/lib/flapjack/gateways/oobetet_spec.rb +35 -35
  96. data/spec/lib/flapjack/gateways/pagerduty_spec.rb +40 -40
  97. data/spec/lib/flapjack/gateways/sms_messagenet_spec.rb +3 -3
  98. data/spec/lib/flapjack/gateways/web/views/check.html.erb_spec.rb +1 -1
  99. data/spec/lib/flapjack/gateways/web/views/contact.html.erb_spec.rb +5 -5
  100. data/spec/lib/flapjack/gateways/web/views/index.html.erb_spec.rb +1 -1
  101. data/spec/lib/flapjack/gateways/web_spec.rb +73 -74
  102. data/spec/lib/flapjack/logger_spec.rb +13 -13
  103. data/spec/lib/flapjack/pikelet_spec.rb +33 -33
  104. data/spec/lib/flapjack/processor_spec.rb +22 -22
  105. data/spec/lib/flapjack/redis_pool_spec.rb +1 -1
  106. data/spec/lib/flapjack/utility_spec.rb +12 -12
  107. data/spec/spec_helper.rb +9 -9
  108. data/spec/support/erb_view_helper.rb +4 -0
  109. metadata +107 -96
  110. data/lib/flapjack/gateways/web/public/css/flapjack.css +0 -49
  111. data/lib/flapjack/gateways/web/views/_css.html.erb +0 -42
  112. data/lib/flapjack/gateways/web/views/_foot.html.erb +0 -3
  113. data/lib/flapjack/gateways/web/views/_head.html.erb +0 -5
  114. data/lib/flapjack/gateways/web/views/_nav.html.erb +0 -10
@@ -1,77 +1,57 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <% nav = render_erb('_nav.html.erb', binding) %>
5
- <% head = render_erb('_head.html.erb', binding) %>
6
- <% foot = render_erb('_foot.html.erb', binding) %>
7
- <title>Flapjack - <%= @adjective.capitalize %> Checks</title>
8
- <%= head %>
9
- </head>
10
- <body>
11
- <div id="wrap">
12
- <div class="container">
13
- <div class="page-header">
14
- <%= nav %>
15
- <h2><%= @adjective.capitalize %> Checks</h2>
16
- </div>
1
+ <% page_title "#{@adjective.capitalize} Checks" %>
17
2
 
18
- <p><%= h @count_failing_checks %> failing out of <%= h @count_all_checks %></p>
3
+ <div class="page-header">
4
+ <h2><%= @adjective.capitalize %> Checks</h2>
5
+ </div>
19
6
 
20
- <table class="table table-bordered table-hover table-condensed">
21
- <tr>
22
- <th>Entity</th>
23
- <th>Check</th>
24
- <th>State</th>
25
- <th>Summary</th>
26
- <th>Last State Change</th>
27
- <th>Last Update</th>
28
- <th>Last Notification</th>
29
- </tr>
30
- <% @entities_sorted.each do |entity| %>
31
- <% row_entity = nil %>
32
- <% entity_link = "/entity/" << u(entity) %>
33
- <% @states[entity].each do |check, status, summary, changed, updated, in_unscheduled_outage, in_scheduled_outage, notified| %>
34
- <%
35
- row_colour = case status
36
- when 'critical', 'unknown'
37
- 'error'
38
- when 'ok', 'up'
39
- 'success'
40
- else
41
- status
42
- end
7
+ <p><%= h @count_failing_checks %> failing out of <%= h @count_all_checks %></p>
43
8
 
44
- check_link = "/check?entity=" << u(entity) << "&amp;check=" << u(check)
9
+ <table class="table table-bordered table-hover table-condensed">
10
+ <tr>
11
+ <th>Entity</th>
12
+ <th>Check</th>
13
+ <th>State</th>
14
+ <th>Summary</th>
15
+ <th>Last State Change</th>
16
+ <th>Last Update</th>
17
+ <th>Last Notification</th>
18
+ </tr>
19
+ <% @entities_sorted.each do |entity| %>
20
+ <% row_entity = nil %>
21
+ <% entity_link = "/entity/" << u(entity) %>
22
+ <% @states[entity].each do |check, status, summary, changed, updated, in_unscheduled_outage, in_scheduled_outage, notified| %>
23
+ <%
24
+ row_colour = case status
25
+ when 'critical', 'unknown'
26
+ 'error'
27
+ when 'ok', 'up'
28
+ 'success'
29
+ else
30
+ status
31
+ end
45
32
 
46
- %>
47
- <tr class="<%= row_colour %>">
48
- <% unless row_entity && entity == row_entity %>
49
- <td rowspan=<%= @states[entity].length %>>
50
- <a href="<%= entity_link %>"><%= h entity %></a>
51
- </td>
52
- <% row_entity = entity %>
53
- <% end %>
54
- <td><a href="<%= check_link %>" title="check detail"><%= h check %></a></td>
55
- <td class="<%= status %>">
56
- <%= h status.upcase %>
57
- <% if in_unscheduled_outage%> (Ack'd)<% end %>
58
- <% if in_scheduled_outage %> (Sched)<% end %>
59
- </td>
60
- <td><%= h summary %></td>
61
- <td><%= h changed %></td>
62
- <td><%= h updated %></td>
63
- <td><%= h notified %></td>
64
- </tr>
33
+ check_link = "/check?entity=" << u(entity) << "&amp;check=" << u(check)
65
34
 
66
- <% end %>
67
- <% end %>
68
- </table>
35
+ %>
36
+ <tr class="<%= row_colour %>">
37
+ <% unless row_entity && entity == row_entity %>
38
+ <td rowspan=<%= @states[entity].length %>>
39
+ <a href="<%= entity_link %>"><%= h entity %></a>
40
+ </td>
41
+ <% row_entity = entity %>
42
+ <% end %>
43
+ <td><a href="<%= check_link %>" title="check detail"><%= h check %></a></td>
44
+ <td class="<%= status %>">
45
+ <%= h status.upcase %>
46
+ <% if in_unscheduled_outage%> (Ack'd)<% end %>
47
+ <% if in_scheduled_outage %> (Sched)<% end %>
48
+ </td>
49
+ <td><%= h summary %></td>
50
+ <td><%= h changed %></td>
51
+ <td><%= h updated %></td>
52
+ <td><%= h notified %></td>
53
+ </tr>
69
54
 
70
- </div>
71
- <div id="push"></div>
72
- </div>
73
- <div id="footer">
74
- <%= foot %>
75
- </div>
76
- </body>
77
- </html>
55
+ <% end %>
56
+ <% end %>
57
+ </table>
@@ -1,174 +1,152 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <% nav = render_erb('_nav.html.erb', binding) %>
5
- <% head = render_erb('_head.html.erb', binding) %>
6
- <% foot = render_erb('_foot.html.erb', binding) %>
7
- <title>Flapjack - <%= h @contact.name %> (contact)</title>
8
- <%= head %>
9
- </head>
10
- <body>
11
- <div id="wrap">
12
- <div class="container">
13
- <div class="page-header">
14
- <%= nav %>
15
- <h2><%= h @contact.name %></h2>
16
- </div>
1
+ <div class="page-header">
2
+ <h2><%= h @contact.name %></h2>
3
+ </div>
17
4
 
18
- <% alerting = {} %>
5
+ <% alerting = {} %>
19
6
 
20
- <h3>Contact Media</h3>
21
- <% if !@contact.media || @contact.media.empty? %>
22
- <p>No media</p>
23
- <% else %>
24
- <table class="table table-bordered table-hover table-condensed">
25
- <tr>
26
- <th>Media</th>
27
- <th>Address</th>
28
- <th>Interval</th>
29
- <th>Summary Mode</th>
30
- <th>Summary Threshold</th>
31
- </tr>
32
- <% @contact.media.each_pair do |mk, mv| %>
33
- <% alerting_checks = @contact.alerting_checks_for_media(mk) %>
34
- <% alerting[mk] = alerting_checks unless (alerting_checks.nil? || alerting_checks.empty?) %>
35
- <tr>
36
- <% if 'pagerduty'.eql?(mk) %>
37
- <td>PagerDuty</td>
38
- <td>
39
- <% @pagerduty_credentials.each_pair do |pk, pv| %>
40
- <p><%= 'password'.eql?(pk) ? h("#{pk}: ...") : h("#{pk}: #{pv}") %></p>
41
- <% end %>
42
- </td>
43
- <td></td>
44
- <td></td>
45
- <td></td>
46
- <% else %>
47
- <td><%= h mk.capitalize %></td>
48
- <td><%= h mv %></td>
49
- <td>
50
- <% if @contact.media_intervals[mk] %>
51
- <%= h @contact.media_intervals[mk] %> seconds
52
- <% else %>
53
- no custom interval
54
- <% end %>
55
- </td>
56
- <td>
57
- <% rollup_threshold = @contact.media_rollup_thresholds[mk] %>
58
- <% num_alerting = alerting[mk].nil? ? 0 : alerting[mk].length %>
59
- <% if rollup_threshold.nil? || (num_alerting < rollup_threshold.to_i) %>
60
- No -
61
- <% else %>
62
- Yes -
63
- <% end %>
64
- <%= num_alerting %> alerting
65
- </td>
66
- <td>
67
- <% if rollup_threshold.nil? %>
68
- -
69
- <% else %>
70
- <%= h rollup_threshold %>
71
- <% end %>
72
- </td>
73
- <% end %>
74
- </tr>
7
+ <h3>Contact Media</h3>
8
+ <% if !@contact.media || @contact.media.empty? %>
9
+ <p>No media</p>
10
+ <% else %>
11
+ <table class="table table-bordered table-hover table-condensed">
12
+ <tr>
13
+ <th>Media</th>
14
+ <th>Address</th>
15
+ <th>Interval</th>
16
+ <th>Summary Mode</th>
17
+ <th>Summary Threshold</th>
18
+ </tr>
19
+ <% @contact.media.each_pair do |mk, mv| %>
20
+ <% alerting_checks = @contact.alerting_checks_for_media(mk) %>
21
+ <% alerting[mk] = alerting_checks unless (alerting_checks.nil? || alerting_checks.empty?) %>
22
+ <tr>
23
+ <% if 'pagerduty'.eql?(mk) %>
24
+ <td>PagerDuty</td>
25
+ <td>
26
+ <% @pagerduty_credentials.each_pair do |pk, pv| %>
27
+ <p><%= 'password'.eql?(pk) ? h("#{pk}: ...") : h("#{pk}: #{pv}") %></p>
75
28
  <% end %>
76
- </table>
77
- <% end %>
78
-
79
- <h3>Alerting Checks</h3>
80
- <p>Alerting checks are any that are failing, not acknowledged, not in scheduled maintenance, and currently allowed by this contact's notification rules.</p>
81
-
82
- <% if alerting.empty? %>
83
- <p><em>There are no currently alerting checks.</em></p>
29
+ </td>
30
+ <td></td>
31
+ <td></td>
32
+ <td></td>
84
33
  <% else %>
85
- <table class="table table-bordered table-hover table-condensed">
86
- <tr>
87
- <th>Media</th>
88
- <th>Alerting Checks</th>
89
- </tr>
90
- <% alerting.each_pair do |media, checks| %>
91
- <% if checks.length > 0 %>
92
- <tr>
93
- <td><%= h media.capitalize %></td>
94
- <td>
95
- <% checks.each do |entity_check| %>
96
- <% entity, check = entity_check.split(':', 2) %>
97
- <% check_link = "<a href=\"/check?entity=#{u(entity)}&amp;check=#{u(check)}\" title=\"check status\">" +
98
- h(check) + "</a>"%>
99
- <a href="/entity/<%= u(entity) %>" title="entity status"><%= h entity %></a> ::
100
- <%= check_link %> <br />
101
- <% end %>
102
- </td>
103
- </tr>
104
- <% end %>
34
+ <td><%= h mk.capitalize %></td>
35
+ <td><%= h mv %></td>
36
+ <td>
37
+ <% if @contact.media_intervals[mk] %>
38
+ <%= h @contact.media_intervals[mk] %> seconds
39
+ <% else %>
40
+ no custom interval
105
41
  <% end %>
106
- </table>
107
- <% end %>
108
-
109
- <h3>Notification Rules</h3>
110
- <% rules = @contact.notification_rules %>
111
- <% if !rules || rules.empty? %>
112
- <p>No notification rules</p>
113
- <% else %>
114
- <table class="table table-bordered table-hover table-condensed">
115
- <tr>
116
- <th>ID</th>
117
- <th>Entities</th>
118
- <th>Tags</th>
119
- <th>Warning Media</th>
120
- <th>Critical Media</th>
121
- <th>Time Restrictions</th>
122
- <th>Blackholes</th>
123
- </tr>
124
- <% rules.each do |rule| %>
125
- <tr>
126
- <td><%= h rule.id %></td>
127
- <td><%= h( (rule.entities && !rule.entities.empty?) ? rule.entities.join(', ') : '-') %></td>
128
- <td><%= h( (rule.tags && !rule.tags.empty?) ? rule.tags.to_a.join(', ') : '-') %></td>
129
- <td><%= h( (rule.warning_media && !rule.warning_media.empty?) ? rule.warning_media.join(', ') : '-')%></td>
130
- <td><%= h( (rule.critical_media && !rule.critical_media.empty?) ? rule.critical_media.join(', ') : '-') %></td>
131
- <td><%= h(rule.time_restrictions) %></td>
132
- <% blackholes = [] %>
133
- <% blackholes << 'Warning' if rule.warning_blackhole %>
134
- <% blackholes << 'Critical' if rule.critical_blackhole %>
135
- <td><%= h(blackholes.join(', ')) %></td>
136
- </tr>
42
+ </td>
43
+ <td>
44
+ <% rollup_threshold = @contact.media_rollup_thresholds[mk] %>
45
+ <% num_alerting = alerting[mk].nil? ? 0 : alerting[mk].length %>
46
+ <% if rollup_threshold.nil? || (num_alerting < rollup_threshold.to_i) %>
47
+ No -
48
+ <% else %>
49
+ Yes -
50
+ <% end %>
51
+ <%= num_alerting %> alerting
52
+ </td>
53
+ <td>
54
+ <% if rollup_threshold.nil? %>
55
+ -
56
+ <% else %>
57
+ <%= h rollup_threshold %>
137
58
  <% end %>
138
- </table>
59
+ </td>
139
60
  <% end %>
61
+ </tr>
62
+ <% end %>
63
+ </table>
64
+ <% end %>
140
65
 
141
- <h3>All Entities and Checks</h3>
142
- <% if !@entities_and_checks || @entities_and_checks.empty? %>
143
- <p>No entities</p>
144
- <% else %>
145
- <table class="table table-bordered table-hover table-condensed">
146
- <tr>
147
- <th>Entity</th>
148
- <th>Checks</th>
149
- </tr>
150
- <% @entities_and_checks.each do |ec| %>
151
- <%
152
- entity = ec[:entity]
153
- checks = ec[:checks]
154
- %>
155
- <tr>
156
- <td><a href="/entity/<%= u(entity.name) %>" title="entity status"><%= h entity.name %></a></td>
157
- <td>
158
- <% checks.each do |check| %>
159
- <%= "<a href=\"/check?entity=#{u(entity.name)}&amp;check=#{u(check)}\" title=\"check status\">#{ h check }</a>" %>
160
- <% end %>
161
- </td>
162
- </tr>
66
+ <h3>Alerting Checks</h3>
67
+ <p>Alerting checks are any that are failing, not acknowledged, not in scheduled maintenance, and currently allowed by this contact's notification rules.</p>
68
+
69
+ <% if alerting.empty? %>
70
+ <p><em>There are no currently alerting checks.</em></p>
71
+ <% else %>
72
+ <table class="table table-bordered table-hover table-condensed">
73
+ <tr>
74
+ <th>Media</th>
75
+ <th>Alerting Checks</th>
76
+ </tr>
77
+ <% alerting.each_pair do |media, checks| %>
78
+ <% if checks.length > 0 %>
79
+ <tr>
80
+ <td><%= h media.capitalize %></td>
81
+ <td>
82
+ <% checks.each do |entity_check| %>
83
+ <% entity, check = entity_check.split(':', 2) %>
84
+ <% check_link = "<a href=\"/check?entity=#{u(entity)}&amp;check=#{u(check)}\" title=\"check status\">" +
85
+ h(check) + "</a>"%>
86
+ <a href="/entity/<%= u(entity) %>" title="entity status"><%= h entity %></a> ::
87
+ <%= check_link %> <br />
163
88
  <% end %>
164
- </table>
165
- <% end %>
89
+ </td>
90
+ </tr>
91
+ <% end %>
92
+ <% end %>
93
+ </table>
94
+ <% end %>
95
+
96
+ <h3>Notification Rules</h3>
97
+ <% rules = @contact.notification_rules %>
98
+ <% if !rules || rules.empty? %>
99
+ <p>No notification rules</p>
100
+ <% else %>
101
+ <table class="table table-bordered table-hover table-condensed">
102
+ <tr>
103
+ <th>ID</th>
104
+ <th>Entities</th>
105
+ <th>Tags</th>
106
+ <th>Warning Media</th>
107
+ <th>Critical Media</th>
108
+ <th>Time Restrictions</th>
109
+ <th>Blackholes</th>
110
+ </tr>
111
+ <% rules.each do |rule| %>
112
+ <tr>
113
+ <td><%= h rule.id %></td>
114
+ <td><%= h( (rule.entities && !rule.entities.empty?) ? rule.entities.join(', ') : '-') %></td>
115
+ <td><%= h( (rule.tags && !rule.tags.empty?) ? rule.tags.to_a.join(', ') : '-') %></td>
116
+ <td><%= h( (rule.warning_media && !rule.warning_media.empty?) ? rule.warning_media.join(', ') : '-')%></td>
117
+ <td><%= h( (rule.critical_media && !rule.critical_media.empty?) ? rule.critical_media.join(', ') : '-') %></td>
118
+ <td><%= h(rule.time_restrictions) %></td>
119
+ <% blackholes = [] %>
120
+ <% blackholes << 'Warning' if rule.warning_blackhole %>
121
+ <% blackholes << 'Critical' if rule.critical_blackhole %>
122
+ <td><%= h(blackholes.join(', ')) %></td>
123
+ </tr>
124
+ <% end %>
125
+ </table>
126
+ <% end %>
166
127
 
167
- </div>
168
- <div id="push"></div>
169
- </div>
170
- <div id="footer">
171
- <%= foot %>
172
- </div>
173
- </body>
174
- </html>
128
+ <h3>All Entities and Checks</h3>
129
+ <% if !@entities_and_checks || @entities_and_checks.empty? %>
130
+ <p>No entities</p>
131
+ <% else %>
132
+ <table class="table table-bordered table-hover table-condensed">
133
+ <tr>
134
+ <th>Entity</th>
135
+ <th>Checks</th>
136
+ </tr>
137
+ <% @entities_and_checks.each do |ec| %>
138
+ <%
139
+ entity = ec[:entity]
140
+ checks = ec[:checks]
141
+ %>
142
+ <tr>
143
+ <td><a href="/entity/<%= u(entity.name) %>" title="entity status"><%= h entity.name %></a></td>
144
+ <td>
145
+ <% checks.each do |check| %>
146
+ <%= "<a href=\"/check?entity=#{u(entity.name)}&amp;check=#{u(check)}\" title=\"check status\">#{ h check }</a>" %>
147
+ <% end %>
148
+ </td>
149
+ </tr>
150
+ <% end %>
151
+ </table>
152
+ <% end %>
@@ -1,42 +1,22 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <% nav = render_erb('_nav.html.erb', binding) %>
5
- <% head = render_erb('_head.html.erb', binding) %>
6
- <% foot = render_erb('_foot.html.erb', binding) %>
7
- <title>Flapjack - Contacts</title>
8
- <%= head %>
9
- </head>
10
- <body>
11
- <div id="wrap">
12
- <div class="container">
13
- <div class="page-header">
14
- <%= nav %>
15
- <h2>Contacts</h2>
16
- </div>
1
+ <% page_title 'Contacts' %>
17
2
 
18
- <% if !@contacts || @contacts.empty? %>
19
- <p>No contacts</p>
20
- <% else %>
21
- <table class="table table-bordered table-hover table-condensed">
22
- <tr>
23
- <th>Name</th>
24
- <th>Email</th>
25
- </tr>
26
- <% @contacts.sort_by {|c| [c.last_name, c.first_name] }.each do |contact| %>
27
- <tr>
28
- <td><a href="/contacts/<%= contact.id %>" title="contact details"><%= h contact.name %></a></td>
29
- <td><%= h contact.email %></td>
30
- </tr>
31
- <% end %>
32
- </table>
33
- <% end %>
3
+ <div class="page-header">
4
+ <h2>Contacts</h2>
5
+ </div>
34
6
 
35
- </div>
36
- <div id="push"></div>
37
- </div>
38
- <div id="footer">
39
- <%= foot %>
40
- </div>
41
- </body>
42
- </html>
7
+ <% if !@contacts || @contacts.empty? %>
8
+ <p>No contacts</p>
9
+ <% else %>
10
+ <table class="table table-bordered table-hover table-condensed">
11
+ <tr>
12
+ <th>Name</th>
13
+ <th>Email</th>
14
+ </tr>
15
+ <% @contacts.sort_by {|c| [c.last_name, c.first_name] }.each do |contact| %>
16
+ <tr>
17
+ <td><a href="/contacts/<%= contact.id %>" title="contact details"><%= h contact.name %></a></td>
18
+ <td><%= h contact.email %></td>
19
+ </tr>
20
+ <% end %>
21
+ </table>
22
+ <% end %>