Merge remote-tracking branch 'github-open/open229b' into open-master

This commit is contained in:
Pete Richards 2015-11-06 09:54:42 -08:00
commit 639546bf86
4 changed files with 19 additions and 11 deletions

View File

@ -102,7 +102,7 @@ define(
function updateDomain(value) { function updateDomain(value) {
var newDomain = conductor.domain(value); var newDomain = conductor.domain(value);
conductorScope.parameters.format = newDomain.format; conductorScope.parameters.format = newDomain.format;
repScope.$broadcast('telemetry:display:bounds', bounds()); broadcastBounds();
} }
// telemetry domain metadata -> option for a select control // telemetry domain metadata -> option for a select control
@ -139,8 +139,6 @@ define(
.$watch('ngModel.conductor.inner.end', updateConductorInner); .$watch('ngModel.conductor.inner.end', updateConductorInner);
conductorScope conductorScope
.$watch('ngModel.domain', updateDomain); .$watch('ngModel.domain', updateDomain);
repScope.$on('telemetry:view', updateConductorInner);
}; };
ConductorRepresenter.prototype.conductorScope = function (s) { ConductorRepresenter.prototype.conductorScope = function (s) {

View File

@ -245,9 +245,6 @@ define(
// Unsubscribe when the plot is destroyed // Unsubscribe when the plot is destroyed
$scope.$on("$destroy", releaseSubscription); $scope.$on("$destroy", releaseSubscription);
// Notify any external observers that a new telemetry view is here
$scope.$emit("telemetry:view");
} }
/** /**

View File

@ -39,6 +39,7 @@ define(
*/ */
function TelemetryHandle($q, subscription) { function TelemetryHandle($q, subscription) {
var seriesMap = {}, var seriesMap = {},
active = true,
self = Object.create(subscription); self = Object.create(subscription);
// Request a telemetry series for this specific object // Request a telemetry series for this specific object
@ -50,7 +51,7 @@ define(
// Store it for subsequent lookup // Store it for subsequent lookup
seriesMap[id] = series; seriesMap[id] = series;
// Notify callback of new series data, if there is one // Notify callback of new series data, if there is one
if (callback) { if (callback && active) {
callback(telemetryObject, series); callback(telemetryObject, series);
} }
// Pass it along for promise-chaining // Pass it along for promise-chaining
@ -61,6 +62,10 @@ define(
return telemetry.requestData(request).then(receiveSeries); return telemetry.requestData(request).then(receiveSeries);
} }
self.unsubscribe = function () {
active = false;
return subscription.unsubscribe();
};
/** /**
* Get the most recently obtained telemetry data series associated * Get the most recently obtained telemetry data series associated

View File

@ -85,10 +85,18 @@ define(
it("exposes subscription API", function () { it("exposes subscription API", function () {
// Should still expose methods from the provided subscription // Should still expose methods from the provided subscription
expect(handle.unsubscribe) // (though these may have been wrapped)
.toBe(mockSubscription.unsubscribe); expect(mockSubscription.getTelemetryObjects)
expect(handle.getTelemetryObjects) .not.toHaveBeenCalled();
.toBe(mockSubscription.getTelemetryObjects); handle.getTelemetryObjects();
expect(mockSubscription.getTelemetryObjects)
.toHaveBeenCalled();
expect(mockSubscription.unsubscribe)
.not.toHaveBeenCalled();
handle.unsubscribe();
expect(mockSubscription.unsubscribe)
.toHaveBeenCalled();
}); });
it("provides an interface for historical requests", function () { it("provides an interface for historical requests", function () {