mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 21:27:52 +00:00
Wait for bounds change to reset telemetry collection data (#6857)
* Reset and re-request telemetry only after receiving bounds following a mode change * Don't check for tick - just in case the mode is set without bounds * Use the imagery view timeContext to get related telemetry. --------- Co-authored-by: Khalid Adil <khalidadil29@gmail.com>
This commit is contained in:
parent
50559ac502
commit
f705bf9a61
@ -204,7 +204,8 @@ export default class TelemetryAPI {
|
||||
*/
|
||||
standardizeRequestOptions(options = {}) {
|
||||
if (!Object.hasOwn(options, 'start')) {
|
||||
if (options.timeContext?.getBounds()) {
|
||||
const bounds = options.timeContext?.getBounds();
|
||||
if (bounds?.start) {
|
||||
options.start = options.timeContext.getBounds().start;
|
||||
} else {
|
||||
options.start = this.openmct.time.getBounds().start;
|
||||
@ -212,7 +213,8 @@ export default class TelemetryAPI {
|
||||
}
|
||||
|
||||
if (!Object.hasOwn(options, 'end')) {
|
||||
if (options.timeContext?.getBounds()) {
|
||||
const bounds = options.timeContext?.getBounds();
|
||||
if (bounds?.end) {
|
||||
options.end = options.timeContext.getBounds().end;
|
||||
} else {
|
||||
options.end = this.openmct.time.getBounds().end;
|
||||
|
@ -71,6 +71,7 @@ export default class TelemetryCollection extends EventEmitter {
|
||||
this.requestAbort = undefined;
|
||||
this.isStrategyLatest = this.options.strategy === 'latest';
|
||||
this.dataOutsideTimeBounds = false;
|
||||
this.modeChanged = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -306,6 +307,12 @@ export default class TelemetryCollection extends EventEmitter {
|
||||
* @private
|
||||
*/
|
||||
_bounds(bounds, isTick) {
|
||||
if (this.modeChanged) {
|
||||
this.modeChanged = false;
|
||||
this._reset();
|
||||
return;
|
||||
}
|
||||
|
||||
let startChanged = this.lastBounds.start !== bounds.start;
|
||||
let endChanged = this.lastBounds.end !== bounds.end;
|
||||
|
||||
@ -439,7 +446,8 @@ export default class TelemetryCollection extends EventEmitter {
|
||||
}
|
||||
|
||||
_timeModeChanged() {
|
||||
this._reset();
|
||||
//We're need this so that when the bounds change comes in after this mode change, we can reset and request historic telemetry
|
||||
this.modeChanged = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -209,6 +209,7 @@ import ImageControls from './ImageControls.vue';
|
||||
import ImageThumbnail from './ImageThumbnail.vue';
|
||||
import imageryData from '../../imagery/mixins/imageryData';
|
||||
import AnnotationsCanvas from './AnnotationsCanvas.vue';
|
||||
import { TIME_CONTEXT_EVENTS } from '../../../api/time/constants';
|
||||
|
||||
const REFRESH_CSS_MS = 500;
|
||||
const DURATION_TRACK_MS = 1000;
|
||||
@ -754,32 +755,28 @@ export default {
|
||||
this.stopFollowingTimeContext();
|
||||
this.timeContext = this.openmct.time.getContextForView(this.objectPath);
|
||||
//listen
|
||||
this.timeContext.on('timeSystem', this.timeContextChanged);
|
||||
this.timeContext.on('clock', this.timeContextChanged);
|
||||
this.timeContextChanged();
|
||||
this.timeContext.on('timeSystem', this.setModeAndTrackDuration);
|
||||
this.timeContext.on(TIME_CONTEXT_EVENTS.clockChanged, this.setModeAndTrackDuration);
|
||||
this.timeContext.on(TIME_CONTEXT_EVENTS.modeChanged, this.setModeAndTrackDuration);
|
||||
this.setModeAndTrackDuration();
|
||||
},
|
||||
stopFollowingTimeContext() {
|
||||
if (this.timeContext) {
|
||||
this.timeContext.off('timeSystem', this.timeContextChanged);
|
||||
this.timeContext.off('clock', this.timeContextChanged);
|
||||
this.timeContext.off('timeSystem', this.setModeAndTrackDuration);
|
||||
this.timeContext.off(TIME_CONTEXT_EVENTS.clockChanged, this.setModeAndTrackDuration);
|
||||
this.timeContext.off(TIME_CONTEXT_EVENTS.modeChanged, this.setModeAndTrackDuration);
|
||||
}
|
||||
},
|
||||
timeContextChanged() {
|
||||
setModeAndTrackDuration() {
|
||||
this.setIsFixed();
|
||||
this.setCanTrackDuration();
|
||||
this.trackDuration();
|
||||
},
|
||||
setIsFixed() {
|
||||
this.isFixed = this.timeContext ? this.timeContext.isFixed() : this.openmct.time.isFixed();
|
||||
this.isFixed = this.timeContext.isRealTime() === false;
|
||||
},
|
||||
setCanTrackDuration() {
|
||||
let isRealTime;
|
||||
if (this.timeContext) {
|
||||
isRealTime = this.timeContext.isRealTime();
|
||||
} else {
|
||||
isRealTime = this.openmct.time.isRealTime();
|
||||
}
|
||||
|
||||
let isRealTime = this.timeContext.isRealTime();
|
||||
this.canTrackDuration = isRealTime && this.timeSystem.isUTCBased;
|
||||
},
|
||||
updateSelection(selection) {
|
||||
@ -809,13 +806,18 @@ export default {
|
||||
}
|
||||
},
|
||||
async initializeRelatedTelemetry() {
|
||||
this.relatedTelemetry = new RelatedTelemetry(this.openmct, this.domainObject, [
|
||||
...this.spacecraftPositionKeys,
|
||||
...this.spacecraftOrientationKeys,
|
||||
...this.cameraKeys,
|
||||
...this.sunKeys,
|
||||
...this.transformationsKeys
|
||||
]);
|
||||
this.relatedTelemetry = new RelatedTelemetry(
|
||||
this.openmct,
|
||||
this.domainObject,
|
||||
[
|
||||
...this.spacecraftPositionKeys,
|
||||
...this.spacecraftOrientationKeys,
|
||||
...this.cameraKeys,
|
||||
...this.sunKeys,
|
||||
...this.transformationsKeys
|
||||
],
|
||||
this.timeContext
|
||||
);
|
||||
|
||||
if (this.relatedTelemetry.hasRelatedTelemetry) {
|
||||
await this.relatedTelemetry.load();
|
||||
|
@ -30,9 +30,10 @@ function copyRelatedMetadata(metadata) {
|
||||
|
||||
import IndependentTimeContext from '@/api/time/IndependentTimeContext';
|
||||
export default class RelatedTelemetry {
|
||||
constructor(openmct, domainObject, telemetryKeys) {
|
||||
constructor(openmct, domainObject, telemetryKeys, timeContext) {
|
||||
this._openmct = openmct;
|
||||
this._domainObject = domainObject;
|
||||
this.timeContext = timeContext;
|
||||
|
||||
let metadata = this._openmct.telemetry.getMetadata(this._domainObject);
|
||||
let imageHints = metadata.valuesForHints(['image'])[0];
|
||||
@ -43,7 +44,7 @@ export default class RelatedTelemetry {
|
||||
this.keys = telemetryKeys;
|
||||
|
||||
this._timeFormatter = undefined;
|
||||
this._timeSystemChange(this._openmct.time.timeSystem());
|
||||
this._timeSystemChange(this.timeContext.timeSystem());
|
||||
|
||||
// grab related telemetry metadata
|
||||
for (let key of this.keys) {
|
||||
@ -57,7 +58,7 @@ export default class RelatedTelemetry {
|
||||
this._timeSystemChange = this._timeSystemChange.bind(this);
|
||||
this.destroy = this.destroy.bind(this);
|
||||
|
||||
this._openmct.time.on('timeSystem', this._timeSystemChange);
|
||||
this.timeContext.on('timeSystem', this._timeSystemChange);
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,7 +110,7 @@ export default class RelatedTelemetry {
|
||||
// and set bounds.
|
||||
ephemeralContext.resetContext();
|
||||
const newBounds = {
|
||||
start: this._openmct.time.bounds().start,
|
||||
start: this.timeContext.bounds().start,
|
||||
end: this._parseTime(datum)
|
||||
};
|
||||
ephemeralContext.bounds(newBounds);
|
||||
@ -183,7 +184,7 @@ export default class RelatedTelemetry {
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this._openmct.time.off('timeSystem', this._timeSystemChange);
|
||||
this.timeContext.off('timeSystem', this._timeSystemChange);
|
||||
for (let key of this.keys) {
|
||||
if (this[key] && this[key].unsubscribe) {
|
||||
this[key].unsubscribe();
|
||||
|
Loading…
Reference in New Issue
Block a user