From 03df04ac1cd2db1288dca634ce05c4dbb3220848 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Thu, 16 Feb 2023 00:57:11 +0000 Subject: [PATCH] add cd-add button to vm config Signed-off-by: Arthur Lu --- config.html | 5 ++++- css/style.css | 4 ++++ images/actions/add-cd.svg | 1 + images/actions/{create.svg => add-disk.svg} | 0 scripts/config.js | 15 +++++++++++---- 5 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 images/actions/add-cd.svg rename images/actions/{create.svg => add-disk.svg} (100%) diff --git a/config.html b/config.html index 607ee27..0752a65 100644 --- a/config.html +++ b/config.html @@ -21,7 +21,10 @@ Disks

-
Add New Disk
+
+ Add New Disk + Add New CDROM +
diff --git a/css/style.css b/css/style.css index 282bfd7..aa2f576 100644 --- a/css/style.css +++ b/css/style.css @@ -87,6 +87,10 @@ img.clickable { visibility: hidden; } +.none { + display: none; +} + .visuallyhidden { border: 0; clip: rect(0 0 0 0); diff --git a/images/actions/add-cd.svg b/images/actions/add-cd.svg new file mode 100644 index 0000000..2ff123b --- /dev/null +++ b/images/actions/add-cd.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/actions/create.svg b/images/actions/add-disk.svg similarity index 100% rename from images/actions/create.svg rename to images/actions/add-disk.svg diff --git a/scripts/config.js b/scripts/config.js index 035149f..0d440cd 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -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; -} \ No newline at end of file +async function handleCDAdd () {} \ No newline at end of file