Messing about with us

This commit is contained in:
Andrew Henry 2025-05-29 10:08:07 -07:00
parent 8c62b927d5
commit 16e2feeeb1
5 changed files with 91 additions and 94 deletions

View File

@ -103,10 +103,6 @@ const config = {
transform: function (content) {
return content.toString().replace(/dist\//g, '');
}
},
{
from: 'src/plugins/imagery/layers',
to: 'imagery'
}
]
}),

View File

@ -14,6 +14,14 @@ const METADATA_BY_TYPE = {
domain: 1
}
},
{
key: 'µs',
name: 'µs Time',
format: 'µsf',
hints: {
domain: 2
}
},
{
key: 'yesterday',
name: 'Yesterday',

View File

@ -77,6 +77,7 @@
data: {
name: data.name,
utc: nextStep,
µs: nextStep - Math.floor(Math.random() * 1000) / 1000,
yesterday: nextStep - 60 * 60 * 24 * 1000,
sin: sin(
nextStep,
@ -173,6 +174,7 @@
function createDataPoint(time, request) {
return {
utc: time,
µs: time - Math.floor(Math.random() * 1000) / 1000,
yesterday: time - 60 * 60 * 24 * 1000,
sin: sin(
time,

View File

@ -126,98 +126,87 @@
showAsView: ['summary-widget', 'example.imagery']
})
);
openmct.install(
openmct.plugins.Conductor({
menuOptions: [
{
name: 'Fixed',
timeSystem: 'utc',
bounds: {
start: Date.now() - THIRTY_MINUTES,
end: Date.now()
},
// commonly used bounds can be stored in history
// bounds (start and end) can accept either a milliseconds number
// or a callback function returning a milliseconds number
// a function is useful for invoking Date.now() at exact moment of preset selection
presets: [
{
label: 'Last Day',
bounds: {
start: () => Date.now() - ONE_DAY,
end: () => Date.now()
}
},
{
label: 'Last 2 hours',
bounds: {
start: () => Date.now() - TWO_HOURS,
end: () => Date.now()
}
},
{
label: 'Last hour',
bounds: {
start: () => Date.now() - ONE_HOUR,
end: () => Date.now()
}
}
],
// maximum recent bounds to retain in conductor history
records: 10
// maximum duration between start and end bounds
// for utc-based time systems this is in milliseconds
// limit: ONE_DAY
},
{
name: 'Realtime',
timeSystem: 'utc',
clock: 'local',
clockOffsets: {
start: -THIRTY_MINUTES,
end: THIRTY_SECONDS
},
presets: [
{
label: '1 Hour',
bounds: {
start: -ONE_HOUR,
end: THIRTY_SECONDS
}
},
{
label: '30 Minutes',
bounds: {
start: -THIRTY_MINUTES,
end: THIRTY_SECONDS
}
},
{
label: '15 Minutes',
bounds: {
start: -FIFTEEN_MINUTES,
end: THIRTY_SECONDS
}
},
{
label: '5 Minutes',
bounds: {
start: -FIVE_MINUTES,
end: THIRTY_SECONDS
}
},
{
label: '1 Minute',
bounds: {
start: -ONE_MINUTE,
end: THIRTY_SECONDS
}
}
]
openmct.install((openmct) => {
openmct.time.addTimeSystem({
key: 'µs',
name: 'microseconds',
cssClass: 'icon-clock',
timeFormat: 'µsf',
durationFormat: 'duration',
isUTCBased: true
});
});
openmct.install((openmct) => {
function getµsComponent(text) {
return text.substring(23, text.length - 1);
}
function getDecimalPart(floatOrInteger) {
return (floatOrInteger * 1000) - Math.floor(floatOrInteger) * 1000;
}
openmct.telemetry.addFormat({
key: 'µsf',
parse(text) {
if (typeof text === 'number' || text === undefined) {
return text;
} else {
if (!text.endsWith("Z")) {
throw new Error("Only supports Zulu timestamps");
}
const µsPart = getµsComponent(text).padEnd(3, '0');
const msPrecisionNumber = Date.parse(text);
const µsPrecisionNumber = msPrecisionNumber + (Number.parseInt(µsPart, 10) / 1000);
return µsPrecisionNumber;
}
]
},
format(number) {
if (typeof number === "number"){
let dateText = new Date(number).toISOString();
if (!Number.isInteger(number)) {
// Append microseconds to the end
dateText = dateText.substring(dateText.length - 2) + getDecimalPart(number).toString().padStart(3, '0') + 'Z';
}
return dateText;
} else {
return number;
}
}
})
);
});
openmct.install(openmct.plugins.Conductor({
menuOptions: [
{
name: "Fixed",
timeSystem: 'utc',
bounds: {
start: Date.parse("2025-05-02T15:33:00Z"),
end: Date.parse("2025-05-06T02:53:00Z")
}
},
{
name: "Realtime",
timeSystem: 'utc',
clock: 'local',
clockOffsets: {
start: -THIRTY_MINUTES,
end: 0
}
},
{
name: "Realtime",
timeSystem: 'µs',
clock: 'local',
clockOffsets: {
start: -THIRTY_MINUTES,
end: 0
}
}
]
}));
openmct.time.setBounds({start: Date.parse("2025-05-02T15:33:00Z"), end: Date.parse("2025-05-06T02:53:00Z")});
openmct.install(openmct.plugins.StaticRootPlugin({namespace: 'static', exportUrl:'/favicons/test-condition-set.json'}))
openmct.install(openmct.plugins.SummaryWidget());
openmct.install(openmct.plugins.Notebook());
openmct.install(openmct.plugins.LADTable());
@ -234,6 +223,7 @@
openmct.install(openmct.plugins.Timelist());
openmct.install(openmct.plugins.BarChart());
openmct.install(openmct.plugins.ScatterPlot());
document.addEventListener('DOMContentLoaded', function () {
openmct.start();
});

View File

@ -0,0 +1 @@
{"openmct":{"26e36f47-0ca4-4cbb-8c5b-80069a457cc2":{"identifier":{"key":"26e36f47-0ca4-4cbb-8c5b-80069a457cc2","namespace":""},"name":"TEST Condition Set","type":"conditionSet","configuration":{"conditionTestData":[{"telemetry":{"key":"65a191eb-fb42-4652-85f3-166eb6ed6657","namespace":""},"metadata":"value","input":"","isTrusted":true,"value":"1"},{"telemetry":{"key":"756777b0-7b29-4888-880b-6e89ff919b7e","namespace":""},"metadata":"value","input":"","isTrusted":true,"value":"1"}],"conditionCollection":[{"id":"d37d9722-e3dc-4daf-900a-9439c3d670c0","configuration":{"name":"P1 OR P2 ARE OFF","output":"P1 OR P2 ARE OFF","trigger":"any","criteria":[{"id":"696a54bd-29f6-4226-89c8-49c8cb47c81c","telemetry":{"key":"65a191eb-fb42-4652-85f3-166eb6ed6657","namespace":""},"operation":"equalTo","input":[0],"metadata":"value"},{"id":"5a471cad-3d73-488b-b8ea-8cc677b518bf","telemetry":{"key":"756777b0-7b29-4888-880b-6e89ff919b7e","namespace":""},"operation":"equalTo","input":[0],"metadata":"value"}]},"summary":"Match if any criteria are met: P1 Value is 0 or P2 Value is 0 "},{"id":"4d2762a5-55b2-498c-8271-74f8bfb1a0bc","configuration":{"name":"P1 AND P2 ARE ON","output":"P1 AND P2 ARE ON","trigger":"all","criteria":[{"id":"1217f246-6dee-4c3d-9e26-5e12a71ca243","telemetry":{"key":"65a191eb-fb42-4652-85f3-166eb6ed6657","namespace":""},"operation":"equalTo","input":[1],"metadata":"value"},{"id":"485d36fc-26e0-4355-b12a-bedeeb884908","telemetry":{"key":"756777b0-7b29-4888-880b-6e89ff919b7e","namespace":""},"operation":"equalTo","input":[1],"metadata":"value"}]},"summary":"Match if all criteria are met: P1 Value is 1 and P2 Value is 1 "},{"isDefault":true,"id":"d1ced660-9fef-4221-b4b2-c4073be0b330","configuration":{"name":"Default","output":"Default","trigger":"all","criteria":[]},"summary":""}]},"composition":[{"key":"65a191eb-fb42-4652-85f3-166eb6ed6657","namespace":""},{"key":"756777b0-7b29-4888-880b-6e89ff919b7e","namespace":""}],"telemetry":{},"modified":1746828312188,"location":"mine","created":1746819159686,"persisted":1746828312188},"65a191eb-fb42-4652-85f3-166eb6ed6657":{"identifier":{"key":"65a191eb-fb42-4652-85f3-166eb6ed6657","namespace":""},"name":"P1","type":"example.state-generator","telemetry":{"duration":1},"modified":1746820525237,"location":"26e36f47-0ca4-4cbb-8c5b-80069a457cc2","created":1746819174338,"persisted":1746820525237},"756777b0-7b29-4888-880b-6e89ff919b7e":{"identifier":{"key":"756777b0-7b29-4888-880b-6e89ff919b7e","namespace":""},"name":"P2","type":"example.state-generator","telemetry":{"duration":2},"modified":1746820703684,"location":"26e36f47-0ca4-4cbb-8c5b-80069a457cc2","created":1746819421553,"persisted":1746820703684}},"rootId":"26e36f47-0ca4-4cbb-8c5b-80069a457cc2"}