diff --git a/awx/ui/static/js/helpers/ConfigureTower.js b/awx/ui/static/js/helpers/ConfigureTower.js index e511eed4e2..4ea6af7608 100644 --- a/awx/ui/static/js/helpers/ConfigureTower.js +++ b/awx/ui/static/js/helpers/ConfigureTower.js @@ -221,66 +221,7 @@ angular.module('ConfigureTowerHelper', [ 'Utilities', 'RestServices', 'Schedules }; - scope.deleteSystemSchedule = function(id){ - var url, hdr,action; - Rest.setUrl(scheduleUrl+id+'/schedules/'); - Rest.get() - .success(function(data) { - //delete the schedule if one exists - if(data.count>0){ - if(!Empty(data.results[0].url)){ - url = data.results[0].url; - hdr = 'Delete Schedule'; - action = function () { - Wait('start'); - Rest.setUrl(url); - Rest.destroy() - .success(function () { - $('#prompt-modal').modal('hide'); - Wait('stop'); - scope.$emit(callback, id); - }) - .error(function (data, status) { - try { - $('#prompt-modal').modal('hide'); - } - catch(e) { - // ignore - } - ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + - ' failed. DELETE returned: ' + status }); - }); - }; - Prompt({ - hdr: hdr, - body: "
Are you sure you want to delete the " + data.results[0].name + " schedule?
", - action: action, - backdrop: false - }); - } - } else { - //a schedule doesn't exist - $("#prompt_action_btn").text('OK'); - $('#prompt_cancel_btn').hide(); - var action2 = function(){ - $('#prompt-modal').modal('hide'); - $("#prompt_action_btn").text('Yes'); - $('#prompt_cancel_btn').show(); - }; - Prompt({ - hdr: "Delete", - body: "
No schedule exists for that job.
", - action: action2, - backdrop: false - }); - } - }) - .error(function(data, status) { - ProcessErrors(scope, data, status, null, { hdr: 'Error!', - msg: 'Failed updating job ' + scope.job_template_id + ' with variables. PUT returned: ' + status }); - }); - }; parent_scope.refreshJobs = function(){ scope.search(SchedulesList.iterator); @@ -328,7 +269,7 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched container = $('#configure-schedules-form-container'); $("#configure-jobs").show(); $("#configure-schedules-form-container").hide(); - + scope.mode = mode; // Clean up any lingering stuff container.hide(); target.empty(); @@ -379,7 +320,6 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched scheduler.setRRule(schedule.rrule); scheduler.setName(schedule.name); scope.schedulerPurgeDays = (!Empty(scope.days)) ? Number(scope.days) : 30; - scope.id = id; }); } }; @@ -447,6 +387,60 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched } }; + scope.deleteSystemSchedule = function(){ + var hdr = 'Delete Schedule', + action = function () { + Wait('start'); + Rest.setUrl(schedule.url); + Rest.destroy() + .success(function () { + $('#prompt-modal').modal('hide'); + Wait('stop'); + // scope.$emit(callback, id); + scope.cancelScheduleForm(); + }) + .error(function (data, status) { + try { + $('#prompt-modal').modal('hide'); + } + catch(e) { + // ignore + } + ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + + ' failed. DELETE returned: ' + status }); + }); + }; + + Prompt({ + hdr: hdr, + body: "
Are you sure you want to delete the " + scope.schedulerName + " schedule?
", + action: action, + backdrop: false + }); + // } + // } else { + // //a schedule doesn't exist + // $("#prompt_action_btn").text('OK'); + // $('#prompt_cancel_btn').hide(); + // var action2 = function(){ + // $('#prompt-modal').modal('hide'); + // $("#prompt_action_btn").text('Yes'); + // $('#prompt_cancel_btn').show(); + // }; + // Prompt({ + // hdr: "Delete", + // body: "
No schedule exists for that job.
", + // action: action2, + // backdrop: false + // }); + // } + // }) + // .error(function(data, status) { + // ProcessErrors(scope, data, status, null, { hdr: 'Error!', + // msg: 'Failed updating job ' + scope.job_template_id + ' with variables. PUT returned: ' + status }); + // }); + }; + scope.cancelScheduleForm = function() { container.hide('slide', { direction: 'right' }, 500, restoreList); scope.$destroy(); diff --git a/awx/ui/static/js/lists/ConfigureTowerJobs.js b/awx/ui/static/js/lists/ConfigureTowerJobs.js index 51cebc9176..6ffae95f8c 100644 --- a/awx/ui/static/js/lists/ConfigureTowerJobs.js +++ b/awx/ui/static/js/lists/ConfigureTowerJobs.js @@ -41,16 +41,16 @@ angular.module('ConfigureTowerJobsListDefinition', []) schedule: { label: 'Schedule', mode: 'all', - ngClick: 'configureSchedule(configure_job.id)', // '#/job_templates/{{ configure_job.id }}/schedules', + ngClick: 'configureSchedule(configure_job.id, configure_job.name)', // '#/job_templates/{{ configure_job.id }}/schedules', awToolTip: 'Schedule future job template runs', dataPlacement: 'top', - }, - delete: { - label: 'Delete Schedule', - mode: 'all', - ngClick: 'deleteSystemSchedule(configure_job.id)', // '#/job_templates/{{ configure_job.id }}/schedules', - awToolTip: 'Delete the schedule ', - dataPlacement: 'top' } + // delete: { + // label: 'Delete Schedule', + // mode: 'all', + // ngClick: 'deleteSystemSchedule(configure_job.id)', // '#/job_templates/{{ configure_job.id }}/schedules', + // awToolTip: 'Delete the schedule ', + // dataPlacement: 'top' + // } } }); diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html index 840461d668..f39a2b8373 100644 --- a/awx/ui/templates/ui/index.html +++ b/awx/ui/templates/ui/index.html @@ -408,6 +408,7 @@
View Details Back to options +