mirror of
https://github.com/nasa/openmct.git
synced 2025-05-13 14:03:21 +00:00
Populate format in input fields
This commit is contained in:
parent
334ca64551
commit
15a608a861
@ -16,7 +16,7 @@
|
|||||||
<span class="l-time-range-input-w start-date">
|
<span class="l-time-range-input-w start-date">
|
||||||
<mct-control key="'datetime-field'"
|
<mct-control key="'datetime-field'"
|
||||||
structure="{
|
structure="{
|
||||||
format: 'utc',
|
format: timeSystemModel.format,
|
||||||
validate: tcController.validation.validateStart
|
validate: tcController.validation.validateStart
|
||||||
}"
|
}"
|
||||||
ng-model="formModel"
|
ng-model="formModel"
|
||||||
@ -59,7 +59,7 @@
|
|||||||
ng-controller="ToggleController as t2">
|
ng-controller="ToggleController as t2">
|
||||||
<mct-control key="'datetime-field'"
|
<mct-control key="'datetime-field'"
|
||||||
structure="{
|
structure="{
|
||||||
format: 'utc',
|
format: timeSystemModel.format,
|
||||||
validate: tcController.validation.validateEnd
|
validate: tcController.validation.validateEnd
|
||||||
}"
|
}"
|
||||||
ng-model="formModel"
|
ng-model="formModel"
|
||||||
|
@ -22,8 +22,7 @@
|
|||||||
|
|
||||||
define([
|
define([
|
||||||
'./TimeSystem',
|
'./TimeSystem',
|
||||||
'./LocalClock',
|
'./LocalClock'
|
||||||
'../../../../commonUI/formats/src/UTCTimeFormat'
|
|
||||||
], function (TimeSystem, LocalClock, UTCTimeFormat) {
|
], function (TimeSystem, LocalClock, UTCTimeFormat) {
|
||||||
var FIFTEEN_MINUTES = 15 * 60 * 1000,
|
var FIFTEEN_MINUTES = 15 * 60 * 1000,
|
||||||
DEFAULT_PERIOD = 1000;
|
DEFAULT_PERIOD = 1000;
|
||||||
@ -36,13 +35,20 @@ define([
|
|||||||
function UTCTimeSystem ($timeout) {
|
function UTCTimeSystem ($timeout) {
|
||||||
TimeSystem.call(this);
|
TimeSystem.call(this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some metadata, which will be used to identify the time system in
|
||||||
|
* the UI
|
||||||
|
* @type {{key: string, name: string, glyph: string}}
|
||||||
|
*/
|
||||||
this.metadata = {
|
this.metadata = {
|
||||||
'key': 'utc',
|
'key': 'utc',
|
||||||
'name': 'UTC',
|
'name': 'UTC',
|
||||||
'glyph': '\u0043'
|
'glyph': '\u0043'
|
||||||
};
|
};
|
||||||
|
|
||||||
this._formats = [new UTCTimeFormat()];
|
//Time formats are defined as extensions. Include the key
|
||||||
|
// for the corresponding time format here
|
||||||
|
this._formats = ['utc'];
|
||||||
this._tickSources = [new LocalClock($timeout, DEFAULT_PERIOD)];
|
this._tickSources = [new LocalClock($timeout, DEFAULT_PERIOD)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ define(
|
|||||||
TimeConductorController.prototype.initializeScope = function ($scope) {
|
TimeConductorController.prototype.initializeScope = function ($scope) {
|
||||||
$scope.timeSystemModel = {
|
$scope.timeSystemModel = {
|
||||||
selected: undefined,
|
selected: undefined,
|
||||||
|
format: undefined,
|
||||||
options: []
|
options: []
|
||||||
};
|
};
|
||||||
$scope.modeModel = {
|
$scope.modeModel = {
|
||||||
@ -155,13 +156,17 @@ define(
|
|||||||
}
|
}
|
||||||
newMode.initialize();
|
newMode.initialize();
|
||||||
|
|
||||||
|
var timeSystem = newMode.selectedTimeSystem();
|
||||||
|
|
||||||
this.$scope.modeModel.selected = newMode;
|
this.$scope.modeModel.selected = newMode;
|
||||||
|
|
||||||
//Synchronize scope with time system on mode
|
//Synchronize scope with time system on mode
|
||||||
this.$scope.timeSystemModel.options = newMode.timeSystems().map(function (timeSystem) {
|
this.$scope.timeSystemModel.options = newMode.timeSystems().map(function (timeSystem) {
|
||||||
return timeSystem.metadata;
|
return timeSystem.metadata;
|
||||||
});
|
});
|
||||||
this.$scope.timeSystemModel.selected = newMode.selectedTimeSystem();
|
this.$scope.timeSystemModel.selected = timeSystem;
|
||||||
|
//Use default format
|
||||||
|
this.$scope.timeSystemModel.format = timeSystem.formats()[0];
|
||||||
this.setDefaultsFromTimeSystem(newMode.selectedTimeSystem());
|
this.setDefaultsFromTimeSystem(newMode.selectedTimeSystem());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user