Updated react and server build scripts to operate with new UI

This commit is contained in:
Davide Passoni 2024-07-25 11:38:36 +02:00
parent 03de0f9175
commit 473f16dda0
26 changed files with 68 additions and 440 deletions

2
.gitignore vendored
View File

@ -41,3 +41,5 @@ frontend/website/plugins/controltips/index.js
/scripts/**/*.jpg
manager/manager.log
/frontend/server/public/assets
/frontend/server/public/vite
/frontend/server/build

View File

@ -61,7 +61,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,4,0
FILEVERSION 2,0,0,0
PRODUCTVERSION 1,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
@ -79,12 +79,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "DCS Olympus"
VALUE "FileDescription", "DCS Olympus"
VALUE "FileVersion", "1.0.4.0"
VALUE "FileVersion", "2.0.0.0"
VALUE "InternalName", "core.dll"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "core.dll"
VALUE "ProductName", "DCS Olympus"
VALUE "ProductVersion", "1.0.4.0"
VALUE "ProductVersion", "2.0.0.0"
END
END
BLOCK "VarFileInfo"

View File

@ -61,7 +61,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,4,0
FILEVERSION 2,0,0,0
PRODUCTVERSION 1,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
@ -79,12 +79,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "DCS Olympus"
VALUE "FileDescription", "DCS Olympus"
VALUE "FileVersion", "1.0.4.0"
VALUE "FileVersion", "2.0.0.0"
VALUE "InternalName", "dcstools.dll"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "dcstools.dll"
VALUE "ProductName", "DCS Olympus"
VALUE "ProductVersion", "1.0.4.0"
VALUE "ProductVersion", "2.0.0.0"
END
END
BLOCK "VarFileInfo"

View File

@ -61,7 +61,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,4,0
FILEVERSION 2,0,0,0
PRODUCTVERSION 1,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
@ -79,12 +79,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "DCS Olympus"
VALUE "FileDescription", "DCS Olympus"
VALUE "FileVersion", "1.0.4.0"
VALUE "FileVersion", "2.0.0.0"
VALUE "InternalName", "logger.dll"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "logger.dll"
VALUE "ProductName", "DCS Olympus"
VALUE "ProductVersion", "1.0.4.0"
VALUE "ProductVersion", "2.0.0.0"
END
END
BLOCK "VarFileInfo"

View File

@ -61,7 +61,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,4,0
FILEVERSION 2,0,0,0
PRODUCTVERSION 1,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
@ -79,12 +79,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "DCS Olympus"
VALUE "FileDescription", "DCS Olympus"
VALUE "FileVersion", "1.0.4.0"
VALUE "FileVersion", "2.0.0.0"
VALUE "InternalName", "luatools.dll"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "luatools.dll"
VALUE "ProductName", "DCS Olympus"
VALUE "ProductVersion", "1.0.4.0"
VALUE "ProductVersion", "2.0.0.0"
END
END
BLOCK "VarFileInfo"

View File

@ -61,7 +61,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,4,0
FILEVERSION 2,0,0,0
PRODUCTVERSION 1,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
@ -79,12 +79,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "DCS Olympus"
VALUE "FileDescription", "DCS Olympus"
VALUE "FileVersion", "1.0.4.0"
VALUE "FileVersion", "2.0.0.0"
VALUE "InternalName", "olympus.dll"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "olympus.dll"
VALUE "ProductName", "DCS Olympus"
VALUE "ProductVersion", "1.0.4.0"
VALUE "ProductVersion", "2.0.0.0"
END
END
BLOCK "VarFileInfo"

View File

@ -61,7 +61,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,4,0
FILEVERSION 2,0,0,0
PRODUCTVERSION 1,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
@ -79,12 +79,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "DCS Olympus"
VALUE "FileDescription", "DCS Olympus"
VALUE "FileVersion", "1.0.4.0"
VALUE "FileVersion", "2.0.0.0"
VALUE "InternalName", "utils.dll"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "utils.dll"
VALUE "ProductName", "TODO: <Product name>"
VALUE "ProductVersion", "1.0.4.0"
VALUE "ProductVersion", "2.0.0.0"
END
END
BLOCK "VarFileInfo"

View File

@ -6,7 +6,7 @@ export default defineConfig({
plugins: [react()],
base: "/vite",
build: {
outDir: '../server/public'
outDir: '../server/public/vite'
}
});

View File

@ -11,9 +11,21 @@
"skipFiles": [
"<node_internals>/**"
],
"args": ["--config", "${input:enterDir}/Config/olympus.json"],
"program": "./build/www.js",
"preLaunchTask": "build"
"runtimeExecutable": "nodemon",
"runtimeArgs": [
"--watch",
"src/**/*.ts",
"--exec",
"node",
"--inspect",
"-r",
"ts-node/register",
"src/www.ts",
"-c",
"${input:enterDir}/Config/olympus.json",
"--vite"
],
"restart": true
},
{
"type": "node",
@ -33,7 +45,8 @@
"ts-node/register",
"src/www.ts",
"-c",
"${input:enterDir}/Config/olympus.json"
"${input:enterDir}/Config/olympus.json",
"--vite"
],
"restart": true,
"preLaunchTask": "demo-server"

View File

@ -27,7 +27,7 @@ function createWindow() {
}
app.whenReady().then(() => {
const server = spawn('node', [path.join('.', 'bin', 'www'), "--config", args["config"]]);
const server = spawn('node', [path.join('.', 'build', 'www.js'), "--config", args["config"]]);
server.stdout.on('data', (data) => {
console.log(`${data}`);

View File

@ -4,9 +4,9 @@
"version": "{{OLYMPUS_VERSION_NUMBER}}",
"scripts": {
"build-release": "call ./scripts/build-release.bat",
"server": "node ./bin/www",
"server": "node ./build/www.js",
"client": "electron .",
"debug": "nodemon --watch src/**/*.ts --exec ts-node src/www.ts"
"tsc": "tsc"
},
"private": true,
"dependencies": {

View File

@ -1,21 +0,0 @@
<!doctype html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite/vite.svg" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap"
rel="stylesheet"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Olympus v2</title>
<script type="module" crossorigin src="/vite/assets/index-BP5CwipQ.js"></script>
<link rel="stylesheet" crossorigin href="/vite/assets/index-mMPKJKf4.css">
</head>
<body>
<div id="root" class="h-screen w-screen"></div>
</body>
</html>

View File

@ -1,6 +0,0 @@
{
"name": "Control Tip Plugin",
"version": "0.0.1",
"description": "This plugin shows useful control tips on the right side of the screen. The tips change dynamically depending on what the user does",
"author": "Peekaboo"
}

View File

@ -1,33 +0,0 @@
#control-tips-panel {
align-self: center;
display: flex;
flex-flow: column wrap;
font-size: 13px;
justify-self: flex-end;
position: absolute;
right: 10px;
row-gap: 20px;
text-align: right;
z-index: 999;
}
#control-tips-panel>* {
align-items: center;
align-self: end;
background-color: var(--background-steel);
border-radius: var(--border-radius-md);
color: white;
column-gap: 8px;
display: flex;
justify-items: right;
opacity: .9;
padding: 5px;
width: fit-content;
}
#control-tips-panel>*>.key {
background-color: var(--background-grey);
border-radius: var(--border-radius-sm);
color: white;
padding: 1px 4px;
}

File diff suppressed because one or more lines are too long

View File

@ -1,6 +0,0 @@
{
"name": "Database Manager",
"version": "0.0.1",
"description": "This plugin allows to edit the unit databases",
"author": "DCSOlympus team"
}

View File

@ -1,295 +0,0 @@
#database-manager-panel {
flex-direction: column;
display: flex;
width: 80%;
height: 80%;
padding: 10px;
border-radius: 5px;
background-color: var(--background-steel) !important;
z-index: 9999999;
}
@media (min-width: 1200px) {
.dm-container {
flex-direction: row;
}
}
@media (max-width: 1200px) {
.dm-container {
flex-direction: column;
overflow-y: auto;
}
}
#database-manager-panel * {
font-size: 13;
font-family: 'Open Sans', sans-serif !important;
user-select: none;
}
#database-manager-panel>div:first-child {
display: flex;
align-items: center;
}
#database-manager-panel>div:last-child {
display: flex;
column-gap: 5px;
align-items: center;
justify-content: end;
justify-items: end;
margin-top: 5px;
}
#database-manager-panel>div:last-child>button {
border: 1px solid white;
}
.dm-container {
background-color: var(--background-grey);
border: 2px solid #777777;
position: relative;
display: flex;
width: 100%;
padding: 5px;
height: calc(100% - 64px - 5px);
border-radius: 0px 5px 5px 5px;
}
.dm-content-container {
position: relative;
margin: 10px;
display: flex;
flex-direction: column;
row-gap: 5px;
max-height: 100%;
padding: 10px;
}
@media (min-width: 1200px) {
.dm-content-container {
height: calc(100% - 20px);
}
.dm-content-container:nth-of-type(1) {
width: 400px;
}
.dm-content-container:nth-of-type(2) {
width: 500px;
}
.dm-content-container:nth-of-type(3) {
flex: 1;
}
}
@media (max-width: 1200px) {
.dm-content-container {
width: calc(100% - 20px);
}
.dm-content-container:nth-of-type(1) {
height: 30%;
}
.dm-content-container:nth-of-type(2) {
height: 50%;
}
.dm-content-container:nth-of-type(3) {
flex: 1;
}
}
.dm-content-container>label {
font-size: 18px !important;
font-weight: bold;
}
.dm-scroll-container {
display: flex;
flex-direction: column;
overflow-y: scroll;
max-height: 100%;
color: black;
font-weight: bold;
}
#database-manager-panel input {
font-weight: bold;
}
.dm-scroll-container>div:nth-child(even) {
background-color: gainsboro;
}
.dm-scroll-container>div:nth-child(odd) {
background-color: white;
}
.dm-scroll-container>div *:nth-child(1) {
height: 100%;
width: calc(100% - 25px);
padding: 2px;
word-wrap: break-word;
}
.dm-scroll-container>div *:nth-child(1):hover {
background-color: var(--accent-dark-blue);
color: white;
cursor: pointer;
}
.blueprint-selected {
background-color: var(--accent-light-blue) !important;
color: white;
}
.dm-scroll-container>div {
display: flex;
align-items: center;
justify-content: space-between;
}
.dm-scroll-container>div>div {
display: flex;
align-items: center;
justify-content: space-between;
}
.dm-scroll-container>div>button {
height: 20px;
width: 20px;
padding: 0px;
}
.dm-scroll-container>div>div>div:nth-child(1) {
width: fit-content;
}
.dm-scroll-container>div>div>div:nth-child(2) {
overflow: hidden;
text-wrap: nowrap;
text-overflow: ellipsis;
font-weight: normal;
}
.input-row {
width: 100%;
display: flex;
flex-direction: row;
}
@media (max-width: 1200px) {
.dm-content-container label {
width: 100%;
}
.input-row {
width: 50%;
}
}
.input-row>dt {
width: 250px;
}
.input-row>dd {
width: 100%;
text-align: right;
}
.input-row>dd>* {
width: 100%;
font-weight: bold;
}
.input-row>dd>*[type="checkbox"] {
width: 20px;
font-weight: bold;
}
.dm-loadout-container {
max-height: 100%;
max-width: 500px;
width: 100%;
}
.dm-items-container {
max-height: 100%;
height: fit-content;
}
.dm-items-container>div {
display: flex;
align-items: center;
column-gap: 2px;
}
.dm-items-container>div>label {
width: 80px !important;
}
.dm-items-container div>input:nth-of-type(1) {
flex: 1;
font-weight: bold;
}
.dm-items-container div>input:nth-of-type(2) {
width: 40px;
font-weight: bold;
}
.dm-new-element-input {
display: flex;
flex-direction: row;
column-gap: 2px;
width: 100%;
align-items: center;
}
.dm-new-element-input>input {
width: 100%;
}
.dm-new-element-input>button {
width: 60px;
}
.dm-new-item-input {
display: flex;
justify-content: end;
}
.dm-new-item-input>button {
width: 60px;
}
.tab-button {
transform: translateY(+3px);
background-color: var(--background-steel);
border-radius: 0;
border-bottom: 2px solid transparent !important;
border-top: 2px solid #777777 !important;
border-left: 2px solid #777777 !important;
border-right: 0px solid #777777 !important;
}
.tab-button.selected {
background-color: var(--background-grey);
z-index: 10;
}
.tab-button:first-of-type {
border-top-left-radius: 5px;
}
.tab-button:last-of-type {
border-top-right-radius: 5px;
border-right: 2px solid #777777 !important;
}
#database-manager-panel button :not(.dm-scroll-container>div) {
border: 1px solid white;
}

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,9 +1,6 @@
call .\scripts\copy.bat
npm run tsc
echo D|xcopy /Y /S /E .\bin ..\..\build\frontend\bin
echo D|xcopy /Y /S /E .\public ..\..\build\frontend\public
echo D|xcopy /Y /S /E .\routes ..\..\build\frontend\routes
echo D|xcopy /Y /S /E .\views ..\..\build\frontend\views
echo D|xcopy /Y /S /E .\views ..\..\build\frontend\cert
echo F|xcopy /Y .\app.js ..\..\build\frontend\app.js

View File

@ -1,2 +0,0 @@
echo F|xcopy /Y ..\website\node_modules\leaflet\dist\leaflet.css .\public\stylesheets\leaflet\leaflet.css
echo F|xcopy /Y ..\website\node_modules\leaflet-gesture-handling\dist\leaflet-gesture-handling.css .\public\stylesheets\leaflet\leaflet-gesture-handling.css

View File

@ -1,3 +1,2 @@
call .\scripts\copy.bat
call .\scripts\create-mock-dcs.bat
nodemon --watch src\demo\**\*.ts --exec node --inspect -r ts-node\register .\src\demo\www.ts -c %1

View File

@ -9,7 +9,7 @@ import cors = require("cors");
/* Load the proxy middleware plugin */
import httpProxyMiddleware = require("http-proxy-middleware");
module.exports = function (configLocation) {
module.exports = function (configLocation, viteProxy) {
/* Config specific routers */
const elevationRouter = require("./routes/api/elevation")(configLocation);
const resourcesRouter = require("./routes/resources")(configLocation);
@ -26,8 +26,6 @@ module.exports = function (configLocation) {
"databases"
)
);
const indexRouter = require("./routes/index");
const pluginsRouter = require("./routes/plugins");
/* Load the config and create the express app */
let config = {};
@ -57,22 +55,33 @@ module.exports = function (configLocation) {
changeOrigin: true,
})
);
app.use(
"/vite",
httpProxyMiddleware.createProxyMiddleware({ target: `http://localhost:8080/`, ws: true })
);
if (viteProxy) {
app.use(
"/vite",
httpProxyMiddleware.createProxyMiddleware({
target: `http://localhost:8080/`,
ws: true,
})
);
}
app.use(bodyParser.json({ limit: "50mb" }));
app.use(bodyParser.urlencoded({ limit: "50mb", extended: true }));
app.use(express.static(path.join(__dirname, "..", "public")));
app.use(cors());
/* Apply routers */
app.use("/", indexRouter);
app.use("/api/airbases", airbasesRouter);
app.use("/api/elevation", elevationRouter);
app.use("/api/databases", databasesRouter);
app.use("/plugins", pluginsRouter);
app.use("/resources", resourcesRouter);
/* Set default index */
if (!viteProxy) {
app.get("/", function (req, res) {
res.sendfile(path.join(__dirname, "..", "public", "vite", "index.html"));
});
}
return app;
};

View File

@ -1,9 +0,0 @@
import express = require('express');
const router = express.Router();
/* GET home page. */
router.get('/', function (req, res, next) {
res.render('index', { title: 'Express' });
});
module.exports = router;

View File

@ -1,21 +0,0 @@
import express = require('express');
import fs = require('fs');
import path = require('path');
const pluginsDirectory = "./public/plugins"
const router = express.Router();
function listDirectories(source) {
const directories = fs.readdirSync(source, { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name);
return directories;
}
router.get('/list', function (req, res) {
var directories = listDirectories(pluginsDirectory);
res.send(directories.filter(directory => fs.existsSync(path.join(pluginsDirectory, directory))));
});
module.exports = router;

View File

@ -2,11 +2,15 @@ import yargs = require("yargs");
import fs = require("fs");
import http = require("http");
/* Define configuration parameter */
/* Define configuration parameters */
yargs
.alias("c", "config")
.describe("c", "olympus.json config location")
.string("rp");
.string("c");
yargs
.alias("v", "vite")
.describe("v", "proxy requests to vite server for development")
.boolean("v");
const args = yargs.argv;
/* Startup print */
@ -20,7 +24,7 @@ if (fs.existsSync(args["config"])) {
httpPort = json["frontend"]["port"];
/* Load the dependencies. The app is loaded providing the configuration file location */
const app = require("./app")(args["config"]);
const app = require("./app")(args["config"], args["vite"]);
/* Normalize port */
const port = normalizePort(httpPort);

View File

@ -2,8 +2,7 @@
"compilerOptions": {
"outDir": "./build",
"allowJs": true,
"target": "es5",
"sourceMap": true
"target": "es5"
},
"include": [
"./src/**/*"