mirror of
https://github.com/nasa/openmct.git
synced 2025-02-11 13:16:15 +00:00
Merge remote-tracking branch 'origin/open1018-new'
This commit is contained in:
commit
652a50c700
@ -204,6 +204,7 @@ define([
|
|||||||
"implementation": TimeRangeController,
|
"implementation": TimeRangeController,
|
||||||
"depends": [
|
"depends": [
|
||||||
"$scope",
|
"$scope",
|
||||||
|
"$timeout",
|
||||||
"formatService",
|
"formatService",
|
||||||
"DEFAULT_TIME_FORMAT",
|
"DEFAULT_TIME_FORMAT",
|
||||||
"now"
|
"now"
|
||||||
|
@ -53,7 +53,7 @@ define([
|
|||||||
* format has been otherwise specified
|
* format has been otherwise specified
|
||||||
* @param {Function} now a function to return current system time
|
* @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.$scope = $scope;
|
||||||
this.formatService = formatService;
|
this.formatService = formatService;
|
||||||
this.defaultFormat = defaultFormat;
|
this.defaultFormat = defaultFormat;
|
||||||
@ -66,6 +66,7 @@ define([
|
|||||||
this.formatter = formatService.getFormat(defaultFormat);
|
this.formatter = formatService.getFormat(defaultFormat);
|
||||||
this.formStartChanged = false;
|
this.formStartChanged = false;
|
||||||
this.formEndChanged = false;
|
this.formEndChanged = false;
|
||||||
|
this.$timeout = $timeout;
|
||||||
|
|
||||||
this.$scope.ticks = [];
|
this.$scope.ticks = [];
|
||||||
|
|
||||||
@ -259,18 +260,23 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
TimeRangeController.prototype.updateBoundsFromForm = function () {
|
TimeRangeController.prototype.updateBoundsFromForm = function () {
|
||||||
if (this.formStartChanged) {
|
var self = this;
|
||||||
this.$scope.ngModel.outer.start =
|
|
||||||
this.$scope.ngModel.inner.start =
|
//Allow Angular to trigger watches and determine whether values have changed.
|
||||||
this.$scope.formModel.start;
|
this.$timeout(function () {
|
||||||
this.formStartChanged = false;
|
if (self.formStartChanged) {
|
||||||
|
self.$scope.ngModel.outer.start =
|
||||||
|
self.$scope.ngModel.inner.start =
|
||||||
|
self.$scope.formModel.start;
|
||||||
|
self.formStartChanged = false;
|
||||||
}
|
}
|
||||||
if (this.formEndChanged) {
|
if (self.formEndChanged) {
|
||||||
this.$scope.ngModel.outer.end =
|
self.$scope.ngModel.outer.end =
|
||||||
this.$scope.ngModel.inner.end =
|
self.$scope.ngModel.inner.end =
|
||||||
this.$scope.formModel.end;
|
self.$scope.formModel.end;
|
||||||
this.formEndChanged = false;
|
self.formEndChanged = false;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
TimeRangeController.prototype.onFormStartChange = function (
|
TimeRangeController.prototype.onFormStartChange = function (
|
||||||
|
@ -33,6 +33,7 @@ define(
|
|||||||
var mockScope,
|
var mockScope,
|
||||||
mockFormatService,
|
mockFormatService,
|
||||||
testDefaultFormat,
|
testDefaultFormat,
|
||||||
|
mockTimeout,
|
||||||
mockNow,
|
mockNow,
|
||||||
mockFormat,
|
mockFormat,
|
||||||
controller;
|
controller;
|
||||||
@ -54,6 +55,10 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
mockTimeout = function (fn) {
|
||||||
|
return fn();
|
||||||
|
};
|
||||||
|
|
||||||
mockScope = jasmine.createSpyObj(
|
mockScope = jasmine.createSpyObj(
|
||||||
"$scope",
|
"$scope",
|
||||||
["$apply", "$watch", "$watchCollection"]
|
["$apply", "$watch", "$watchCollection"]
|
||||||
@ -78,6 +83,7 @@ define(
|
|||||||
|
|
||||||
controller = new TimeRangeController(
|
controller = new TimeRangeController(
|
||||||
mockScope,
|
mockScope,
|
||||||
|
mockTimeout,
|
||||||
mockFormatService,
|
mockFormatService,
|
||||||
testDefaultFormat,
|
testDefaultFormat,
|
||||||
mockNow
|
mockNow
|
||||||
|
Loading…
x
Reference in New Issue
Block a user