]> source.dussan.org Git - rspamd.git/commitdiff
[WebUI] Show grayed out pie 2825/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Fri, 29 Mar 2019 09:41:49 +0000 (12:41 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Fri, 29 Mar 2019 09:41:49 +0000 (12:41 +0300)
when throughput percentage is undefined

interface/js/app/graph.js

index e01d97afff64a925afbfbea9440e27dc8f4e9e88..2fd66b5553f32ddd1b5f7b2bff9aea738a148abd 100644 (file)
@@ -204,12 +204,40 @@ define(["jquery", "d3evolution", "footable"],
                     }
 
                     rrd_summary = getRrdSummary(data, scaleFactor);
+                }
+
+                if (graphs.rrd_pie) {
+                    graphs.rrd_pie.destroy();
+                    delete graphs.rrd_pie;
+                }
+                if (rrd_summary.total) {
                     graphs.rrd_pie = rspamd.drawPie(graphs.rrd_pie,
                         "rrd-pie",
                         rrd_summary.rows,
                         rrd_pie_config);
-                } else if (graphs.rrd_pie) {
-                    graphs.rrd_pie.destroy();
+                } else {
+                    // Show grayed out pie as percentage is undefined
+                    graphs.rrd_pie = rspamd.drawPie(graphs.rrd_pie,
+                        "rrd-pie",
+                        [{
+                            value: 1,
+                            color: "#FFFFFF",
+                        }],
+                        $.extend({}, rrd_pie_config, {
+                            labels: {
+                                outer: {
+                                    format: "none"
+                                },
+                                inner: {
+                                    format: "none"
+                                },
+                            },
+                            tooltips: {
+                                enabled: true,
+                                string: "Undefined"
+                            },
+                        })
+                    );
                 }
 
                 graphs.graph.data(data);