[TimeAPI] Fix independent time context check (#6308)

* Fix independent time context to check first object in path (self) for upstream content instead of last object in path

* Revert changes that don't allow unregistering independent time context

---------

Co-authored-by: Shefali <simplyrender@gmail.com>
This commit is contained in:
Khalid Adil
2023-02-09 17:34:17 -06:00
committed by GitHub
parent 302dbe7359
commit 7dcccee1ae
3 changed files with 33 additions and 10 deletions

View File

@ -202,16 +202,10 @@ class IndependentTimeContext extends TimeContext {
}
getUpstreamContext() {
const objectKey = this.openmct.objects.makeKeyString(this.objectPath[this.objectPath.length - 1].identifier);
const doesObjectHaveTimeContext = this.globalTimeContext.independentContexts.get(objectKey);
if (doesObjectHaveTimeContext) {
return undefined;
}
let timeContext = this.globalTimeContext;
this.objectPath.some((item, index) => {
const key = this.openmct.objects.makeKeyString(item.identifier);
//last index is the view object itself
//first index is the view object itself
const itemContext = this.globalTimeContext.independentContexts.get(key);
if (index > 0 && itemContext && itemContext.hasOwnContext()) {
//upstream time context