mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Merge pull request #818 from Pax1601/813-fix-last-details-of-the-manager
Fixed missing sleep in popup callback
This commit is contained in:
commit
daec6dab5b
@ -501,7 +501,7 @@ class DCSInstance {
|
||||
} catch (err) {
|
||||
logger.log(`An error occurred during editing: ${err}`);
|
||||
getManager().getActiveInstance().error = true;
|
||||
|
||||
|
||||
showErrorPopup(`<div class='main-message'>A critical error occurred! </div><div class='sub-message'> Check ${getManager().getLogLocation()} for more info. </div>`)
|
||||
getManager().getMode() === "basic"? getManager().settingsPage.show(): getManager().instancesPage.show();
|
||||
}
|
||||
@ -599,7 +599,10 @@ class DCSInstance {
|
||||
getManager().instancesPage.show();
|
||||
return true;
|
||||
} catch (err) {
|
||||
logger.error(err)
|
||||
logger.error(err);
|
||||
|
||||
/* Nested popup calls need to wait for animation to complete */
|
||||
await sleep(300);
|
||||
showErrorPopup(`<div class='main-message'>An error has occurred while uninstalling the Olympus instance. </div><div class='sub-message'> Make sure Olympus and DCS are not running. </div><div class='sub-message'>You can find more info in ${path.join(__dirname, "..", "manager.log")} </div>`, () => {
|
||||
if (getManager().getMode() === 'basic')
|
||||
getManager().settingsPage.show();
|
||||
|
||||
@ -116,11 +116,15 @@ class Manager {
|
||||
/* Ask the user for confirmation */
|
||||
showConfirmPopup("<div class='main-message'> One or more of your Olympus instances are not up to date! </div><div class='sub-message'> If you have just updated Olympus this is normal.<br><br> Press <b>Accept</b> and the Manager will update your instances for you. <br> Press <b>Close</b> to update your instances manually using the Installation Wizard</div>", async () => {
|
||||
try {
|
||||
/* Nested popup calls need to wait for animation to complete */
|
||||
await sleep(300);
|
||||
|
||||
await DCSInstance.fixInstances();
|
||||
location.reload();
|
||||
} catch (err) {
|
||||
logger.error(err);
|
||||
|
||||
/* Nested popup calls need to wait for animation to complete */
|
||||
await sleep(300);
|
||||
showErrorPopup(`<div class='main-message'>An error occurred while trying to fix your installations. Please reinstall Olympus manually. </div><div class='sub-message'> You can find more info in ${this.options.logLocation} </div>`);
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ const AdmZip = require("adm-zip");
|
||||
const { Octokit } = require('octokit');
|
||||
const { logger } = require("./filesystem");
|
||||
const { getManager } = require('./managerfactory');
|
||||
const { sleep } = require('./utils');
|
||||
|
||||
const VERSION = "{{OLYMPUS_VERSION_NUMBER}}";
|
||||
logger.log(`Running in ${__dirname}`);
|
||||
@ -71,7 +72,10 @@ async function updateOlympusBeta() {
|
||||
const date1 = new Date(artifact.updated_at);
|
||||
const date2 = fs.statSync(".").mtime;
|
||||
if (date1 > date2) {
|
||||
showConfirmPopup(`<div class='main-message'> Looks like you are running a beta version of Olympus!</div><div class='sub-message'> Latest beta artifact timestamp of: <b style="color: orange">${date1.toLocaleString()}</b> <br> Your installation timestamp: <b style="color: orange">${date2.toLocaleString()}</b> <br><br> Do you want to update to the newest beta version?</div>`, () => {
|
||||
showConfirmPopup(`<div class='main-message'> Looks like you are running a beta version of Olympus!</div><div class='sub-message'> Latest beta artifact timestamp of: <b style="color: orange">${date1.toLocaleString()}</b> <br> Your installation timestamp: <b style="color: orange">${date2.toLocaleString()}</b> <br><br> Do you want to update to the newest beta version?</div>`, async () => {
|
||||
/* Nested popup calls need to wait for animation to complete */
|
||||
await sleep(300);
|
||||
|
||||
/* Run the browser and download the artifact */ //TODO: try and directly download the file from code rather than using the browser
|
||||
exec(`start https://github.com/Pax1601/DCSOlympus/actions/runs/${artifact.workflow_run.id}/artifacts/${artifact.id}`)
|
||||
showConfirmPopup(`<div class='main-message'> A browser window was opened to download the beta artifact. </div><div class='sub-message'> Please wait for the download to complete, then press "Accept" and select the downloaded beta artifact.</div>`,
|
||||
@ -222,8 +226,7 @@ const ipc = {
|
||||
/* From main to render. */
|
||||
'receive': [
|
||||
'event:maximized',
|
||||
'event:unmaximized',
|
||||
'check-version'
|
||||
'event:unmaximized'
|
||||
],
|
||||
/* From render to main and back again. */
|
||||
'sendReceive': []
|
||||
@ -262,6 +265,7 @@ contextBridge.exposeInMainWorld(
|
||||
window.addEventListener('DOMContentLoaded', async () => {
|
||||
document.getElementById("loader").classList.remove("hide");
|
||||
await getManager().start();
|
||||
await checkVersion();
|
||||
})
|
||||
|
||||
window.addEventListener('resize', () => {
|
||||
@ -291,8 +295,3 @@ function computePagesHeight() {
|
||||
pages[i].style.height = (window.innerHeight - (titleBar.clientHeight + header.clientHeight)) + "px";
|
||||
}
|
||||
}
|
||||
|
||||
ipcRenderer.on("check-version", () => {
|
||||
/* Check if a new version is available */
|
||||
checkVersion();
|
||||
})
|
||||
|
||||
@ -38,7 +38,6 @@ function createWindow() {
|
||||
|
||||
electronApp.on('ready', () => {
|
||||
window = createWindow();
|
||||
window.webContents.send('check-version')
|
||||
});
|
||||
|
||||
electronApp.on('window-all-closed', () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user