From 0c10581ecddbe8a4ca3388706e6aeb7253fc71c8 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Sun, 30 Nov 2014 21:34:26 -0500 Subject: [PATCH] Clean up jobs Made the prompt for days field required when submitting a cleanup job. --- awx/ui/static/js/helpers/ConfigureTower.js | 19 ++++++++++++------- awx/ui/templates/ui/index.html | 6 ++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/awx/ui/static/js/helpers/ConfigureTower.js b/awx/ui/static/js/helpers/ConfigureTower.js index b6309f1509..cd240f951d 100644 --- a/awx/ui/static/js/helpers/ConfigureTower.js +++ b/awx/ui/static/js/helpers/ConfigureTower.js @@ -16,9 +16,9 @@ angular.module('ConfigureTowerHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', 'ListGenerator', 'ModalDialog', 'GeneratorHelpers']) - .factory('ConfigureTower', ['Wait', '$location' , 'CreateDialog', 'ConfigureTowerJobsList', 'GenerateList', 'GetBasePath' , 'SearchInit' , 'PaginateInit', 'PlaybookRun', 'LoadSchedulesScope', + .factory('ConfigureTower', ['Wait', '$location' , '$compile', 'CreateDialog', 'ConfigureTowerJobsList', 'GenerateList', 'GetBasePath' , 'SearchInit' , 'PaginateInit', 'PlaybookRun', 'LoadSchedulesScope', 'SchedulesList', 'SchedulesControllerInit' , 'ConfigureTowerSchedule', 'Rest' , 'ProcessErrors', - function(Wait, $location, CreateDialog, ConfigureTowerJobsList, GenerateList, GetBasePath, SearchInit, PaginateInit, PlaybookRun, LoadSchedulesScope, + function(Wait, $location, $compile, CreateDialog, ConfigureTowerJobsList, GenerateList, GetBasePath, SearchInit, PaginateInit, PlaybookRun, LoadSchedulesScope, SchedulesList, SchedulesControllerInit, ConfigureTowerSchedule, Rest, ProcessErrors) { return function(params) { // Set modal dimensions based on viewport width @@ -28,7 +28,7 @@ angular.module('ConfigureTowerHelper', [ 'Utilities', 'RestServices', 'Schedules callback = 'OpenConfig', defaultUrl = GetBasePath('system_job_templates'), list = ConfigureTowerJobsList, - view = GenerateList, + view = GenerateList, e, scheduleUrl = GetBasePath('system_job_templates'), buttons = [ { @@ -147,7 +147,12 @@ angular.module('ConfigureTowerHelper', [ 'Utilities', 'RestServices', 'Schedules minWidth: 200, callback: 'PromptForDays', onOpen: function(){ - $("#days_to_keep").val(30); + e = angular.element(document.getElementById('prompt_for_days_form')); + scope.prompt_for_days_form.days_to_keep.$setViewValue(30); + $compile(e)(scope); + $('#prompt-for-days-launch').attr("ng-disabled", 'prompt_for_days_form.$invalid'); + e = angular.element(document.getElementById('prompt-for-days-launch')); + $compile(e)(scope); }, buttons: [{ "label": "Cancel", @@ -157,11 +162,11 @@ angular.module('ConfigureTowerHelper', [ 'Utilities', 'RestServices', 'Schedules }, "icon": "fa-times", "class": "btn btn-default", - "id": "prompt-for-days-button" + "id": "prompt-for-days-cancel" },{ "label": "Launch", "onClick": function() { - var extra_vars = {"days": $("#days_to_keep").val() }, + var extra_vars = {"days": scope.days_to_keep }, data = {}; data.extra_vars = JSON.stringify(extra_vars); @@ -180,7 +185,7 @@ angular.module('ConfigureTowerHelper', [ 'Utilities', 'RestServices', 'Schedules }, "icon": "fa-rocket", "class": "btn btn-primary", - "id": "prompt-for-days-button" + "id": "prompt-for-days-launch" }] }); diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html index 1f8604ffdb..0a71c38d9d 100644 --- a/awx/ui/templates/ui/index.html +++ b/awx/ui/templates/ui/index.html @@ -425,8 +425,10 @@