openmct/example/generator/SinewaveStalenessProvider.js

158 lines
4.8 KiB
JavaScript
Raw Normal View History

[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
import EventEmitter from 'EventEmitter';
export default class SinewaveLimitProvider extends EventEmitter {
#openmct;
#observingStaleness;
#watchingTheClock;
#isRealTime;
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
constructor(openmct) {
super();
this.#openmct = openmct;
this.#observingStaleness = {};
this.#watchingTheClock = false;
this.#isRealTime = undefined;
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
supportsStaleness(domainObject) {
return domainObject.type === 'generator';
}
isStale(domainObject, options) {
if (!this.#providingStaleness(domainObject)) {
return;
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
const id = this.#getObjectKeyString(domainObject);
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
if (!this.#observerExists(id)) {
this.#createObserver(id);
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
return Promise.resolve({
isStale: this.#observingStaleness[id].isStale,
utc: Date.now()
});
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
subscribeToStaleness(domainObject, callback) {
const id = this.#getObjectKeyString(domainObject);
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
if (this.#isRealTime === undefined) {
this.#updateRealTime(this.#openmct.time.clock());
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
this.#handleClockUpdate();
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
if (this.#observerExists(id)) {
this.#addCallbackToObserver(id, callback);
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
} else {
this.#createObserver(id, callback);
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
const intervalId = setInterval(() => {
if (this.#providingStaleness(domainObject)) {
this.#updateStaleness(id, !this.#observingStaleness[id].isStale);
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
}, 10000);
return () => {
clearInterval(intervalId);
this.#updateStaleness(id, false);
this.#handleClockUpdate();
this.#destroyObserver(id);
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
};
}
#handleClockUpdate() {
let observers = Object.values(this.#observingStaleness).length > 0;
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
if (observers && !this.#watchingTheClock) {
this.#watchingTheClock = true;
this.#openmct.time.on('clock', this.#updateRealTime, this);
} else if (!observers && this.#watchingTheClock) {
this.#watchingTheClock = false;
this.#openmct.time.off('clock', this.#updateRealTime, this);
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
}
#updateRealTime(clock) {
this.#isRealTime = clock !== undefined;
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
if (!this.#isRealTime) {
Object.keys(this.#observingStaleness).forEach((id) => {
this.#updateStaleness(id, false);
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
});
}
}
#updateStaleness(id, isStale) {
this.#observingStaleness[id].isStale = isStale;
this.#observingStaleness[id].utc = Date.now();
this.#observingStaleness[id].callback({
isStale: this.#observingStaleness[id].isStale,
utc: this.#observingStaleness[id].utc
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
});
this.emit('stalenessEvent', {
id,
isStale: this.#observingStaleness[id].isStale
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
});
}
#createObserver(id, callback) {
this.#observingStaleness[id] = {
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
isStale: false,
utc: Date.now()
};
if (typeof callback === 'function') {
this.#addCallbackToObserver(id, callback);
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
}
#destroyObserver(id) {
if (this.#observingStaleness[id]) {
delete this.#observingStaleness[id];
}
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
#providingStaleness(domainObject) {
return domainObject.telemetry?.staleness === true && this.#isRealTime;
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
#getObjectKeyString(object) {
return this.#openmct.objects.makeKeyString(object.identifier);
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
#addCallbackToObserver(id, callback) {
this.#observingStaleness[id].callback = callback;
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
#observerExists(id) {
return this.#observingStaleness?.[id];
[Staleness] API and Component Functionality (#6108) * initial telemetry api updates for staleness support * modifying staleness to a subsription style * fixing variable name * debuggin * put the subscribe in the wrong place * stale class for object views * temp cyan border for testing * added staleness to swg, working on stacked plot staleness * WIP: stacked plot staleness * reverting, going a different route * staleness on stacked plots * plot legend staleness * remove debug code * staleness for alphanumerics * lad table and table set staleness * overlay plot staleness * remove debug code * hardened lad staleness functionality fixed plots without composition bug * adding staleness to gauges * renaming telemetry age check functionality so it does not conflict with new staleness functionality * couple one-off fixes here and there, and WIP for condition sets, moving to telemetry tables to facilitate styling of completed components * small fix on lad tables, added staleness functionality to tables * finishing up condition sets * some cleaning up * adding border to condition sets when an item is stale * fixing dub sub * addressing PR comment, moving repeated code to a function * robustified the SWG stalenes provider, little fixes here and there as far as cleaning up listeners and... whatnot * removing debug code * typo fixes * cleanin up debug code * created a simple stalenes mixin for more basic usage in components * more robustification, if a new staleness subscription happens, will now send the current staleness value if we have it, beefed up example stalenes swg provider * beefed up staleness mixin a bit to give it more use * copyright * cleanin up ladtable code * cleanin up ladtable code * cleaning up lad table sets * some minor updates * Closes #6109 - New staleness glyph and font CSS added. * Closes #6109 - Normalized staleness colors as theme constants. - New mixins for staleness application to view elements. - Applied staleness styling to all relevant view elements. - TODO: smoke-test in Show theme. * adding staleness utils helper, mixin and isStale functionalirty for telemtry api * Closes #6109 - Refined style for Snow theme. * need to have one domainObject per stalenes utility * making sure we handle domains correctly while dealing with staleness * couple fixes * moving abort controller logic to a spot where it makes more sense * added some more info for the StalenesProvider interface docs * returning undefinded for ifStale requests with no provider * debuggin * debuggin * missed "isStale" call in condtioncollections * removing debug code and using mixin unsubscribe in gauge * fixing tests * more targeted tree item click Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com>
2023-01-23 18:27:04 +00:00
}
}