forked from saurabh/orbit4-5
Fix RWD for dashboard
This commit is contained in:
parent
03baa31648
commit
8ab1a5f753
|
@ -6,17 +6,14 @@
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-content" style='overflow: hidden; text-align:center;'>
|
<div class="box-content" style='overflow: hidden; text-align:center;'>
|
||||||
<div style="min-width: 543px;">
|
<div style="row-fluid">
|
||||||
<div id="cpu_usage" class="usages pull-left " style=""></div>
|
<div id="cpu_usage" class="usages pull-left span4" style=""></div>
|
||||||
<div id="mem_usage" class="usages" style=""></div>
|
<div id="mem_usage" class="usages span4" style=""></div>
|
||||||
<div id="disk_usage" class="usages pull-right" style=""></div>
|
<div id="disk_usage" class="usages pull-right span4" style=""></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.usages{
|
.usages{
|
||||||
width:180px;
|
|
||||||
height:144px;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -25,25 +22,42 @@ var Gages = { 'CPU':{
|
||||||
'container': 'cpu_usage',
|
'container': 'cpu_usage',
|
||||||
'title': 'CPU Usage',
|
'title': 'CPU Usage',
|
||||||
'fn': 'get_cpu_usage',
|
'fn': 'get_cpu_usage',
|
||||||
'update_interval': 2000
|
'update_interval': 2000,
|
||||||
|
'initialized': false
|
||||||
},
|
},
|
||||||
'Mem':{
|
'Mem':{
|
||||||
'JustGage': null,
|
'JustGage': null,
|
||||||
'container': 'mem_usage',
|
'container': 'mem_usage',
|
||||||
'title': 'Memory Usage',
|
'title': 'Memory Usage',
|
||||||
'fn': 'get_mem_usage',
|
'fn': 'get_mem_usage',
|
||||||
'update_interval': 30000
|
'update_interval': 30000,
|
||||||
|
'initialized': false
|
||||||
},
|
},
|
||||||
'Disk':{
|
'Disk':{
|
||||||
'JustGage': null,
|
'JustGage': null,
|
||||||
'container': 'disk_usage',
|
'container': 'disk_usage',
|
||||||
'title': 'Disk Usage',
|
'title': 'Disk Usage',
|
||||||
'fn': 'get_disk_usage',
|
'fn': 'get_disk_usage',
|
||||||
'update_interval': 180000
|
'update_interval': 180000,
|
||||||
|
'initialized': false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
initialize_usage();
|
||||||
|
|
||||||
|
$(window).resize(function() {
|
||||||
|
$("#cpu_usage").html("");
|
||||||
|
$("#mem_usage").html("");
|
||||||
|
$("#disk_usage").html("");
|
||||||
|
initialize_usage();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function initialize_usage(){
|
||||||
|
var h = parseInt($('#server_loading').width()/3*0.75);
|
||||||
|
$.each($(".usages"),function(){$(this).height(h);});
|
||||||
|
|
||||||
$.each(Gages,function(id,Gage){
|
$.each(Gages,function(id,Gage){
|
||||||
Gage['JustGage'] = new JustGage({
|
Gage['JustGage'] = new JustGage({
|
||||||
id: Gage['container'],
|
id: Gage['container'],
|
||||||
|
@ -51,6 +65,7 @@ $(function () {
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 100,
|
max: 100,
|
||||||
title: Gage['title'],
|
title: Gage['title'],
|
||||||
|
showInnerShadow: false,
|
||||||
shadowVerticalOffset: 10,
|
shadowVerticalOffset: 10,
|
||||||
levelColors: ['#39D824','#FFC33F','#F51F1F'],
|
levelColors: ['#39D824','#FFC33F','#F51F1F'],
|
||||||
titleFontColor: '#666',
|
titleFontColor: '#666',
|
||||||
|
@ -59,16 +74,18 @@ $(function () {
|
||||||
label: '%',
|
label: '%',
|
||||||
refreshAnimationTime: 800
|
refreshAnimationTime: 800
|
||||||
});
|
});
|
||||||
|
|
||||||
update_usage(Gage);
|
update_usage(Gage);
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
function update_usage(Gage){
|
function update_usage(Gage, Loop){
|
||||||
$.get('/admin/dashboards/'+Gage['fn'],function(usage){
|
$.get('/admin/dashboards/'+Gage['fn'],function(usage){
|
||||||
Gage['JustGage'].refresh(parseInt(usage));
|
Gage['JustGage'].refresh(parseInt(usage));
|
||||||
setTimeout(function(){update_usage(Gage);},Gage['update_interval']);
|
});
|
||||||
});
|
if(!Gage['initialized'] || Loop){
|
||||||
|
setTimeout(function(){update_usage(Gage,true);},Gage['update_interval']);
|
||||||
|
Gage['initialized'] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue