mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added simplified mode and disabled not useful buttons
This commit is contained in:
3
manager/DCS.openbeta - Copia.log
Normal file
3
manager/DCS.openbeta - Copia.log
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Microsoft (R) Windows Script Host Versione 5.812
|
||||||
|
Copyright (C) Microsoft Corporation. Tutti i diritti riservati.
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
</style>
|
</style>
|
||||||
<div id="manager-connections">
|
<div id="manager-connections">
|
||||||
<div class="step-summary">
|
<div class="step-summary">
|
||||||
<div class="blue <%= !install? 'hide': '' %>">User path</div>
|
<div class="blue <%= !install || simplified? 'hide': '' %>">User path</div>
|
||||||
<div class="white">Ports and address</div>
|
<div class="white">Ports and address</div>
|
||||||
<div class="empty">Passwords</div>
|
<div class="empty">Passwords</div>
|
||||||
<div class="empty"> <%= install? 'Install': 'Update' %></div>
|
<div class="empty"> <%= install? 'Install': 'Update' %></div>
|
||||||
@@ -75,15 +75,19 @@
|
|||||||
<input type="text" value="<%= instance["backendAddress"] %>">
|
<input type="text" value="<%= instance["backendAddress"] %>">
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons-footer">
|
<div class="buttons-footer">
|
||||||
|
<% if (!simplified) { %>
|
||||||
<div class="button back">
|
<div class="button back">
|
||||||
Back
|
Back
|
||||||
</div>
|
</div>
|
||||||
|
<% } %>
|
||||||
<div class="button next">
|
<div class="button next">
|
||||||
Next
|
Next
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% if (!simplified) { %>
|
||||||
<div class="button cancel">
|
<div class="button cancel">
|
||||||
Cancel installation
|
Cancel installation
|
||||||
</div>
|
</div>
|
||||||
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -55,6 +55,8 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
background-color: transparent;
|
||||||
|
color: var(--offwhite);
|
||||||
}
|
}
|
||||||
|
|
||||||
#manager-menu .option:hover {
|
#manager-menu .option:hover {
|
||||||
@@ -62,6 +64,12 @@
|
|||||||
background-color: var(--offwhite);
|
background-color: var(--offwhite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#manager-menu .option.disabled {
|
||||||
|
pointer-events: none;
|
||||||
|
color: var(--darkgray);
|
||||||
|
border-color: var(--darkgray);
|
||||||
|
}
|
||||||
|
|
||||||
#manager-menu .option * {
|
#manager-menu .option * {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
@@ -74,14 +82,14 @@
|
|||||||
<div>Using this manager, you can install Olympus, update settings, and view and manage instances</div>
|
<div>Using this manager, you can install Olympus, update settings, and view and manage instances</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="menu">
|
<div id="menu">
|
||||||
<div class="option install">
|
<div class="option install <%= installEnabled? '': 'disabled' %>">
|
||||||
Install Olympus
|
Install Olympus
|
||||||
</div>
|
</div>
|
||||||
<div class="option update">
|
<div class="option update <%= updateEnabled? '': 'disabled' %>">
|
||||||
Update/remove Olympus
|
Update/remove Olympus
|
||||||
</div>
|
</div>
|
||||||
<div class="option divider"></div>
|
<div class="option divider"></div>
|
||||||
<div class="option manage">
|
<div class="option manage <%= manageEnabled? '': 'disabled' %>">
|
||||||
View and manage instances
|
View and manage instances
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
</style>
|
</style>
|
||||||
<div id="manager-passwords">
|
<div id="manager-passwords">
|
||||||
<div class="step-summary">
|
<div class="step-summary">
|
||||||
<div class="blue <%= !install? 'hide': '' %>">User path</div>
|
<div class="blue <%= !install || simplified? 'hide': '' %>">User path</div>
|
||||||
<div class="blue">Ports and address</div>
|
<div class="blue">Ports and address</div>
|
||||||
<div class="white">Passwords</div>
|
<div class="white">Passwords</div>
|
||||||
<div class="empty"> <%= install? 'Install': 'Update' %></div>
|
<div class="empty"> <%= install? 'Install': 'Update' %></div>
|
||||||
@@ -41,8 +41,10 @@
|
|||||||
Next
|
Next
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% if (!simplified) { %>
|
||||||
<div class="button cancel">
|
<div class="button cancel">
|
||||||
Cancel installation
|
Cancel installation
|
||||||
</div>
|
</div>
|
||||||
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -15,9 +15,14 @@ class ConnectionsPage extends ManagerPage {
|
|||||||
const element = this.getElement();
|
const element = this.getElement();
|
||||||
element.innerHTML = str;
|
element.innerHTML = str;
|
||||||
|
|
||||||
this.element.querySelector(".back").addEventListener("click", (e) => this.onBackClicked(e));
|
if (this.element.querySelector(".back"))
|
||||||
this.element.querySelector(".next").addEventListener("click", (e) => this.onNextClicked(e));
|
this.element.querySelector(".back").addEventListener("click", (e) => this.onBackClicked(e));
|
||||||
this.element.querySelector(".cancel").addEventListener("click", (e) => this.onCancelClicked(e));
|
|
||||||
|
if (this.element.querySelector(".next"))
|
||||||
|
this.element.querySelector(".next").addEventListener("click", (e) => this.onNextClicked(e));
|
||||||
|
|
||||||
|
if (this.element.querySelector(".cancel"))
|
||||||
|
this.element.querySelector(".cancel").addEventListener("click", (e) => this.onCancelClicked(e));
|
||||||
|
|
||||||
this.element.querySelector(".client-port").querySelector("input").addEventListener("change", async (e) => { this.setClientPort(Number(e.target.value)); })
|
this.element.querySelector(".client-port").querySelector("input").addEventListener("change", async (e) => { this.setClientPort(Number(e.target.value)); })
|
||||||
this.element.querySelector(".backend-port").querySelector("input").addEventListener("change", async (e) => { this.setBackendPort(Number(e.target.value)); })
|
this.element.querySelector(".backend-port").querySelector("input").addEventListener("change", async (e) => { this.setBackendPort(Number(e.target.value)); })
|
||||||
|
|||||||
@@ -10,13 +10,17 @@ const { showErrorPopup, showWaitPopup } = require('./popup');
|
|||||||
const { fixInstances } = require('./filesystem');
|
const { fixInstances } = require('./filesystem');
|
||||||
|
|
||||||
class Manager {
|
class Manager {
|
||||||
|
simplified = true;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
var instances = await DCSInstance.getInstances();
|
var instances = await DCSInstance.getInstances();
|
||||||
|
|
||||||
|
this.simplified = instances.length === 1 && !instances[0].installed;
|
||||||
|
|
||||||
document.getElementById("loader").classList.add("hide");
|
document.getElementById("loader").classList.add("hide");
|
||||||
|
|
||||||
if (instances.some((instance) => {
|
if (instances.some((instance) => {
|
||||||
@@ -33,8 +37,18 @@ class Manager {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const installEnabled = instances.some((instance) => { return !instance.installed; });
|
||||||
|
const updateEnabled = instances.some((instance) => { return instance.installed; });
|
||||||
|
const manageEnabled = instances.some((instance) => { return instance.installed; });
|
||||||
|
|
||||||
/* Menu */
|
/* Menu */
|
||||||
var menuPage = new MenuPage();
|
var menuPage = new MenuPage();
|
||||||
|
menuPage.options = {
|
||||||
|
...menuPage.options,
|
||||||
|
installEnabled: installEnabled,
|
||||||
|
updateEnabled: updateEnabled,
|
||||||
|
manageEnabled: manageEnabled
|
||||||
|
}
|
||||||
menuPage.onInstallClicked = (e) => {
|
menuPage.onInstallClicked = (e) => {
|
||||||
menuPage.hide();
|
menuPage.hide();
|
||||||
installationsPage.show();
|
installationsPage.show();
|
||||||
@@ -66,16 +80,19 @@ class Manager {
|
|||||||
connectionsPage.options = {
|
connectionsPage.options = {
|
||||||
...connectionsPage.options,
|
...connectionsPage.options,
|
||||||
instance: activeInstance,
|
instance: activeInstance,
|
||||||
|
simplified: this.simplified,
|
||||||
install: true
|
install: true
|
||||||
}
|
}
|
||||||
passwordsPage.options = {
|
passwordsPage.options = {
|
||||||
...passwordsPage.options,
|
...passwordsPage.options,
|
||||||
instance: activeInstance,
|
instance: activeInstance,
|
||||||
|
simplified: this.simplified,
|
||||||
install: true
|
install: true
|
||||||
}
|
}
|
||||||
resultPage.options = {
|
resultPage.options = {
|
||||||
...resultPage.options,
|
...resultPage.options,
|
||||||
instance: activeInstance,
|
instance: activeInstance,
|
||||||
|
simplified: this.simplified,
|
||||||
install: true
|
install: true
|
||||||
}
|
}
|
||||||
installationsPage.hide();
|
installationsPage.hide();
|
||||||
@@ -101,16 +118,19 @@ class Manager {
|
|||||||
connectionsPage.options = {
|
connectionsPage.options = {
|
||||||
...connectionsPage.options,
|
...connectionsPage.options,
|
||||||
instance: activeInstance,
|
instance: activeInstance,
|
||||||
|
simplified: this.simplified,
|
||||||
install: false
|
install: false
|
||||||
}
|
}
|
||||||
passwordsPage.options = {
|
passwordsPage.options = {
|
||||||
...passwordsPage.options,
|
...passwordsPage.options,
|
||||||
instance: activeInstance,
|
instance: activeInstance,
|
||||||
|
simplified: this.simplified,
|
||||||
install: false
|
install: false
|
||||||
}
|
}
|
||||||
resultPage.options = {
|
resultPage.options = {
|
||||||
...resultPage.options,
|
...resultPage.options,
|
||||||
instance: activeInstance,
|
instance: activeInstance,
|
||||||
|
simplified: this.simplified,
|
||||||
install: false
|
install: false
|
||||||
}
|
}
|
||||||
instancesPage.hide();
|
instancesPage.hide();
|
||||||
@@ -199,7 +219,30 @@ class Manager {
|
|||||||
document.body.appendChild(passwordsPage.getElement());
|
document.body.appendChild(passwordsPage.getElement());
|
||||||
document.body.appendChild(resultPage.getElement());
|
document.body.appendChild(resultPage.getElement());
|
||||||
|
|
||||||
menuPage.show();
|
if (this.simplified) {
|
||||||
|
connectionsPage.options = {
|
||||||
|
...connectionsPage.options,
|
||||||
|
instance: instances[0],
|
||||||
|
simplified: this.simplified,
|
||||||
|
install: true
|
||||||
|
}
|
||||||
|
passwordsPage.options = {
|
||||||
|
...passwordsPage.options,
|
||||||
|
instance: instances[0],
|
||||||
|
simplified: this.simplified,
|
||||||
|
install: true
|
||||||
|
}
|
||||||
|
resultPage.options = {
|
||||||
|
...resultPage.options,
|
||||||
|
instance: instances[0],
|
||||||
|
simplified: this.simplified,
|
||||||
|
install: true
|
||||||
|
}
|
||||||
|
instancesPage.hide();
|
||||||
|
connectionsPage.show();
|
||||||
|
} else {
|
||||||
|
menuPage.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,6 @@ class MenuPage extends ManagerPage {
|
|||||||
|
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
ejs.renderFile("./ejs/menu.ejs", options, {}, (err, str) => {
|
|
||||||
if (!err) {
|
|
||||||
this.render(str);
|
|
||||||
} else {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render(str) {
|
render(str) {
|
||||||
@@ -26,6 +18,20 @@ class MenuPage extends ManagerPage {
|
|||||||
element.querySelector(".update").addEventListener("click", (e) => this.onUpdateClicked(e))
|
element.querySelector(".update").addEventListener("click", (e) => this.onUpdateClicked(e))
|
||||||
element.querySelector(".manage").addEventListener("click", (e) => this.onManageClicked(e))
|
element.querySelector(".manage").addEventListener("click", (e) => this.onManageClicked(e))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
show() {
|
||||||
|
this.instance = this.options.instance;
|
||||||
|
|
||||||
|
ejs.renderFile("./ejs/menu.ejs", this.options, {}, (err, str) => {
|
||||||
|
if (!err) {
|
||||||
|
this.render(str);
|
||||||
|
} else {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
super.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = MenuPage;
|
module.exports = MenuPage;
|
||||||
@@ -14,9 +14,14 @@ class PasswordsPage extends ManagerPage {
|
|||||||
const element = this.getElement();
|
const element = this.getElement();
|
||||||
element.innerHTML = str;
|
element.innerHTML = str;
|
||||||
|
|
||||||
this.element.querySelector(".back").addEventListener("click", (e) => this.onBackClicked(e));
|
if (this.element.querySelector(".back"))
|
||||||
this.element.querySelector(".next").addEventListener("click", (e) => this.onNextClicked(e));
|
this.element.querySelector(".back").addEventListener("click", (e) => this.onBackClicked(e));
|
||||||
this.element.querySelector(".cancel").addEventListener("click", (e) => this.onCancelClicked(e));
|
|
||||||
|
if (this.element.querySelector(".next"))
|
||||||
|
this.element.querySelector(".next").addEventListener("click", (e) => this.onNextClicked(e));
|
||||||
|
|
||||||
|
if (this.element.querySelector(".cancel"))
|
||||||
|
this.element.querySelector(".cancel").addEventListener("click", (e) => this.onCancelClicked(e));
|
||||||
|
|
||||||
this.element.querySelector(".game-master").querySelector("input").addEventListener("change", async (e) => { this.instance.setGameMasterPassword(e.target.value); })
|
this.element.querySelector(".game-master").querySelector("input").addEventListener("change", async (e) => { this.instance.setGameMasterPassword(e.target.value); })
|
||||||
this.element.querySelector(".blue-commander").querySelector("input").addEventListener("change", async (e) => { this.instance.setBlueCommanderPassword(e.target.value); })
|
this.element.querySelector(".blue-commander").querySelector("input").addEventListener("change", async (e) => { this.instance.setBlueCommanderPassword(e.target.value); })
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ body {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
row-gap: 10px;
|
row-gap: 10px;
|
||||||
|
width: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.instructions>span {
|
.instructions>span {
|
||||||
|
|||||||
Reference in New Issue
Block a user