mirror of
https://github.com/ansible/awx.git
synced 2026-04-11 21:19:22 -02:30
Merge pull request #7106 from gconsidine/ui/fix/scheduler-time-input
Fix scheduler time inputs by resetting invalid input to 00
This commit is contained in:
@@ -25,6 +25,31 @@ export default ['$filter', '$state', '$stateParams', 'AddSchedule', 'Wait',
|
|||||||
$scope.schedulerEndSecond = "00";
|
$scope.schedulerEndSecond = "00";
|
||||||
$scope.parentObject = ParentObject;
|
$scope.parentObject = ParentObject;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a workaround for the angular-scheduler library inserting `ll` into fields after an
|
||||||
|
* invalid entry and never unsetting them. Presumably null is being truncated down to 2 chars
|
||||||
|
* in that case.
|
||||||
|
*
|
||||||
|
* Because this same problem exists in the edit mode and because there's no inheritence, this
|
||||||
|
* block of code is duplicated in both add/edit controllers pending a much needed broader
|
||||||
|
* refactoring effort.
|
||||||
|
*/
|
||||||
|
$scope.timeChange = () => {
|
||||||
|
if (!Number($scope.schedulerStartHour)) {
|
||||||
|
$scope.schedulerStartHour = '00';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Number($scope.schedulerStartMinute)) {
|
||||||
|
$scope.schedulerStartMinute = '00';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Number($scope.schedulerStartSecond)) {
|
||||||
|
$scope.schedulerStartSecond = '00';
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.scheduleTimeChange();
|
||||||
|
};
|
||||||
|
|
||||||
$scope.$on("ScheduleFormCreated", function(e, scope) {
|
$scope.$on("ScheduleFormCreated", function(e, scope) {
|
||||||
$scope.hideForm = false;
|
$scope.hideForm = false;
|
||||||
$scope = angular.extend($scope, scope);
|
$scope = angular.extend($scope, scope);
|
||||||
|
|||||||
@@ -16,6 +16,30 @@ function($filter, $state, $stateParams, EditSchedule, Wait, $scope, $rootScope,
|
|||||||
$scope.schedulerEndSecond = "00";
|
$scope.schedulerEndSecond = "00";
|
||||||
$scope.parentObject = ParentObject;
|
$scope.parentObject = ParentObject;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a workaround for the angular-scheduler library inserting `ll` into fields after an
|
||||||
|
* invalid entry and never unsetting them. Presumably null is being truncated down to 2 chars
|
||||||
|
* in that case.
|
||||||
|
*
|
||||||
|
* Because this same problem exists in the edit mode and because there's no inheritence, this
|
||||||
|
* block of code is duplicated in both add/edit controllers pending a much needed broader
|
||||||
|
* refactoring effort.
|
||||||
|
*/
|
||||||
|
$scope.timeChange = () => {
|
||||||
|
if (!Number($scope.schedulerStartHour)) {
|
||||||
|
$scope.schedulerStartHour = '00';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Number($scope.schedulerStartMinute)) {
|
||||||
|
$scope.schedulerStartMinute = '00';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Number($scope.schedulerStartSecond)) {
|
||||||
|
$scope.schedulerStartSecond = '00';
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.scheduleTimeChange();
|
||||||
|
};
|
||||||
|
|
||||||
$scope.$on("ScheduleFormCreated", function(e, scope) {
|
$scope.$on("ScheduleFormCreated", function(e, scope) {
|
||||||
$scope.hideForm = false;
|
$scope.hideForm = false;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
placeholder="HH24"
|
placeholder="HH24"
|
||||||
aw-min="0" min="0" aw-max="23"
|
aw-min="0" min="0" aw-max="23"
|
||||||
max="23" data-zero-pad="2" required
|
max="23" data-zero-pad="2" required
|
||||||
ng-change="scheduleTimeChange()" >
|
ng-change="timeChange()" >
|
||||||
<span
|
<span
|
||||||
class="SchedulerTime-separator">
|
class="SchedulerTime-separator">
|
||||||
:
|
:
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
placeholder="MM"
|
placeholder="MM"
|
||||||
min="0" max="59" data-zero-pad="2"
|
min="0" max="59" data-zero-pad="2"
|
||||||
required
|
required
|
||||||
ng-change="scheduleTimeChange()" >
|
ng-change="timeChange()" >
|
||||||
<span
|
<span
|
||||||
class="SchedulerTime-separator">
|
class="SchedulerTime-separator">
|
||||||
:
|
:
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
placeholder="SS"
|
placeholder="SS"
|
||||||
min="0" max="59" data-zero-pad="2"
|
min="0" max="59" data-zero-pad="2"
|
||||||
required
|
required
|
||||||
ng-change="scheduleTimeChange()" >
|
ng-change="timeChange()" >
|
||||||
</div>
|
</div>
|
||||||
<div class="error"
|
<div class="error"
|
||||||
ng-show="scheduler_startTime_error">
|
ng-show="scheduler_startTime_error">
|
||||||
|
|||||||
Reference in New Issue
Block a user