diff --git a/awx/ui/static/js/helpers/ConfigureTower.js b/awx/ui/static/js/helpers/ConfigureTower.js index e33281bbf1..a33edd309e 100644 --- a/awx/ui/static/js/helpers/ConfigureTower.js +++ b/awx/ui/static/js/helpers/ConfigureTower.js @@ -344,6 +344,40 @@ export default }; scope.configureSchedule = function(id, name) { + if (id === 4) { + scope.isFactCleanup = true; + scope.keep_unit_choices = [{ + "label" : "Days", + "value" : "d" + }, + { + "label": "Weeks", + "value" : "w" + }, + { + "label" : "Years", + "value" : "y" + }]; + scope.granularity_keep_unit_choices = [{ + "label" : "Days", + "value" : "d" + }, + { + "label": "Weeks", + "value" : "w" + }, + { + "label" : "Years", + "value" : "y" + }]; + scope.prompt_for_days_facts_form.keep_amount.$setViewValue(30); + scope.prompt_for_days_facts_form.granularity_keep_amount.$setViewValue(1); + scope.keep_unit = scope.keep_unit_choices[0]; + scope.granularity_keep_unit = scope.granularity_keep_unit_choices[1]; + } else { + scope.isFactCleanup = false; + } + Rest.setUrl(scheduleUrl+id+'/schedules/'); Rest.get() .success(function(data) { @@ -446,6 +480,32 @@ export default container.show('slide', { direction: 'right' }, 300); // scope.schedulerPurgeDays = (!Empty(scope.days)) ? Number(scope.days) : 30; target.show(); + scope.$watch('scheduler_form.keep_amount.$modelValue', function(newVal) { + if (!newVal && newVal !== 0) { + $('#configure-save-button').prop("disabled", true); + } else if (isNaN(newVal)) { + $('#configure-save-button').prop("disabled", true); + } else if (newVal < 0) { + $('#configure-save-button').prop("disabled", true); + } else if (newVal > 9999) { + $('#configure-save-button').prop("disabled", true); + } else { + $('#configure-save-button').prop("disabled", false); + } + }); + scope.$watch('scheduler_form.granularity_keep_amount.$modelValue', function(newVal2) { + if (!newVal2 && newVal2 !== 0) { + $('#configure-save-button').prop("disabled", true); + } else if (isNaN(newVal2)) { + $('#configure-save-button').prop("disabled", true); + } else if (newVal2 < 0) { + $('#configure-save-button').prop("disabled", true); + } else if (newVal2 > 9999) { + $('#configure-save-button').prop("disabled", true); + } else { + $('#configure-save-button').prop("disabled", false); + } + }); if(mode==="add"){ scope.$apply(function(){ scope.schedulerPurgeDays = 30; diff --git a/awx/ui/static/less/ansible-ui.less b/awx/ui/static/less/ansible-ui.less index 343645ba02..e2a7b6050f 100644 --- a/awx/ui/static/less/ansible-ui.less +++ b/awx/ui/static/less/ansible-ui.less @@ -2000,3 +2000,33 @@ tr td button i { .JobDetails-status { margin-bottom: 12px; } + +.red-text { + color: @red; +} + +.factDetailsNote { + margin-bottom: 10px; +} + +.inputSpacer { + margin-bottom: 25px; +} + +.cleanupStretcher { + margin: 0 -15px; +} + +.factDaysToKeepCompacter { + margin-bottom: 15px; +} + +.factDetailsHeader { + font-weight: bold; +} + +@media (max-width: 991px) { + .inputCompactMobile { + margin-bottom: 15px; + } +} diff --git a/awx/ui/static/lib/angular-scheduler/lib/angular-scheduler.html b/awx/ui/static/lib/angular-scheduler/lib/angular-scheduler.html index 78c4b7dec8..23917d90b6 100644 --- a/awx/ui/static/lib/angular-scheduler/lib/angular-scheduler.html +++ b/awx/ui/static/lib/angular-scheduler/lib/angular-scheduler.html @@ -22,11 +22,39 @@