Skip to content

Derived Telemetry Prototype #7815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 108 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
4316003
skeleton for comps
scottbell Jul 25, 2024
6c74e84
more scaffolding
scottbell Jul 29, 2024
f5d7a33
more drafts
scottbell Jul 30, 2024
0dd0442
add comps manager
scottbell Aug 1, 2024
ff81454
worker ready
scottbell Aug 2, 2024
74c3a95
telemetry is null for some reason
scottbell Aug 2, 2024
ce5e435
can add two sin waves
scottbell Aug 2, 2024
69db534
adding works
scottbell Aug 2, 2024
90a24b3
exact values enabled
scottbell Aug 5, 2024
37d222f
subscriptions work
scottbell Aug 6, 2024
55c8609
Merge remote-tracking branch 'origin/master' into telemetry-comps
scottbell Aug 8, 2024
a94c752
slowing adding gui
scottbell Aug 8, 2024
0113ec0
fix plots
scottbell Aug 12, 2024
a0a2ead
rudimentary expression editor
scottbell Aug 12, 2024
e5719fc
correctly persist
scottbell Aug 13, 2024
0326e38
parameters
scottbell Aug 13, 2024
413338d
can take arbitrary expressions
scottbell Aug 13, 2024
f174515
styles and timing for loading worker
scottbell Aug 14, 2024
9e3e739
ui works kinda
scottbell Aug 14, 2024
dcc8938
need to figure out ranger
scottbell Aug 14, 2024
87dc272
works with time
scottbell Aug 15, 2024
df3ca84
timesystem works
scottbell Aug 15, 2024
484a81b
get rid of batch for now
scottbell Aug 15, 2024
446c811
gui still leaking data
scottbell Aug 15, 2024
aa8750e
memory conserved
scottbell Aug 15, 2024
4d546fb
styles
scottbell Aug 16, 2024
d6c8bee
Merge remote-tracking branch 'origin/master' into telemetry-comps
scottbell Aug 19, 2024
d7d7913
fix initial load
scottbell Aug 19, 2024
d4b2986
expression validator
scottbell Aug 19, 2024
a9d63b9
fix test data
scottbell Aug 20, 2024
e4dcda8
do not persist
scottbell Aug 20, 2024
58568b8
persist after adding
scottbell Aug 20, 2024
d96c3fc
fix editing issues
scottbell Aug 21, 2024
28ec13a
mutate when parameters or expression changes
scottbell Aug 22, 2024
386c3b4
implement output format
scottbell Sep 3, 2024
5af6413
implement output format
scottbell Sep 3, 2024
1c68c7e
be consistent with output key
scottbell Sep 3, 2024
5894363
add icons and fix errant telemetry
scottbell Sep 4, 2024
40a95cf
lint
scottbell Sep 4, 2024
ccc12de
lint
scottbell Sep 4, 2024
3ad21ee
use key instead of name
scottbell Sep 4, 2024
4260cc3
Style enhancements for Derived Telemetry object
charlesh88 Sep 4, 2024
cce3008
Style enhancements for Derived Telemetry object
charlesh88 Sep 4, 2024
2793da4
Enhancements for Derived Telemetry object
charlesh88 Sep 5, 2024
1d686c2
Style enhancements for Derived Telemetry object
charlesh88 Sep 5, 2024
f8ceaa5
Merge branch 'telemetry-comps' of github.com:nasa/openmct into teleme…
charlesh88 Sep 5, 2024
e1f50fe
Enhancements for Derived Telemetry object
charlesh88 Sep 5, 2024
eac4676
do not apply test data when edit mode changes to false
scottbell Sep 5, 2024
02cf701
Revert "do not apply test data when edit mode changes to false"
scottbell Sep 5, 2024
9aeb454
trying this again without blowing away the very pretty styling
scottbell Sep 5, 2024
fb8730c
clean up composition effects
scottbell Sep 5, 2024
06e916e
allow deleting of parameters
scottbell Sep 5, 2024
1996e66
can chain and plot derived data
scottbell Sep 5, 2024
dde0d1a
can delete properly
scottbell Sep 5, 2024
cde34e3
Enhancements for Derived Telemetry object
charlesh88 Sep 5, 2024
fdcece8
Merge branch 'telemetry-comps' of github.com:nasa/openmct into teleme…
charlesh88 Sep 5, 2024
80d8bab
handle arrays and add skeleton tests
scottbell Sep 5, 2024
1615c36
Merge branch 'telemetry-comps' of github.com:nasa/openmct into teleme…
charlesh88 Sep 5, 2024
59461d6
Enhancements for Derived Telemetry object
charlesh88 Sep 6, 2024
1b186d7
add tests
scottbell Sep 6, 2024
b251fde
ensure output format propagates
scottbell Sep 6, 2024
89e18d4
add output format test
scottbell Sep 6, 2024
dd57d78
add some basic object path label tests
scottbell Sep 7, 2024
8b4eed9
good job code scanner. changing to or condition
scottbell Sep 9, 2024
60e07e6
refactor aria labeling
scottbell Sep 10, 2024
e02217a
Merge branch 'master' into telemetry-comps
scottbell Sep 10, 2024
c1a361d
Merge branch 'master' into telemetry-comps
scottbell Sep 11, 2024
ee612a6
resolve conflicts
scottbell Sep 17, 2024
dfcfa47
pass options on request to underlying collections
scottbell Sep 24, 2024
4a301a1
ensure derived DERIVED telemetry loads in the proper order. also have…
scottbell Sep 25, 2024
eb5d32c
fix domains
scottbell Oct 1, 2024
5e013b6
ensure we only ask for latest for comp editor
scottbell Oct 1, 2024
1a94010
Merge remote-tracking branch 'origin/master' into telemetry-comps
scottbell Oct 2, 2024
8e5ac68
improvement in loading
scottbell Oct 3, 2024
154e8c6
fix slow loading errors
scottbell Oct 3, 2024
4bbbd17
more telemetry collection changes to acommodate bound changes
scottbell Oct 3, 2024
38316bd
more debug just in case
scottbell Oct 4, 2024
f718ccd
stacked plots are overriding telemetry object configurations
scottbell Oct 4, 2024
58d6cdb
some changes
scottbell Oct 4, 2024
d859322
add new flag to deal with plots asking for zoomed out data that shoul…
scottbell Oct 4, 2024
395436a
works
scottbell Oct 9, 2024
3f92deb
add sample size
scottbell Oct 9, 2024
c680694
check if sample size greater than zero
scottbell Oct 9, 2024
8e7bfd0
ensure number for sample size
scottbell Oct 9, 2024
2de628a
ensure we have a reference value before we slice
scottbell Oct 9, 2024
ba7f291
can do derived derived accumulated comps now
scottbell Oct 9, 2024
7c01a5e
ensure we are checking for not equal
scottbell Oct 9, 2024
bf9d5ef
add a few more awaits
scottbell Oct 9, 2024
d6f5056
allow blank test values for arrays
scottbell Oct 9, 2024
85a7769
check for blank test values
scottbell Oct 9, 2024
3be414e
Merge remote-tracking branch 'origin/master' into telemetry-comps-wit…
scottbell Oct 9, 2024
3b06c77
change to just value
scottbell Oct 9, 2024
4de0354
impute requested data properly
scottbell Oct 9, 2024
3b78d4d
fix output and add accumulation label
scottbell Oct 10, 2024
d5ee430
update output when comp changes
scottbell Oct 10, 2024
6710ad0
remove unused function
scottbell Oct 10, 2024
7d46afb
add placeholder
scottbell Oct 10, 2024
00c8c0e
Merge remote-tracking branch 'origin/master' into telemetry-comps
scottbell Oct 11, 2024
51f73bb
Merge remote-tracking branch 'origin/master' into telemetry-comps
scottbell Oct 14, 2024
1516524
support lambda values
scottbell Oct 14, 2024
96b1ef0
reduce size
Oct 22, 2024
4a4dabf
Merge remote-tracking branch 'origin/master' into telemetry-comps
scottbell Oct 28, 2024
9ca489c
widen size to accomodate sample size
scottbell Oct 28, 2024
55063a0
removing debug statements for PR review
scottbell Oct 28, 2024
64ae96e
Closes #7823
charlesh88 Nov 14, 2024
5683320
Merge remote-tracking branch 'origin/master' into telemetry-comps
scottbell Nov 15, 2024
5e15af1
Merge branch 'master' into telemetry-comps
scottbell Dec 11, 2024
6770390
Merge branch 'master' into telemetry-comps
akhenry Mar 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
can delete properly
  • Loading branch information
scottbell committed Sep 5, 2024
commit dde0d1a64d96c5ee1af43868db69eb0691980718
7 changes: 1 addition & 6 deletions src/plugins/comps/CompsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,296 +4,291 @@
#openmct;
#domainObject;
#composition;
#telemetryObjects = {};
#telemetryCollections = {};
#dataFrame = {};
#telemetryLoadedPromises = [];
#loaded = false;
#compositionLoaded = false;
#telemetryProcessors = {};

Check warning on line 13 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L7-L13

Added lines #L7 - L13 were not covered by tests
// make id random 4 digit number
#id = Math.floor(Math.random() * 9000) + 1000;

Check warning on line 15 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L15

Added line #L15 was not covered by tests

constructor(openmct, domainObject) {
super();
this.#openmct = openmct;
this.#domainObject = domainObject;
this.clearData = this.clearData.bind(this);

Check warning on line 21 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L18-L21

Added lines #L18 - L21 were not covered by tests
}

isValid() {
return this.#domainObject.configuration.comps.valid;

Check warning on line 25 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L25

Added line #L25 was not covered by tests
}

setValid(valid) {
this.#domainObject.configuration.comps.valid = valid;

Check warning on line 29 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L29

Added line #L29 was not covered by tests
}

#getNextAlphabeticalParameterName() {
const parameters = this.#domainObject.configuration.comps.parameters;
const existingNames = new Set(parameters.map((p) => p.name));
const alphabet = 'abcdefghijklmnopqrstuvwxyz';
let suffix = '';

Check warning on line 36 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L33-L36

Added lines #L33 - L36 were not covered by tests
// eslint-disable-next-line no-constant-condition
while (true) {
for (let letter of alphabet) {
const proposedName = letter + suffix;
if (!existingNames.has(proposedName)) {
return proposedName;

Check warning on line 42 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L38-L42

Added lines #L38 - L42 were not covered by tests
}
}
// Increment suffix after exhausting the alphabet
suffix = (parseInt(suffix, 10) || 0) + 1;

Check warning on line 46 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L46

Added line #L46 was not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why wasn't this covered by tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'd need 26 different parameters before slapping numbers on them. e.g., a,b,..z,a1,b2,c2,etc.

}
}

addParameter(telemetryObject) {
const keyString = this.#openmct.objects.makeKeyString(telemetryObject.identifier);
const metaData = this.#openmct.telemetry.getMetadata(telemetryObject);
const specificTelemetryCollection = this.#telemetryCollections[keyString];
const specificTimeKey = specificTelemetryCollection.timeKey;
const timeMetaData = metaData.valueMetadatas.find((metaDatum) => {
return metaDatum.key === specificTimeKey || metaDatum.source === specificTimeKey;

Check warning on line 56 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L51-L56

Added lines #L51 - L56 were not covered by tests
});
// in the valuesMetadata, find the first numeric data type
const rangeItems = metaData.valueMetadatas.filter(
(metaDatum) => metaDatum.hints && metaDatum.hints.range

Check warning on line 60 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L59-L60

Added lines #L59 - L60 were not covered by tests
);
rangeItems.sort((a, b) => a.hints.range - b.hints.range);
let valueToUse = rangeItems[0]?.key;
if (!valueToUse) {

Check warning on line 64 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L62-L64

Added lines #L62 - L64 were not covered by tests
// if no numeric data type, just use the first one
valueToUse = metaData.valueMetadatas[0]?.key;

Check warning on line 66 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L66

Added line #L66 was not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SWGs have numeric data types, so we never fall through here.

}
this.#domainObject.configuration.comps.parameters.push({

Check warning on line 68 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L68

Added line #L68 was not covered by tests
keyString,
name: `${this.#getNextAlphabeticalParameterName()}`,
valueToUse,
testValue: 0,
timeMetaData
});
this.emit('parameterAdded', this.#domainObject);

Check warning on line 75 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L75

Added line #L75 was not covered by tests
}

getParameters() {
const parameters = this.#domainObject.configuration.comps.parameters;
const parametersWithTimeKey = parameters.map((parameter) => {
return {

Check warning on line 81 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L79-L81

Added lines #L79 - L81 were not covered by tests
...parameter,
timeKey: this.#telemetryCollections[parameter.keyString]?.timeKey
};
});
return parametersWithTimeKey;

Check warning on line 86 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L86

Added line #L86 was not covered by tests
}

getTelemetryObjectForParameter(keyString) {
return this.#telemetryObjects[keyString];

Check warning on line 90 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L90

Added line #L90 was not covered by tests
}

getMetaDataValuesForParameter(keyString) {
const telemetryObject = this.getTelemetryObjectForParameter(keyString);
const metaData = this.#openmct.telemetry.getMetadata(telemetryObject);
return metaData.valueMetadatas;

Check warning on line 96 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L94-L96

Added lines #L94 - L96 were not covered by tests
}

deleteParameter(keyString) {
this.#domainObject.configuration.comps.parameters =

Check warning on line 100 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L100

Added line #L100 was not covered by tests
this.#domainObject.configuration.comps.parameters.filter(
(parameter) => parameter.keyString !== keyString

Check warning on line 102 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L102

Added line #L102 was not covered by tests
);
// if there are no parameters referencing this parameter keyString, remove the telemetry object too
const parameterExists = this.#domainObject.configuration.comps.parameters.some(
(parameter) => parameter.keyString === keyString

Check warning on line 106 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L105-L106

Added lines #L105 - L106 were not covered by tests
);
if (!parameterExists) {
this.#composition.remove(this.#telemetryObjects[keyString]);
this.emit('parameterRemoved', this.#domainObject);

Check warning on line 109 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L108-L109

Added lines #L108 - L109 were not covered by tests
}
}

setDomainObject(passedDomainObject) {
this.#domainObject = passedDomainObject;

Check warning on line 114 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L114

Added line #L114 was not covered by tests
}

isReady() {
return this.isValid() && this.#loaded;

Check warning on line 118 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L118

Added line #L118 was not covered by tests
}

async load() {
if (!this.#compositionLoaded) {
await this.#loadComposition();
this.#compositionLoaded = true;

Check warning on line 124 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L122-L124

Added lines #L122 - L124 were not covered by tests
}
if (!this.#loaded) {
await Promise.all(this.#telemetryLoadedPromises);
this.#telemetryLoadedPromises = [];
this.#loaded = true;
console.debug('📦 CompsManager: loaded');

Check warning on line 130 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L126-L130

Added lines #L126 - L130 were not covered by tests
}
}

async startListeningToUnderlyingTelemetry() {
console.debug('🎉 CompsManager: startListeningToUnderlyingTelemetry');
this.#loaded = false;
Object.keys(this.#telemetryCollections).forEach((keyString) => {
if (!this.#telemetryCollections[keyString].loaded) {
this.#telemetryCollections[keyString].on('add', this.#getTelemetryProcessor(keyString));
this.#telemetryCollections[keyString].on('clear', this.clearData);
const telemetryLoadedPromise = this.#telemetryCollections[keyString].load();
this.#telemetryLoadedPromises.push(telemetryLoadedPromise);

Check warning on line 142 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L135-L142

Added lines #L135 - L142 were not covered by tests
}
});
await Promise.all(this.#telemetryLoadedPromises);
this.#telemetryLoadedPromises = [];
this.#loaded = true;

Check warning on line 147 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L145-L147

Added lines #L145 - L147 were not covered by tests
}

stopListeningToUnderlyingTelemetry() {
console.debug('🔇 CompsManager: stopListeningToUnderlyingTelemetry');
this.#loaded = false;
Object.keys(this.#telemetryCollections).forEach((keyString) => {
const specificTelemetryProcessor = this.#telemetryProcessors[keyString];
delete this.#telemetryProcessors[keyString];
this.#telemetryCollections[keyString].off('add', specificTelemetryProcessor);
this.#telemetryCollections[keyString].off('clear', this.clearData);
this.#telemetryCollections[keyString].destroy();

Check warning on line 158 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L151-L158

Added lines #L151 - L158 were not covered by tests
});
}

getTelemetryObjects() {
return this.#telemetryObjects;

Check warning on line 163 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L163

Added line #L163 was not covered by tests
}

async #loadComposition() {
this.#composition = this.#openmct.composition.get(this.#domainObject);
if (this.#composition) {
this.#composition.on('add', this.#addTelemetryObject);
this.#composition.on('remove', this.#removeTelemetryObject);
await this.#composition.load();

Check warning on line 171 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L167-L171

Added lines #L167 - L171 were not covered by tests
}
console.debug(`📢 CompsManager: composition loaded`);

Check warning on line 173 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L173

Added line #L173 was not covered by tests
}

getFullDataFrame(newTelemetry) {
const dataFrame = {};

Check warning on line 177 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L177

Added line #L177 was not covered by tests
// can assume on data item
const newTelemetryKey = Object.keys(newTelemetry)[0];
const newTelemetryData = newTelemetry[newTelemetryKey];
const otherTelemetryKeys = Object.keys(this.#telemetryCollections).filter(
(keyString) => keyString !== newTelemetryKey

Check warning on line 182 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L179-L182

Added lines #L179 - L182 were not covered by tests
);
// initialize the data frame with the new telemetry data
dataFrame[newTelemetryKey] = newTelemetryData;

Check warning on line 185 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L185

Added line #L185 was not covered by tests
// initialize the other telemetry data
otherTelemetryKeys.forEach((keyString) => {
dataFrame[keyString] = [];

Check warning on line 188 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L187-L188

Added lines #L187 - L188 were not covered by tests
});

// march through the new telemetry data and add data to the frame from the other telemetry objects
// using LOCF

newTelemetryData.forEach((newDatum) => {
otherTelemetryKeys.forEach((otherKeyString) => {
const otherCollection = this.#telemetryCollections[otherKeyString];
let insertionPointForNewData = otherCollection._sortedIndex(newDatum);
const otherCollectionData = otherCollection.getAll();
if (insertionPointForNewData && insertionPointForNewData >= otherCollectionData.length) {
insertionPointForNewData = otherCollectionData.length - 1;

Check warning on line 200 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L194-L200

Added lines #L194 - L200 were not covered by tests
}
// get the closest datum to the new datum
const closestDatum = otherCollectionData[insertionPointForNewData];
if (closestDatum) {
dataFrame[otherKeyString].push(closestDatum);

Check warning on line 205 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L203-L205

Added lines #L203 - L205 were not covered by tests
}
});
});
return dataFrame;

Check warning on line 209 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L209

Added line #L209 was not covered by tests
}

#removeTelemetryObject = (telemetryObjectIdentifier) => {
console.debug('❌ CompsManager: removeTelemetryObject', telemetryObjectIdentifier);
const keyString = this.#openmct.objects.makeKeyString(telemetryObjectIdentifier);
delete this.#telemetryObjects[keyString];
this.#telemetryCollections[keyString]?.destroy();
delete this.#telemetryCollections[keyString];

Check warning on line 217 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L212-L217

Added lines #L212 - L217 were not covered by tests
// remove all parameters that reference this telemetry object
this.#domainObject.configuration.comps.parameters =
this.#domainObject.configuration.comps.parameters.filter(
(parameter) => parameter.keyString !== keyString
);
this.emit('parametersUpdated', keyString);
this.deleteParameter(keyString);

Check warning on line 219 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L219

Added line #L219 was not covered by tests
};

requestUnderlyingTelemetry() {
const underlyingTelemetry = {};
Object.keys(this.#telemetryCollections).forEach((collectionKey) => {
const collection = this.#telemetryCollections[collectionKey];
underlyingTelemetry[collectionKey] = collection.getAll();

Check warning on line 226 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L223-L226

Added lines #L223 - L226 were not covered by tests
});
return underlyingTelemetry;

Check warning on line 228 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L228

Added line #L228 was not covered by tests
}

#getTelemetryProcessor(keyString) {
if (this.#telemetryProcessors[keyString]) {
return this.#telemetryProcessors[keyString];

Check warning on line 233 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L232-L233

Added lines #L232 - L233 were not covered by tests
}

const telemetryProcessor = (newTelemetry) => {
this.emit('underlyingTelemetryUpdated', { [keyString]: newTelemetry });

Check warning on line 237 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L236-L237

Added lines #L236 - L237 were not covered by tests
};
this.#telemetryProcessors[keyString] = telemetryProcessor;
return telemetryProcessor;

Check warning on line 240 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L239-L240

Added lines #L239 - L240 were not covered by tests
}

#telemetryProcessor = (newTelemetry, keyString) => {
this.emit('underlyingTelemetryUpdated', { [keyString]: newTelemetry });

Check warning on line 244 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L243-L244

Added lines #L243 - L244 were not covered by tests
};

clearData(telemetryLoadedPromise) {
console.debug('💨 Clear Data fired, need to wait for all telemetry collections to load');
this.#loaded = false;
this.#telemetryLoadedPromises.push(telemetryLoadedPromise);

Check warning on line 250 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L248-L250

Added lines #L248 - L250 were not covered by tests
}

getOutputFormat() {
return this.#domainObject.configuration.comps.outputFormat;

Check warning on line 254 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L254

Added line #L254 was not covered by tests
}

getExpression() {
return this.#domainObject.configuration.comps.expression;

Check warning on line 258 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L258

Added line #L258 was not covered by tests
}

#addTelemetryObject = (telemetryObject) => {
console.debug(`📢 CompsManager: addTelemetryObject`, telemetryObject);
const keyString = this.#openmct.objects.makeKeyString(telemetryObject.identifier);
this.#telemetryObjects[keyString] = telemetryObject;
this.#telemetryCollections[keyString] =

Check warning on line 265 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L261-L265

Added lines #L261 - L265 were not covered by tests
this.#openmct.telemetry.requestCollection(telemetryObject);

this.#telemetryCollections[keyString].on('add', this.#getTelemetryProcessor(keyString));
this.#telemetryCollections[keyString].on('clear', this.clearData);
const telemetryLoadedPromise = this.#telemetryCollections[keyString].load();
this.#telemetryLoadedPromises.push(telemetryLoadedPromise);
console.debug('📢 CompsManager: loaded telemetry collection', keyString);

Check warning on line 272 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L268-L272

Added lines #L268 - L272 were not covered by tests

// check to see if we have a corresponding parameter
// if not, add one
const parameterExists = this.#domainObject.configuration.comps.parameters.some(
(parameter) => parameter.keyString === keyString

Check warning on line 277 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L276-L277

Added lines #L276 - L277 were not covered by tests
);
if (!parameterExists) {
this.addParameter(telemetryObject);

Check warning on line 280 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L279-L280

Added lines #L279 - L280 were not covered by tests
}
console.debug(`📢 CompsManager: done adding telemetry object`, telemetryObject);

Check warning on line 282 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L282

Added line #L282 was not covered by tests
};

static getCompsManager(domainObject, openmct, compsManagerPool) {
const id = openmct.objects.makeKeyString(domainObject.identifier);

Check warning on line 286 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L286

Added line #L286 was not covered by tests

if (!compsManagerPool[id]) {
compsManagerPool[id] = new CompsManager(openmct, domainObject);

Check warning on line 289 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L288-L289

Added lines #L288 - L289 were not covered by tests
}

return compsManagerPool[id];

Check warning on line 292 in src/plugins/comps/CompsManager.js

View check run for this annotation

Codecov / codecov/patch

src/plugins/comps/CompsManager.js#L292

Added line #L292 was not covered by tests
}
}
Loading