group action icons by type

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-02-21 21:50:54 +00:00
parent 00683eddb8
commit b6642c9f0c
19 changed files with 23 additions and 18 deletions

View File

@ -22,8 +22,8 @@
<div class="input-grid" id="disks" style="grid-template-columns: auto auto auto 1fr;"></div> <div class="input-grid" id="disks" style="grid-template-columns: auto auto auto 1fr;"></div>
<hr> <hr>
<div class="btn-group"> <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="disk-add" src="images/actions/disk/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"> <img id="cd-add" src="images/actions/disk/add-cd.svg" class="clickable none" alt="Add New CDROM" title="Add New CDROM">
</div> </div>
</fieldset> </fieldset>
<fieldset class="fieldset-no-border"> <fieldset class="fieldset-no-border">

View File

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 326 B

View File

Before

Width:  |  Height:  |  Size: 386 B

After

Width:  |  Height:  |  Size: 386 B

View File

Before

Width:  |  Height:  |  Size: 407 B

After

Width:  |  Height:  |  Size: 407 B

View File

Before

Width:  |  Height:  |  Size: 479 B

After

Width:  |  Height:  |  Size: 479 B

View File

Before

Width:  |  Height:  |  Size: 64 B

After

Width:  |  Height:  |  Size: 64 B

View File

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 208 B

View File

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 208 B

View File

Before

Width:  |  Height:  |  Size: 265 B

After

Width:  |  Height:  |  Size: 265 B

View File

Before

Width:  |  Height:  |  Size: 268 B

After

Width:  |  Height:  |  Size: 268 B

View File

Before

Width:  |  Height:  |  Size: 1015 B

After

Width:  |  Height:  |  Size: 1015 B

View File

Before

Width:  |  Height:  |  Size: 1018 B

After

Width:  |  Height:  |  Size: 1018 B

View File

Before

Width:  |  Height:  |  Size: 443 B

After

Width:  |  Height:  |  Size: 443 B

View File

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 446 B

View File

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 232 B

View File

Before

Width:  |  Height:  |  Size: 285 B

After

Width:  |  Height:  |  Size: 285 B

View File

@ -16,6 +16,8 @@
<button id="logout">LOGOUT</button> <button id="logout">LOGOUT</button>
</nav> </nav>
</header> </header>
<main><div id="instance-container" class="center-div"></div></main> <main>
<div id="instance-container" class="center-div"></div>
</main>
</body> </body>
</html> </html>

View File

@ -133,18 +133,24 @@ function addDiskLine (fieldset, busPrefix, busName, device, diskDetails) {
let action = document.createElement("img"); let action = document.createElement("img");
action.classList.add("clickable"); action.classList.add("clickable");
if (element === "detach_attach" && diskMetaData[type][busPrefix].actions.includes("attach")){ // attach if (element === "detach_attach" && diskMetaData[type][busPrefix].actions.includes("attach")){ // attach
action.src = "images/actions/attach.svg"; action.src = "images/actions/disk/attach.svg";
action.title = "Attach Disk"; action.title = "Attach Disk";
action.addEventListener("click", handleDiskAttach); action.addEventListener("click", handleDiskAttach);
} }
else if (element === "detach_attach" && diskMetaData[type][busPrefix].actions.includes("detach")){ // detach else if (element === "detach_attach" && diskMetaData[type][busPrefix].actions.includes("detach")){ // detach
action.src = "images/actions/detach.svg"; action.src = "images/actions/disk/detach.svg";
action.title = "Detach Disk"; action.title = "Detach Disk";
action.addEventListener("click", handleDiskDetach); action.addEventListener("click", handleDiskDetach);
} }
else if (element === "delete") {
let active = diskMetaData[type][busPrefix].actions.includes(element) ? "active" : "inactive"; // resize
action.src = `images/actions/delete-${active}.svg`;
action.title = "Delete Disk";
action.addEventListener("click", handleDiskDelete);
}
else { else {
let active = diskMetaData[type][busPrefix].actions.includes(element) ? "active" : "inactive"; // resize let active = diskMetaData[type][busPrefix].actions.includes(element) ? "active" : "inactive"; // resize
action.src = `images/actions/${element}-${active}.svg`; action.src = `images/actions/disk/${element}-${active}.svg`;
action.title = `${element.charAt(0).toUpperCase()}${element.slice(1)} Disk`; action.title = `${element.charAt(0).toUpperCase()}${element.slice(1)} Disk`;
if (active === "active") { if (active === "active") {
if (element === "move") { if (element === "move") {
@ -153,9 +159,6 @@ function addDiskLine (fieldset, busPrefix, busName, device, diskDetails) {
else if (element === "resize") { else if (element === "resize") {
action.addEventListener("click", handleDiskResize); action.addEventListener("click", handleDiskResize);
} }
else if (element === "delete") {
action.addEventListener("click", handleDiskDelete);
}
} }
} }
action.dataset.disk = diskID; action.dataset.disk = diskID;

View File

@ -34,31 +34,31 @@ export const resources = {
export const instances = { export const instances = {
running: { running: {
powerButtonSrc: "images/actions/stop.svg", powerButtonSrc: "images/actions/instance/stop.svg",
powerButtonAlt: "Shutdown Instance", powerButtonAlt: "Shutdown Instance",
configButtonSrc: "images/actions/config-inactive.svg", configButtonSrc: "images/actions/instance/config-inactive.svg",
configButtonAlt: "Change Configuration (Inactive)", configButtonAlt: "Change Configuration (Inactive)",
consoleButtonSrc: "images/actions/console-active.svg", consoleButtonSrc: "images/actions/instance/console-active.svg",
consoleButtonAlt: "Open Console", consoleButtonAlt: "Open Console",
deleteButtonSrc: "images/actions/delete-inactive.svg", deleteButtonSrc: "images/actions/delete-inactive.svg",
deleteButtonAlt: "Delete Instance (Inactive)" deleteButtonAlt: "Delete Instance (Inactive)"
}, },
stopped: { stopped: {
powerButtonSrc: "images/actions/start.svg", powerButtonSrc: "images/actions/instance/start.svg",
powerButtonAlt: "Start Instance", powerButtonAlt: "Start Instance",
configButtonSrc: "images/actions/config-active.svg", configButtonSrc: "images/actions/instance/config-active.svg",
configButtonAlt: "Change Configuration", configButtonAlt: "Change Configuration",
consoleButtonSrc: "images/actions/console-inactive.svg", consoleButtonSrc: "images/actions/instance/console-inactive.svg",
consoleButtonAlt: "Open Console (Inactive)", consoleButtonAlt: "Open Console (Inactive)",
deleteButtonSrc: "images/actions/delete-active.svg", deleteButtonSrc: "images/actions/delete-active.svg",
deleteButtonAlt: "Delete Instance" deleteButtonAlt: "Delete Instance"
}, },
loading: { loading: {
powerButtonSrc: "images/actions/loading.svg", powerButtonSrc: "images/actions/instance/loading.svg",
powerButtonAlt: "Loading Instance", powerButtonAlt: "Loading Instance",
configButtonSrc: "images/actions/config-inactive.svg", configButtonSrc: "images/actions/instance/config-inactive.svg",
configButtonAlt: "Change Configuration (Inactive)", configButtonAlt: "Change Configuration (Inactive)",
consoleButtonSrc: "images/actions/console-inactive.svg", consoleButtonSrc: "images/actions/instance/console-inactive.svg",
consoleButtonAlt: "Open Console (Inactive)", consoleButtonAlt: "Open Console (Inactive)",
deleteButtonSrc: "images/actions/delete-inactive.svg", deleteButtonSrc: "images/actions/delete-inactive.svg",
deleteButtonAlt: "Delete Instance (Inactive)" deleteButtonAlt: "Delete Instance (Inactive)"