From: Wido den Hollander Date: Mon, 11 Dec 2017 10:33:16 +0000 (+0100) Subject: mgr/dashboard: Fix PG status coloring X-Git-Tag: v12.2.3~227^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2042881c6702a9d660b57385a908e9da7df4cd0f;p=ceph.git mgr/dashboard: Fix PG status coloring 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 (cherry picked from commit 450aa2133d05916822083969260ee07622591e33) --- diff --git a/src/pybind/mgr/dashboard/health.html b/src/pybind/mgr/dashboard/health.html index e076d4bb0ad..20c868d1e3d 100644 --- a/src/pybind/mgr/dashboard/health.html +++ b/src/pybind/mgr/dashboard/health.html @@ -81,15 +81,33 @@ }; 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) {