You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sam Ruby <ru...@apache.org> on 2016/02/07 13:51:51 UTC
[whimsy.git] [1/1] Commit c9b8ec1: add a fatal level
Commit c9b8ec18f76ec8afd3f9d9a8c8a7c73d30c6bf61:
add a fatal level
Pave the way for moving warning out of the list of levels that trigger an
alert.
Branch: refs/heads/master
Author: Sam Ruby <ru...@intertwingly.net>
Committer: Sam Ruby <ru...@intertwingly.net>
Pusher: rubys <ru...@apache.org>
------------------------------------------------------------
www/status/README.md | +++++ ----
www/status/css/status.css | +++++
www/status/monitor.rb | +++++ -----
------------------------------------------------------------
24 changes: 15 additions, 9 deletions.
------------------------------------------------------------
diff --git a/www/status/README.md b/www/status/README.md
index ed4130e..1021f98 100644
--- a/www/status/README.md
+++ b/www/status/README.md
@@ -22,8 +22,8 @@ Levels
------
Each node is associated with a status *level*. Valid levels are `success`,
-`info`, `warning` and `danger`. (These levels are modelled after Bootstrap
-[alerts](http://getbootstrap.com/components/#alerts)).
+`info`, `warning`, `danger`, and `fatal`. (The first four levels are modelled
+after Bootstrap [alerts](http://getbootstrap.com/components/#alerts)).
Default level for valid leaf nodes is `success`. Invalid leaf nodes (e.g., a
node consisting of a `nil` value) have a level of `danger`. Only leaf nodes
@@ -31,8 +31,9 @@ that in the form of a Hash can have levels. Leaf nodes that are not Hashes
will be normalized into a Hash with a `level` and `data`.
Default level for non-leaf nodes is the highest level in children nodes (where
-`danger` > `warning`, `warning` > `info` and `info` > `success`). Normally
-monitors will not assign level values for non-leaf nodes.
+`fatal` > `danger`, `danger` > `warning`, `warning` > `info` and `info` >
+`success`). Normally monitors will not assign level values for non-leaf
+nodes.
Titles
------
diff --git a/www/status/css/status.css b/www/status/css/status.css
index 2a9def8..8623412 100644
--- a/www/status/css/status.css
+++ b/www/status/css/status.css
@@ -58,3 +58,8 @@ a.list-group-item.alert-danger {
background-color: #f2dede;
color: #a94442;
}
+
+a.list-group-item.alert-fatal {
+ background-color: #ff0000;
+ color: #FFFFFF;
+}
diff --git a/www/status/monitor.rb b/www/status/monitor.rb
index 6822875..f94cdc3 100644
--- a/www/status/monitor.rb
+++ b/www/status/monitor.rb
@@ -10,7 +10,7 @@
class Monitor
# match http://getbootstrap.com/components/#alerts
- LEVELS = %w(success info warning danger)
+ LEVELS = %w(success info warning danger fatal)
attr_reader :status
@@ -52,10 +52,10 @@ def initialize(args = [])
end
rescue Exception => e
status = {
- level: 'danger',
+ level: 'fatal',
data: {
exception: {
- level: 'danger',
+ level: 'fatal',
text: e.inspect,
data: e.backtrace
}
@@ -130,7 +130,7 @@ def normalize(status)
if status['level']
if not LEVELS.include? status['level']
status['title'] ||= "invalid status: #{status['level'].inspect}"
- status['level'] = 'danger'
+ status['level'] = 'fatal'
end
else
if status['data'].instance_of? Hash
@@ -140,7 +140,7 @@ def normalize(status)
[9, []]
# adopt that level
- status['level'] = LEVELS[highest.first] || 'danger'
+ status['level'] = LEVELS[highest.first] || 'fatal'
group = highest.last
if group.length != 1