mirror of
https://github.com/nasa/openmct.git
synced 2024-12-30 09:58:52 +00:00
persist metadata
This commit is contained in:
parent
f3f8e3a577
commit
cf4f3aa618
@ -29,7 +29,7 @@ export default class ConditionSetMetadataProvider {
|
||||
return domainObject.type === 'conditionSet';
|
||||
}
|
||||
|
||||
getDomains(domainObject) {
|
||||
getDefaultDomains(domainObject) {
|
||||
return this.openmct.time.getAllTimeSystems().map(function (ts, i) {
|
||||
return {
|
||||
key: ts.key,
|
||||
@ -63,8 +63,8 @@ export default class ConditionSetMetadataProvider {
|
||||
}
|
||||
];
|
||||
|
||||
return {
|
||||
values: this.getDomains().concat([
|
||||
const metaDataToReturn = {
|
||||
values: [
|
||||
{
|
||||
key: 'value',
|
||||
name: 'Value',
|
||||
@ -82,7 +82,20 @@ export default class ConditionSetMetadataProvider {
|
||||
range: 2
|
||||
}
|
||||
}
|
||||
])
|
||||
]
|
||||
};
|
||||
|
||||
// if there are any parameters, grab the first one's timeMetaData
|
||||
const timeMetaData =
|
||||
domainObject?.configuration?.conditionCollection[0]?.configuration.timeMetadata;
|
||||
|
||||
if (timeMetaData) {
|
||||
metaDataToReturn.values.push(timeMetaData);
|
||||
} else {
|
||||
const defaultDomains = this.getDefaultDomains(domainObject);
|
||||
metaDataToReturn.values.push(...defaultDomains);
|
||||
}
|
||||
|
||||
return metaDataToReturn;
|
||||
}
|
||||
}
|
||||
|
@ -57,11 +57,12 @@ export default class HistoricalTelemetryProvider {
|
||||
return specificDatum;
|
||||
}
|
||||
|
||||
#formatDatumForOutput(datum, metadata) {
|
||||
#formatDatumForOutput(datum, metadata, result) {
|
||||
const formattedDatum = {
|
||||
...datum
|
||||
...datum,
|
||||
value: datum[metadata],
|
||||
result
|
||||
};
|
||||
formattedDatum.value = datum[metadata];
|
||||
return formattedDatum;
|
||||
}
|
||||
|
||||
@ -89,7 +90,8 @@ export default class HistoricalTelemetryProvider {
|
||||
dataFrame[outputTelmetryDetail.outputTelemetryKeyString][timestamp];
|
||||
const formattedDatum = this.#formatDatumForOutput(
|
||||
outputTelmetryDatum,
|
||||
outputTelmetryDetail.outputMetadata
|
||||
outputTelmetryDetail.outputMetadata,
|
||||
result
|
||||
);
|
||||
return formattedDatum;
|
||||
} else if (outputTelmetryDetail?.staticOutputValue) {
|
||||
|
@ -336,6 +336,7 @@ export default {
|
||||
if (config?.output !== TELEMETRY_VALUE) {
|
||||
config.outputTelemetry = null;
|
||||
config.outputMetadata = null;
|
||||
config.timeMetadata = null;
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
@ -467,10 +468,28 @@ export default {
|
||||
this.condition.configuration.criteria.splice(index + 1, 0, clonedCriterion);
|
||||
this.persist();
|
||||
},
|
||||
persistTimeMetadata() {
|
||||
if (!this.condition.configuration.outputTelemetry) {
|
||||
return;
|
||||
}
|
||||
const outputTelemetryObject = this.telemetry.find(
|
||||
(telemetryItem) =>
|
||||
this.openmct.objects.makeKeyString(telemetryItem.identifier) ===
|
||||
this.condition.configuration.outputTelemetry
|
||||
);
|
||||
const timeSystem = this.openmct.time.getTimeSystem();
|
||||
const telemetryMetadata = this.openmct.telemetry.getMetadata(outputTelemetryObject);
|
||||
const domains = telemetryMetadata?.valuesForHints(['domain']);
|
||||
const timeMetaData = domains.find((d) => d.key === timeSystem.key);
|
||||
if (telemetryMetadata) {
|
||||
this.condition.configuration.timeMetadata = timeMetaData;
|
||||
}
|
||||
},
|
||||
persist() {
|
||||
const valueMetadata = this.getOutputMetadata();
|
||||
if (valueMetadata) {
|
||||
this.condition.configuration.valueMetadata = valueMetadata;
|
||||
this.persistTimeMetadata();
|
||||
}
|
||||
this.$emit('update-condition', {
|
||||
condition: this.condition
|
||||
|
Loading…
Reference in New Issue
Block a user