mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 04:06:47 +00:00
feat(instances): a VM's boot settings as switches and its boot order as one list
The Boot pane shows Autostart and the boot menu as switches that save on change, and the boot order as one list of the VM's disks, CD-ROM drives and NICs: the devices in the order first, checked and numbered, the others below. Up and Down move the checked devices; Apply order saves. - The boot menu can be changed while the VM runs: it is in the persistent definition, so it applies at the next start, as the boot order does. - The boot order editor no longer needs the boot menu enabled. - A VM that boots by device type (<os><boot dev='hd'/>) names those types; checking devices replaces that order. - An order is refused while a device the list does not show (a host device, a floppy) has a boot place, so Apply does not drop it; the message points to the XML editor. - An empty order is refused with a message instead of being ignored. - get_bootorder gives a NIC's full MAC as its target. - The unused jQuery multiselect plugin is removed.
This commit is contained in:
parent
a8f445d580
commit
20cfc25367
10 changed files with 168 additions and 163 deletions
|
|
@ -226,63 +226,39 @@
|
|||
});
|
||||
</script>
|
||||
<script>
|
||||
function set_orderlist(obj){
|
||||
var result = '';
|
||||
$('#b_order label input:checked').each(function () {
|
||||
if (result != '') result += ',';
|
||||
result += $(this).val();
|
||||
});
|
||||
obj.val(result);
|
||||
// the boot order: the checked devices, top to bottom, as "disk:vda,cdrom:sda"
|
||||
function set_orderlist() {
|
||||
var order = $('#b_order input:checked').map(function () { return this.value; }).get();
|
||||
$('#bootorder').val(order.join(','));
|
||||
}
|
||||
$(document).ready(function () {
|
||||
{# Boot Order Arragements #}
|
||||
jQuery.fn.multiselect = function() {
|
||||
$(this).each(function() {
|
||||
var checkboxes = $(this).find("input:checkbox");
|
||||
checkboxes.each(function() {
|
||||
var checkbox = $(this);
|
||||
// Highlight pre-selected checkboxes
|
||||
if (checkbox.prop("checked"))
|
||||
checkbox.parent().addClass("multiselect-on");
|
||||
// Highlight checkboxes that the user selects
|
||||
checkbox.click(function() {
|
||||
if (checkbox.prop("checked"))
|
||||
checkbox.parent().addClass("multiselect-on");
|
||||
else
|
||||
checkbox.parent().removeClass("multiselect-on");
|
||||
});
|
||||
$(function () {
|
||||
set_orderlist();
|
||||
$('#b_order').on('change', 'input', set_orderlist);
|
||||
|
||||
$('#boot_order_up').on('click', function () {
|
||||
$('#b_order label input:checked').each(function () {
|
||||
var label = $(this).parent();
|
||||
var newPos = label.index() - 1;
|
||||
if (newPos > -1) {
|
||||
$('#b_order label').eq(newPos).before(label);
|
||||
}
|
||||
});
|
||||
set_orderlist();
|
||||
});
|
||||
};
|
||||
$(function() {
|
||||
$(".multiselect").multiselect();
|
||||
});
|
||||
|
||||
$('#boot_order_up').bind('click', function() {
|
||||
$('#b_order label input:checked').each( function() {
|
||||
var label = $(this).parent();
|
||||
var newPos = label.index() - 1;
|
||||
if (newPos > -1) {
|
||||
// moved, not rebuilt: the checkbox keeps its handler
|
||||
$('#b_order label').eq(newPos).before(label);
|
||||
}
|
||||
$('#boot_order_down').on('click', function () {
|
||||
var countOptions = $('#b_order label').length;
|
||||
var countSelected = $('#b_order label input:checked').length;
|
||||
$('#b_order label input:checked').each(function () {
|
||||
var label = $(this).parent();
|
||||
var newPos = label.index() + countSelected;
|
||||
if (newPos < countOptions) {
|
||||
$('#b_order label').eq(newPos).after(label);
|
||||
}
|
||||
});
|
||||
set_orderlist();
|
||||
});
|
||||
set_orderlist($("#bootorder"));
|
||||
});
|
||||
|
||||
$('#boot_order_down').bind('click', function() {
|
||||
var countOptions = $('#b_order label').length;
|
||||
var countSelected = $('#b_order label input:checked').length;
|
||||
$('#b_order label input:checked').each( function() {
|
||||
var label = $(this).parent();
|
||||
var newPos = label.index() + countSelected;
|
||||
if (newPos < countOptions) {
|
||||
$('#b_order label').eq(newPos).after(label);
|
||||
}
|
||||
});
|
||||
set_orderlist($("#bootorder"));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(function () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue