openc3-cosmos-constellation 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Rakefile +24 -0
- data/microservices/BRIDGE/bridge.py +546 -0
- data/microservices/BRIDGE/constellation_space/__init__.py +0 -0
- data/microservices/BRIDGE/constellation_space/results.py +512 -0
- data/plugin.txt +25 -0
- data/targets/CONSTELLATION/cmd_tlm/tlm.txt +78 -0
- data/targets/CONSTELLATION/target.txt +1 -0
- data/tools/constellationforecast/forecast-view.js +673 -0
- data/tools/constellationforecast/main.js +102 -0
- metadata +57 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// The Constellation Forecast tool in COSMOS. COSMOS loads a tool's INLINE_URL with SystemJS and
|
|
2
|
+
// runs it as a single-spa app, so this file is System.register by hand: no framework, no build.
|
|
3
|
+
// The view is the shared Constellation Forecast view (bridges/shared/forecast-view.js, copied
|
|
4
|
+
// in beside this file when the gem is built), the same one Yamcs and Open MCT draw.
|
|
5
|
+
//
|
|
6
|
+
// /tools/constellationforecast every workflow, by category
|
|
7
|
+
// /tools/constellationforecast/<slug> that workflow alone
|
|
8
|
+
//
|
|
9
|
+
// It reads the documents the plugin's bridge writes to COSMOS's config bucket
|
|
10
|
+
// (<scope>/constellation/index.json and workflow-<slug>.json) through COSMOS's storage API, with
|
|
11
|
+
// the operator's own COSMOS token: the browser never sees a Constellation key.
|
|
12
|
+
System.register([], function (_export) {
|
|
13
|
+
'use strict';
|
|
14
|
+
return {
|
|
15
|
+
execute: function () {
|
|
16
|
+
const BASE = '/tools/constellationforecast';
|
|
17
|
+
let view = null;
|
|
18
|
+
let mountForecast = null;
|
|
19
|
+
let nav = null;
|
|
20
|
+
let body = null;
|
|
21
|
+
|
|
22
|
+
async function load(name) {
|
|
23
|
+
const scope = window.openc3Scope || 'DEFAULT';
|
|
24
|
+
// COSMOS Core's auth.js: refreshes (or sends to login) and leaves the token here.
|
|
25
|
+
if (window.OpenC3Auth) await window.OpenC3Auth.updateToken(window.OpenC3Auth.defaultMinValidity);
|
|
26
|
+
const key = encodeURIComponent(`${scope}/constellation/${name}`);
|
|
27
|
+
const response = await fetch(`/openc3-api/storage/download_file/${key}?bucket=OPENC3_CONFIG_BUCKET&scope=${scope}`, {
|
|
28
|
+
headers: { Authorization: localStorage.openc3Token || '' },
|
|
29
|
+
});
|
|
30
|
+
if (response.status === 401) {
|
|
31
|
+
// A token COSMOS no longer knows (its sessions were reset) still looks valid here: drop
|
|
32
|
+
// it and sign in again, coming back to this page.
|
|
33
|
+
delete localStorage.openc3Token;
|
|
34
|
+
location.assign(`/login?redirect=${encodeURIComponent(location.pathname)}`);
|
|
35
|
+
throw new Error('Your COSMOS sign-in expired: signing in again');
|
|
36
|
+
}
|
|
37
|
+
if (!response.ok) throw new Error(response.status === 404 ? 'none yet' : `COSMOS answered ${response.status}`);
|
|
38
|
+
const bytes = Uint8Array.from(atob((await response.json()).contents), (c) => c.charCodeAt(0));
|
|
39
|
+
return JSON.parse(new TextDecoder().decode(bytes));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const slugOf = () => decodeURIComponent(location.pathname.slice(BASE.length).split('/')[1] || '');
|
|
43
|
+
const link = (href, label, current) =>
|
|
44
|
+
`<a href="${href}" data-nav${current ? ' aria-current="page"' : ''}>${label.replace(/[&<>"']/g, '')}</a>`;
|
|
45
|
+
|
|
46
|
+
function drawNav(workflows, slug) {
|
|
47
|
+
nav.innerHTML = [link(BASE, 'Overview', !slug), ...workflows.map((w) => link(`${BASE}/${encodeURIComponent(w.workflow)}`, w.workflow, w.workflow === slug))].join('');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function show() {
|
|
51
|
+
const slug = slugOf();
|
|
52
|
+
view?.destroy();
|
|
53
|
+
drawNav([], slug);
|
|
54
|
+
view = mountForecast(body, {
|
|
55
|
+
theme: 'dark',
|
|
56
|
+
// A workflow's page shows that workflow alone; the nav always lists them all.
|
|
57
|
+
load: async (name) => {
|
|
58
|
+
const doc = await load(name);
|
|
59
|
+
if (name === 'index.json') {
|
|
60
|
+
drawNav(doc.workflows || [], slug);
|
|
61
|
+
if (slug) doc.workflows = (doc.workflows || []).filter((w) => w.workflow === slug);
|
|
62
|
+
}
|
|
63
|
+
return doc;
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function follow(e) {
|
|
69
|
+
const a = e.target.closest('a[data-nav]');
|
|
70
|
+
if (!a) return;
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
history.pushState(null, '', a.getAttribute('href'));
|
|
73
|
+
show();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_export({
|
|
77
|
+
load,
|
|
78
|
+
bootstrap: async () => {},
|
|
79
|
+
mount: async () => {
|
|
80
|
+
({ mountForecast } = await import(`${BASE}/forecast-view.js`));
|
|
81
|
+
const root = document.getElementById('openc3-tool');
|
|
82
|
+
root.innerHTML = `<style>
|
|
83
|
+
.cfc { min-height:100%; background:#1a1a19; }
|
|
84
|
+
.cfc-nav { display:flex; gap:4px; flex-wrap:wrap; padding:12px 24px 0; font:13px Roboto, system-ui, sans-serif; }
|
|
85
|
+
.cfc-nav a { color:#a3a29c; text-decoration:none; padding:4px 10px; border:1px solid rgba(255,255,255,.12); border-radius:6px; }
|
|
86
|
+
.cfc-nav a[aria-current] { color:#e8e8e6; border-color:#e8e8e6; }
|
|
87
|
+
</style><div class="cfc"><nav class="cfc-nav" aria-label="Constellation Forecast"></nav><div></div></div>`;
|
|
88
|
+
[nav, body] = [root.querySelector('nav'), root.querySelector('nav + div')];
|
|
89
|
+
nav.addEventListener('click', follow);
|
|
90
|
+
window.addEventListener('popstate', show);
|
|
91
|
+
show();
|
|
92
|
+
},
|
|
93
|
+
unmount: async () => {
|
|
94
|
+
window.removeEventListener('popstate', show);
|
|
95
|
+
view?.destroy();
|
|
96
|
+
view = null;
|
|
97
|
+
document.getElementById('openc3-tool').innerHTML = '';
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
});
|
metadata
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: openc3-cosmos-constellation
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.7.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Constellation Space Corp
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-11-11 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: |2
|
|
14
|
+
A CONSTELLATION target whose packets a bridge microservice fills from the Constellation
|
|
15
|
+
feed: the next predicted pass, the next 24 hours, the soonest rain-fade swap to decide, a
|
|
16
|
+
day's capacity across the antennas (CAPACITY), the next pass's MODCOD plan (MODCOD), and the
|
|
17
|
+
run they came from. Every value is a forecast.
|
|
18
|
+
email:
|
|
19
|
+
- support@constellation.space
|
|
20
|
+
executables: []
|
|
21
|
+
extensions: []
|
|
22
|
+
extra_rdoc_files: []
|
|
23
|
+
files:
|
|
24
|
+
- Rakefile
|
|
25
|
+
- microservices/BRIDGE/bridge.py
|
|
26
|
+
- microservices/BRIDGE/constellation_space/__init__.py
|
|
27
|
+
- microservices/BRIDGE/constellation_space/results.py
|
|
28
|
+
- plugin.txt
|
|
29
|
+
- targets/CONSTELLATION/cmd_tlm/tlm.txt
|
|
30
|
+
- targets/CONSTELLATION/target.txt
|
|
31
|
+
- tools/constellationforecast/forecast-view.js
|
|
32
|
+
- tools/constellationforecast/main.js
|
|
33
|
+
homepage: https://constellation.space
|
|
34
|
+
licenses:
|
|
35
|
+
- Apache-2.0
|
|
36
|
+
metadata:
|
|
37
|
+
source_code_uri: https://github.com/constellationhq/connectors
|
|
38
|
+
post_install_message:
|
|
39
|
+
rdoc_options: []
|
|
40
|
+
require_paths:
|
|
41
|
+
- lib
|
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
|
+
requirements:
|
|
49
|
+
- - ">="
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: '0'
|
|
52
|
+
requirements: []
|
|
53
|
+
rubygems_version: 3.5.22
|
|
54
|
+
signing_key:
|
|
55
|
+
specification_version: 4
|
|
56
|
+
summary: Constellation workflow forecasts in OpenC3 COSMOS
|
|
57
|
+
test_files: []
|