From 1e44ea8f7fcc7e03b2bd7517f66bc71b8ff58c14 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Mon, 6 Jun 2016 14:47:41 -0700 Subject: [PATCH] Adding Relaunch and cancel/delete buttons to the stdout page for SCM update, inv-sync, and adhoc --- awx/ui/client/src/lists/AllJobs.js | 2 +- .../adhoc/standard-out-adhoc.partial.html | 9 +++- .../standard-out-inventory-sync.partial.html | 9 +++- .../standard-out-scm-update.partial.html | 9 +++- .../standard-out/standard-out.controller.js | 45 +++++++++++++++++-- 5 files changed, 67 insertions(+), 7 deletions(-) diff --git a/awx/ui/client/src/lists/AllJobs.js b/awx/ui/client/src/lists/AllJobs.js index eb6556e9c0..1f05eaea8b 100644 --- a/awx/ui/client/src/lists/AllJobs.js +++ b/awx/ui/client/src/lists/AllJobs.js @@ -107,7 +107,7 @@ export default ngClick: 'deleteJob(all_job.id)', awToolTip: 'Cancel the job', dataPlacement: 'top', - ngShow: "all_job.status === 'running'|| all_job.status == 'waiting' || all_job.status == 'pending'" + ngShow: "all_job.status === 'running'|| all_job.status === 'waiting' || all_job.status === 'pending'" }, "delete": { mode: 'all', diff --git a/awx/ui/client/src/standard-out/adhoc/standard-out-adhoc.partial.html b/awx/ui/client/src/standard-out/adhoc/standard-out-adhoc.partial.html index ad7bd4d139..9dd947c905 100644 --- a/awx/ui/client/src/standard-out/adhoc/standard-out-adhoc.partial.html +++ b/awx/ui/client/src/standard-out/adhoc/standard-out-adhoc.partial.html @@ -4,7 +4,14 @@
- RESULTS +
+ RESULTS +
+
+ + + +
diff --git a/awx/ui/client/src/standard-out/inventory-sync/standard-out-inventory-sync.partial.html b/awx/ui/client/src/standard-out/inventory-sync/standard-out-inventory-sync.partial.html index a5bff088ec..66dbef6bc3 100644 --- a/awx/ui/client/src/standard-out/inventory-sync/standard-out-inventory-sync.partial.html +++ b/awx/ui/client/src/standard-out/inventory-sync/standard-out-inventory-sync.partial.html @@ -4,7 +4,14 @@
- RESULTS +
+ RESULTS +
+
+ + + +
diff --git a/awx/ui/client/src/standard-out/scm-update/standard-out-scm-update.partial.html b/awx/ui/client/src/standard-out/scm-update/standard-out-scm-update.partial.html index 683d3fee9c..9ffa89f0cb 100644 --- a/awx/ui/client/src/standard-out/scm-update/standard-out-scm-update.partial.html +++ b/awx/ui/client/src/standard-out/scm-update/standard-out-scm-update.partial.html @@ -4,7 +4,14 @@
- RESULTS +
+ RESULTS +
+
+ + + +
diff --git a/awx/ui/client/src/standard-out/standard-out.controller.js b/awx/ui/client/src/standard-out/standard-out.controller.js index df0dcdd4ca..6320339068 100644 --- a/awx/ui/client/src/standard-out/standard-out.controller.js +++ b/awx/ui/client/src/standard-out/standard-out.controller.js @@ -10,8 +10,9 @@ * @description This controller's for the standard out page that can be displayed when a job runs */ - -export function JobStdoutController ($rootScope, $scope, $state, $stateParams, ClearScope, GetBasePath, Rest, ProcessErrors, Empty, GetChoices, LookUpName, ParseTypeChange, ParseVariableString) { +export function JobStdoutController ($rootScope, $scope, $state, $stateParams, + ClearScope, GetBasePath, Rest, ProcessErrors, Empty, GetChoices, LookUpName, + ParseTypeChange, ParseVariableString, RelaunchJob, DeleteJob, Wait) { ClearScope(); @@ -164,6 +165,17 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams, C } + if ($scope.removeDeleteFinished) { + $scope.removeDeleteFinished(); + } + $scope.removeDeleteFinished = $scope.$on('DeleteFinished', function(e, action) { + Wait('stop'); + if (action !== 'cancel') { + Wait('stop'); + $state.go('jobs'); + } + }); + // TODO: this is currently not used but is necessary for cases where sockets // are not available and a manual refresh trigger is needed. $scope.refresh = function(){ @@ -175,8 +187,35 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams, C $scope.stdoutFullScreen = !$scope.stdoutFullScreen; }; + $scope.deleteJob = function() { + DeleteJob({ + scope: $scope, + id: $scope.job.id, + job: $scope.job, + callback: 'DeleteFinished' + }); + }; + + $scope.relaunchJob = function() { + var typeId, job = $scope.job; + if (job.type === 'inventory_update') { + typeId = job.inventory_source; + } + else if (job.type === 'project_update') { + typeId = job.project; + } + else if (job.type === 'job' || job.type === "system_job" || job.type === 'ad_hoc_command') { + typeId = job.id; + } + RelaunchJob({ scope: $scope, id: typeId, type: job.type, name: job.name }); + }; + + getJobDetails(); } -JobStdoutController.$inject = [ '$rootScope', '$scope', '$state', '$stateParams', 'ClearScope', 'GetBasePath', 'Rest', 'ProcessErrors', 'Empty', 'GetChoices', 'LookUpName', 'ParseTypeChange', 'ParseVariableString']; +JobStdoutController.$inject = [ '$rootScope', '$scope', '$state', + '$stateParams', 'ClearScope', 'GetBasePath', 'Rest', 'ProcessErrors', + 'Empty', 'GetChoices', 'LookUpName', 'ParseTypeChange', + 'ParseVariableString', 'RelaunchJob', 'DeleteJob', 'Wait'];