Revision d50e58d9
src/sunstone/public/js/plugins/vms-tab.js | ||
---|---|---|
666 | 666 |
call: OpenNebula.VM.update, |
667 | 667 |
callback: function(request,response){ |
668 | 668 |
notifyMessage(tr("VirtualMachine updated correctly")); |
669 |
Sunstone.runAction('VM.showinfo',request.request.data[0]); |
|
670 |
Sunstone.runAction("VM.list"); |
|
671 |
}, |
|
672 |
error: onError |
|
673 |
}, |
|
674 |
|
|
675 |
"VM.update_actions" : { // Update template |
|
676 |
type: "single", |
|
677 |
call: OpenNebula.VM.update, |
|
678 |
callback: function(request,response){ |
|
679 |
notifyMessage(tr("VirtualMachine updated correctly")); |
|
669 | 680 |
Sunstone.runAction("VM.showscheduling", request.request.data[0]); |
670 | 681 |
}, |
671 | 682 |
error: onError |
... | ... | |
1088 | 1099 |
// Returns the html code for a nice formatted VM history |
1089 | 1100 |
// Some calculations are performed, inspired from what is done |
1090 | 1101 |
// in the CLI |
1091 |
function generateHistoryTable(vm){ |
|
1092 |
var html = ' <div class="">\ |
|
1093 |
<div id="datatable_cluster_vnets_info_div columns twelve">\ |
|
1102 |
function generatePlacementTable(vm){ |
|
1103 |
var requirements_str = "-"; |
|
1104 |
var rank_str = "-"; |
|
1105 |
|
|
1106 |
if (vm.USER_TEMPLATE.SCHED_REQUIREMENTS) |
|
1107 |
{ |
|
1108 |
requirements_str = vm.USER_TEMPLATE.SCHED_REQUIREMENTS; |
|
1109 |
} |
|
1110 |
|
|
1111 |
if (vm.USER_TEMPLATE.SCHED_RANK) |
|
1112 |
{ |
|
1113 |
rank_str = vm.USER_TEMPLATE.SCHED_RANK; |
|
1114 |
} |
|
1115 |
|
|
1116 |
var html = '<div class="six columns">\ |
|
1117 |
<table id="vm_placement_table" class="extended_table twelve">\ |
|
1118 |
<thead>\ |
|
1119 |
<tr>\ |
|
1120 |
<th colspan="2" align="center">'+tr("Placement")+'</th>\ |
|
1121 |
</tr>\ |
|
1122 |
</thead>\ |
|
1123 |
<tbody>\ |
|
1124 |
<tr>\ |
|
1125 |
<td>REQUIREMENTS</td>\ |
|
1126 |
<td>'+requirements_str+'</td>\ |
|
1127 |
</tr>\ |
|
1128 |
<tr>\ |
|
1129 |
<td>RANK</td>\ |
|
1130 |
<td>'+rank_str+'</td>\ |
|
1131 |
</tr>\ |
|
1132 |
</tbody>\ |
|
1133 |
</table>\ |
|
1134 |
</div>\ |
|
1135 |
<div class="six columns">\ |
|
1094 | 1136 |
<table id="vm_history_table" class="extended_table twelve">\ |
1095 | 1137 |
<thead>\ |
1096 | 1138 |
<tr>\ |
1097 |
<th>'+tr("Sequence")+'</th>\
|
|
1139 |
<th>'+tr("#")+'</th>\
|
|
1098 | 1140 |
<th>'+tr("Host")+'</th>\ |
1099 | 1141 |
<th>'+tr("Reason")+'</th>\ |
1100 |
<th>'+tr("State change time")+'</th>\
|
|
1142 |
<th>'+tr("Chg time")+'</th>\
|
|
1101 | 1143 |
<th>'+tr("Total time")+'</th>\ |
1102 | 1144 |
<th colspan="2">'+tr("Prolog time")+'</th>\ |
1103 | 1145 |
</tr>\ |
... | ... | |
1315 | 1357 |
}; |
1316 | 1358 |
|
1317 | 1359 |
|
1318 |
var history_tab = {
|
|
1319 |
title: tr("History"),
|
|
1320 |
content: generateHistoryTable(vm_info)
|
|
1360 |
var placement_tab = {
|
|
1361 |
title: tr("Placement"),
|
|
1362 |
content: generatePlacementTable(vm_info)
|
|
1321 | 1363 |
}; |
1322 | 1364 |
|
1323 | 1365 |
$("#div_edit_rename_link").die(); |
... | ... | |
1344 | 1386 |
Sunstone.updateInfoPanelTab("vm_info_panel","vm_hotplugging_tab",hotplugging_tab); |
1345 | 1387 |
Sunstone.updateInfoPanelTab("vm_info_panel","vm_network_tab",network_tab); |
1346 | 1388 |
Sunstone.updateInfoPanelTab("vm_info_panel","vm_snapshot_tab",snapshot_tab); |
1347 |
Sunstone.updateInfoPanelTab("vm_info_panel","vm_history_tab",history_tab);
|
|
1389 |
Sunstone.updateInfoPanelTab("vm_info_panel","vm_placement_tab",placement_tab);
|
|
1348 | 1390 |
Sunstone.updateInfoPanelTab("vm_info_panel","vm_template_tab",template_tab); |
1349 | 1391 |
Sunstone.updateInfoPanelTab("vm_info_panel","vm_log_tab",log_tab); |
1350 | 1392 |
Sunstone.updateInfoPanelTab("vm_info_panel","vm_actions_tab",actions_tab); |
1351 |
Sunstone.updateInfoPanelTab("vm_info_panel","vm_history_tab",history_tab); |
|
1352 | 1393 |
|
1353 | 1394 |
// TODO: re-use pool_monitor data? |
1354 | 1395 |
|
... | ... | |
1394 | 1435 |
</div>' |
1395 | 1436 |
|
1396 | 1437 |
// Remove previous listeners |
1397 |
$(".remove_x").die(); |
|
1398 |
$(".edit_e").die(); |
|
1438 |
$(".remove_action_x").die();
|
|
1439 |
$(".edit_action_e").die();
|
|
1399 | 1440 |
$('#add_scheduling_action').die(); |
1400 | 1441 |
$("#submit_scheduling_action").die(); |
1401 | 1442 |
$(".select_action").die(); |
... | ... | |
1477 | 1518 |
// Let OpenNebula know |
1478 | 1519 |
var template_str = convert_template_to_string(vm_info.USER_TEMPLATE); |
1479 | 1520 |
console.log(template_str) |
1480 |
Sunstone.runAction("VM.update_template",vm_info.ID,template_str);
|
|
1521 |
Sunstone.runAction("VM.update_actions",vm_info.ID,template_str);
|
|
1481 | 1522 |
|
1482 | 1523 |
$("#add_scheduling_action").removeAttr("disabled"); |
1483 | 1524 |
return false; |
1484 | 1525 |
}); |
1485 | 1526 |
|
1486 | 1527 |
// Listener for key,value pair remove action |
1487 |
$(".remove_x").live("click", function() { |
|
1488 |
// Remove div_minus_ from the id |
|
1528 |
$(".remove_action_x").live("click", function() { |
|
1489 | 1529 |
var index = this.id.substring(6,this.id.length); |
1490 | 1530 |
var tmp_tmpl = new Array(); |
1491 | 1531 |
|
... | ... | |
1498 | 1538 |
var template_str = convert_template_to_string(vm_info.USER_TEMPLATE); |
1499 | 1539 |
|
1500 | 1540 |
// Let OpenNebula know |
1501 |
Sunstone.runAction("VM.update_template",vm_info.ID,template_str);
|
|
1541 |
Sunstone.runAction("VM.update_actions",vm_info.ID,template_str);
|
|
1502 | 1542 |
}); |
1503 | 1543 |
|
1504 | 1544 |
// Listener for key,value pair edit action |
1505 |
$(".edit_e").live("click", function() { |
|
1545 |
$(".edit_action_e").live("click", function() {
|
|
1506 | 1546 |
// Action |
1507 | 1547 |
$("#add_scheduling_action").attr("disabled", "disabled"); |
1508 | 1548 |
|
... | ... | |
1560 | 1600 |
var template_str = convert_template_to_string(vm_info.USER_TEMPLATE); |
1561 | 1601 |
|
1562 | 1602 |
// Let OpenNebula know |
1563 |
Sunstone.runAction("VM.update_template",vm_info.ID,template_str);
|
|
1603 |
Sunstone.runAction("VM.update_actions",vm_info.ID,template_str);
|
|
1564 | 1604 |
$("#add_scheduling_action").removeAttr("disabled"); |
1565 | 1605 |
}); |
1566 | 1606 |
|
... | ... | |
1588 | 1628 |
var template_str = convert_template_to_string(vm_info.USER_TEMPLATE); |
1589 | 1629 |
|
1590 | 1630 |
// Let OpenNebula know |
1591 |
Sunstone.runAction("VM.update_template",vm_info.ID,template_str);
|
|
1631 |
Sunstone.runAction("VM.update_actions",vm_info.ID,template_str);
|
|
1592 | 1632 |
$("#add_scheduling_action").removeAttr("disabled"); |
1593 | 1633 |
}); |
1594 | 1634 |
|
... | ... | |
1630 | 1670 |
<td class="message_row">'+message_str+'</td>\ |
1631 | 1671 |
<td>\ |
1632 | 1672 |
<div>\ |
1633 |
<a id="edit_'+scheduling_action.ID+'" class="edit_e" href="#"><i class="icon-edit"/></a>\ |
|
1673 |
<a id="edit_'+scheduling_action.ID+'" class="edit_action_e" href="#"><i class="icon-edit"/></a>\
|
|
1634 | 1674 |
\ |
1635 |
<a id="minus_'+scheduling_action.ID+'" class="remove_x" href="#"><i class="icon-trash"/></a>\ |
|
1675 |
<a id="minus_'+scheduling_action.ID+'" class="remove_action_x" href="#"><i class="icon-trash"/></a>\
|
|
1636 | 1676 |
</div>\ |
1637 | 1677 |
</td>\ |
1638 | 1678 |
</tr>'; |
Also available in: Unified diff