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 7f6d5d319e
commit 7f3bbbbff2
4 changed files with 20 additions and 0 deletions

View File

@ -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();
}
}
};

View File

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

View File

@ -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;
}
}
}

View File

@ -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);