orbit4-5/app/views/admin/dashboards/_server_loading.erb

74 lines
2.2 KiB
Plaintext

<div class="box-header">
<h2>
<i class="icons-gauge"></i>
<span class="break"></span>
<%= t(:server_usage) %>
</h2>
</div>
<div class="box-content" style='overflow: hidden; text-align:center;'>
<div style="min-width: 543px;">
<div id="cpu_usage" class="usages pull-left " style=""></div>
<div id="mem_usage" class="usages" style=""></div>
<div id="disk_usage" class="usages pull-right" style=""></div>
</div>
</div>
<style type="text/css">
.usages{
width:180px;
height:144px;
display: inline-block;
}
</style>
<script type="text/javascript">
var Gages = { 'CPU':{
'JustGage': null,
'container': 'cpu_usage',
'title': 'CPU Usage',
'fn': 'get_cpu_usage',
'update_interval': 2000
},
'Mem':{
'JustGage': null,
'container': 'mem_usage',
'title': 'Memory Usage',
'fn': 'get_mem_usage',
'update_interval': 30000
},
'Disk':{
'JustGage': null,
'container': 'disk_usage',
'title': 'Disk Usage',
'fn': 'get_disk_usage',
'update_interval': 180000
}
};
$(function () {
$.each(Gages,function(id,Gage){
Gage['JustGage'] = new JustGage({
id: Gage['container'],
value: 0,
min: 0,
max: 100,
title: Gage['title'],
shadowVerticalOffset: 10,
levelColors: ['#39D824','#FFC33F','#F51F1F'],
titleFontColor: '#666',
valueFontColor: '#666',
labelFontColor: '#666',
label: '%',
refreshAnimationTime: 800
});
update_usage(Gage);
});
});
function update_usage(Gage){
$.get('/admin/dashboards/'+Gage['fn'],function(usage){
Gage['JustGage'].refresh(parseInt(usage));
setTimeout(function(){update_usage(Gage);},Gage['update_interval']);
});
}
</script>