From b7488b7043b73412bcec089a2d0cca1a1cbce239 Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Tue, 17 Sep 2013 12:05:25 -0400 Subject: [PATCH] AC-463 Latest changes automating refresh button on Projects and Jobs tab. Cleaned up Cancel/Delete buttons on Jobs tab. --- awx/ui/static/js/app.js | 4 ++++ awx/ui/static/js/controllers/Jobs.js | 6 ++++-- awx/ui/static/js/lists/Jobs.js | 11 ++++++----- awx/ui/static/less/ansible-ui.less | 6 +++++- awx/ui/static/lib/ansible/form-generator.js | 5 +++++ awx/ui/static/lib/ansible/list-generator.js | 7 ++++--- 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 126cf06d35..72ab526156 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -258,6 +258,10 @@ angular.module('ansible', [ CheckLicense(); } + if ($rootScope.timer) { + clearInterval($rootScope.timer); + } + // Make the correct tab active var base = $location.path().replace(/^\//,'').split('/')[0]; if (base == '') { diff --git a/awx/ui/static/js/controllers/Jobs.js b/awx/ui/static/js/controllers/Jobs.js index 1b58a829dc..e8d17b4fe2 100644 --- a/awx/ui/static/js/controllers/Jobs.js +++ b/awx/ui/static/js/controllers/Jobs.js @@ -70,10 +70,12 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest, LoadBreadCrumbs(); - scope.refreshJob = function() { + scope.refresh = function() { scope.search(list.iterator); } + scope.refreshJob = scope.refresh; + scope.editJob = function(id, name) { LoadBreadCrumbs({ path: '/jobs/' + id, title: id + ' - ' + name }); $location.path($location.path() + '/' + id); @@ -94,7 +96,7 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest, Rest.get() .success( function(data, status, headers, config) { var url, action_label, restcall, hdr; - if (data.status == 'pending' || data.status == 'running') { + if (data.status == 'pending' || data.status == 'running' || data.status == 'waiting') { url = data.related.cancel; action_label = 'cancel'; hdr = 'Cancel Job'; diff --git a/awx/ui/static/js/lists/Jobs.js b/awx/ui/static/js/lists/Jobs.js index eb6138d5d4..faeb38c979 100644 --- a/awx/ui/static/js/lists/Jobs.js +++ b/awx/ui/static/js/lists/Jobs.js @@ -47,7 +47,8 @@ angular.module('JobsListDefinition', []) "class": 'job-\{\{ job.status \}\}', searchType: 'select', searchOptions: [ - { name: "new", value: "new" }, + { name: "new", value: "new" }, + { name: "waiting", value: "waiting" }, { name: "pending", value: "pending" }, { name: "running", value: "running" }, { name: "successful", value: "successful" }, @@ -117,18 +118,18 @@ angular.module('JobsListDefinition', []) icon: 'icon-minus-sign', mode: 'all', ngClick: 'deleteJob(\{\{ job.id \}\})', - "class": 'btn-danger btn-xs', + "class": 'btn-danger btn-xs delete-btn', awToolTip: 'Cancel a running or pending job', - ngShow: "job.status == 'pending' || job.status == 'running'" + ngShow: "job.status == 'pending' || job.status == 'running' || job.status == 'waiting'" }, "delete": { label: 'Delete', icon: 'icon-trash', mode: 'all', ngClick: 'deleteJob(\{\{ job.id \}\})', - "class": 'btn-danger btn-xs', + "class": 'btn-danger btn-xs delete-btn', awToolTip: 'Remove the selected job from the database', - ngShow: "job.status != 'pending' && job.status != 'running'" + ngShow: "job.status != 'pending' && job.status != 'running' && job.status != 'waiting'" } } }); diff --git a/awx/ui/static/less/ansible-ui.less b/awx/ui/static/less/ansible-ui.less index e20b1765fc..025c733523 100644 --- a/awx/ui/static/less/ansible-ui.less +++ b/awx/ui/static/less/ansible-ui.less @@ -960,7 +960,11 @@ tr td button i { /* Large desktop */ @media (min-width: 1200px) { - + + .delete-btn { + /* Used on job page to make cancel and delete buttons have an equal width */ + width: 60px; + } } /* Portrait tablet to landscape and desktop */ diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index 55d693675c..26811278d9 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -100,6 +100,11 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) } }); + // Remove leftover timer, if any + //if ((!options.modal) && this.scope.timer) { + // clearInterval(this.scope.timer); + //} + if (options.modal) { this.scope.formModalActionDisabled = false; this.scope.formModalInfo = false //Disable info button for default modal diff --git a/awx/ui/static/lib/ansible/list-generator.js b/awx/ui/static/lib/ansible/list-generator.js index a9ca103069..006f429c1a 100644 --- a/awx/ui/static/lib/ansible/list-generator.js +++ b/awx/ui/static/lib/ansible/list-generator.js @@ -71,9 +71,10 @@ angular.module('ListGenerator', ['GeneratorHelpers']) // remove lingering popover
. Seems to be a bug in TB3 RC1 $(this).remove(); }); - // Remove leftover timer - //if (options.mode != 'lookup' && $rootScope.timer) { - // clearInterval($rootScope.timer); + + // Remove leftover timer, if any + //if (options.mode != 'lookup' && this.scope.timer) { + // clearInterval(this.scope.timer); //} if (options.mode == 'lookup') {