mirror of
https://github.com/nasa/openmct.git
synced 2025-02-26 03:18:51 +00:00
ensure output format propagates
This commit is contained in:
parent
1b186d7596
commit
b251fde1fc
@ -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.
|
||||
*
|
||||
|
@ -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),
|
||||
|
@ -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: '<comps-inspector-view></comps-inspector-view>'
|
||||
},
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -45,6 +45,8 @@
|
||||
<script setup>
|
||||
import { inject, onBeforeMount, onBeforeUnmount, ref } from 'vue';
|
||||
|
||||
import CompsManager from '../CompsManager';
|
||||
|
||||
const isEditing = ref(false);
|
||||
const inputFormatValue = ref('');
|
||||
|
||||
@ -68,6 +70,7 @@ function toggleEdit(passedIsEditing) {
|
||||
|
||||
function changeInputFormat() {
|
||||
openmct.objects.mutate(domainObject, `configuration.comps.outputFormat`, inputFormatValue.value);
|
||||
compsManagerPool.setDomainObject(domainObject);
|
||||
const compsManager = CompsManager.getCompsManager(domainObject, openmct, compsManagerPool);
|
||||
compsManager.setOutputFormat(inputFormatValue.value);
|
||||
}
|
||||
</script>
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user