From 1e44ea8f7fcc7e03b2bd7517f66bc71b8ff58c14 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Mon, 6 Jun 2016 14:47:41 -0700 Subject: [PATCH 1/4] 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']; From 8602b66c47fe0966dd791895135fe9dc4bb5478e Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Mon, 6 Jun 2016 15:27:09 -0700 Subject: [PATCH 2/4] adding delete/cancel for mgmt jobs stdout --- .../standard-out-management-jobs.partial.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.partial.html b/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.partial.html index 6e195c2485..748689a23b 100644 --- a/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.partial.html +++ b/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.partial.html @@ -1,10 +1,16 @@
-
+
- RESULTS +
+ RESULTS +
+
+ + +
From c5aee042ce9013bee6c8e9f7a3d768e3f4618879 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 8 Jun 2016 11:30:02 -0700 Subject: [PATCH 3/4] fixing cancel button nghide when job is running --- .../src/standard-out/adhoc/standard-out-adhoc.partial.html | 4 ++-- .../inventory-sync/standard-out-inventory-sync.partial.html | 4 ++-- .../management-jobs/standard-out-management-jobs.partial.html | 4 ++-- .../scm-update/standard-out-scm-update.partial.html | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) 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 9dd947c905..04c762e436 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 @@ -9,8 +9,8 @@
- - + +
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 66dbef6bc3..28d9f36181 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 @@ -9,8 +9,8 @@
- - + +
diff --git a/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.partial.html b/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.partial.html index 748689a23b..67507383bd 100644 --- a/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.partial.html +++ b/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.partial.html @@ -8,8 +8,8 @@ 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 9ffa89f0cb..258dacee3b 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 @@ -9,8 +9,8 @@
- - + +
From 945380c07aa02ba2c7e3b346882665e65749d17b Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 8 Jun 2016 14:37:16 -0700 Subject: [PATCH 4/4] Redirecting non-playbook-jobs to correct stdout pages --- .../launchjob.factory.js | 26 +++++++++++++++++-- .../management-jobs/card/card.controller.js | 12 ++++----- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js index 4fd209c9d1..b4d633874b 100644 --- a/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js +++ b/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js @@ -107,10 +107,32 @@ export default Rest.post(job_launch_data) .success(function(data) { Wait('stop'); - var job = data.job || data.system_job; + var job = data.job || data.system_job || data.project_update || data.inventory_update || data.ad_hoc_command, + key = Object.keys(data); if((scope.portalMode===false || scope.$parent.portalMode===false ) && Empty(data.system_job) || (base === 'home')){ // use $state.go with reload: true option to re-instantiate sockets in - $state.go('jobDetail', {id: job}, {reload: true}); + + var goToJobDetails = function(state) { + $state.go(state, {id: job}, {reload:true}); + }; + + switch(key[0]) { + case 'job': + goToJobDetails('jobDetail'); + break; + case 'ad_hoc_command': + goToJobDetails('adHocJobStdout'); + break; + case 'system_job': + goToJobDetails('managementJobStdout'); + break; + case 'project_update': + goToJobDetails('scmUpdateStdout'); + break; + case 'inventory_update': + goToJobDetails('inventorySyncStdout'); + break; + } } if(scope.clearDialog) { scope.clearDialog(); 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 5bc335514d..e497f0c1d3 100644 --- a/awx/ui/client/src/management-jobs/card/card.controller.js +++ b/awx/ui/client/src/management-jobs/card/card.controller.js @@ -7,11 +7,11 @@ // import listGenerator from 'tower/shared/list-generator/main'; export default - [ 'Wait', '$location' , '$compile', 'CreateDialog', 'GetBasePath' , + [ 'Wait', '$compile', 'CreateDialog', 'GetBasePath' , 'SearchInit' , 'PaginateInit', 'SchedulesList', 'Rest' , 'ProcessErrors', 'managementJobsListObject', '$rootScope', '$state', '$scope', 'CreateSelect2', - function( Wait, $location, $compile, CreateDialog, GetBasePath, + function( Wait, $compile, CreateDialog, GetBasePath, SearchInit, PaginateInit, SchedulesList, Rest, ProcessErrors, managementJobsListObject, $rootScope, $state, $scope, CreateSelect2) { @@ -129,11 +129,11 @@ export default Rest.setUrl(defaultUrl); Rest.post(data) - .success(function() { + .success(function(data) { Wait('stop'); $("#prompt-for-days-facts").dialog("close"); $("#configure-tower-dialog").dialog('close'); - $location.path('/jobs/'); + $state.go('managementJobStdout', {id: data.system_job}, {reload:true}); }) .error(function(data, status) { ProcessErrors(scope, data, status, null, { hdr: 'Error!', @@ -217,11 +217,11 @@ export default Rest.setUrl(defaultUrl); Rest.post(data) - .success(function() { + .success(function(data) { Wait('stop'); $("#prompt-for-days").dialog("close"); // $("#configure-tower-dialog").dialog('close'); - $location.path('/jobs/'); + $state.go('managementJobStdout', {id: data.system_job}, {reload:true}); }) .error(function(data, status) { ProcessErrors(scope, data, status, null, { hdr: 'Error!',