]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Fix PG status coloring
authorWido den Hollander <wido@42on.com>
Mon, 11 Dec 2017 10:33:16 +0000 (11:33 +0100)
committerWido den Hollander <wido@42on.com>
Mon, 11 Dec 2017 12:04:58 +0000 (13:04 +0100)
This was broken in the 12.2.2 release and PGs would not get a
color anymore.

This commit also makes sure pools/PGs are marked as red when
one or more PGs are inactive, inconsistent, incomplete, down, etc.

Signed-off-by: Wido den Hollander <wido@42on.com>
src/pybind/mgr/dashboard/health.html

index 4859f686da7ba34c9f5cc94caaba7323569ba8b5..37525af6d5e3d2165563db937681d4d5c8a89ed9 100644 (file)
             };
 
             rivets.formatters.pg_status_style = function(pg_status) {
+                var warning = false;
+                var error = false;
+
                 $.each(pg_status, function(state, count) {
-                    if (state == "active+clean"
-                     || state == "active+clean+scrubbing"
-                     || state == "active+clean+scrubbing+deep") {
-                        return "color: #00bb00";
-                    } else {
-                        return "color: #FFC200";
+                    if (state.includes("inconsistent") ||
+                        state.includes("incomplete") ||
+                        !state.includes("active")
+                    ) {
+                        error = true;
+                    }
+
+                    if (state != "active+clean"
+                     && state != "active+clean+scrubbing"
+                     && state != "active+clean+scrubbing+deep") {
+                        warning = true;
                     }
                 });
+
+                if (error) {
+                    return "color: #FF0000";
+                }
+
+                if (warning) {
+                    return "color: #FFC200";
+                }
+
+                return "color: #00BB00";
             };
 
             rivets.formatters.pg_status = function(pg_status) {