AC-463 Latest changes automating refresh button on Projects and Jobs tab. Cleaned up Cancel/Delete buttons on Jobs tab.

This commit is contained in:
chouseknecht
2013-09-17 12:05:25 -04:00
parent f97b889a9b
commit b7488b7043
6 changed files with 28 additions and 11 deletions

View File

@@ -258,6 +258,10 @@ angular.module('ansible', [
CheckLicense(); CheckLicense();
} }
if ($rootScope.timer) {
clearInterval($rootScope.timer);
}
// Make the correct tab active // Make the correct tab active
var base = $location.path().replace(/^\//,'').split('/')[0]; var base = $location.path().replace(/^\//,'').split('/')[0];
if (base == '') { if (base == '') {

View File

@@ -70,10 +70,12 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest,
LoadBreadCrumbs(); LoadBreadCrumbs();
scope.refreshJob = function() { scope.refresh = function() {
scope.search(list.iterator); scope.search(list.iterator);
} }
scope.refreshJob = scope.refresh;
scope.editJob = function(id, name) { scope.editJob = function(id, name) {
LoadBreadCrumbs({ path: '/jobs/' + id, title: id + ' - ' + name }); LoadBreadCrumbs({ path: '/jobs/' + id, title: id + ' - ' + name });
$location.path($location.path() + '/' + id); $location.path($location.path() + '/' + id);
@@ -94,7 +96,7 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest,
Rest.get() Rest.get()
.success( function(data, status, headers, config) { .success( function(data, status, headers, config) {
var url, action_label, restcall, hdr; 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; url = data.related.cancel;
action_label = 'cancel'; action_label = 'cancel';
hdr = 'Cancel Job'; hdr = 'Cancel Job';

View File

@@ -48,6 +48,7 @@ angular.module('JobsListDefinition', [])
searchType: 'select', searchType: 'select',
searchOptions: [ searchOptions: [
{ name: "new", value: "new" }, { name: "new", value: "new" },
{ name: "waiting", value: "waiting" },
{ name: "pending", value: "pending" }, { name: "pending", value: "pending" },
{ name: "running", value: "running" }, { name: "running", value: "running" },
{ name: "successful", value: "successful" }, { name: "successful", value: "successful" },
@@ -117,18 +118,18 @@ angular.module('JobsListDefinition', [])
icon: 'icon-minus-sign', icon: 'icon-minus-sign',
mode: 'all', mode: 'all',
ngClick: 'deleteJob(\{\{ job.id \}\})', ngClick: 'deleteJob(\{\{ job.id \}\})',
"class": 'btn-danger btn-xs', "class": 'btn-danger btn-xs delete-btn',
awToolTip: 'Cancel a running or pending job', 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": { "delete": {
label: 'Delete', label: 'Delete',
icon: 'icon-trash', icon: 'icon-trash',
mode: 'all', mode: 'all',
ngClick: 'deleteJob(\{\{ job.id \}\})', ngClick: 'deleteJob(\{\{ job.id \}\})',
"class": 'btn-danger btn-xs', "class": 'btn-danger btn-xs delete-btn',
awToolTip: 'Remove the selected job from the database', 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'"
} }
} }
}); });

View File

@@ -961,6 +961,10 @@ tr td button i {
@media (min-width: 1200px) { @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 */ /* Portrait tablet to landscape and desktop */

View File

@@ -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) { if (options.modal) {
this.scope.formModalActionDisabled = false; this.scope.formModalActionDisabled = false;
this.scope.formModalInfo = false //Disable info button for default modal this.scope.formModalInfo = false //Disable info button for default modal

View File

@@ -71,9 +71,10 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
// remove lingering popover <div>. Seems to be a bug in TB3 RC1 // remove lingering popover <div>. Seems to be a bug in TB3 RC1
$(this).remove(); $(this).remove();
}); });
// Remove leftover timer
//if (options.mode != 'lookup' && $rootScope.timer) { // Remove leftover timer, if any
// clearInterval($rootScope.timer); //if (options.mode != 'lookup' && this.scope.timer) {
// clearInterval(this.scope.timer);
//} //}
if (options.mode == 'lookup') { if (options.mode == 'lookup') {