/[projects]/misc/xenconsole/index.php
ViewVC logotype

Diff of /misc/xenconsole/index.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2025 by torben, Fri Jul 19 13:13:34 2013 UTC revision 2100 by torben, Thu Jan 30 09:47:17 2014 UTC
# Line 83  $(document).ready( function() { Line 83  $(document).ready( function() {
83                  openConsole(conurl,session,name);                  openConsole(conurl,session,name);
84          });          });
85    
86            $('.bar').progressbar( );
87    
88          $('#logo').click( function() {          $('#logo').click( function() {
89                  refreshData();                  refreshData();
90          });          });
# Line 133  function loginDialog() { Line 135  function loginDialog() {
135          $('#dialog-login').dialog({          $('#dialog-login').dialog({
136                  modal: true,                  modal: true,
137                  height: 210,                  height: 210,
138                  width: 325,                  width: 350,
139                  buttons: {                  buttons: {
140                          Login: loginDialogSubmit                          Login: loginDialogSubmit
141                  }                  }
# Line 149  function loginDialogSubmit() { Line 151  function loginDialogSubmit() {
151                          password = $('#password').val();                          password = $('#password').val();
152    
153                          $('#login').html("Logged in as <i>" + username + "</i>");                          $('#login').html("Logged in as <i>" + username + "</i>");
154                            refreshData();
155                  } else {                  } else {
156                          alert(data);                          alert(data);
157                  }                  }
# Line 168  function cdSelectorDialog(uuid) { Line 171  function cdSelectorDialog(uuid) {
171                  cddata = data;                  cddata = data;
172                  if (data.ISO != '') {                  if (data.ISO != '') {
173                          $('#cdcurrent').html(  data.ISO );                          $('#cdcurrent').html(  data.ISO );
174                            $(":button:contains('Mount')").prop("disabled", true).addClass("ui-state-disabled");
175                  } else {                  } else {
176                          $('#cdcurrent').html('<i>No ISO currently mounted</i>');                          $('#cdcurrent').html('<i>No ISO currently mounted</i>');
177                            $(":button:contains('Eject')").prop("disabled", true).addClass("ui-state-disabled");
178                  }                  }
179          });          });
180                    
# Line 208  function refreshData() { Line 213  function refreshData() {
213                  $(xml).find('host').each(function() {                  $(xml).find('host').each(function() {
214                          var memtotal = $(this).find('memtotal').text();                          var memtotal = $(this).find('memtotal').text();
215                          var memfree = $(this).find('memfree').text();                            var memfree = $(this).find('memfree').text();  
216                          var cpuavg = $(this).find('cpuavg').text();                          var cpuavg = $(this).find('cpuavg').text() * 1; // *1 is used to convert the string var to an int
217    
218                          memtotal = Math.round ( memtotal / (1024*1024) );                          memtotal = Math.round ( memtotal / (1024*1024) );
219                          memfree = Math.round ( memfree / (1024*1024) );                          memfree = Math.round ( memfree / (1024*1024) );
# Line 217  function refreshData() { Line 222  function refreshData() {
222    
223                          //alert(memused + ' ' + mem_percentage);                          //alert(memused + ' ' + mem_percentage);
224    
225                          $('#server_memory_usage').attr('src', 'usagebar.php?usage=' + mem_percentage);                          //$('#server_memory_usage').attr('src', 'usagebar.php?usage=' + mem_percentage);
226                            $('#server_memory_usage').progressbar( "value", mem_percentage );
227                          $('#server_memory_usage').attr('alt', mem_percentage + '%');                          $('#server_memory_usage').attr('alt', mem_percentage + '%');
228                          $('#server_memory_usage').attr('title', mem_percentage + '%');                          $('#server_memory_usage').attr('title', mem_percentage + '%');
229                          $('#server_memory_usage_txt').text( memused + '/' + memtotal + 'MB');                          $('#server_memory_usage_txt').text( memused + '/' + memtotal + 'MB');
230    
231    
232                          $('#server_cpu_usage').attr('src', 'usagebar.php?usage=' + cpuavg);                          //$('#server_cpu_usage').attr('src', 'usagebar.php?usage=' + cpuavg);
233                            $('#server_cpu_usage').progressbar( "value", cpuavg );
234                          $('#server_cpu_usage').attr('alt', cpuavg + '%');                          $('#server_cpu_usage').attr('alt', cpuavg + '%');
235                          $('#server_cpu_usage').attr('title', cpuavg + '%');                          $('#server_cpu_usage').attr('title', cpuavg + '%');
236                          $('#server_cpu_usage_txt').text( cpuavg+ '%');                          $('#server_cpu_usage_txt').text( cpuavg+ '%');
# Line 269  function refreshData() { Line 276  function refreshData() {
276                                  vm.find('.console').data('session', session);                                  vm.find('.console').data('session', session);
277                                  vm.find('.console').data('name', name);                                  vm.find('.console').data('name', name);
278                                  vm.find('.settings').hide();                                  vm.find('.settings').hide();
279                                  vm.find('.actionstop').show();                                  if (loggedin) {
280                                  vm.find('.actionstart').hide();                                          vm.find('.actionstop').show();
281                                            vm.find('.actionstart').hide();
282                                    }
283                                  vm.find('.os').text(' - ' + os);                                  vm.find('.os').text(' - ' + os);
284    
285                                    cpuavg = cpuavg * 1;
286                                  vm.find('.cpu_graph').show();                                  vm.find('.cpu_graph').show();
287                                  vm.find('.cpu_graph').attr('src', 'usagebar.php?usage=' + cpuavg);                                  //vm.find('.cpu_graph').attr('src', 'usagebar.php?usage=' + cpuavg);
288                                    vm.find('.cpu_graph').progressbar( "value", cpuavg );
289                                  vm.find('.cpu_graph').attr('title',  cpuavg + '%');                                  vm.find('.cpu_graph').attr('title',  cpuavg + '%');
290    
291                                  vm.find('.mem_graph').show();                                  vm.find('.mem_graph').show();
292                                  vm.find('.mem_graph').attr('src', 'usagebar.php?usage=' + mempercent);                                  //vm.find('.mem_graph').attr('src', 'usagebar.php?usage=' + mempercent);
293                                    vm.find('.mem_graph').progressbar( "value", mempercent );
294                                  vm.find('.mem_graph').attr('title',  curmem + ' / ' + maxmem + ' MB' );                                  vm.find('.mem_graph').attr('title',  curmem + ' / ' + maxmem + ' MB' );
295                          } else {                          } else {
296                                  if (state == "Halted") {                                  if (state == "Halted") {
# Line 292  function refreshData() { Line 303  function refreshData() {
303                                  vm.find('.network').hide();                                  vm.find('.network').hide();
304                                  vm.find('.console').hide();                                  vm.find('.console').hide();
305                                  vm.find('.settings').show();                                  vm.find('.settings').show();
306                                  vm.find('.actionstop').hide();                                  if (loggedin) {
307                                  vm.find('.actionstart').show();                                          vm.find('.actionstop').hide();
308                                            vm.find('.actionstart').show();
309                                    }
310                                  vm.find('.cpu_graph').hide();                                  vm.find('.cpu_graph').hide();
311                                  vm.find('.mem_graph').hide();                                  vm.find('.mem_graph').hide();
312                          }                          }
313                            vm.find('.state').attr('title', state);
314                                                    
315                  });                  });
316                  $('#logo').show();                  $('#logo').show();
# Line 400  body { Line 414  body {
414          margin: 4;          margin: 4;
415          border: 1px solid #222;          border: 1px solid #222;
416  }  }
417    
418    .ui-progressbar-value {
419            background: #61B4F3;
420    }
421    
422    .ui-progressbar {
423            border-style:solid;
424            border-width:1px;
425            border-color: #666666;
426    }
427    
428    .bar {
429            width:  102px;
430            height:  16px;
431    }
432    
433  </style>  </style>
434  </head>  </head>
435  <body>  <body>
# Line 417  body { Line 447  body {
447          </span>          </span>
448  </td>  </td>
449  <td width='150'></td>  <td width='150'></td>
450          <td width='150' align='right' class='small'><img src='gfx/icon-cpu.png'>          <td width='150' align='right' class='small'>
451                  <img id='server_cpu_usage' src='usagebar.php?usage=12' width='102' height='16' title='static dummy data'><div id='server_cpu_usage_txt'>12%</div></td>          <div id='server_cpu_usage' class='bar'></div>
452                    <img src='gfx/icon-cpu.png'>
453                    <span id='server_cpu_usage_txt'>12%</span>
454            </td>
455    
456          <td width='150' align='right' class='small'><img src='gfx/icon-memory.png'>          <td width='150' align='right' class='small'>
457                  <img id='server_memory_usage' src='usagebar.php?usage=1' width='102' height='16' title='static dummy data'><div id='server_memory_usage_txt'>0/4 MB</div></td>          <div id='server_memory_usage' class='bar'></div>
458                    <img src='gfx/icon-memory.png'>
459                    <span id='server_memory_usage_txt'>0/4 MB</span>
460        </td>
461  <!--  <!--
462          <td width='150' align='right' class='small'><img src='gfx/icon-network.png'>          <td width='150' align='right' class='small'><img src='gfx/icon-network.png'>
463                  <img id='server_net_usage' src='usagebar.php?usage=41' width='102' height='16' title='static dummy data'><div id='server_net_usage_txt'>1%</div></td>                  <img id='server_net_usage' src='usagebar.php?usage=41' width='102' height='16' title='static dummy data'><div id='server_net_usage_txt'>1%</div></td>
# Line 491  foreach($vms_array as $vm) { Line 527  foreach($vms_array as $vm) {
527                          <span class="actionstop" style='display:none'>                          <span class="actionstop" style='display:none'>
528                                  start |                                  start |
529                                  <a href='#' onclick="doAction('shutdown','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >stop</a> |                                  <a href='#' onclick="doAction('shutdown','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >stop</a> |
530                                  <a href='#' onclick="doAction('hardshutdown','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >force shutdown</a>                                  <a href='#' onclick="doAction('hardshutdown','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >force shutdown</a> |
531                                    <a href='#' onclick="doAction('hardreboot','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >force reboot</a>
532                          </span>                          </span>
533                                                    
534                          <span class="actionstart">                                                <span class="actionstart" style='display:none'>                
535                                  <a href='#' onclick="doAction('start','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >start</a> |                                  <a href='#' onclick="doAction('start','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >start</a> |
536                                  stop |                                  stop |
537                                  force shutdown                                  force shutdown
# Line 503  foreach($vms_array as $vm) { Line 540  foreach($vms_array as $vm) {
540                  </td>                  </td>
541    
542                  <td width='100' align='right' class='small' valign='top'>                  <td width='100' align='right' class='small' valign='top'>
543                          <img src='usagebar.php?usage=1' width='102' height='16' title='static dummy data' class='cpu_graph'><br>                          <div class='cpu_graph bar'></div>
544                          <img src='gfx/icon-cpu.png' style='vertical-align: middle;'>                          <img src='gfx/icon-cpu.png' style='vertical-align: middle;'>
545                          <span class='vps_cpu_usage_txt_UID'><?php echo $cpu_count; ?> VCPU</span>                          <span class='vps_cpu_usage_txt_UID'><?php echo $cpu_count; ?> VCPU</span>
546                  </td>                  </td>
547                  <td width='100' align='right' class='small'>                  <td width='100' align='right' class='small'>
548                          <img src='usagebar.php?usage=1' width='102' height='16' title='static dummy data' class='mem_graph'><br>                          <div class='mem_graph bar'></div>
549                          <img src='gfx/icon-memory.png' style='vertical-align: middle;'>                          <img src='gfx/icon-memory.png' style='vertical-align: middle;'>
550                          <span class='vps_memory_usage_txt_UID'><?php echo format_memory($memory); ?></span>                          <span class='vps_memory_usage_txt_UID'><?php echo format_memory($memory); ?></span>
551                  </td>                  </td>

Legend:
Removed from v.2025  
changed lines
  Added in v.2100

  ViewVC Help
Powered by ViewVC 1.1.20