Added success/failure banner and fixed instance status

This commit is contained in:
Pax1601
2024-01-29 13:24:09 +01:00
parent c2f6edfd74
commit 7ee3fb883b
10 changed files with 85 additions and 48 deletions

View File

@@ -474,9 +474,10 @@ class DCSInstance {
logger.log(`Editing completed successfully`);
hidePopup();
getManager().options.mode === "basic"? getManager().menuPage.show(): getManager().instancesPage.show();
getManager().options.mode === "basic"? getManager().settingsPage.show(): getManager().instancesPage.show();
} catch (err) {
logger.log(`An error occurred during editing: ${err}`);
getManager().getActiveInstance().error = true;
hidePopup();
showErrorPopup(`A critical error occurred, check ${getManager().options.logLocation} for more info.`)
}

View File

@@ -359,12 +359,19 @@ class Manager {
/* When the back button of a wizard page is clicked */
onBackClicked() {
this.activePage.hide();
/* If we have backed to the menu, instances or settings page, reset the active instance */
if ([this.instancesPage, this.settingsPage].includes(this.activePage.previousPage)) {
delete this.options.activeInstance;
}
this.activePage.previousPage.show(true); // Don't change the previous page
this.updateInstances();
}
onCancelClicked() {
this.activePage.hide();
delete this.options.activeInstance;
if (this.options.mode === "basic")
this.menuPage.show(true);
else
@@ -606,7 +613,7 @@ class Manager {
document.getElementById("loader").style.opacity = "0%";
window.setTimeout(() => {
document.getElementById("loader").classList.add("hide");
}, 200);
}, 250);
}
}

View File

@@ -40,20 +40,17 @@ class ManagerPage {
this.element.style.opacity = "0%";
window.setTimeout(() => {
this.element.classList.add("hide");
}, 200);
}, 250);
}
render(str) {
this.element.innerHTML = str;
this.element.style.opacity = "0%";
window.setTimeout(() => {
this.element.classList.remove("hide");
}, 200)
this.element.classList.remove("hide");
window.setTimeout(() => {
this.element.style.opacity = "100%";
}, 300)
}, 0)
/* Connect all the collapsable buttons */
let buttons = document.querySelectorAll(".button.collapse");

View File

@@ -97,7 +97,7 @@ function hidePopup() {
window.setTimeout(() => {
document.getElementById("grayout").classList.add("hide");
document.getElementById("popup").classList.add("hide");
}, 200);
}, 250);
}
function setPopupLoadingProgress(message, percent) {