From b3dbc59df6aa05d4d66978c4bdf68edc6caff4c0 Mon Sep 17 00:00:00 2001 From: jaredevantabor Date: Thu, 10 Nov 2016 11:34:06 -0500 Subject: [PATCH] Fixing jobs list page: adding launch & cancel buttons and making sure that you can launch jobs from the jobs list, and that sockets work with the jobs list for live updates --- awx/ui/client/src/controllers/Jobs.js | 16 +++------------- awx/ui/client/src/lists/AllJobs.js | 8 ++++---- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/awx/ui/client/src/controllers/Jobs.js b/awx/ui/client/src/controllers/Jobs.js index 54187896df..a01b225bb1 100644 --- a/awx/ui/client/src/controllers/Jobs.js +++ b/awx/ui/client/src/controllers/Jobs.js @@ -48,7 +48,7 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $ //ignore } - job = Find({ list: list, key: 'id', val: id }); + job = Find({ list: $scope.jobs, key: 'id', val: id }); if (job.type === 'inventory_update') { typeId = job.inventory_source; } else if (job.type === 'project_update') { @@ -88,21 +88,11 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $ }; - $scope.refreshJobs = function() { - $state.reload(); - }; - - if ($rootScope.removeJobStatusChange) { - $rootScope.removeJobStatusChange(); - } - $rootScope.removeJobStatusChange = $rootScope.$on('JobStatusChange-jobs', function() { + $scope.$on('ws-jobs', function(){ $scope.refreshJobs(); }); - if ($rootScope.removeScheduleStatusChange) { - $rootScope.removeScheduleStatusChange(); - } - $rootScope.removeScheduleStatusChange = $rootScope.$on('ScheduleStatusChange', function() { + $scope.$on('ws-schedules', function(){ $state.reload(); }); } diff --git a/awx/ui/client/src/lists/AllJobs.js b/awx/ui/client/src/lists/AllJobs.js index 0ee8cfcfae..437e605f18 100644 --- a/awx/ui/client/src/lists/AllJobs.js +++ b/awx/ui/client/src/lists/AllJobs.js @@ -75,7 +75,7 @@ export default columnClass: 'col-lg-2 col-md-2 col-sm-3 col-xs-4', "view": { mode: "all", - ngClick: "viewJob(all_job.id)", + ngClick: "viewJob(job.id)", awToolTip: "View the job", dataPlacement: "top" }, @@ -85,21 +85,21 @@ export default ngClick: 'relaunchJob($event, job.id)', awToolTip: 'Relaunch using the same parameters', dataPlacement: 'top', - ngShow: "!(all_job.type == 'system_job') && all_job.summary_fields.user_capabilities.start" + ngShow: "!(job.type == 'system_job') && job.summary_fields.user_capabilities.start" }, cancel: { mode: 'all', ngClick: 'deleteJob(job.id)', awToolTip: 'Cancel the job', dataPlacement: 'top', - ngShow: "(all_job.status === 'running'|| all_job.status === 'waiting' || all_job.status === 'pending') && all_job.summary_fields.user_capabilities.start" + ngShow: "(job.status === 'running'|| job.status === 'waiting' || job.status === 'pending') && job.summary_fields.user_capabilities.start" }, "delete": { mode: 'all', ngClick: 'deleteJob(job.id)', awToolTip: 'Delete the job', dataPlacement: 'top', - ngShow: "(all_job.status !== 'running' && all_job.status !== 'waiting' && all_job.status !== 'pending') && all_job.summary_fields.user_capabilities.delete" + ngShow: "(job.status !== 'running' && job.status !== 'waiting' && job.status !== 'pending') && job.summary_fields.user_capabilities.delete" } } });