1.8.2 merge into master - the version of open mct after the last but equally as important (#4611)

* Release 1.8.2

* Trasactions tests are ids equal fix 1.8.2 (#4593)

* test fix

* return promise on 'onSave'

* "Export as JSON" yielding corrupted data #4577 (#4585)

https://github.com/nasa/openmct/issues/4577

* Fix date picker default time setting (#4581)

Fix mode dropdown position
Fix unlistening of upstream events

* Bar graph composition policy fix to allow condition set creation. (#4598)

* Use image timestamp instead of image index to show large view (#4591)

* Use image timestamp instead of image index to show large view

* Fix failing test

Co-authored-by: Nikhil <nikhil.k.mandlik@nasa.gov>
This commit is contained in:
Shefali Joshi
2021-12-17 12:57:49 -08:00
committed by GitHub
parent 2d64813a4f
commit 70f2fad243
10 changed files with 39 additions and 31 deletions

View File

@ -145,7 +145,6 @@ class IndependentTimeContext extends TimeContext {
/**
* Causes this time context to follow another time context (either the global context, or another upstream time context)
* This allows views to have their own time context which points to the appropriate upstream context as necessary, achieving nesting.
* @param {*} upstreamTimeContext
*/
followTimeContext() {
this.stopFollowingTimeContext();
@ -153,7 +152,9 @@ class IndependentTimeContext extends TimeContext {
TIME_CONTEXT_EVENTS.forEach((eventName) => {
const thisTimeContext = this;
this.upstreamTimeContext.on(eventName, passthrough);
this.unlisteners.push(() => this.upstreamTimeContext.off(eventName, passthrough));
this.unlisteners.push(() => {
thisTimeContext.upstreamTimeContext.off(eventName, passthrough);
});
function passthrough() {
thisTimeContext.emit(eventName, ...arguments);
}
@ -167,6 +168,7 @@ class IndependentTimeContext extends TimeContext {
*/
stopFollowingTimeContext() {
this.unlisteners.forEach(unlisten => unlisten());
this.unlisteners = [];
}
resetContext() {
@ -180,17 +182,19 @@ class IndependentTimeContext extends TimeContext {
* Refresh the time context, following any upstream time contexts as necessary
*/
refreshContext(viewKey) {
//TODO: find a better way to skip upstream context for the view that just got an independent time context
const key = this.openmct.objects.makeKeyString(this.objectPath[0].identifier);
if (viewKey && key === viewKey) {
return;
}
//this is necessary as the upstream context gets reassigned after this
this.stopFollowingTimeContext();
this.upstreamTimeContext = this.getUpstreamContext();
this.followTimeContext();
// Emit bounds so that views that are changing context get the upstream bounds
this.emit('bounds', this.upstreamTimeContext.bounds());
this.emit('bounds', this.bounds());
}
hasOwnContext() {