don't crash js if a backend service is not running
This commit is contained in:
parent
4f7c8bf0db
commit
4d8dc01638
|
@ -44,22 +44,24 @@ function generatePartitions(partitions){
|
||||||
function success(data, textStatus, jqXHR){
|
function success(data, textStatus, jqXHR){
|
||||||
var services = data.status.services;
|
var services = data.status.services;
|
||||||
|
|
||||||
for (var key in services){
|
for (var key in services) {
|
||||||
var s = services[key];
|
var s = services[key];
|
||||||
var children = $("#"+s.name).children();
|
if (s) {
|
||||||
$(children[0]).text(s.name);
|
var children = $("#"+s.name).children();
|
||||||
|
$(children[0]).text(s.name);
|
||||||
var status_class = "not-available-icon";
|
|
||||||
if (s.status == 0){
|
var status_class = "not-available-icon";
|
||||||
status_class = "checked-icon";
|
if (s.status == 0){
|
||||||
} else if (s.status == 1) {
|
status_class = "checked-icon";
|
||||||
status_class = "warning-icon";
|
} else if (s.status == 1) {
|
||||||
|
status_class = "warning-icon";
|
||||||
|
}
|
||||||
|
|
||||||
|
$($(children[1]).children()[0]).attr("class", status_class);
|
||||||
|
$(children[2]).text(sprintf('%(days)sd %(hours)sh %(minutes)sm %(seconds)ss', convertSecondsToDaysHoursMinutesSeconds(s.uptime_seconds)));
|
||||||
|
$(children[3]).text(s.cpu_perc);
|
||||||
|
$(children[4]).text(sprintf('%01.1fMB (%s)', parseInt(s.memory_kb)/1000, s.memory_perc));
|
||||||
}
|
}
|
||||||
|
|
||||||
$($(children[1]).children()[0]).attr("class", status_class);
|
|
||||||
$(children[2]).text(sprintf('%(days)sd %(hours)sh %(minutes)sm %(seconds)ss', convertSecondsToDaysHoursMinutesSeconds(s.uptime_seconds)));
|
|
||||||
$(children[3]).text(s.cpu_perc);
|
|
||||||
$(children[4]).text(sprintf('%01.1fMB (%s)', parseInt(s.memory_kb)/1000, s.memory_perc));
|
|
||||||
}
|
}
|
||||||
if (data.status.partitions){
|
if (data.status.partitions){
|
||||||
generatePartitions(data.status.partitions);
|
generatePartitions(data.status.partitions);
|
||||||
|
|
Loading…
Reference in New Issue