From b251fde1fc06a4b9667dd24ac56860528a11df16 Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Fri, 6 Sep 2024 11:27:20 +0200 Subject: [PATCH] ensure output format propagates --- src/api/telemetry/TelemetryAPI.js | 9 +++++++++ src/api/telemetry/TelemetryCollection.js | 5 ----- src/plugins/comps/CompsInspectorViewProvider.js | 3 ++- src/plugins/comps/CompsManager.js | 5 +++++ src/plugins/comps/components/CompsInspectorView.vue | 5 ++++- src/plugins/comps/components/CompsView.vue | 8 ++++++++ 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/api/telemetry/TelemetryAPI.js b/src/api/telemetry/TelemetryAPI.js index c9c83b195b..5e963e0f58 100644 --- a/src/api/telemetry/TelemetryAPI.js +++ b/src/api/telemetry/TelemetryAPI.js @@ -684,6 +684,15 @@ export default class TelemetryAPI { return this.metadataCache.get(domainObject); } + /** + * Remove a domain object from the telemetry metadata cache. + * @param {import('openmct').DomainObject} domainObject + */ + + removeMetadataFromCache(domainObject) { + this.metadataCache.delete(domainObject); + } + /** * Get a value formatter for a given valueMetadata. * diff --git a/src/api/telemetry/TelemetryCollection.js b/src/api/telemetry/TelemetryCollection.js index 3b7cd9d935..2e736a1d6a 100644 --- a/src/api/telemetry/TelemetryCollection.js +++ b/src/api/telemetry/TelemetryCollection.js @@ -115,7 +115,6 @@ export default class TelemetryCollection extends EventEmitter { } this.removeAllListeners(); - console.debug('🔥 Telemetry Collection destroyed', this.domainObject?.identifier?.key); this.loaded = false; } @@ -187,10 +186,6 @@ export default class TelemetryCollection extends EventEmitter { const options = { ...this.options }; //We always want to receive all available values in telemetry tables. options.strategy = this.openmct.telemetry.SUBSCRIBE_STRATEGY.BATCH; - console.debug( - '🔊 Telemetry Collection Subscribing to telemetry data...', - this.domainObject?.identifier?.key - ); this.unsubscribe = this.openmct.telemetry.subscribe( this.domainObject, (datum) => this._processNewTelemetry(datum), diff --git a/src/plugins/comps/CompsInspectorViewProvider.js b/src/plugins/comps/CompsInspectorViewProvider.js index 11526c0256..d2241ef2db 100644 --- a/src/plugins/comps/CompsInspectorViewProvider.js +++ b/src/plugins/comps/CompsInspectorViewProvider.js @@ -45,6 +45,7 @@ export default class ConditionSetViewProvider { let _destroy = null; const domainObject = selection[0][0].context.item; const openmct = this.openmct; + const compsManagerPool = this.compsManagerPool; return { show: function (element) { @@ -57,7 +58,7 @@ export default class ConditionSetViewProvider { provide: { openmct, domainObject, - compsManagerPool: this.compsManagerPool + compsManagerPool }, template: '' }, diff --git a/src/plugins/comps/CompsManager.js b/src/plugins/comps/CompsManager.js index d998ebabd5..48c218cb08 100644 --- a/src/plugins/comps/CompsManager.js +++ b/src/plugins/comps/CompsManager.js @@ -236,6 +236,11 @@ export default class CompsManager extends EventEmitter { this.#telemetryLoadedPromises.push(telemetryLoadedPromise); } + setOutputFormat(outputFormat) { + this.#domainObject.configuration.comps.outputFormat = outputFormat; + this.emit('outputFormatChanged', outputFormat); + } + getOutputFormat() { return this.#domainObject.configuration.comps.outputFormat; } diff --git a/src/plugins/comps/components/CompsInspectorView.vue b/src/plugins/comps/components/CompsInspectorView.vue index 5a33816cb7..9ace9cc005 100644 --- a/src/plugins/comps/components/CompsInspectorView.vue +++ b/src/plugins/comps/components/CompsInspectorView.vue @@ -45,6 +45,8 @@ diff --git a/src/plugins/comps/components/CompsView.vue b/src/plugins/comps/components/CompsView.vue index 80412d0534..058c40d0bc 100644 --- a/src/plugins/comps/components/CompsView.vue +++ b/src/plugins/comps/components/CompsView.vue @@ -179,6 +179,7 @@ onBeforeMount(async () => { outputTelemetryCollection.on('clear', clearData); compsManager.on('parameterAdded', reloadParameters); compsManager.on('parameterRemoved', reloadParameters); + compsManager.on('outputFormatChanged', updateOutputFormat); await compsManager.load(); parameters.value = compsManager.getParameters(); expression.value = compsManager.getExpression(); @@ -192,6 +193,7 @@ onBeforeUnmount(() => { outputTelemetryCollection.off('clear', clearData); compsManager.off('parameterAdded', reloadParameters); compsManager.off('parameterRemoved', reloadParameters); + compsManager.off('outputFormatChanged', updateOutputFormat); outputTelemetryCollection.destroy(); }); @@ -204,6 +206,12 @@ watch( } ); +function updateOutputFormat() { + outputFormat.value = compsManager.getOutputFormat(); + // delete the metadata cache so that the new output format is used + openmct.telemetry.removeMetadataFromCache(domainObject); +} + function reloadParameters(passedDomainObject) { // Because this is triggered by a composition change, we have // to defer mutation of our domain object, otherwise we might