add cd-add button to vm config

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-02-16 00:57:11 +00:00
parent 725a7baf5e
commit 1533b26467
5 changed files with 20 additions and 5 deletions

View File

@ -21,7 +21,10 @@
<legend>Disks</legend>
<div class="input-grid" id="disks" style="grid-template-columns: auto auto auto 1fr;"></div>
<hr>
<div class="center-div"><img id="disk-add" src="images/actions/create.svg" class="clickable" alt="Add New Disk" title="Add New Disk"></div>
<div class="btn-group">
<img id="disk-add" src="images/actions/add-disk.svg" class="clickable" alt="Add New Disk" title="Add New Disk">
<img id="cd-add" src="images/actions/add-cd.svg" class="clickable none" alt="Add New CDROM" title="Add New CDROM">
</div>
</fieldset>
<fieldset class="fieldset-no-border">
<div class="btn-group" id="form-actions">

View File

@ -87,6 +87,10 @@ img.clickable {
visibility: hidden;
}
.none {
display: none;
}
.visuallyhidden {
border: 0;
clip: rect(0 0 0 0);

View File

@ -0,0 +1 @@
<svg width="16" height="16" viewBox="2 2 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 12h5m0 0h5m-5 0V7m0 5v5" stroke="#FFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle cx="12" cy="12" r="9" stroke="#FFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>

After

Width:  |  Height:  |  Size: 326 B

View File

Before

Width:  |  Height:  |  Size: 386 B

After

Width:  |  Height:  |  Size: 386 B

View File

@ -92,6 +92,16 @@ function populateDisk () {
});
}
document.querySelector("#disk-add").addEventListener("click", handleDiskAdd);
if (type === "qemu") {
document.querySelector("#cd-add").classList.remove("none");
document.querySelector("#cd-add").addEventListener("click", handleCDAdd);
}
}
function getOrderedUsed(disks){
let ordered_keys = Object.keys(disks).sort((a,b) => {parseInt(a) - parseInt(b)}); // ordered integer list
return ordered_keys;
}
function addDiskLine (fieldset, busPrefix, busName, device, diskDetails) {
@ -395,7 +405,4 @@ async function handleDiskAdd () {
dialog.show();
}
function getOrderedUsed(disks){
let ordered_keys = Object.keys(disks).sort((a,b) => {parseInt(a) - parseInt(b)}); // ordered integer list
return ordered_keys;
}
async function handleCDAdd () {}