Improved support from plot

This commit is contained in:
Henry 2016-07-26 16:55:00 -04:00
parent 5b2eb72b16
commit aa4a5e56f9
2 changed files with 29 additions and 12 deletions

View File

@ -103,7 +103,8 @@ define([
'./platform/entanglement/bundle',
'./platform/search/bundle',
'./platform/status/bundle',
'./platform/commonUI/regions/bundle'
'./platform/commonUI/regions/bundle',
'./example/msl/bundle'
], function (Main, legacyRegistry) {
return {
legacyRegistry: legacyRegistry,

View File

@ -39,21 +39,26 @@ define(
function ConductorTelemetryDecorator(conductor, telemetryService) {
this.conductor = conductor;
this.telemetryService = telemetryService;
this.amendRequests = ConductorTelemetryDecorator.prototype.amendRequests.bind(this);
}
function amendRequest(request, bounds, timeSystem) {
request = request || {};
request.start = bounds.start;
request.end = bounds.end;
request.domain = timeSystem.metadata.key;
return request;
}
ConductorTelemetryDecorator.prototype.amendRequests = function (requests) {
var bounds = this.conductor.bounds(),
timeSystem = this.conductor.timeSystem();
function amendRequest(request) {
request = request || {};
request.start = bounds.start;
request.end = bounds.end;
request.domain = timeSystem.metadata.key;
return request;
}
return (requests || []).map(amendRequest);
return (requests || []).map(function (request) {
return amendRequest(request, bounds, timeSystem);
});
};
ConductorTelemetryDecorator.prototype.requestTelemetry = function (requests) {
@ -62,8 +67,19 @@ define(
};
ConductorTelemetryDecorator.prototype.subscribe = function (callback, requests) {
return this.telemetryService
.subscribe(callback, requests);
var unsubscribeFunc = this.telemetryService.subscribe(callback, this.amendRequests(requests)),
conductor = this.conductor,
self = this;
function amendRequests() {
return self.amendRequests(requests);
}
conductor.on('bounds', amendRequests);
return function() {
unsubscribeFunc();
conductor.off('bounds', amendRequests);
}
};
return ConductorTelemetryDecorator;