diff --git a/awx/ui/client/src/management-jobs/card/card.controller.js b/awx/ui/client/src/management-jobs/card/card.controller.js index e2c1b1a844..846b95a6ff 100644 --- a/awx/ui/client/src/management-jobs/card/card.controller.js +++ b/awx/ui/client/src/management-jobs/card/card.controller.js @@ -38,121 +38,6 @@ export default $scope.cardAction = "notifications"; } - $scope.submitCleanupJob = function(id, name){ - defaultUrl = GetBasePath('system_job_templates')+id+'/launch/'; - CreateDialog({ - id: 'prompt-for-days-facts', - title: name, - scope: $scope, - width: 500, - height: 470, - minWidth: 200, - callback: 'PromptForDaysFacts', - resizable: false, - onOpen: function(){ - $scope.$watch('prompt_for_days_facts_form.$invalid', function(invalid) { - if (invalid === true) { - $('#prompt-for-days-facts-launch').prop("disabled", true); - } else { - $('#prompt-for-days-facts-launch').prop("disabled", false); - } - }); - - var fieldScope = $scope.$parent; - - // set these form elements up on the $scope where the form - // is the parent of the current $scope - - fieldScope.keep_unit_choices = [{ - "label" : "Days", - "value" : "d" - }, - { - "label": "Weeks", - "value" : "w" - }, - { - "label" : "Years", - "value" : "y" - }]; - fieldScope.granularity_keep_unit_choices = [{ - "label" : "Days", - "value" : "d" - }, - { - "label": "Weeks", - "value" : "w" - }, - { - "label" : "Years", - "value" : "y" - }]; - $scope.prompt_for_days_facts_form.$setPristine(); - $scope.prompt_for_days_facts_form.$invalid = false; - fieldScope.keep_unit = fieldScope.keep_unit_choices[0]; - fieldScope.granularity_keep_unit = fieldScope.granularity_keep_unit_choices[1]; - fieldScope.keep_amount = 30; - fieldScope.granularity_keep_amount = 1; - }, - buttons: [ - { - "label": "Cancel", - "onClick": function() { - $(this).dialog('close'); - }, - "class": "btn btn-default", - "id": "prompt-for-days-facts-cancel" - }, - { - "label": "Launch", - "onClick": function() { - var extra_vars = { - "older_than": $scope.keep_amount+$scope.keep_unit.value, - "granularity": $scope.granularity_keep_amount+$scope.granularity_keep_unit.value - }, - data = {}; - data.extra_vars = JSON.stringify(extra_vars); - - Rest.setUrl(defaultUrl); - Rest.post(data) - .then(({data}) => { - Wait('stop'); - $("#prompt-for-days-facts").dialog("close"); - $("#configure-dialog").dialog('close'); - $state.go('jobz', { id: data.system_job, type: 'system' }, { reload: true }); - }) - .catch(({data, status}) => { - let template_id = $scope.job_template_id; - template_id = (template_id === undefined) ? "undefined" : i18n.sprintf("%d", template_id); - ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'), - msg: i18n.sprintf(i18n._('Failed updating job %s with variables. POST returned: %d'), template_id, status) }); - }); - }, - "class": "btn btn-primary", - "id": "prompt-for-days-facts-launch", - } - ] - }); - - if ($scope.removePromptForDays) { - $scope.removePromptForDays(); - } - $scope.removePromptForDays = $scope.$on('PromptForDaysFacts', function() { - // $('#configure-dialog').dialog('close'); - $('#prompt-for-days-facts').show(); - $('#prompt-for-days-facts').dialog('open'); - CreateSelect2({ - element: '#keep_unit', - multiple: false - }); - CreateSelect2({ - element: '#granularity_keep_unit', - multiple: false - }); - Wait('stop'); - }); - }; - $scope.goToNotifications = function(card){ $state.transitionTo('managementJobsList.notifications',{ card: card, @@ -235,15 +120,6 @@ export default }); }; - $scope.chooseRunJob = function(id, name) { - if(this.card.job_type === "cleanup_facts") { - // Run only for 'Cleanup Fact Details' - $scope.submitCleanupJob(id, name); - } else { - $scope.submitJob(id, name); - } - }; - $scope.configureSchedule = function(id) { $state.transitionTo('managementJobsList.schedule', { id: id diff --git a/awx/ui/client/src/management-jobs/card/card.partial.html b/awx/ui/client/src/management-jobs/card/card.partial.html index 66aa4befbe..008786dc7f 100644 --- a/awx/ui/client/src/management-jobs/card/card.partial.html +++ b/awx/ui/client/src/management-jobs/card/card.partial.html @@ -18,7 +18,7 @@