mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
@@ -112,7 +112,7 @@ dl.ol-data-grid dd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ol-panel.ol-dialog {
|
.ol-panel.ol-dialog {
|
||||||
padding:25px;
|
padding:20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ol-dialog-close {
|
.ol-dialog-close {
|
||||||
@@ -138,6 +138,12 @@ dl.ol-data-grid dd {
|
|||||||
padding-top:15px;
|
padding-top:15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ol-dialog.scrollable .ol-dialog-content {
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.ol-checkbox label {
|
.ol-checkbox label {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
@import url("contextmenus.css");
|
@import url("contextmenus.css");
|
||||||
@import url("mouseinfopanel.css");
|
@import url("mouseinfopanel.css");
|
||||||
@import url("units.css");
|
@import url("units.css");
|
||||||
|
@import url("unitdatatable.css");
|
||||||
@import url("unitcontrolpanel.css");
|
@import url("unitcontrolpanel.css");
|
||||||
@import url("unitinfopanel.css");
|
@import url("unitinfopanel.css");
|
||||||
|
|
||||||
|
|||||||
27
client/public/stylesheets/unitdatatable.css
Normal file
27
client/public/stylesheets/unitdatatable.css
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#unit-data-table {
|
||||||
|
display:flex;
|
||||||
|
flex-direction: column;
|
||||||
|
font-size:13px;
|
||||||
|
height: 250px;
|
||||||
|
width:fit-content;
|
||||||
|
}
|
||||||
|
|
||||||
|
#unit-data-table > div {
|
||||||
|
display:flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
#unit-data-table > div > div {
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
width:100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#unit-data-table > div:first-of-type {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#unit-data-table > div > div:nth-of-type( 4 ) {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import { ATC } from "./atc/atc";
|
|||||||
import { FeatureSwitches } from "./featureswitches";
|
import { FeatureSwitches } from "./featureswitches";
|
||||||
import { LogPanel } from "./panels/logpanel";
|
import { LogPanel } from "./panels/logpanel";
|
||||||
import { getAirbases, getBulllseye as getBulllseyes, getMission, getUnits, toggleDemoEnabled } from "./server/server";
|
import { getAirbases, getBulllseye as getBulllseyes, getMission, getUnits, toggleDemoEnabled } from "./server/server";
|
||||||
|
import { UnitDataTable } from "./units/unitdatatable";
|
||||||
|
|
||||||
var map: Map;
|
var map: Map;
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ var connected: boolean = false;
|
|||||||
var activeCoalition: string = "blue";
|
var activeCoalition: string = "blue";
|
||||||
|
|
||||||
var sessionHash: string | null = null;
|
var sessionHash: string | null = null;
|
||||||
|
var unitDataTable = new UnitDataTable();
|
||||||
|
|
||||||
var featureSwitches;
|
var featureSwitches;
|
||||||
|
|
||||||
@@ -75,6 +77,7 @@ function setup() {
|
|||||||
startPeriodicUpdate();
|
startPeriodicUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function startPeriodicUpdate() {
|
function startPeriodicUpdate() {
|
||||||
requestUpdate();
|
requestUpdate();
|
||||||
requestRefresh();
|
requestRefresh();
|
||||||
@@ -84,6 +87,7 @@ function requestUpdate() {
|
|||||||
/* Main update rate = 250ms is minimum time, equal to server update time. */
|
/* Main update rate = 250ms is minimum time, equal to server update time. */
|
||||||
getUnits((data: UnitsData) => {
|
getUnits((data: UnitsData) => {
|
||||||
getUnitsManager()?.update(data);
|
getUnitsManager()?.update(data);
|
||||||
|
getUnitDataTable().update( data.units )
|
||||||
checkSessionHash(data.sessionHash);
|
checkSessionHash(data.sessionHash);
|
||||||
}, false);
|
}, false);
|
||||||
setTimeout(() => requestUpdate(), getConnected() ? 250 : 1000);
|
setTimeout(() => requestUpdate(), getConnected() ? 250 : 1000);
|
||||||
@@ -137,13 +141,21 @@ function setupEvents() {
|
|||||||
|
|
||||||
/* Keyup events */
|
/* Keyup events */
|
||||||
document.addEventListener("keyup", ev => {
|
document.addEventListener("keyup", ev => {
|
||||||
|
|
||||||
switch (ev.code) {
|
switch (ev.code) {
|
||||||
|
|
||||||
case "KeyL":
|
case "KeyL":
|
||||||
document.body.toggleAttribute("data-hide-labels");
|
document.body.toggleAttribute("data-hide-labels");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "KeyD":
|
case "KeyD":
|
||||||
toggleDemoEnabled();
|
toggleDemoEnabled();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Quote":
|
||||||
|
unitDataTable.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -154,7 +166,6 @@ function setupEvents() {
|
|||||||
unitName.setAttribute( "readonly", "true" );
|
unitName.setAttribute( "readonly", "true" );
|
||||||
|
|
||||||
// Do something with this:
|
// Do something with this:
|
||||||
console.log( unitName.value );
|
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener( "editUnitName", ev => {
|
document.addEventListener( "editUnitName", ev => {
|
||||||
@@ -214,6 +225,10 @@ export function getMissionData() {
|
|||||||
return missionHandler;
|
return missionHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getUnitDataTable() {
|
||||||
|
return unitDataTable;
|
||||||
|
}
|
||||||
|
|
||||||
export function getUnitsManager() {
|
export function getUnitsManager() {
|
||||||
return unitsManager;
|
return unitsManager;
|
||||||
}
|
}
|
||||||
|
|||||||
103
client/src/units/unitdatatable.ts
Normal file
103
client/src/units/unitdatatable.ts
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
export class UnitDataTable {
|
||||||
|
|
||||||
|
#element;
|
||||||
|
#tableId = "unit-data-table";
|
||||||
|
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
|
||||||
|
const table = document.getElementById( this.#tableId );
|
||||||
|
|
||||||
|
if ( table instanceof HTMLElement ) {
|
||||||
|
|
||||||
|
this.#element = table;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getElement() {
|
||||||
|
return this.#element;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
hide() {
|
||||||
|
this.getElement()?.closest( ".ol-dialog" )?.classList.add( "hide" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
show() {
|
||||||
|
this.getElement()?.closest( ".ol-dialog" )?.classList.remove( "hide" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
toggle() {
|
||||||
|
this.getElement()?.closest( ".ol-dialog" )?.classList.toggle( "hide" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
update( units:object ) {
|
||||||
|
|
||||||
|
const unitsArray = Object.values( units ).sort( ( a, b ) => {
|
||||||
|
|
||||||
|
const aVal = a.baseData.unitName.toLowerCase();
|
||||||
|
const bVal = b.baseData.unitName.toLowerCase();
|
||||||
|
|
||||||
|
if ( aVal > bVal ) {
|
||||||
|
return 1;
|
||||||
|
} else if ( bVal > aVal ) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function addRow( parentEl:HTMLElement, columns:string[] ) {
|
||||||
|
|
||||||
|
const rowDiv = document.createElement( "div" );
|
||||||
|
|
||||||
|
for ( const item of columns ) {
|
||||||
|
|
||||||
|
const div = document.createElement( "div" );
|
||||||
|
div.innerText = item;
|
||||||
|
rowDiv.appendChild( div );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
parentEl.appendChild( rowDiv );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const el = this.getElement();
|
||||||
|
|
||||||
|
if ( el ) {
|
||||||
|
|
||||||
|
el.innerHTML = "";
|
||||||
|
|
||||||
|
addRow( el, [ "Callsign", "Name", "Category", "AI/Human" ] )
|
||||||
|
|
||||||
|
for ( const unit of unitsArray ) {
|
||||||
|
|
||||||
|
const dataset = [ unit.baseData.unitName, unit.baseData.name, unit.baseData.category, ( unit.baseData.AI ) ? "AI" : "Human" ];
|
||||||
|
|
||||||
|
if ( this.getElement() ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
addRow( el, dataset );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
/* Language and Environment */
|
/* Language and Environment */
|
||||||
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
"target": "es2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||||
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
<%- include('navbar.ejs') %>
|
<%- include('navbar.ejs') %>
|
||||||
<%- include('connectionstatuspanel.ejs') %>
|
<%- include('connectionstatuspanel.ejs') %>
|
||||||
<%- include('dialogs.ejs') %>
|
<%- include('dialogs.ejs') %>
|
||||||
|
<%- include('unitdatatable.ejs') %>
|
||||||
|
|
||||||
<% /* %>
|
<% /* %>
|
||||||
<%- include('log.ejs') %>
|
<%- include('log.ejs') %>
|
||||||
|
|||||||
13
client/views/unitdatatable.ejs
Normal file
13
client/views/unitdatatable.ejs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<div class="ol-panel ol-dialog scrollable hide">
|
||||||
|
|
||||||
|
<div class="ol-dialog-close" data-on-click="closeDialog"></div>
|
||||||
|
|
||||||
|
<div class="ol-dialog-header">
|
||||||
|
<h4>Unit list</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="unit-data-table" class="ol-dialog-content">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user