mirror of
https://github.com/nasa/openmct.git
synced 2025-04-27 14:29:59 +00:00
Revert "[Time Conductor] Validate numeric date-time fields"
This reverts commit 07c407edea24825b15001ecad96026ecdf6d53ad.
This commit is contained in:
parent
99556ed6a5
commit
e6d0537e5e
@ -24,7 +24,7 @@
|
|||||||
<input type="text"
|
<input type="text"
|
||||||
ng-model="textValue"
|
ng-model="textValue"
|
||||||
ng-blur="restoreTextValue(); ngBlur()"
|
ng-blur="restoreTextValue(); ngBlur()"
|
||||||
ng-class="{ error: textInvalid, test: valueInvalid }">
|
ng-class="{ error: textInvalid }">
|
||||||
</input>
|
</input>
|
||||||
<a class="ui-symbol icon icon-calendar"
|
<a class="ui-symbol icon icon-calendar"
|
||||||
ng-if="structure.format === 'utc' || !structure.format"
|
ng-if="structure.format === 'utc' || !structure.format"
|
||||||
|
@ -26,10 +26,6 @@ define(
|
|||||||
function () {
|
function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function ACCEPT() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller to support the date-time entry field.
|
* Controller to support the date-time entry field.
|
||||||
*
|
*
|
||||||
@ -48,8 +44,7 @@ define(
|
|||||||
* format has been otherwise specified
|
* format has been otherwise specified
|
||||||
*/
|
*/
|
||||||
function DateTimeFieldController($scope, formatService, defaultFormat) {
|
function DateTimeFieldController($scope, formatService, defaultFormat) {
|
||||||
var formatter = formatService.getFormat(defaultFormat),
|
var formatter = formatService.getFormat(defaultFormat);
|
||||||
validate = ACCEPT;
|
|
||||||
|
|
||||||
function updateFromModel(value) {
|
function updateFromModel(value) {
|
||||||
// Only reformat if the value is different from user
|
// Only reformat if the value is different from user
|
||||||
@ -64,12 +59,10 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateFromView(textValue) {
|
function updateFromView(textValue) {
|
||||||
var newValue;
|
|
||||||
$scope.textInvalid = !formatter.validate(textValue);
|
$scope.textInvalid = !formatter.validate(textValue);
|
||||||
if (!$scope.textInvalid) {
|
if (!$scope.textInvalid) {
|
||||||
newValue = formatter.parse(textValue);
|
$scope.ngModel[$scope.field] =
|
||||||
$scope.valueInvalid = !validate(newValue);
|
formatter.parse(textValue);
|
||||||
$scope.ngModel[$scope.field] = newValue;
|
|
||||||
$scope.lastValidValue = $scope.textValue;
|
$scope.lastValidValue = $scope.textValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,10 +82,6 @@ define(
|
|||||||
updateFromModel($scope.ngModel[$scope.field]);
|
updateFromModel($scope.ngModel[$scope.field]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setValidator(newValidator) {
|
|
||||||
validate = newValidator || ACCEPT;
|
|
||||||
}
|
|
||||||
|
|
||||||
function restoreTextValue() {
|
function restoreTextValue() {
|
||||||
$scope.textValue = $scope.lastValidValue;
|
$scope.textValue = $scope.lastValidValue;
|
||||||
updateFromView($scope.textValue);
|
updateFromView($scope.textValue);
|
||||||
@ -106,7 +95,7 @@ define(
|
|||||||
$scope.$watch('ngModel[field]', updateFromModel);
|
$scope.$watch('ngModel[field]', updateFromModel);
|
||||||
$scope.$watch('pickerModel.value', updateFromPicker);
|
$scope.$watch('pickerModel.value', updateFromPicker);
|
||||||
$scope.$watch('textValue', updateFromView);
|
$scope.$watch('textValue', updateFromView);
|
||||||
$scope.$watch('structure.validate', setValidator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return DateTimeFieldController;
|
return DateTimeFieldController;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user