Skip to content

Commit

Permalink
Populate format in input fields
Browse files Browse the repository at this point in the history
  • Loading branch information
akhenry committed Jul 19, 2016
1 parent 334ca64 commit 15a608a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<span class="l-time-range-input-w start-date">
<mct-control key="'datetime-field'"
structure="{
format: 'utc',
format: timeSystemModel.format,
validate: tcController.validation.validateStart
}"
ng-model="formModel"
Expand Down Expand Up @@ -59,7 +59,7 @@
ng-controller="ToggleController as t2">
<mct-control key="'datetime-field'"
structure="{
format: 'utc',
format: timeSystemModel.format,
validate: tcController.validation.validateEnd
}"
ng-model="formModel"
Expand Down
12 changes: 9 additions & 3 deletions platform/features/conductor-v2/src/timeSystems/UTCTimeSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

define([
'./TimeSystem',
'./LocalClock',
'../../../../commonUI/formats/src/UTCTimeFormat'
'./LocalClock'
], function (TimeSystem, LocalClock, UTCTimeFormat) {
var FIFTEEN_MINUTES = 15 * 60 * 1000,
DEFAULT_PERIOD = 1000;
Expand All @@ -36,13 +35,20 @@ define([
function UTCTimeSystem ($timeout) {
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 = {
'key': 'utc',
'name': 'UTC',
'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)];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ define(
TimeConductorController.prototype.initializeScope = function ($scope) {
$scope.timeSystemModel = {
selected: undefined,
format: undefined,
options: []
};
$scope.modeModel = {
Expand Down Expand Up @@ -155,13 +156,17 @@ define(
}
newMode.initialize();

var timeSystem = newMode.selectedTimeSystem();

this.$scope.modeModel.selected = newMode;

//Synchronize scope with time system on mode
this.$scope.timeSystemModel.options = newMode.timeSystems().map(function (timeSystem) {
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());
}
};
Expand Down

0 comments on commit 15a608a

Please sign in to comment.