From 7f3bbbbff269eb6419a8fd91c712cb4120e8c75e Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Tue, 28 Feb 2023 23:56:39 +0000 Subject: [PATCH] gracefully recover from config error Signed-off-by: Arthur Lu --- scripts/config.js | 14 ++++++++++++++ scripts/index.js | 1 + scripts/instance.js | 4 ++++ scripts/login.js | 1 + 4 files changed, 20 insertions(+) diff --git a/scripts/config.js b/scripts/config.js index f1edcaa..ed14347 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -192,6 +192,8 @@ async function handleDiskDetach () { } else { console.error(result); + await getConfig(); + populateDisk(); } } }; @@ -226,6 +228,8 @@ async function handleDiskAttach () { } else { console.error(result); + await getConfig(); + populateDisk(); } } }; @@ -257,6 +261,8 @@ async function handleDiskResize () { } else{ console.error(result); + await getConfig(); + populateDisk(); } } }; @@ -305,6 +311,8 @@ async function handleDiskMove () { } else { console.error(result); + await getConfig(); + populateDisk(); } } }; @@ -335,6 +343,8 @@ async function handleDiskDelete () { } else { console.error(result); + await getConfig(); + populateDisk(); } } }; @@ -383,6 +393,8 @@ async function handleDiskAdd () { } else { console.error(result); + await getConfig(); + populateDisk(); } } }; @@ -442,6 +454,8 @@ async function handleCDAdd () { } else { console.error(result); + await getConfig(); + populateDisk(); } } }; diff --git a/scripts/index.js b/scripts/index.js index cf92beb..ee69b69 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -172,6 +172,7 @@ async function handleInstanceAdd () { } else { console.error(result); + populateInstances(); } } } diff --git a/scripts/instance.js b/scripts/instance.js index 25d216a..fc17178 100644 --- a/scripts/instance.js +++ b/scripts/instance.js @@ -171,6 +171,7 @@ export class Instance extends HTMLElement { dialog.callback = async (result, form) => { if (result === "confirm") { this.actionLock = true; + let prevStatus = this.status; this.status = "loading"; this.update(); @@ -191,6 +192,9 @@ export class Instance extends HTMLElement { } else { console.error(result); + this.status = this.prevStatus; + this.update(); + this.actionLock = false; } } } diff --git a/scripts/login.js b/scripts/login.js index 1957f49..a4d6dcb 100644 --- a/scripts/login.js +++ b/scripts/login.js @@ -8,6 +8,7 @@ function init (){ let status = document.querySelector("#status"); formSubmitButton.addEventListener("click", async (e) => { status.innerText = ""; + status.style.color = "#000000"; e.preventDefault(); let form = document.querySelector("form"); let formData = new FormData(form);