mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 14:18:16 +00:00
[Time Conductor] Use timeService from control
This commit is contained in:
@ -26,6 +26,7 @@
|
|||||||
"platform/policy",
|
"platform/policy",
|
||||||
"platform/entanglement",
|
"platform/entanglement",
|
||||||
"platform/search",
|
"platform/search",
|
||||||
|
"platform/time",
|
||||||
|
|
||||||
"example/imagery",
|
"example/imagery",
|
||||||
"example/eventGenerator",
|
"example/eventGenerator",
|
||||||
|
@ -44,11 +44,11 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
SinewaveTimeSystem.prototype.now = function () {
|
SinewaveTimeSystem.prototype.now = function () {
|
||||||
return new SinewaveTelemetrySeries().getPointCount();
|
return new SinewaveTelemetrySeries({}).getPointCount();
|
||||||
};
|
};
|
||||||
|
|
||||||
SinewaveTimeSystem.prototype.increment = function (scale) {
|
SinewaveTimeSystem.prototype.increment = function (scale) {
|
||||||
return Math.pow(10, (scale || 0) + 1);
|
return Math.max(Math.pow(10, (scale || 0) + 1), 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
return SinewaveTimeSystem;
|
return SinewaveTimeSystem;
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
{
|
{
|
||||||
"key": "TimeRangeController",
|
"key": "TimeRangeController",
|
||||||
"implementation": "controllers/TimeRangeController.js",
|
"implementation": "controllers/TimeRangeController.js",
|
||||||
"depends": [ "$scope", "dateService", "now" ]
|
"depends": [ "$scope", "timeService", "now" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "DateTimePickerController",
|
"key": "DateTimePickerController",
|
||||||
|
@ -102,7 +102,7 @@
|
|||||||
<div class="l-time-range-ticks-holder">
|
<div class="l-time-range-ticks-holder">
|
||||||
<div class="l-time-range-ticks">
|
<div class="l-time-range-ticks">
|
||||||
<div
|
<div
|
||||||
ng-repeat="tick in ticks"
|
ng-repeat="tick in ticks track by $index"
|
||||||
ng-style="{ left: $index * (100 / (ticks.length - 1)) + '%' }"
|
ng-style="{ left: $index * (100 / (ticks.length - 1)) + '%' }"
|
||||||
class="tick tick-x"
|
class="tick tick-x"
|
||||||
>
|
>
|
||||||
|
@ -34,24 +34,20 @@ define(
|
|||||||
* @memberof platform/commonUI/general
|
* @memberof platform/commonUI/general
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function TimeRangeController($scope, dateService, now) {
|
function TimeRangeController($scope, timeService, now) {
|
||||||
var tickCount = 2,
|
var tickCount = 2,
|
||||||
innerMinimumSpan = 1000, // 1 second
|
innerMinimumSpan = 1000, // 1 second
|
||||||
outerMinimumSpan = 1000 * 60 * 60, // 1 hour
|
outerMinimumSpan = 1000 * 60 * 60, // 1 hour
|
||||||
initialDragValue;
|
initialDragValue,
|
||||||
|
timeSystem = timeService.system(); // Start with default
|
||||||
function timeSystemKey() {
|
|
||||||
return ($scope.parameters || {}).system;
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatTimestamp(ts) {
|
function formatTimestamp(ts) {
|
||||||
return dateService.format(ts, timeSystemKey());
|
return timeSystem.format(ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseTimestamp(text) {
|
function parseTimestamp(text) {
|
||||||
var key = timeSystemKey();
|
if (timeSystem.validate(text)) {
|
||||||
if (dateService.validate(text, key)) {
|
return timeSystem.parse(text);
|
||||||
return dateService.parse(text, key);
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Could not parse " + text);
|
throw new Error("Could not parse " + text);
|
||||||
}
|
}
|
||||||
@ -270,6 +266,30 @@ define(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reinitializeBounds(now, increment) {
|
||||||
|
var end = Math.ceil(now / increment) * increment,
|
||||||
|
start = end - increment;
|
||||||
|
$scope.ngModel.outer.start = start;
|
||||||
|
$scope.ngModel.outer.end = end;
|
||||||
|
$scope.ngModel.inner.start = start;
|
||||||
|
$scope.ngModel.inner.end = end;
|
||||||
|
$scope.boundsModel = {};
|
||||||
|
updateViewFromModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateTimeSystem(key) {
|
||||||
|
timeSystem = timeService.system(key) || timeService.system();
|
||||||
|
|
||||||
|
// One second / one hour in UTC; should be
|
||||||
|
// similarly useful in other time systems.
|
||||||
|
innerMinimumSpan = timeSystem.increment(-3);
|
||||||
|
outerMinimumSpan = timeSystem.increment(-1);
|
||||||
|
reinitializeBounds(
|
||||||
|
timeSystem.now(),
|
||||||
|
timeSystem.increment()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function updateStartFromPicker(value) {
|
function updateStartFromPicker(value) {
|
||||||
updateOuterStart(value);
|
updateOuterStart(value);
|
||||||
updateBoundsText($scope.ngModel);
|
updateBoundsText($scope.ngModel);
|
||||||
@ -300,6 +320,7 @@ define(
|
|||||||
$scope.$watch("ngModel.outer.end", updateEndFromPicker);
|
$scope.$watch("ngModel.outer.end", updateEndFromPicker);
|
||||||
$scope.$watch("boundsModel.start", updateStartFromText);
|
$scope.$watch("boundsModel.start", updateStartFromText);
|
||||||
$scope.$watch("boundsModel.end", updateEndFromText);
|
$scope.$watch("boundsModel.end", updateEndFromText);
|
||||||
|
$scope.$watch("parameters.system", updateTimeSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TimeRangeController;
|
return TimeRangeController;
|
||||||
|
Reference in New Issue
Block a user