mirror of
https://github.com/9ParsonsB/Pulsar.git
synced 2025-07-01 16:33:43 -04:00
Journals Now processed in own thread
Some invalid journal data is now handled Journals now use polymorphic deserialization Added Event names to all journal events Remove unused controllers
This commit is contained in:
7
Pulsar/WebApp/.vscode/launch.json
vendored
7
Pulsar/WebApp/.vscode/launch.json
vendored
@ -4,6 +4,13 @@
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Edge",
|
||||
"request": "launch",
|
||||
"type": "msedge",
|
||||
"url": "http://localhost:5000",
|
||||
"webRoot": "${workspaceFolder}"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
|
8
Pulsar/WebApp/package-lock.json
generated
8
Pulsar/WebApp/package-lock.json
generated
@ -18,7 +18,7 @@
|
||||
"eslint-plugin-svelte": "^2.39.0",
|
||||
"globals": "^15.2.0",
|
||||
"sass": "^1.77.2",
|
||||
"svelte": "^5.0.0-next.136",
|
||||
"svelte": "^5.0.0-next.141",
|
||||
"svelte-check": "^3.7.1",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.4.5",
|
||||
@ -3070,9 +3070,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/svelte": {
|
||||
"version": "5.0.0-next.136",
|
||||
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.0.0-next.136.tgz",
|
||||
"integrity": "sha512-M3jHAIfWZ7K+hjZdvu2p53ZtWE843yubxJfjxeQw9XiwMYG5z6quCA5u8r23GrxAp20JBl36B6ucbZvLUf0Z/g==",
|
||||
"version": "5.0.0-next.141",
|
||||
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.0.0-next.141.tgz",
|
||||
"integrity": "sha512-zT74TUo0vOOrbxRfdlWXu+ac4O9lqPFG0YoZB3uOfrOewT1GKxKm0qwG/jo9bGvgZ++TSHjR7AtV091LY2FhBA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@ampproject/remapping": "^2.2.1",
|
||||
|
@ -22,7 +22,7 @@
|
||||
"eslint-plugin-svelte": "^2.39.0",
|
||||
"globals": "^15.2.0",
|
||||
"sass": "^1.77.2",
|
||||
"svelte": "^5.0.0-next.136",
|
||||
"svelte": "^5.0.0-next.141",
|
||||
"svelte-check": "^3.7.1",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.4.5",
|
||||
|
@ -20,18 +20,10 @@
|
||||
let fuelDown = $state(false);
|
||||
|
||||
onMount(async () => {
|
||||
|
||||
if ($connection.state === HubConnectionState.Disconnected)
|
||||
{
|
||||
await $connection.start();
|
||||
}
|
||||
|
||||
loading = false;
|
||||
|
||||
$connection.on("StatusUpdated", (message) => {
|
||||
statusStore.update((s) => {
|
||||
return { ...s, ...message };
|
||||
});
|
||||
$statusStore = { ...$statusStore, ...message };
|
||||
|
||||
// only 3 in array
|
||||
if (last.length >= 3) {
|
||||
@ -66,16 +58,13 @@
|
||||
}
|
||||
});
|
||||
|
||||
if ($connection.state === HubConnectionState.Disconnected)
|
||||
{
|
||||
await $connection.start();
|
||||
}
|
||||
|
||||
if (!$statusStore.pips) {
|
||||
const value = (await (
|
||||
await fetch("http://localhost:5000/api/status")
|
||||
).json()) as Status;
|
||||
|
||||
console.log(value);
|
||||
|
||||
statusStore.set({
|
||||
...value,
|
||||
});
|
||||
await $connection.invoke("Status");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -98,10 +87,13 @@
|
||||
{/if}
|
||||
|
||||
<div>
|
||||
{#if $statusStore}
|
||||
{#if $statusStore}
|
||||
<span
|
||||
>Fuel%: {((($statusStore.fuel?.fuelMain ?? 0) / 32) * 100).toFixed(2)}% est{fuelDown ? ' REMAINING' : ' to fill'}: {timeToMax.toFixed(2 )}s</span
|
||||
>
|
||||
>Fuel%: {((($statusStore.fuel?.fuelMain ?? 0) / 32) * 100).toFixed(2)}%
|
||||
{#if $statusStore.flags! & StatusFlags.FuelScooping}
|
||||
<span>est{fuelDown ? ' REMAINING' : ' to fill'}: {timeToMax.toFixed(2 )}s</span>
|
||||
{/if}
|
||||
</span>
|
||||
<div class="power">
|
||||
<div class="sys">
|
||||
<div>{$statusStore?.pips?.sys ?? "?"}</div>
|
||||
@ -129,8 +121,8 @@
|
||||
<span>dest?: {$statusStore?.destination?.name}</span>
|
||||
<span>gui focus: {getEnumNameFromValue(FocusStatus, $statusStore.guiFocus!)}</span>
|
||||
<span>cargo: {$statusStore.cargo}</span>
|
||||
<span>flag1: {getEnumNamesFromFlag(StatusFlags, $statusStore.flags!)}</span>
|
||||
<span>flag2: {getEnumNamesFromFlag(StatusFlags2, $statusStore.flags2!)}</span>
|
||||
<span>flag1: {getEnumNamesFromFlag(StatusFlags, $statusStore.flags!)} ({$statusStore.flags})</span>
|
||||
<span>flag2: {getEnumNamesFromFlag(StatusFlags2, $statusStore.flags2!)} ({$statusStore.flags2})</span>
|
||||
{:else}
|
||||
<span>No data :(</span>
|
||||
{/if}
|
||||
|
@ -3,6 +3,7 @@
|
||||
import type { FSSDiscoveryScan } from "../../types/api/FSSDiscoveryScan";
|
||||
import type { Scan } from "../../types/api/Scan";
|
||||
import type JournalBase from "../../types/api/JournalBase";
|
||||
import type { FSSBodySignals } from "../../types/api/Signals";
|
||||
|
||||
const data: Partial<Scan>[] = [{}, {}, {}, {}];
|
||||
// total bodies in the current system (FSSDiscovery event)
|
||||
@ -10,6 +11,13 @@
|
||||
let currentSystem = $state("");
|
||||
// accumulated list of bodies in the current system (Scan events)
|
||||
let scans = $state([] as Scan[]);
|
||||
let signals = $state([] as FSSBodySignals[]);
|
||||
|
||||
const filterImportantScans = (scans: Scan[], signals: FSSBodySignals[]) => {
|
||||
return [] as Scan[];
|
||||
};
|
||||
|
||||
const importantScans = $derived(filterImportantScans(scans, signals));
|
||||
|
||||
const targetEvents = ["Scan", "FSSScanBaryCenter", "FSSDiscoveryScan"];
|
||||
|
||||
@ -59,11 +67,17 @@
|
||||
case "High metal content":
|
||||
case "High metal content body":
|
||||
return "HMC";
|
||||
case "Metal rich body":
|
||||
return "MRB";
|
||||
case "Sudarsky class I gas giant":
|
||||
case "Sudarsky class II gas giant":
|
||||
case "Sudarsky class III gas giant":
|
||||
case "Sudarsky class IV gas giant":
|
||||
return "GAS";
|
||||
case "Icy body":
|
||||
return "ICE";
|
||||
case "Rocky body":
|
||||
return "ROC";
|
||||
default:
|
||||
return planetClass;
|
||||
}
|
||||
|
28
Pulsar/WebApp/src/types/api/Signals.ts
Normal file
28
Pulsar/WebApp/src/types/api/Signals.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import type JournalBase from "./JournalBase";
|
||||
|
||||
export interface Signal {
|
||||
type: string;
|
||||
type_Localised: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
export interface GenusType {
|
||||
Genus: string;
|
||||
Genus_Localised: string;
|
||||
}
|
||||
|
||||
interface BodySignalBase extends JournalBase {
|
||||
SystemAddress: bigint;
|
||||
BodyName: string;
|
||||
BodyID: bigint;
|
||||
Signals: Signal[];
|
||||
Genuses: GenusType[];
|
||||
}
|
||||
|
||||
export interface SAASignalsFound extends BodySignalBase {
|
||||
event: "SAASignalsFound";
|
||||
}
|
||||
|
||||
export interface FSSBodySignals extends BodySignalBase {
|
||||
event: "FSSBodySignals";
|
||||
}
|
@ -11,8 +11,8 @@ const config = {
|
||||
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
||||
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
|
||||
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
||||
adapter: adapter()
|
||||
}
|
||||
adapter: adapter(),
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
Reference in New Issue
Block a user