From 327fc826c14fdcd703287e74b1e534b69a0cc407 Mon Sep 17 00:00:00 2001 From: Jesse Mazzella Date: Wed, 28 Dec 2022 11:12:00 -0800 Subject: [PATCH] fix(imagery): Unblock 'latest' strategy requests for Related Telemetry in realtime mode (#6080) * fix: use ephemeral timeContext for thumbnail metadata requests * fix(TEMP): use `eval-source-map` - **!!! REVERT THIS CHANGE BEFORE MERGE !!!** * fix: only mutate if object supports mutation * fix: pass identifier instead of whole domainObject * fix: add start and end bounds to request * Revert "fix(TEMP): use `eval-source-map`" This reverts commit 7972d8c33ab621e8852d65743e2adf946e5c14fb. * docs: add comments --- .../imagery/components/ImageryView.vue | 2 +- .../RelatedTelemetry/RelatedTelemetry.js | 27 +++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/plugins/imagery/components/ImageryView.vue b/src/plugins/imagery/components/ImageryView.vue index 4eb987cc73..8095898699 100644 --- a/src/plugins/imagery/components/ImageryView.vue +++ b/src/plugins/imagery/components/ImageryView.vue @@ -788,7 +788,7 @@ export default { } }, persistVisibleLayers() { - if (this.domainObject.configuration) { + if (this.domainObject.configuration && this.openmct.objects.supportsMutation(this.domainObject.identifier)) { this.openmct.objects.mutate(this.domainObject, 'configuration.layers', this.layers); } diff --git a/src/plugins/imagery/components/RelatedTelemetry/RelatedTelemetry.js b/src/plugins/imagery/components/RelatedTelemetry/RelatedTelemetry.js index f874d81299..f06091d395 100644 --- a/src/plugins/imagery/components/RelatedTelemetry/RelatedTelemetry.js +++ b/src/plugins/imagery/components/RelatedTelemetry/RelatedTelemetry.js @@ -28,6 +28,7 @@ function copyRelatedMetadata(metadata) { return copiedMetadata; } +import IndependentTimeContext from "@/api/time/IndependentTimeContext"; export default class RelatedTelemetry { constructor(openmct, domainObject, telemetryKeys) { @@ -88,9 +89,31 @@ export default class RelatedTelemetry { this[key].historicalDomainObject = await this._openmct.objects.get(this[key].historical.telemetryObjectId); this[key].requestLatestFor = async (datum) => { - const options = { + // We need to create a throwaway time context and pass it along + // as a request option. We do this to "trick" the Time API + // into thinking we are in fixed time mode in order to bypass this logic: + // https://github.com/akhenry/openmct-yamcs/blob/1060d42ebe43bf346dac0f6a8068cb288ade4ba4/src/providers/historical-telemetry-provider.js#L59 + // Context: https://github.com/akhenry/openmct-yamcs/pull/217 + const ephemeralContext = new IndependentTimeContext( + this._openmct, + this._openmct.time, + [this[key].historicalDomainObject] + ); + + // Stop following the global context, stop the clock, + // and set bounds. + ephemeralContext.resetContext(); + const newBounds = { start: this._openmct.time.bounds().start, - end: this._parseTime(datum), + end: this._parseTime(datum) + }; + ephemeralContext.stopClock(); + ephemeralContext.bounds(newBounds); + + const options = { + start: newBounds.start, + end: newBounds.end, + timeContext: ephemeralContext, strategy: 'latest' }; let results = await this._openmct.telemetry