Skip to content

Commit 15a608a

Browse files
committed
Populate format in input fields
1 parent 334ca64 commit 15a608a

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

platform/features/conductor-v2/res/templates/time-conductor.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<span class="l-time-range-input-w start-date">
1717
<mct-control key="'datetime-field'"
1818
structure="{
19-
format: 'utc',
19+
format: timeSystemModel.format,
2020
validate: tcController.validation.validateStart
2121
}"
2222
ng-model="formModel"
@@ -59,7 +59,7 @@
5959
ng-controller="ToggleController as t2">
6060
<mct-control key="'datetime-field'"
6161
structure="{
62-
format: 'utc',
62+
format: timeSystemModel.format,
6363
validate: tcController.validation.validateEnd
6464
}"
6565
ng-model="formModel"

platform/features/conductor-v2/src/timeSystems/UTCTimeSystem.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
define([
2424
'./TimeSystem',
25-
'./LocalClock',
26-
'../../../../commonUI/formats/src/UTCTimeFormat'
25+
'./LocalClock'
2726
], function (TimeSystem, LocalClock, UTCTimeFormat) {
2827
var FIFTEEN_MINUTES = 15 * 60 * 1000,
2928
DEFAULT_PERIOD = 1000;
@@ -36,13 +35,20 @@ define([
3635
function UTCTimeSystem ($timeout) {
3736
TimeSystem.call(this);
3837

38+
/**
39+
* Some metadata, which will be used to identify the time system in
40+
* the UI
41+
* @type {{key: string, name: string, glyph: string}}
42+
*/
3943
this.metadata = {
4044
'key': 'utc',
4145
'name': 'UTC',
4246
'glyph': '\u0043'
4347
};
4448

45-
this._formats = [new UTCTimeFormat()];
49+
//Time formats are defined as extensions. Include the key
50+
// for the corresponding time format here
51+
this._formats = ['utc'];
4652
this._tickSources = [new LocalClock($timeout, DEFAULT_PERIOD)];
4753
}
4854

platform/features/conductor-v2/src/ui/TimeConductorController.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ define(
7272
TimeConductorController.prototype.initializeScope = function ($scope) {
7373
$scope.timeSystemModel = {
7474
selected: undefined,
75+
format: undefined,
7576
options: []
7677
};
7778
$scope.modeModel = {
@@ -155,13 +156,17 @@ define(
155156
}
156157
newMode.initialize();
157158

159+
var timeSystem = newMode.selectedTimeSystem();
160+
158161
this.$scope.modeModel.selected = newMode;
159162

160163
//Synchronize scope with time system on mode
161164
this.$scope.timeSystemModel.options = newMode.timeSystems().map(function (timeSystem) {
162165
return timeSystem.metadata;
163166
});
164-
this.$scope.timeSystemModel.selected = newMode.selectedTimeSystem();
167+
this.$scope.timeSystemModel.selected = timeSystem;
168+
//Use default format
169+
this.$scope.timeSystemModel.format = timeSystem.formats()[0];
165170
this.setDefaultsFromTimeSystem(newMode.selectedTimeSystem());
166171
}
167172
};

0 commit comments

Comments
 (0)