58 |
|
|
59 |
<script type='text/javascript'> |
<script type='text/javascript'> |
60 |
var menu = 0; |
var menu = 0; |
61 |
|
var menu_uuid = ''; |
62 |
|
|
63 |
$(document).ready( function() { |
$(document).ready( function() { |
64 |
$("#menu").hide(); |
$("#menu").hide(); |
76 |
}); |
}); |
77 |
|
|
78 |
$('.settings').click( function(event) { |
$('.settings').click( function(event) { |
79 |
|
menu_uuid = $(this).attr('uuid'); |
80 |
|
|
81 |
$('#menu').menu( { |
$('#menu').menu( { |
82 |
select: function(event2,ui) { |
select: function(event2,ui) { |
83 |
alert( ui.item.text() ); |
var action = $(ui.item).attr("action"); |
84 |
|
if (action == "memory") { |
85 |
|
doAction("setMemory", menu_uuid, ""); |
86 |
|
} |
87 |
|
if (action == "cpu") { |
88 |
|
doAction("setCPU", menu_uuid, ""); |
89 |
|
} |
90 |
}, |
}, |
91 |
create: function(event3,ui) { |
create: function(event3,ui) { |
92 |
menu = 1; |
menu = 1; |
150 |
var cpuavg = $(this).find('cpuavg').text(); |
var cpuavg = $(this).find('cpuavg').text(); |
151 |
var curmem = $(this).find('curmem').text(); |
var curmem = $(this).find('curmem').text(); |
152 |
var maxmem = $(this).find('maxmem').text(); |
var maxmem = $(this).find('maxmem').text(); |
153 |
|
var cpus = $(this).find('cpus').text(); |
154 |
|
|
155 |
var mempercent = Math.round( (curmem*100) / maxmem ); |
var mempercent = Math.round( (curmem*100) / maxmem ); |
156 |
|
|
166 |
} |
} |
167 |
|
|
168 |
vm.find('.vps_memory_usage_txt_UID').text( maxmem + " MB"); |
vm.find('.vps_memory_usage_txt_UID').text( maxmem + " MB"); |
169 |
|
vm.find('.vps_cpu_usage_txt_UID').text( cpus + " VCPU"); |
170 |
|
|
171 |
if (state == "Running") { |
if (state == "Running") { |
172 |
vm.find('.state').css("background-image", "url('gfx/vps_topgreen.png')"); |
vm.find('.state').css("background-image", "url('gfx/vps_topgreen.png')"); |
224 |
if (action == "setMemory") { |
if (action == "setMemory") { |
225 |
val = prompt("Set memory target"); |
val = prompt("Set memory target"); |
226 |
if (val == "" || val == null) { |
if (val == "" || val == null) { |
227 |
alert("" + val); |
return; |
228 |
|
} |
229 |
|
} |
230 |
|
if (action == "setCPU") { |
231 |
|
val = prompt("Set CPU count"); |
232 |
|
if (val == "" || val == null) { |
233 |
return; |
return; |
234 |
} |
} |
235 |
} |
} |
364 |
<a href='#' style='display:none;' class='console'> |
<a href='#' style='display:none;' class='console'> |
365 |
<img src='gfx/icon-terminal.png' style='vertical-align: middle;'> |
<img src='gfx/icon-terminal.png' style='vertical-align: middle;'> |
366 |
</a> |
</a> |
367 |
<a href='#' style='display:none;' class='settings'> |
<a href='#' style='display:none;' class='settings' uuid='<?php echo $uuid;?>'> |
368 |
<img src='gfx/icon-settings16.png' style='vertical-align: middle;'> |
<img src='gfx/icon-settings16.png' style='vertical-align: middle;'> |
369 |
</a> |
</a> |
370 |
</td> |
</td> |
377 |
<span class="actionstop" style='display:none'> |
<span class="actionstop" style='display:none'> |
378 |
start | |
start | |
379 |
<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> | |
380 |
<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> |
|
set memory |
|
381 |
</span> |
</span> |
382 |
|
|
383 |
<span class="actionstart"> |
<span class="actionstart"> |
384 |
<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> | |
385 |
stop | |
stop | |
386 |
force shutdown | |
force shutdown |
|
|
|
|
<a href='#' onclick="doAction('setMemory','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >set memory</a> |
|
387 |
</span> |
</span> |
388 |
|
|
389 |
</td> |
</td> |
391 |
<td width='100' align='right' class='small' valign='top'> |
<td width='100' align='right' class='small' valign='top'> |
392 |
<img src='usagebar.php?usage=1' width='102' height='16' title='static dummy data' class='cpu_graph'><br> |
<img src='usagebar.php?usage=1' width='102' height='16' title='static dummy data' class='cpu_graph'><br> |
393 |
<img src='gfx/icon-cpu.png' style='vertical-align: middle;'> |
<img src='gfx/icon-cpu.png' style='vertical-align: middle;'> |
394 |
<span id='vps_cpu_usage_txt_UID'><?php echo $cpu_count; ?> VCPU</span> |
<span class='vps_cpu_usage_txt_UID'><?php echo $cpu_count; ?> VCPU</span> |
395 |
</td> |
</td> |
396 |
<td width='100' align='right' class='small'> |
<td width='100' align='right' class='small'> |
397 |
<img src='usagebar.php?usage=1' width='102' height='16' title='static dummy data' class='mem_graph'><br> |
<img src='usagebar.php?usage=1' width='102' height='16' title='static dummy data' class='mem_graph'><br> |
420 |
<br> |
<br> |
421 |
|
|
422 |
<ul id="menu"> |
<ul id="menu"> |
423 |
<li><a href="#">Set Memory Size</a></li> |
<li action="memory"><a href="#">Set Memory Size</a></li> |
424 |
<li><a href="#">Set CPU Count</a></li> |
<li action="cpu"><a href="#">Set CPU Count</a></li> |
425 |
|
|
426 |
|
|
427 |
<!-- <li><a href="#">Item 3</a> |
<!-- <li><a href="#">Item 3</a> |