Merge remote-tracking branch 'github/master' into open115b
Merge in latest from master into topic branch for nasa/openmctweb#115 Conflicts: platform/features/conductor/src/ConductorRepresenter.js platform/features/conductor/src/ConductorTelemetrySeries.js platform/features/conductor/src/TimeConductor.js platform/features/conductor/test/ConductorRepresenterSpec.js platform/features/conductor/test/ConductorTelemetrySeriesSpec.js
This commit is contained in:
@@ -3,7 +3,12 @@
|
||||
"representers": [
|
||||
{
|
||||
"implementation": "ConductorRepresenter.js",
|
||||
"depends": [ "conductorService", "$compile", "views[]" ]
|
||||
"depends": [
|
||||
"throttle",
|
||||
"conductorService",
|
||||
"$compile",
|
||||
"views[]"
|
||||
]
|
||||
}
|
||||
],
|
||||
"components": [
|
||||
|
||||
@@ -36,6 +36,7 @@ define(
|
||||
"</mct-include>",
|
||||
'</div>'
|
||||
].join(''),
|
||||
THROTTLE_MS = 200,
|
||||
GLOBAL_SHOWING = false;
|
||||
|
||||
/**
|
||||
@@ -45,6 +46,8 @@ define(
|
||||
* @implements {Representer}
|
||||
* @constructor
|
||||
* @memberof platform/features/conductor
|
||||
* @param {Function} throttle a function used to reduce the frequency
|
||||
* of function invocations
|
||||
* @param {platform/features/conductor.ConductorService} conductorService
|
||||
* service which provides the active time conductor
|
||||
* @param $compile Angular's $compile
|
||||
@@ -52,7 +55,15 @@ define(
|
||||
* @param {Scope} the scope of the representation
|
||||
* @param element the jqLite-wrapped representation element
|
||||
*/
|
||||
function ConductorRepresenter(conductorService, $compile, views, scope, element) {
|
||||
function ConductorRepresenter(
|
||||
throttle,
|
||||
conductorService,
|
||||
$compile,
|
||||
views,
|
||||
scope,
|
||||
element
|
||||
) {
|
||||
this.throttle = throttle;
|
||||
this.scope = scope;
|
||||
this.conductorService = conductorService;
|
||||
this.element = element;
|
||||
@@ -60,31 +71,34 @@ define(
|
||||
this.$compile = $compile;
|
||||
}
|
||||
|
||||
// Combine start/end times & domain into a single object
|
||||
function bounds(start, end, domain) {
|
||||
return { start: start, end: end, domain: domain };
|
||||
}
|
||||
|
||||
// Update the time conductor from the scope
|
||||
function wireScope(conductor, conductorScope, repScope) {
|
||||
function updateConductorOuter() {
|
||||
conductor.queryStart(conductorScope.ngModel.conductor.outer.start);
|
||||
conductor.queryEnd(conductorScope.ngModel.conductor.outer.end);
|
||||
repScope.$broadcast('telemetry:query:bounds', bounds(
|
||||
conductor.queryStart(),
|
||||
conductor.queryEnd(),
|
||||
conductor.domain()
|
||||
));
|
||||
ConductorRepresenter.prototype.wireScope = function () {
|
||||
var conductor = this.conductorService.getConductor(),
|
||||
conductorScope = this.conductorScope(),
|
||||
repScope = this.scope,
|
||||
lastObservedBounds,
|
||||
broadcastBounds;
|
||||
|
||||
// Combine start/end times into a single object
|
||||
function bounds(start, end) {
|
||||
return {
|
||||
start: conductor.displayStart(),
|
||||
end: conductor.displayEnd(),
|
||||
domain: conductor.domain()
|
||||
};
|
||||
}
|
||||
|
||||
function boundsAreStable(newlyObservedBounds) {
|
||||
return !lastObservedBounds ||
|
||||
(lastObservedBounds.start === newlyObservedBounds.start &&
|
||||
lastObservedBounds.end === newlyObservedBounds.end);
|
||||
}
|
||||
|
||||
function updateConductorInner() {
|
||||
conductor.displayStart(conductorScope.ngModel.conductor.inner.start);
|
||||
conductor.displayEnd(conductorScope.ngModel.conductor.inner.end);
|
||||
repScope.$broadcast('telemetry:display:bounds', bounds(
|
||||
conductor.displayStart(),
|
||||
conductor.displayEnd(),
|
||||
conductor.domain()
|
||||
));
|
||||
conductor.displayStart(conductorScope.conductor.inner.start);
|
||||
conductor.displayEnd(conductorScope.conductor.inner.end);
|
||||
lastObservedBounds = lastObservedBounds || bounds();
|
||||
broadcastBounds();
|
||||
}
|
||||
|
||||
function updateDomain(value) {
|
||||
@@ -104,19 +118,25 @@ define(
|
||||
};
|
||||
}
|
||||
|
||||
broadcastBounds = this.throttle(function () {
|
||||
var newlyObservedBounds = bounds();
|
||||
|
||||
if (boundsAreStable(newlyObservedBounds)) {
|
||||
repScope.$broadcast('telemetry:display:bounds', bounds());
|
||||
lastObservedBounds = undefined;
|
||||
} else {
|
||||
lastObservedBounds = newlyObservedBounds;
|
||||
broadcastBounds();
|
||||
}
|
||||
}, THROTTLE_MS);
|
||||
|
||||
conductorScope.ngModel = {};
|
||||
conductorScope.ngModel.conductor = {
|
||||
outer: bounds(conductor.queryStart(), conductor.queryEnd()),
|
||||
inner: bounds(conductor.displayStart(), conductor.displayEnd())
|
||||
};
|
||||
conductorScope.ngModel.conductor =
|
||||
{ outer: bounds(), inner: bounds() };
|
||||
conductorScope.ngModel.options =
|
||||
conductor.domainOptions().map(makeOption);
|
||||
conductorScope.ngModel.domain = conductor.domain();
|
||||
|
||||
conductorScope
|
||||
.$watch('ngModel.conductor.outer.start', updateConductorOuter);
|
||||
conductorScope
|
||||
.$watch('ngModel.conductor.outer.end', updateConductorOuter);
|
||||
conductorScope
|
||||
.$watch('ngModel.conductor.inner.start', updateConductorInner);
|
||||
conductorScope
|
||||
@@ -125,11 +145,10 @@ define(
|
||||
.$watch('ngModel.domain', updateDomain);
|
||||
|
||||
repScope.$on('telemetry:view', updateConductorInner);
|
||||
}
|
||||
};
|
||||
|
||||
ConductorRepresenter.prototype.conductorScope = function (s) {
|
||||
return (this.cScope = arguments.length > 0 ?
|
||||
s : this.cScope);
|
||||
return (this.cScope = arguments.length > 0 ? s : this.cScope);
|
||||
};
|
||||
|
||||
// Handle a specific representation of a specific domain object
|
||||
@@ -143,11 +162,7 @@ define(
|
||||
|
||||
// Create a new scope for the conductor
|
||||
this.conductorScope(this.scope.$new());
|
||||
wireScope(
|
||||
this.conductorService.getConductor(),
|
||||
this.conductorScope(),
|
||||
this.scope
|
||||
);
|
||||
this.wireScope();
|
||||
this.conductorElement =
|
||||
this.$compile(TEMPLATE)(this.conductorScope());
|
||||
this.element.after(this.conductorElement[0]);
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['./ConductorTelemetrySeries'],
|
||||
function (ConductorTelemetrySeries) {
|
||||
function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
@@ -42,32 +41,6 @@ define(
|
||||
this.telemetryService = telemetryService;
|
||||
}
|
||||
|
||||
// Strip out any realtime data series that is outside of the conductor's
|
||||
// bounds.
|
||||
ConductorTelemetryDecorator.prototype.pruneNonDisplayable = function (packaged) {
|
||||
var conductor = this.conductorService.getConductor(),
|
||||
repackaged = {};
|
||||
|
||||
function filterSource(packagedBySource) {
|
||||
var repackagedBySource = {};
|
||||
|
||||
Object.keys(packagedBySource).forEach(function (k) {
|
||||
repackagedBySource[k] = new ConductorTelemetrySeries(
|
||||
packagedBySource[k],
|
||||
conductor
|
||||
);
|
||||
});
|
||||
|
||||
return repackagedBySource;
|
||||
}
|
||||
|
||||
Object.keys(packaged).forEach(function (source) {
|
||||
repackaged[source] = filterSource(packaged[source]);
|
||||
});
|
||||
|
||||
return repackaged;
|
||||
};
|
||||
|
||||
ConductorTelemetryDecorator.prototype.amendRequests = function (requests) {
|
||||
var conductor = this.conductorService.getConductor(),
|
||||
start = conductor.displayStart(),
|
||||
@@ -88,21 +61,14 @@ define(
|
||||
ConductorTelemetryDecorator.prototype.requestTelemetry = function (requests) {
|
||||
var self = this;
|
||||
return this.telemetryService
|
||||
.requestTelemetry(this.amendRequests(requests))
|
||||
.then(function (packaged) {
|
||||
return self.pruneNonDisplayable(packaged);
|
||||
});
|
||||
.requestTelemetry(this.amendRequests(requests));
|
||||
};
|
||||
|
||||
ConductorTelemetryDecorator.prototype.subscribe = function (callback, requests) {
|
||||
var self = this;
|
||||
|
||||
function internalCallback(packagedSeries) {
|
||||
return callback(self.pruneNonDisplayable(packagedSeries));
|
||||
}
|
||||
|
||||
return this.telemetryService
|
||||
.subscribe(internalCallback, this.amendRequests(requests));
|
||||
.subscribe(callback, this.amendRequests(requests));
|
||||
};
|
||||
|
||||
return ConductorTelemetryDecorator;
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
function () {
|
||||
'use strict';
|
||||
|
||||
|
||||
/**
|
||||
* Bound a series of telemetry such that it only includes
|
||||
* points from within the time conductor's displayable window.
|
||||
*
|
||||
* @param {TelemetrySeries} series the telemetry series
|
||||
* @param {platform/features/conductor.TimeConductor} the
|
||||
* time conductor instance which bounds this series
|
||||
* @constructor
|
||||
* @implements {TelemetrySeries}
|
||||
*/
|
||||
function ConductorTelemetrySeries(series, conductor) {
|
||||
var max = series.getPointCount() - 1,
|
||||
domain = conductor.domain();
|
||||
|
||||
function binSearch(min, max, value) {
|
||||
var mid = Math.floor((min + max) / 2);
|
||||
|
||||
return min > max ? min :
|
||||
series.getDomainValue(mid, domain) < value ?
|
||||
binSearch(mid + 1, max, value) :
|
||||
binSearch(min, mid - 1, value);
|
||||
}
|
||||
|
||||
this.startIndex = binSearch(0, max, conductor.displayStart());
|
||||
this.endIndex = binSearch(0, max, conductor.displayEnd());
|
||||
this.series = series;
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
ConductorTelemetrySeries.prototype.getPointCount = function () {
|
||||
return Math.max(0, this.endIndex - this.startIndex);
|
||||
};
|
||||
|
||||
ConductorTelemetrySeries.prototype.getDomainValue = function (i, d) {
|
||||
d = d || this.domain;
|
||||
return this.series.getDomainValue(i + this.startIndex, d);
|
||||
};
|
||||
|
||||
ConductorTelemetrySeries.prototype.getRangeValue = function (i, r) {
|
||||
return this.series.getRangeValue(i + this.startIndex, r);
|
||||
};
|
||||
|
||||
return ConductorTelemetrySeries;
|
||||
}
|
||||
);
|
||||
@@ -41,37 +41,11 @@ define(
|
||||
* @param {number} end the initial end time
|
||||
*/
|
||||
function TimeConductor(start, end, domains) {
|
||||
this.inner = { start: start, end: end };
|
||||
this.outer = { start: start, end: end };
|
||||
this.range = { start: start, end: end };
|
||||
this.domains = domains;
|
||||
this.activeDomain = domains[0].key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set (if called with an argument) the start time for queries.
|
||||
* @param {number} [value] the start time to set
|
||||
* @returns {number} the start time
|
||||
*/
|
||||
TimeConductor.prototype.queryStart = function (value) {
|
||||
if (arguments.length > 0) {
|
||||
this.outer.start = value;
|
||||
}
|
||||
return this.outer.start;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get or set (if called with an argument) the end time for queries.
|
||||
* @param {number} [value] the end time to set
|
||||
* @returns {number} the end time
|
||||
*/
|
||||
TimeConductor.prototype.queryEnd = function (value) {
|
||||
if (arguments.length > 0) {
|
||||
this.outer.end = value;
|
||||
}
|
||||
return this.outer.end;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get or set (if called with an argument) the start time for displays.
|
||||
* @param {number} [value] the start time to set
|
||||
@@ -79,9 +53,9 @@ define(
|
||||
*/
|
||||
TimeConductor.prototype.displayStart = function (value) {
|
||||
if (arguments.length > 0) {
|
||||
this.inner.start = value;
|
||||
this.range.start = value;
|
||||
}
|
||||
return this.inner.start;
|
||||
return this.range.start;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -91,9 +65,9 @@ define(
|
||||
*/
|
||||
TimeConductor.prototype.displayEnd = function (value) {
|
||||
if (arguments.length > 0) {
|
||||
this.inner.end = value;
|
||||
this.range.end = value;
|
||||
}
|
||||
return this.inner.end;
|
||||
return this.range.end;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,8 @@ define(
|
||||
];
|
||||
|
||||
describe("ConductorRepresenter", function () {
|
||||
var mockConductorService,
|
||||
var mockThrottle,
|
||||
mockConductorService,
|
||||
mockCompile,
|
||||
testViews,
|
||||
mockScope,
|
||||
@@ -64,6 +65,7 @@ define(
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockThrottle = jasmine.createSpy('throttle');
|
||||
mockConductorService = jasmine.createSpyObj(
|
||||
'conductorService',
|
||||
['getConductor']
|
||||
@@ -82,8 +84,12 @@ define(
|
||||
mockCompile.andReturn(mockCompiledTemplate);
|
||||
mockCompiledTemplate.andReturn(mockNewElement);
|
||||
mockScope.$new.andReturn(mockNewScope);
|
||||
mockThrottle.andCallFake(function (fn) {
|
||||
return fn;
|
||||
});
|
||||
|
||||
representer = new ConductorRepresenter(
|
||||
mockThrottle,
|
||||
mockConductorService,
|
||||
mockCompile,
|
||||
testViews,
|
||||
@@ -121,15 +127,13 @@ define(
|
||||
});
|
||||
|
||||
it("exposes conductor state in scope", function () {
|
||||
mockConductor.queryStart.andReturn(42);
|
||||
mockConductor.queryEnd.andReturn(12321);
|
||||
mockConductor.displayStart.andReturn(1977);
|
||||
mockConductor.displayEnd.andReturn(1984);
|
||||
representer.represent(testViews[0], {});
|
||||
|
||||
expect(mockNewScope.ngModel.conductor).toEqual({
|
||||
inner: { start: 1977, end: 1984 },
|
||||
outer: { start: 42, end: 12321 }
|
||||
outer: { start: 1977, end: 1984 }
|
||||
});
|
||||
});
|
||||
|
||||
@@ -156,20 +160,56 @@ define(
|
||||
testState.inner.end
|
||||
);
|
||||
expect(mockConductor.displayEnd).toHaveBeenCalledWith(1984);
|
||||
});
|
||||
|
||||
fireWatch(
|
||||
mockNewScope,
|
||||
'ngModel.conductor.outer.start',
|
||||
testState.outer.start
|
||||
);
|
||||
expect(mockConductor.queryStart).toHaveBeenCalledWith(-1977);
|
||||
describe("when bounds are changing", function () {
|
||||
var mockThrottledFn = jasmine.createSpy('throttledFn'),
|
||||
testBounds;
|
||||
|
||||
fireWatch(
|
||||
mockNewScope,
|
||||
'ngModel.conductor.outer.end',
|
||||
testState.outer.end
|
||||
);
|
||||
expect(mockConductor.queryEnd).toHaveBeenCalledWith(12321);
|
||||
function fireThrottledFn() {
|
||||
mockThrottle.mostRecentCall.args[0]();
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockThrottle.andReturn(mockThrottledFn);
|
||||
representer.represent(testViews[0], {});
|
||||
testBounds = { start: 0, end: 1000 };
|
||||
mockNewScope.conductor.inner = testBounds;
|
||||
mockConductor.displayStart.andCallFake(function () {
|
||||
return testBounds.start;
|
||||
});
|
||||
mockConductor.displayEnd.andCallFake(function () {
|
||||
return testBounds.end;
|
||||
});
|
||||
});
|
||||
|
||||
it("does not broadcast while bounds are changing", function () {
|
||||
expect(mockScope.$broadcast).not.toHaveBeenCalled();
|
||||
testBounds.start = 100;
|
||||
fireWatch(mockNewScope, 'conductor.inner.start', testBounds.start);
|
||||
testBounds.end = 500;
|
||||
fireWatch(mockNewScope, 'conductor.inner.end', testBounds.end);
|
||||
fireThrottledFn();
|
||||
testBounds.start = 200;
|
||||
fireWatch(mockNewScope, 'conductor.inner.start', testBounds.start);
|
||||
testBounds.end = 400;
|
||||
fireWatch(mockNewScope, 'conductor.inner.end', testBounds.end);
|
||||
fireThrottledFn();
|
||||
expect(mockScope.$broadcast).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does broadcast when bounds have stabilized", function () {
|
||||
expect(mockScope.$broadcast).not.toHaveBeenCalled();
|
||||
testBounds.start = 100;
|
||||
fireWatch(mockNewScope, 'conductor.inner.start', testBounds.start);
|
||||
testBounds.end = 500;
|
||||
fireWatch(mockNewScope, 'conductor.inner.end', testBounds.end);
|
||||
fireThrottledFn();
|
||||
fireWatch(mockNewScope, 'conductor.inner.start', testBounds.start);
|
||||
fireWatch(mockNewScope, 'conductor.inner.end', testBounds.end);
|
||||
fireThrottledFn();
|
||||
expect(mockScope.$broadcast).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it("exposes domain selection in scope", function () {
|
||||
|
||||
@@ -43,9 +43,9 @@ define(
|
||||
|
||||
it("initializes a time conductor around the current time", function () {
|
||||
var conductor = conductorService.getConductor();
|
||||
expect(conductor.queryStart() <= TEST_NOW).toBeTruthy();
|
||||
expect(conductor.queryEnd() >= TEST_NOW).toBeTruthy();
|
||||
expect(conductor.queryEnd() > conductor.queryStart())
|
||||
expect(conductor.displayStart() <= TEST_NOW).toBeTruthy();
|
||||
expect(conductor.displayEnd() >= TEST_NOW).toBeTruthy();
|
||||
expect(conductor.displayEnd() > conductor.displayStart())
|
||||
.toBeTruthy();
|
||||
});
|
||||
|
||||
|
||||
@@ -156,27 +156,6 @@ define(
|
||||
// }]);
|
||||
// });
|
||||
|
||||
it("prunes historical values to the displayable range", function () {
|
||||
var packagedTelemetry;
|
||||
decorator.requestTelemetry([{ source: "abc", key: "xyz" }]);
|
||||
packagedTelemetry = mockPromise.then.mostRecentCall.args[0]({
|
||||
"abc": { "xyz": mockSeries }
|
||||
});
|
||||
expect(seriesIsInWindow(packagedTelemetry.abc.xyz))
|
||||
.toBeTruthy();
|
||||
});
|
||||
|
||||
it("prunes subscribed values to the displayable range", function () {
|
||||
var mockCallback = jasmine.createSpy('callback'),
|
||||
packagedTelemetry;
|
||||
decorator.subscribe(mockCallback, [{ source: "abc", key: "xyz" }]);
|
||||
mockTelemetryService.subscribe.mostRecentCall.args[0]({
|
||||
"abc": { "xyz": mockSeries }
|
||||
});
|
||||
packagedTelemetry = mockCallback.mostRecentCall.args[0];
|
||||
expect(seriesIsInWindow(packagedTelemetry.abc.xyz))
|
||||
.toBeTruthy();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
||||
|
||||
define(
|
||||
["../src/ConductorTelemetrySeries", "./TestTimeConductor"],
|
||||
function (ConductorTelemetrySeries, TestTimeConductor) {
|
||||
"use strict";
|
||||
|
||||
describe("ConductorTelemetrySeries", function () {
|
||||
var mockSeries,
|
||||
mockConductor,
|
||||
testArray,
|
||||
series;
|
||||
|
||||
beforeEach(function () {
|
||||
testArray = [ -10, 0, 42, 1977, 12321 ];
|
||||
|
||||
mockSeries = jasmine.createSpyObj(
|
||||
'series',
|
||||
[ 'getPointCount', 'getDomainValue', 'getRangeValue' ]
|
||||
);
|
||||
mockConductor = new TestTimeConductor();
|
||||
|
||||
mockSeries.getPointCount.andCallFake(function () {
|
||||
return testArray.length;
|
||||
});
|
||||
mockSeries.getDomainValue.andCallFake(function (i) {
|
||||
return testArray[i];
|
||||
});
|
||||
mockSeries.getRangeValue.andCallFake(function (i) {
|
||||
return testArray[i] * 2;
|
||||
});
|
||||
|
||||
mockConductor.displayStart.andReturn(0);
|
||||
mockConductor.displayEnd.andReturn(2000);
|
||||
|
||||
series = new ConductorTelemetrySeries(
|
||||
mockSeries,
|
||||
mockConductor
|
||||
);
|
||||
});
|
||||
|
||||
it("reduces the apparent size of a series", function () {
|
||||
expect(series.getPointCount()).toEqual(3);
|
||||
});
|
||||
|
||||
it("maps domain value indexes to the displayable range", function () {
|
||||
[0, 1, 2].forEach(function (i) {
|
||||
expect(series.getDomainValue(i))
|
||||
.toEqual(mockSeries.getDomainValue(i + 1));
|
||||
});
|
||||
});
|
||||
|
||||
it("maps range value indexes to the displayable range", function () {
|
||||
[0, 1, 2].forEach(function (i) {
|
||||
expect(series.getRangeValue(i))
|
||||
.toEqual(mockSeries.getRangeValue(i + 1));
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -43,19 +43,13 @@ define(
|
||||
});
|
||||
|
||||
it("provides accessors for query/display start/end times", function () {
|
||||
expect(conductor.queryStart()).toEqual(testStart);
|
||||
expect(conductor.queryEnd()).toEqual(testEnd);
|
||||
expect(conductor.displayStart()).toEqual(testStart);
|
||||
expect(conductor.displayEnd()).toEqual(testEnd);
|
||||
});
|
||||
|
||||
it("provides setters for query/display start/end times", function () {
|
||||
expect(conductor.queryStart(1)).toEqual(1);
|
||||
expect(conductor.queryEnd(2)).toEqual(2);
|
||||
expect(conductor.displayStart(3)).toEqual(3);
|
||||
expect(conductor.displayEnd(4)).toEqual(4);
|
||||
expect(conductor.queryStart()).toEqual(1);
|
||||
expect(conductor.queryEnd()).toEqual(2);
|
||||
expect(conductor.displayStart()).toEqual(3);
|
||||
expect(conductor.displayEnd()).toEqual(4);
|
||||
});
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
"ConductorRepresenter",
|
||||
"ConductorService",
|
||||
"ConductorTelemetryDecorator",
|
||||
"ConductorTelemetrySeries",
|
||||
"TimeConductor"
|
||||
]
|
||||
|
||||
@@ -66,7 +66,6 @@ define(
|
||||
cachedObjects = [],
|
||||
updater,
|
||||
lastBounds,
|
||||
throttledRequery,
|
||||
handle;
|
||||
|
||||
// Populate the scope with axis information (specifically, options
|
||||
@@ -188,15 +187,10 @@ define(
|
||||
function changeDisplayBounds(event, bounds) {
|
||||
self.pending = true;
|
||||
releaseSubscription();
|
||||
throttledRequery();
|
||||
subscribe($scope.domainObject);
|
||||
setBasePanZoom(bounds);
|
||||
}
|
||||
|
||||
// Reestablish/reissue request for telemetry
|
||||
throttledRequery = throttle(function () {
|
||||
subscribe($scope.domainObject);
|
||||
}, 250);
|
||||
|
||||
this.modeOptions = new PlotModeOptions([], subPlotFactory);
|
||||
this.updateValues = updateValues;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user