display errors as modal dialogs

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-05-12 21:26:26 +00:00
parent c53fb01599
commit 119efcda33
3 changed files with 14 additions and 14 deletions

View File

@ -1,5 +1,5 @@
import {requestPVE, requestAPI, goToPage, getURIData, resources} from "./utils.js";
import {dialog} from "./dialog.js";
import {alert, dialog} from "./dialog.js";
window.addEventListener("DOMContentLoaded", init); // do the dumb thing where the disk config refreshes every second
@ -191,7 +191,7 @@ async function handleDiskDetach () {
populateDisk();
}
else {
console.error(result);
alert(result.error);
await getConfig();
populateDisk();
}
@ -222,7 +222,7 @@ async function handleDiskAttach () {
populateDisk();
}
else {
console.error(result);
alert(result.error);
await getConfig();
populateDisk();
}
@ -250,7 +250,7 @@ async function handleDiskResize () {
populateDisk();
}
else{
console.error(result);
alert(result.error);
await getConfig();
populateDisk();
}
@ -294,7 +294,7 @@ async function handleDiskMove () {
populateDisk();
}
else {
console.error(result);
alert(result.error);
await getConfig();
populateDisk();
}
@ -321,7 +321,7 @@ async function handleDiskDelete () {
populateDisk();
}
else {
console.error(result);
alert(result.error);
await getConfig();
populateDisk();
}
@ -365,7 +365,7 @@ async function handleDiskAdd () {
populateDisk();
}
else {
console.error(result);
alert(result.error);
await getConfig();
populateDisk();
}
@ -408,7 +408,7 @@ async function handleCDAdd () {
populateDisk();
}
else {
console.error(result);
alert(result.error);
await getConfig();
populateDisk();
}
@ -442,7 +442,7 @@ async function handleFormExit () {
populateDisk();
}
else {
console.error(result);
alert(result.error);
}
goToPage("index.html");
}

View File

@ -1,5 +1,5 @@
import {requestPVE, requestAPI, goToPage} from "./utils.js";
import {dialog} from "./dialog.js";
import {alert, dialog} from "./dialog.js";
window.addEventListener("DOMContentLoaded", init);
@ -119,7 +119,7 @@ async function handleInstanceAdd () {
populateInstances();
}
else {
console.error(result);
alert(result.error);
populateInstances();
}
}

View File

@ -1,5 +1,5 @@
import {requestPVE, requestAPI, goToPage, goToURL, instances, nodes} from "./utils.js";
import {dialog} from "./dialog.js";
import {alert, dialog} from "./dialog.js";
export class Instance extends HTMLElement {
constructor () {
@ -144,7 +144,7 @@ export class Instance extends HTMLElement {
}
else if (taskStatus.data.status === "stopped") { // task stopped but was not successful
this.status = prevStatus;
console.error(`attempted to ${targetAction} ${this.vmid} but process returned stopped:${result.data.exitstatus}`);
alert(`attempted to ${targetAction} ${this.vmid} but process returned stopped:${result.data.exitstatus}`);
this.update();
this.actionLock = false;
break;
@ -201,7 +201,7 @@ export class Instance extends HTMLElement {
this.parentNode.removeChild(this);
}
else {
console.error(result);
alert(result.error);
this.status = this.prevStatus;
this.update();
this.actionLock = false;