--- misc/xenconsole/index.php 2013/07/19 08:10:08 2021 +++ misc/xenconsole/index.php 2013/07/23 21:03:32 2030 @@ -83,6 +83,9 @@ openConsole(conurl,session,name); }); + $('#server_memory_usage').progressbar( ); + $('#server_cpu_usage').progressbar( ); + $('#logo').click( function() { refreshData(); }); @@ -133,7 +136,7 @@ $('#dialog-login').dialog({ modal: true, height: 210, - width: 325, + width: 350, buttons: { Login: loginDialogSubmit } @@ -149,6 +152,7 @@ password = $('#password').val(); $('#login').html("Logged in as " + username + ""); + refreshData(); } else { alert(data); } @@ -168,8 +172,10 @@ cddata = data; if (data.ISO != '') { $('#cdcurrent').html( data.ISO ); + $(":button:contains('Mount')").prop("disabled", true).addClass("ui-state-disabled"); } else { $('#cdcurrent').html('No ISO currently mounted'); + $(":button:contains('Eject')").prop("disabled", true).addClass("ui-state-disabled"); } }); @@ -208,7 +214,7 @@ $(xml).find('host').each(function() { var memtotal = $(this).find('memtotal').text(); var memfree = $(this).find('memfree').text(); - var cpuavg = $(this).find('cpuavg').text(); + var cpuavg = $(this).find('cpuavg').text() * 1; // *1 is used to convert the string var to an int memtotal = Math.round ( memtotal / (1024*1024) ); memfree = Math.round ( memfree / (1024*1024) ); @@ -217,13 +223,15 @@ //alert(memused + ' ' + mem_percentage); - $('#server_memory_usage').attr('src', 'usagebar.php?usage=' + mem_percentage); + //$('#server_memory_usage').attr('src', 'usagebar.php?usage=' + mem_percentage); + $('#server_memory_usage').progressbar( "value", mem_percentage ); $('#server_memory_usage').attr('alt', mem_percentage + '%'); $('#server_memory_usage').attr('title', mem_percentage + '%'); $('#server_memory_usage_txt').text( memused + '/' + memtotal + 'MB'); - $('#server_cpu_usage').attr('src', 'usagebar.php?usage=' + cpuavg); + //$('#server_cpu_usage').attr('src', 'usagebar.php?usage=' + cpuavg); + $('#server_cpu_usage').progressbar( "value", cpuavg ); $('#server_cpu_usage').attr('alt', cpuavg + '%'); $('#server_cpu_usage').attr('title', cpuavg + '%'); $('#server_cpu_usage_txt').text( cpuavg+ '%'); @@ -269,8 +277,10 @@ vm.find('.console').data('session', session); vm.find('.console').data('name', name); vm.find('.settings').hide(); - vm.find('.actionstop').show(); - vm.find('.actionstart').hide(); + if (loggedin) { + vm.find('.actionstop').show(); + vm.find('.actionstart').hide(); + } vm.find('.os').text(' - ' + os); @@ -292,8 +302,10 @@ vm.find('.network').hide(); vm.find('.console').hide(); vm.find('.settings').show(); - vm.find('.actionstop').hide(); - vm.find('.actionstart').show(); + if (loggedin) { + vm.find('.actionstop').hide(); + vm.find('.actionstart').show(); + } vm.find('.cpu_graph').hide(); vm.find('.mem_graph').hide(); } @@ -400,6 +412,16 @@ margin: 4; border: 1px solid #222; } + +.ui-progressbar-value { + background: #61B4F3; +} + +.bar { + width: 102px; + height: 16px; +} + @@ -417,11 +439,17 @@ - -
12%
+ +
+ + 12% + - -
0/4 MB
+ +
+ + 0/4 MB +