gracefully recover from config error

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-02-28 23:56:39 +00:00
parent 0caaded1a5
commit e72ca340c9
4 changed files with 20 additions and 0 deletions

View File

@ -192,6 +192,8 @@ async function handleDiskDetach () {
} }
else { else {
console.error(result); console.error(result);
await getConfig();
populateDisk();
} }
} }
}; };
@ -226,6 +228,8 @@ async function handleDiskAttach () {
} }
else { else {
console.error(result); console.error(result);
await getConfig();
populateDisk();
} }
} }
}; };
@ -257,6 +261,8 @@ async function handleDiskResize () {
} }
else{ else{
console.error(result); console.error(result);
await getConfig();
populateDisk();
} }
} }
}; };
@ -305,6 +311,8 @@ async function handleDiskMove () {
} }
else { else {
console.error(result); console.error(result);
await getConfig();
populateDisk();
} }
} }
}; };
@ -335,6 +343,8 @@ async function handleDiskDelete () {
} }
else { else {
console.error(result); console.error(result);
await getConfig();
populateDisk();
} }
} }
}; };
@ -383,6 +393,8 @@ async function handleDiskAdd () {
} }
else { else {
console.error(result); console.error(result);
await getConfig();
populateDisk();
} }
} }
}; };
@ -442,6 +454,8 @@ async function handleCDAdd () {
} }
else { else {
console.error(result); console.error(result);
await getConfig();
populateDisk();
} }
} }
}; };

View File

@ -172,6 +172,7 @@ async function handleInstanceAdd () {
} }
else { else {
console.error(result); console.error(result);
populateInstances();
} }
} }
} }

View File

@ -171,6 +171,7 @@ export class Instance extends HTMLElement {
dialog.callback = async (result, form) => { dialog.callback = async (result, form) => {
if (result === "confirm") { if (result === "confirm") {
this.actionLock = true; this.actionLock = true;
let prevStatus = this.status;
this.status = "loading"; this.status = "loading";
this.update(); this.update();
@ -191,6 +192,9 @@ export class Instance extends HTMLElement {
} }
else { else {
console.error(result); console.error(result);
this.status = this.prevStatus;
this.update();
this.actionLock = false;
} }
} }
} }

View File

@ -8,6 +8,7 @@ function init (){
let status = document.querySelector("#status"); let status = document.querySelector("#status");
formSubmitButton.addEventListener("click", async (e) => { formSubmitButton.addEventListener("click", async (e) => {
status.innerText = ""; status.innerText = "";
status.style.color = "#000000";
e.preventDefault(); e.preventDefault();
let form = document.querySelector("form"); let form = document.querySelector("form");
let formData = new FormData(form); let formData = new FormData(form);