/[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 1883 by torben, Fri Nov 30 12:05:52 2012 UTC revision 1884 by torben, Fri Nov 30 15:54:54 2012 UTC
# Line 39  $vms_array = $xenserver->VM__get_all_rec Line 39  $vms_array = $xenserver->VM__get_all_rec
39    
40  <script type='text/javascript'>  <script type='text/javascript'>
41  $(document).ready( function() {  $(document).ready( function() {
42          loadServer();          setInterval(refreshData, 60000);        
43            refreshData();
44  });  });
45    
46    function refreshData() {
47            $.get('ajaxdata.php', function(xml) {
48                    $(xml).find('vm').each(function() {
49                            var name = $(this).find('name').text();
50                            var state = $(this).find('state').text();
51    
52                            name = name.replace(" ", "_");
53                            name = name.replace(".", "_");
54                            
55                            var id = "#state_" + name;
56                            var css = $(id).css("background");
57    
58                            if (state == "Running") {
59                                    $(id).css("background-image", "url('gfx/vps_topgreen.png')");
60                            } else {
61                                    $(id).css("background-image", "url('gfx/vps_topred.png')");
62                            }
63                            
64               })
65           });
66    }
67    
68  function doAction(action, uuid) {  function doAction(action, uuid) {
69          var key = prompt("Key");          var key = prompt("Key");
70          if (key == "" || key == null) {          if (key == "" || key == null) {
# Line 53  function doAction(action, uuid) { Line 76  function doAction(action, uuid) {
76          var response = $.get(url, function(data) {          var response = $.get(url, function(data) {
77                  alert(data);                  alert(data);
78                  document.body.style.cursor = 'default'                  document.body.style.cursor = 'default'
79                  if (data == "OK") {  
80                          window.location.reload();                  refreshData();
                 }  
81          });          });
82  }  }
83    
# Line 74  function console(url, session) { Line 96  function console(url, session) {
96          window.open(url);          window.open(url);
97  }  }
98    
 function loadServer() {  
         $('#mainwindow').load('server.php');  
 }  
99    
 function loadvm(uuid) {  
         $('#mainwindow').load('vm.php?uuid=' + uuid );  
 }  
100    
101  </script>  </script>
102    
# Line 156  foreach($vms_array as $vm) { Line 172  foreach($vms_array as $vm) {
172          $harddrive_size = 0;          $harddrive_size = 0;
173          $cpu_count = $vm["VCPUs_max"];          $cpu_count = $vm["VCPUs_max"];
174    
175            $clean_name = str_replace(" ", "_", $name);
176            $clean_name = str_replace(".", "_", $clean_name);
177            
178    
179          foreach ($vm["VBDs"] as $vbds) {          foreach ($vm["VBDs"] as $vbds) {
180                  $vbd = $xenserver->VBD__get_record($vbds);                  $vbd = $xenserver->VBD__get_record($vbds);
181                  if ($vbd["type"] == 'Disk') {                  if ($vbd["type"] == 'Disk') {
# Line 201  foreach($vms_array as $vm) { Line 221  foreach($vms_array as $vm) {
221          <!-- MACHINE -->          <!-- MACHINE -->
222          <table width='99%' cellpadding='3' cellspacing='0' border='0' class='vps' id='<?php echo $name;?>'>          <table width='99%' cellpadding='3' cellspacing='0' border='0' class='vps' id='<?php echo $name;?>'>
223                  <tr background='gfx/vps_topbg.png'>                  <tr background='gfx/vps_topbg.png'>
224                          <td width='10' background='gfx/<?php echo $vps_topbg; ?>' class='small'>&nbsp;</td>                          <td width='10' background='gfx/<?php echo $vps_topbg; ?>' class='small' id='state_<?php echo $clean_name;?>'>&nbsp;</td>
225                          <td colspan='2' class='small'><b><?php echo $name; ?></b></td>                          <td colspan='2' class='small'><b><?php echo $name; ?></b></td>
226                          <td colspan='2' class='small' align='right'>                          <td colspan='2' class='small' align='right'>
227                                  <?php echo $network;?>                                  <?php echo $network;?>

Legend:
Removed from v.1883  
changed lines
  Added in v.1884

  ViewVC Help
Powered by ViewVC 1.1.20