]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix PG status coloring 19844/head
authorWido den Hollander <wido@42on.com>
Mon, 11 Dec 2017 10:33:16 +0000 (11:33 +0100)
committerJohn Spray <john.spray@redhat.com>
Mon, 8 Jan 2018 16:15:18 +0000 (16:15 +0000)
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>
(cherry picked from commit 450aa2133d05916822083969260ee07622591e33)

src/pybind/mgr/dashboard/health.html

index e076d4bb0ad528232176c6b4fec19d7d3c4ce95c..20c868d1e3d25791a3f97d8f79ece9c989fdfdf1 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) {