mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 22:28:13 +00:00
[Time Conductor] Wire in datetime pickers
WTD-1515
This commit is contained in:
@ -22,12 +22,9 @@
|
|||||||
|
|
||||||
<div class="l-time-controller" ng-controller="TimeRangeController">
|
<div class="l-time-controller" ng-controller="TimeRangeController">
|
||||||
<div class="l-time-range-inputs-holder">
|
<div class="l-time-range-inputs-holder">
|
||||||
Start: {{ngModel.outer.start}}
|
Start: {{startOuterText}}
|
||||||
|
|
||||||
<span ng-controller="ToggleController as t">
|
<span ng-controller="ToggleController as t">
|
||||||
<a class="ui-symbol" ng-click="t.toggle()">
|
<a class="ui-symbol" ng-click="t.toggle()">p</a>
|
||||||
p
|
|
||||||
</a>
|
|
||||||
<mct-popup ng-if="t.isActive()">
|
<mct-popup ng-if="t.isActive()">
|
||||||
<div style="background: #555;"
|
<div style="background: #555;"
|
||||||
mct-click-elsewhere="t.setState(false)">
|
mct-click-elsewhere="t.setState(false)">
|
||||||
@ -39,7 +36,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</mct-popup>
|
</mct-popup>
|
||||||
</span>
|
</span>
|
||||||
End: <input type="date" ng-model="endOuterDate"/>
|
|
||||||
|
End: {{endOuterText}}
|
||||||
|
<span ng-controller="ToggleController as t2">
|
||||||
|
<a class="ui-symbol" ng-click="t2.toggle()">p</a>
|
||||||
|
<mct-popup ng-if="t2.isActive()">
|
||||||
|
<div style="background: #555;"
|
||||||
|
mct-click-elsewhere="t2.setState(false)">
|
||||||
|
<mct-control key="'datetime-picker'"
|
||||||
|
ng-model="ngModel.outer"
|
||||||
|
field="'end'"
|
||||||
|
options="{ hours: true }">
|
||||||
|
</mct-control>
|
||||||
|
</div>
|
||||||
|
</mct-popup>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -172,29 +172,31 @@ define(
|
|||||||
updateViewFromModel($scope.ngModel);
|
updateViewFromModel($scope.ngModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateOuterStart(date) {
|
function updateOuterStart(t) {
|
||||||
var ngModel = $scope.ngModel;
|
var ngModel = $scope.ngModel;
|
||||||
ngModel.outer.start =
|
|
||||||
date.getTime();
|
|
||||||
ngModel.outer.end =
|
ngModel.outer.end =
|
||||||
Math.max(ngModel.outer.start, ngModel.outer.end);
|
Math.max(ngModel.outer.start, ngModel.outer.end);
|
||||||
ngModel.inner.start =
|
ngModel.inner.start =
|
||||||
Math.max(ngModel.outer.start, ngModel.inner.start);
|
Math.max(ngModel.outer.start, ngModel.inner.start);
|
||||||
ngModel.inner.end =
|
ngModel.inner.end =
|
||||||
Math.max(ngModel.outer.start, ngModel.inner.end);
|
Math.max(ngModel.outer.start, ngModel.inner.end);
|
||||||
|
|
||||||
|
$scope.startOuterText = formatTimestamp(t);
|
||||||
|
|
||||||
updateViewForInnerSpanFromModel(ngModel);
|
updateViewForInnerSpanFromModel(ngModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateOuterEnd(date) {
|
function updateOuterEnd(t) {
|
||||||
var ngModel = $scope.ngModel;
|
var ngModel = $scope.ngModel;
|
||||||
ngModel.outer.end =
|
|
||||||
date.getTime();
|
|
||||||
ngModel.outer.start =
|
ngModel.outer.start =
|
||||||
Math.min(ngModel.outer.end, ngModel.outer.start);
|
Math.min(ngModel.outer.end, ngModel.outer.start);
|
||||||
ngModel.inner.start =
|
ngModel.inner.start =
|
||||||
Math.min(ngModel.outer.end, ngModel.inner.start);
|
Math.min(ngModel.outer.end, ngModel.inner.start);
|
||||||
ngModel.inner.end =
|
ngModel.inner.end =
|
||||||
Math.min(ngModel.outer.end, ngModel.inner.end);
|
Math.min(ngModel.outer.end, ngModel.inner.end);
|
||||||
|
|
||||||
|
$scope.endOuterText = formatTimestamp(t);
|
||||||
|
|
||||||
updateViewForInnerSpanFromModel(ngModel);
|
updateViewForInnerSpanFromModel(ngModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,8 +215,8 @@ define(
|
|||||||
|
|
||||||
$scope.$watchCollection("ngModel", updateViewFromModel);
|
$scope.$watchCollection("ngModel", updateViewFromModel);
|
||||||
$scope.$watch("spanWidth", updateSpanWidth);
|
$scope.$watch("spanWidth", updateSpanWidth);
|
||||||
$scope.$watch("startOuterDate", updateOuterStart);
|
$scope.$watch("ngModel.outer.start", updateOuterStart);
|
||||||
$scope.$watch("endOuterDate", updateOuterEnd);
|
$scope.$watch("ngModel.outer.end", updateOuterEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TimeConductorController;
|
return TimeConductorController;
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
define(
|
define(
|
||||||
function () {
|
function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var TEMPLATE = "<div></div>";
|
var TEMPLATE = "<div></div>";
|
||||||
|
|
||||||
function MCTPopup($window, $document, $compile) {
|
function MCTPopup($window, $document, $compile) {
|
||||||
@ -60,7 +62,7 @@ define(
|
|||||||
transclude: true,
|
transclude: true,
|
||||||
link: link,
|
link: link,
|
||||||
scope: {}
|
scope: {}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return MCTPopup;
|
return MCTPopup;
|
||||||
|
Reference in New Issue
Block a user