]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: update for new style health checks
authorJohn Spray <john.spray@redhat.com>
Mon, 26 Jun 2017 18:27:38 +0000 (14:27 -0400)
committerSage Weil <sage@redhat.com>
Wed, 12 Jul 2017 16:52:03 +0000 (12:52 -0400)
Signed-off-by: John Spray <john.spray@redhat.com>
src/pybind/mgr/dashboard/base.html
src/pybind/mgr/dashboard/health.html
src/pybind/mgr/dashboard/module.py

index e7256d1ba0aeb6d2d2a35ca74b5536fe6babe56a..18874fb565f060788fd3bf38ee2ea2787ed3f13d 100644 (file)
@@ -39,7 +39,7 @@
 
             var refresh = function() {
                 $.get("/toplevel_data", function(data) {
-                    _.extend(toplevel_data.health, data.health);
+                    _.extend(toplevel_data, data);
                     setTimeout(refresh, refresh_interval);
                 });
             };
                 }
             }
 
+            rivets.formatters.health_ok = function(status_str) {
+                if (status_str == "HEALTH_OK") {
+                    return true;
+                } else {
+                    return false;
+                }
+            }
+
             var truncate = function(n, max_width) {
                 var stringized = n.toString();
                 var parts = stringized.split(".");
             <!--rivet.formatters.mon_summary = function(mon_map) {-->
             <!--}-->
 
-            rivets.bind($("#health"), toplevel_data.health);
+            rivets.bind($("#health"), toplevel_data);
             rivets.bind($("section.sidebar"), toplevel_data);
             setTimeout(refresh, refresh_interval);
         });
                 <span class="sr-only">Toggle navigation</span>
             </a>
 
-            <div id="health" style="font-size: 20px; padding: 12px 12px;">
-                Health:&nbsp;
-                <span rv-style="overall_status | health_color">
-                    {overall_status}
+            <div id="health" style="font-size: 18px; padding: 12px 12px;">
+                <span rv-hide="health_status | health_ok" >
+                    <span rv-style="health_status | health_color">
+                        {health_status}
+                    </span>
                 </span>
             </div>
 
index e41a1e2da5e2fc64cef1f75af00cfe9c06ec9206..de5a794f27dc5919f28ae94bf0faf43041cc9eaa 100644 (file)
     <!-- Main content -->
     <section class="content">
 
-    Overall status: <span rv-style="health.overall_status | health_color">{health.overall_status}</span>
+    <div class="box-body">
+    Overall status: <span rv-style="health.status | health_color">{health.status}</span>
 
     <ul>
-        <li rv-each-summary="health.summary">
-            {summary.severity}: {summary.summary}
-        </li>
+        <ul>
+            <li rv-each-check="health.checks">
+                <span rv-style="check.severity | health_color">{check.type}</span>:
+                {check.message}
+            </li>
+        </ul>
     </ul>
 
         <div class="row">
index 2576680e395deb372cc3664da6a7e8e5a46253e7..93300135f49c21c15d96edec499e398d0afa4d34 100644 (file)
@@ -434,8 +434,8 @@ class Module(MgrModule):
                 ]
 
                 return {
-                    'health': global_instance().get_sync_object(Health).data,
                     'rbd_pools': rbd_pools,
+                    'health_status': self._health_data()['status'],
                     'filesystems': filesystems
                 }
 
@@ -635,6 +635,21 @@ class Module(MgrModule):
             def servers_data(self):
                 return self._servers()
 
+            def _health_data(self):
+                health = global_instance().get_sync_object(Health).data
+                # Transform the `checks` dict into a list for the convenience
+                # of rendering from javascript.
+                checks = []
+                for k, v in health['checks'].iteritems():
+                    v['type'] = k
+                    checks.append(v)
+
+                checks = sorted(checks, cmp=lambda a, b: a['severity'] > b['severity'])
+
+                health['checks'] = checks
+
+                return health
+
             def _health(self):
                 # Fuse osdmap with pg_summary to get description of pools
                 # including their PG states
@@ -670,7 +685,7 @@ class Module(MgrModule):
                 del osd_map['pg_temp']
 
                 return {
-                    "health": global_instance().get_sync_object(Health).data,
+                    "health": self._health_data(),
                     "mon_status": global_instance().get_sync_object(
                         MonStatus).data,
                     "osd_map": osd_map,