Skip to content

Commit

Permalink
cherry-pick(#6929): Condition sets now provide the timeContext they'r…
Browse files Browse the repository at this point in the history
…e using when sending requests (#6959)

cherry-pick(6929): Condition sets now provide the timeContext they're using when sending requests (#6929)

* Send in the timeContext for requests

* Fix failing test

---------

Co-authored-by: Scott Bell <scott@traclabs.com>
  • Loading branch information
shefalijoshi and scottbell committed Aug 21, 2023
1 parent 2002396 commit c3ac07e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/plugins/condition/criterion/AllTelemetryCriterion.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,11 @@ export default class AllTelemetryCriterion extends TelemetryCriterion {
}

requestLAD(telemetryObjects, requestOptions) {
//We pass in the global time context here
let options = {
strategy: 'latest',
size: 1
size: 1,
timeContext: this.openmct.time.getContextForView([])
};

if (requestOptions !== undefined) {
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/condition/criterion/TelemetryCriterion.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,11 @@ export default class TelemetryCriterion extends EventEmitter {
}

requestLAD(telemetryObjects, requestOptions) {
//We pass in the global time context here
let options = {
strategy: 'latest',
size: 1
size: 1,
timeContext: this.openmct.time.getContextForView([])
};

if (requestOptions !== undefined) {
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/condition/criterion/TelemetryCriterionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,19 @@ describe('The telemetry criterion', function () {
});
openmct.telemetry.getMetadata.and.returnValue(testTelemetryObject.telemetry);

openmct.time = jasmine.createSpyObj('timeAPI', ['timeSystem', 'bounds', 'getAllTimeSystems']);
openmct.time = jasmine.createSpyObj('timeAPI', [
'timeSystem',
'bounds',
'getAllTimeSystems',
'getContextForView'
]);
openmct.time.timeSystem.and.returnValue({ key: 'system' });
openmct.time.bounds.and.returnValue({
start: 0,
end: 1
});
openmct.time.getAllTimeSystems.and.returnValue([{ key: 'system' }]);
openmct.time.getContextForView.and.returnValue({});

testCriterionDefinition = {
id: 'test-criterion-id',
Expand Down

0 comments on commit c3ac07e

Please sign in to comment.