mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 13:17:53 +00:00
[Time Conductor] Bounds updated when date selected from date selector. Fixes #1018
This commit is contained in:
parent
8bdf1e3072
commit
2339560363
@ -204,6 +204,7 @@ define([
|
||||
"implementation": TimeRangeController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout",
|
||||
"formatService",
|
||||
"DEFAULT_TIME_FORMAT",
|
||||
"now"
|
||||
|
@ -53,7 +53,7 @@ define([
|
||||
* format has been otherwise specified
|
||||
* @param {Function} now a function to return current system time
|
||||
*/
|
||||
function TimeRangeController($scope, formatService, defaultFormat, now) {
|
||||
function TimeRangeController($scope, $timeout, formatService, defaultFormat, now) {
|
||||
this.$scope = $scope;
|
||||
this.formatService = formatService;
|
||||
this.defaultFormat = defaultFormat;
|
||||
@ -66,6 +66,7 @@ define([
|
||||
this.formatter = formatService.getFormat(defaultFormat);
|
||||
this.formStartChanged = false;
|
||||
this.formEndChanged = false;
|
||||
this.$timeout = $timeout;
|
||||
|
||||
this.$scope.ticks = [];
|
||||
|
||||
@ -259,18 +260,23 @@ define([
|
||||
};
|
||||
|
||||
TimeRangeController.prototype.updateBoundsFromForm = function () {
|
||||
if (this.formStartChanged) {
|
||||
this.$scope.ngModel.outer.start =
|
||||
this.$scope.ngModel.inner.start =
|
||||
this.$scope.formModel.start;
|
||||
this.formStartChanged = false;
|
||||
}
|
||||
if (this.formEndChanged) {
|
||||
this.$scope.ngModel.outer.end =
|
||||
this.$scope.ngModel.inner.end =
|
||||
this.$scope.formModel.end;
|
||||
this.formEndChanged = false;
|
||||
}
|
||||
var self = this;
|
||||
|
||||
//Allow Angular to trigger watches and determine whether values have changed.
|
||||
this.$timeout(function () {
|
||||
if (self.formStartChanged) {
|
||||
self.$scope.ngModel.outer.start =
|
||||
self.$scope.ngModel.inner.start =
|
||||
self.$scope.formModel.start;
|
||||
self.formStartChanged = false;
|
||||
}
|
||||
if (self.formEndChanged) {
|
||||
self.$scope.ngModel.outer.end =
|
||||
self.$scope.ngModel.inner.end =
|
||||
self.$scope.formModel.end;
|
||||
self.formEndChanged = false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
TimeRangeController.prototype.onFormStartChange = function (
|
||||
|
@ -33,6 +33,7 @@ define(
|
||||
var mockScope,
|
||||
mockFormatService,
|
||||
testDefaultFormat,
|
||||
mockTimeout,
|
||||
mockNow,
|
||||
mockFormat,
|
||||
controller;
|
||||
@ -54,6 +55,10 @@ define(
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockTimeout = function (fn) {
|
||||
return fn();
|
||||
};
|
||||
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
["$apply", "$watch", "$watchCollection"]
|
||||
@ -78,6 +83,7 @@ define(
|
||||
|
||||
controller = new TimeRangeController(
|
||||
mockScope,
|
||||
mockTimeout,
|
||||
mockFormatService,
|
||||
testDefaultFormat,
|
||||
mockNow
|
||||
|
Loading…
Reference in New Issue
Block a user