Display running time more clearly.

This commit is contained in:
zhuyj17 2016-10-23 22:52:01 +08:00
parent ed6d0d6486
commit ad2be9bad1
2 changed files with 11 additions and 2 deletions

View File

@ -205,7 +205,11 @@ function processBasicInfo()
$("#con_state").html("<div class='label label-primary'>Running</div>"); $("#con_state").html("<div class='label label-primary'>Running</div>");
$("#con_ip").html(basic_info.IP); $("#con_ip").html(basic_info.IP);
} }
$("#con_time").html(basic_info.RunningTime+"s"); var total = parseInt(basic_info.RunningTime);
var hour = Math.floor(total / 3600);
var min = Math.floor(total % 3600 / 60);
var secs = Math.floor(total % 3600 % 60);
$("#con_time").html(hour+"h "+min+"m "+secs+"s")
$("#con_billing").html(basic_info.billing+" <img src='/static/img/bean.png' />"); $("#con_billing").html(basic_info.billing+" <img src='/static/img/bean.png' />");
},"json"); },"json");
} }

View File

@ -136,7 +136,11 @@
var detail = "("+used.toFixed(2)+"MiB/"+total.toFixed(2)+"MiB)"; var detail = "("+used.toFixed(2)+"MiB/"+total.toFixed(2)+"MiB)";
$("#"+index+"_disk").html(usedp+"%<br/>"+detail); $("#"+index+"_disk").html(usedp+"%<br/>"+detail);
},"json"); },"json");
$("#"+index+"_time").html(data.monitor.basic_info.RunningTime+"s") var total = parseInt(data.monitor.basic_info.RunningTime);
var hour = Math.floor(total / 3600);
var min = Math.floor(total % 3600 / 60);
var secs = Math.floor(total % 3600 % 60);
$("#"+index+"_time").html(hour+"h "+min+"m "+secs+"s")
$("#"+index+"_billing").html(data.monitor.basic_info.billing+" <img src='/static/img/bean.png' />") $("#"+index+"_billing").html(data.monitor.basic_info.billing+" <img src='/static/img/bean.png' />")
var state = data.monitor.basic_info.State; var state = data.monitor.basic_info.State;
@ -197,6 +201,7 @@
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
} }
updateAll()
setInterval(updateAll,5000); setInterval(updateAll,5000);
</script> </script>