-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow passing in a promise that resolves to a request cache strategy for dictionary load #418
Changes from 9 commits
2c3ff8a
cf3e6ca
34eb1f7
9d6f169
71e0530
0a0ee40
c71c39f
7b678c6
8d8ffb6
839cf0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ const YAMCS_API_MAP = { | |
const operatorStatusParameter = new OperatorStatusParameter(); | ||
|
||
export default class YamcsObjectProvider { | ||
constructor(openmct, url, instance, folderName, roleStatusTelemetry, pollQuestionParameter, pollQuestionTelemetry, realtimeTelemetryProvider, processor = 'realtime') { | ||
constructor(openmct, url, instance, folderName, roleStatusTelemetry, pollQuestionParameter, pollQuestionTelemetry, realtimeTelemetryProvider, processor = 'realtime', dictionaryRequestCacheStrategyPromise = Promise.resolve({})) { | ||
this.openmct = openmct; | ||
this.url = url; | ||
this.instance = instance; | ||
|
@@ -52,6 +52,7 @@ export default class YamcsObjectProvider { | |
this.dictionary = {}; | ||
this.limitOverrides = {}; | ||
this.dictionaryPromise = null; | ||
this.dictionaryRequestCacheStrategyPromise = dictionaryRequestCacheStrategyPromise; | ||
this.roleStatusTelemetry = roleStatusTelemetry; | ||
this.pollQuestionParameter = pollQuestionParameter; | ||
this.pollQuestionTelemetry = pollQuestionTelemetry; | ||
|
@@ -180,7 +181,7 @@ export default class YamcsObjectProvider { | |
|
||
#getTelemetryDictionary() { | ||
if (!this.dictionaryPromise) { | ||
this.dictionaryPromise = this.#loadTelemetryDictionary(this.url, this.instance, this.folderName) | ||
this.dictionaryPromise = this.#loadTelemetryDictionary() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍🏻 |
||
.finally(() => { | ||
this.roleStatusTelemetry.dictionaryLoadComplete(); | ||
}); | ||
|
@@ -193,8 +194,10 @@ export default class YamcsObjectProvider { | |
const operation = 'parameters?details=yes&limit=1000'; | ||
const parameterUrl = this.url + 'api/mdb/' + this.instance + '/' + operation; | ||
const url = this.#getMdbUrl('space-systems'); | ||
const spaceSystems = await accumulateResults(url, {}, 'spaceSystems', []); | ||
const parameters = await accumulateResults(parameterUrl, {}, 'parameters', []); | ||
const requestOptions = await this.dictionaryRequestCacheStrategyPromise; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have some other function like 'buildRequestOptions' that does this? I mean, we can always add it down the road, but it seems weird just assigning directly from the cache strategy promise. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i hear you. we could change it now or wait until there are other requests. this one is very specific to loading the dictionary so i think we may be okay. |
||
|
||
const spaceSystems = await accumulateResults(url, requestOptions, 'spaceSystems', []); | ||
const parameters = await accumulateResults(parameterUrl, requestOptions, 'parameters', []); | ||
|
||
/* Sort the space systems by name, so that the | ||
children of the root object are in sorted order. */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a fix for a lint error that snuck in from a different, unrelated, PR.