Merge pull request #17421 from nrdmn/dashboard-colors

mgr/dashboard: change raw usage chart's color depending on usage

Reviewed-by: John Spray <john.spray@redhat.com>
This commit is contained in:
Sage Weil 2017-09-01 09:31:35 -05:00 committed by GitHub
commit 692a32600d

View File

@ -144,6 +144,18 @@
content_data.df.stats.total_used_bytes
/ content_data.df.stats.total_bytes)) + "%";
var raw_usage_canvas = $("#raw_usage_chart").get(0).getContext("2d");
if (content_data.df.stats.total_used_bytes/content_data.df.stats.total_bytes
>= content_data.osd_map.full_ratio) {
var raw_usage_chart_color = "#ff0000";
} else if (content_data.df.stats.total_used_bytes/content_data.df.stats.total_bytes
>= content_data.osd_map.backfillfull_ratio) {
var raw_usage_chart_color = "#ff6600";
} else if (content_data.df.stats.total_used_bytes/content_data.df.stats.total_bytes
>= content_data.osd_map.nearfull_ratio) {
var raw_usage_chart_color = "#ffc200";
} else {
var raw_usage_chart_color = "#00bb00";
}
var raw_usage_chart = new Chart(raw_usage_canvas, {
type: 'doughnut',
data: {
@ -159,7 +171,7 @@
content_data.df.stats.total_used_bytes,
content_data.df.stats.total_avail_bytes
],
backgroundColor: ["#424d52", "#222d32"]
backgroundColor: [raw_usage_chart_color, "#424d52"]
}
]
},