From 06c6e926cac8b9b4bc91a91ce9855581a03676be Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Fri, 12 May 2023 21:26:26 +0000 Subject: [PATCH] display errors as modal dialogs Signed-off-by: Arthur Lu --- scripts/config.js | 18 +++++++++--------- scripts/index.js | 4 ++-- scripts/instance.js | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/config.js b/scripts/config.js index 4549763..9018076 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -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"); } \ No newline at end of file diff --git a/scripts/index.js b/scripts/index.js index 85b8238..77b6aa4 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -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(); } } diff --git a/scripts/instance.js b/scripts/instance.js index 4ac74bb..2f6c601 100644 --- a/scripts/instance.js +++ b/scripts/instance.js @@ -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;