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 {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 window.addEventListener("DOMContentLoaded", init); // do the dumb thing where the disk config refreshes every second
@ -191,7 +191,7 @@ async function handleDiskDetach () {
populateDisk(); populateDisk();
} }
else { else {
console.error(result); alert(result.error);
await getConfig(); await getConfig();
populateDisk(); populateDisk();
} }
@ -222,7 +222,7 @@ async function handleDiskAttach () {
populateDisk(); populateDisk();
} }
else { else {
console.error(result); alert(result.error);
await getConfig(); await getConfig();
populateDisk(); populateDisk();
} }
@ -250,7 +250,7 @@ async function handleDiskResize () {
populateDisk(); populateDisk();
} }
else{ else{
console.error(result); alert(result.error);
await getConfig(); await getConfig();
populateDisk(); populateDisk();
} }
@ -294,7 +294,7 @@ async function handleDiskMove () {
populateDisk(); populateDisk();
} }
else { else {
console.error(result); alert(result.error);
await getConfig(); await getConfig();
populateDisk(); populateDisk();
} }
@ -321,7 +321,7 @@ async function handleDiskDelete () {
populateDisk(); populateDisk();
} }
else { else {
console.error(result); alert(result.error);
await getConfig(); await getConfig();
populateDisk(); populateDisk();
} }
@ -365,7 +365,7 @@ async function handleDiskAdd () {
populateDisk(); populateDisk();
} }
else { else {
console.error(result); alert(result.error);
await getConfig(); await getConfig();
populateDisk(); populateDisk();
} }
@ -408,7 +408,7 @@ async function handleCDAdd () {
populateDisk(); populateDisk();
} }
else { else {
console.error(result); alert(result.error);
await getConfig(); await getConfig();
populateDisk(); populateDisk();
} }
@ -442,7 +442,7 @@ async function handleFormExit () {
populateDisk(); populateDisk();
} }
else { else {
console.error(result); alert(result.error);
} }
goToPage("index.html"); goToPage("index.html");
} }

View File

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

View File

@ -1,5 +1,5 @@
import {requestPVE, requestAPI, goToPage, goToURL, instances, nodes} from "./utils.js"; 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 { export class Instance extends HTMLElement {
constructor () { constructor () {
@ -144,7 +144,7 @@ export class Instance extends HTMLElement {
} }
else if (taskStatus.data.status === "stopped") { // task stopped but was not successful else if (taskStatus.data.status === "stopped") { // task stopped but was not successful
this.status = prevStatus; 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.update();
this.actionLock = false; this.actionLock = false;
break; break;
@ -201,7 +201,7 @@ export class Instance extends HTMLElement {
this.parentNode.removeChild(this); this.parentNode.removeChild(this);
} }
else { else {
console.error(result); alert(result.error);
this.status = this.prevStatus; this.status = this.prevStatus;
this.update(); this.update();
this.actionLock = false; this.actionLock = false;