diff --git a/plugins/dynamix/DashStats.page b/plugins/dynamix/DashStats.page index cea87b794..e8095409c 100644 --- a/plugins/dynamix/DashStats.page +++ b/plugins/dynamix/DashStats.page @@ -516,24 +516,23 @@ function toggle_CPU(init) { if (!init) { if ($.cookie('cpu')===undefined) $.cookie('cpu','close',{path:'/',expires:3650}); else $.removeCookie('cpu',{path:'/'}); } - if ($.cookie('cpu')===undefined) { - $('.cpu_open').show(); - } else { - $('.cpu_open').hide(); - } + $.cookie('cpu')===undefined ? $('.cpu_open').show() : $('.cpu_open').hide(); } var cpuload = new NchanSubscriber('/sub/cpuload'); -cpuload.on('message',function(message) { -// message should be something like: {"cpuload": {"cpu":[0,0],"cpu0":[0,0],"cpu1":[0,0],"cpu2":[0,0],"cpu3":[0,0]}} -// The array values are [,]. guest-percentage is that part of load-percentage that is being consumed by VM guests -// var json = $.parseJSON(message); -// $.each(json["cpuload"],function(k,v) { -// $('#'+k).animate({width:v[0]+'%'},{step:function(){$('#'+k).css('overflow','visible');}}).text(v[0]+'%'); -// }); -// message is the cpuload.ini file contents - var ini = parseINI(message); +cpuload.on('message',function(data) { +/* +message should be something like: {"cpuload": {"cpu":[0,0],"cpu0":[0,0],"cpu1":[0,0],"cpu2":[0,0],"cpu3":[0,0]}} +The array values are [,]. guest-percentage is that part of load-percentage that is being consumed by VM guests +var json = $.parseJSON(message); +$.each(json["cpuload"],function(k,v) { + $('#'+k).animate({width:v[0]+'%'},{step:function(){$('#'+k).css('overflow','visible');}}).text(v[0]+'%'); +}); +*/ +//data is the cpuload.ini file contents + var ini = parseINI(data); $.each(ini,function(k,v) { - $('#'+k).animate({width:v['host']+'%'},{step:function(){$('#'+k).css('overflow','visible');}}).text(v['host']+'%'); + var load = v['host']+'%'; + $('#'+k).animate({width:load},{step:function(){$('#'+k).css('overflow','visible');}}).text(load); }); }); $(function() { diff --git a/plugins/dynamix/Eth0.page b/plugins/dynamix/Eth0.page index eabd0c263..bb07083bc 100644 --- a/plugins/dynamix/Eth0.page +++ b/plugins/dynamix/Eth0.page @@ -372,8 +372,10 @@ watchDHCP.on('message', function(data) { var id = row.split('_'); var form = $('form[name="'+id[0]+'_settings"]'); var key = id[2].split('='); - if (id[1]=='I') form.find('input[name="'+key[0]+'"]').val(key[1]); - else if (id[1]=='S') form.find('select[name="'+key[0]+'"]').val(key[1]); + switch (id[1]) { + case 'I': form.find('input[name="'+key[0]+'"]').val(key[1]); break; + case 'S': form.find('select[name="'+key[0]+'"]').val(key[1]); break; + } } }); $(function() {