mirror of
https://github.com/nasa/openmct.git
synced 2025-04-16 07:26:53 +00:00
* force update to latest image when history is received * force update to latest history image on response received * remove console log" * change requestLAD function to last item in array, in case response is an array with more than one item * fix checkstyle * remove requestLAD because its requesting history twice in cases where server does not have latest flag
This commit is contained in:
parent
75ae5ab3bb
commit
8c739e9fd9
@ -92,7 +92,7 @@ define(
|
||||
this.updateHistory(datum);
|
||||
this.updateValues(datum);
|
||||
}.bind(this));
|
||||
this.requestLad(false);
|
||||
|
||||
this.requestHistory(this.openmct.time.bounds());
|
||||
}.bind(this));
|
||||
};
|
||||
@ -107,34 +107,13 @@ define(
|
||||
if (this.requestCount > requestId) {
|
||||
return Promise.resolve('Stale request');
|
||||
}
|
||||
|
||||
values.forEach(function (datum) {
|
||||
this.updateHistory(datum);
|
||||
}, this);
|
||||
this.requestLad(true);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
* Makes a request for the most recent datum in the
|
||||
* telelmetry store. Optional addToHistory argument
|
||||
* determines whether the requested telemetry should
|
||||
* be added to history or only used to update the current
|
||||
* image url and timestamp.
|
||||
* @private
|
||||
* @param {boolean} [addToHistory] if true, adds to history
|
||||
*/
|
||||
ImageryController.prototype.requestLad = function (addToHistory) {
|
||||
this.openmct.telemetry
|
||||
.request(this.domainObject, {
|
||||
strategy: 'latest',
|
||||
size: 1
|
||||
})
|
||||
.then(function (values) {
|
||||
this.updateValues(values[0]);
|
||||
if (addToHistory !== false) {
|
||||
this.updateHistory(values[0]);
|
||||
}
|
||||
}.bind(this));
|
||||
this.updateValues(values[values.length - 1]);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
ImageryController.prototype.stopListening = function () {
|
||||
|
@ -59,7 +59,8 @@ define(
|
||||
'timeSystem',
|
||||
'clock',
|
||||
'on',
|
||||
'off'
|
||||
'off',
|
||||
'bounds'
|
||||
]),
|
||||
telemetry: jasmine.createSpyObj('telemetryAPI', [
|
||||
'subscribe',
|
||||
@ -118,7 +119,8 @@ define(
|
||||
|
||||
describe("when loaded", function () {
|
||||
var callback,
|
||||
boundsListener;
|
||||
boundsListener,
|
||||
bounds;
|
||||
|
||||
beforeEach(function () {
|
||||
waitsFor(function () {
|
||||
@ -137,13 +139,9 @@ define(
|
||||
});
|
||||
});
|
||||
|
||||
it("uses LAD telemetry", function () {
|
||||
it("requests history", function () {
|
||||
expect(openmct.telemetry.request).toHaveBeenCalledWith(
|
||||
newDomainObject,
|
||||
{
|
||||
strategy: 'latest',
|
||||
size: 1
|
||||
}
|
||||
newDomainObject, bounds
|
||||
);
|
||||
expect(controller.getTime()).toEqual(prefix + 1434600258123);
|
||||
expect(controller.getImageUrl()).toEqual('some/url');
|
||||
@ -204,7 +202,7 @@ define(
|
||||
it("requests telemetry", function () {
|
||||
expect(openmct.telemetry.request).toHaveBeenCalledWith(
|
||||
newDomainObject,
|
||||
jasmine.any(Object)
|
||||
bounds
|
||||
);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user