Docker: added cpu load and memory load display

This commit is contained in:
bergware
2018-05-29 14:02:30 +02:00
parent a81508cffe
commit 17088573e7
3 changed files with 27 additions and 5 deletions

View File

@@ -17,6 +17,9 @@ Markdown="false"
* all copies or substantial portions of the Software.
*/
?>
<?
if (!exec("pgrep docker_load")) exec("$docroot/plugins/dynamix.docker.manager/scripts/docker_load >/dev/null 2>&1 &");
?>
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.ui.css')?>">
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.switchbutton.css')?>">
<style>
@@ -35,6 +38,7 @@ img.paused{opacity:0.6}
.switch-button-label.off{color:inherit}
th.five{width:5%}
th.eight{width:8%}
th.load{width:100px}
tbody > tr.sortable:hover{cursor:move}
</style>
<div id="dialog-confirm" style="display:none;" title="Dialog Title"></div>
@@ -42,8 +46,8 @@ tbody > tr.sortable:hover{cursor:move}
<span class="status" style="margin-top:-44px"><span><input type="checkbox" class="advancedview"></span></span>
<div class="spinner fixed"></div>
<table id="docker_containers" class="tablesorter shift">
<thead><tr><th><a href="#" style="cursor:hand;margin-left:12px" onclick="resetSorting()" title="Reset sorting"><i class="fa fa-th-list"></i></a></th><th>Application</th><th>Version</th><th>Network</th><th>Port Mappings <small>(App to Host)</small></th><th>Volume Mappings <small>(App to Host)</small></th><th class="eight">Autostart</th><th class="five">Log</th></tr></thead>
<tbody id="docker_list"><tr><td colspan='8'><div class="spinner"></div></td></tr></tbody>
<thead><tr><th><a href="#" style="cursor:hand;margin-left:12px" onclick="resetSorting()" title="Reset sorting"><i class="fa fa-th-list"></i></a></th><th>Application</th><th>Version</th><th>Network</th><th>Port Mappings <small>(App to Host)</small></th><th>Volume Mappings <small>(App to Host)</small></th><th class="load">CPU load</th><th class="load">Memory load</th><th class="eight">Autostart</th><th class="five">Log</th></tr></thead>
<tbody id="docker_list"><tr><td colspan='10'><div class="spinner"></div></td></tr></tbody>
</table>
<input type="button" onclick="addContainer()" value="Add Container" style="display:none">
<input type="button" onclick="startAll()" value="Start all Containers" style="display:none">
@@ -112,6 +116,15 @@ function loadlist(update) {
if (!update) $('input#updateAll').hide();
});
}
var watchDocker = new NchanSubscriber('/sub/dockerload', /^((?!chrome|android).)*safari/i.test(navigator.userAgent) ? {subscriber:'longpoll'} : {});
watchDocker.on('message', function(data) {
data = data.split('\n');
for (var i=0,row; row=data[i]; i++) {
var id = row.split(' ');
$('#cpu-'+id[0]).css('width',id[1]).text(id[1].replace('.','<?=$display['number'][0]?>'));
$('#mem-'+id[0]).css('width',id[2]).text(id[2].replace('.','<?=$display['number'][0]?>'));
}
});
$(function() {
$('.advancedview').switchButton({labels_placement:'left', on_label:'Advanced View', off_label:'Basic View', checked:$.cookie('docker_listview_mode')=='advanced'});
$('.advancedview').change(function() {
@@ -121,5 +134,6 @@ $(function() {
listview();
});
$.post('/plugins/dynamix.docker.manager/include/DockerUpdate.php',{},function(u){loadlist(u);});
watchDocker.start();
});
</script>