--- misc/xenconsole/index.php 2013/07/19 13:13:34 2025 +++ misc/xenconsole/index.php 2013/07/23 21:14:49 2031 @@ -83,6 +83,8 @@ openConsole(conurl,session,name); }); + $('.bar').progressbar( ); + $('#logo').click( function() { refreshData(); }); @@ -133,7 +135,7 @@ $('#dialog-login').dialog({ modal: true, height: 210, - width: 325, + width: 350, buttons: { Login: loginDialogSubmit } @@ -149,6 +151,7 @@ password = $('#password').val(); $('#login').html("Logged in as " + username + ""); + refreshData(); } else { alert(data); } @@ -168,8 +171,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 +213,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 +222,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,17 +276,21 @@ 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); - + cpuavg = cpuavg * 1; vm.find('.cpu_graph').show(); - vm.find('.cpu_graph').attr('src', 'usagebar.php?usage=' + cpuavg); + //vm.find('.cpu_graph').attr('src', 'usagebar.php?usage=' + cpuavg); + vm.find('.cpu_graph').progressbar( "value", cpuavg ); vm.find('.cpu_graph').attr('title', cpuavg + '%'); vm.find('.mem_graph').show(); - vm.find('.mem_graph').attr('src', 'usagebar.php?usage=' + mempercent); + //vm.find('.mem_graph').attr('src', 'usagebar.php?usage=' + mempercent); + vm.find('.mem_graph').progressbar( "value", mempercent ); vm.find('.mem_graph').attr('title', curmem + ' / ' + maxmem + ' MB' ); } else { if (state == "Halted") { @@ -292,8 +303,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 +413,16 @@ margin: 4; border: 1px solid #222; } + +.ui-progressbar-value { + background: #61B4F3; +} + +.bar { + width: 102px; + height: 16px; +} + @@ -417,11 +440,17 @@ - -
12%
+ +
+ + 12% + - -
0/4 MB
+ +
+ + 0/4 MB +