mirror of
https://github.com/ansible/awx.git
synced 2026-03-16 00:17:29 -02:30
AC-144 Job Tags now functional
This commit is contained in:
@@ -145,6 +145,24 @@ angular.module('JobTemplateFormDefinition', [])
|
|||||||
dataTitle: 'Extra Variables',
|
dataTitle: 'Extra Variables',
|
||||||
dataPlacement: 'left'
|
dataPlacement: 'left'
|
||||||
},
|
},
|
||||||
|
job_tags: {
|
||||||
|
label: 'Job Tags',
|
||||||
|
type: 'textarea',
|
||||||
|
rows: 1,
|
||||||
|
addRequired: false,
|
||||||
|
editRequired: false,
|
||||||
|
'class': 'span12',
|
||||||
|
column: 2,
|
||||||
|
awPopOver: "<p>Provide a comma separated list of tags.</p>\n" +
|
||||||
|
"<p>Tags are useful when you have a large playbook, and you want to run a specific part of a play or task.</p>" +
|
||||||
|
"<p>For example, you might have a task consisiting of a long list of actions. Tag values can be assigned to each action. " +
|
||||||
|
"Suppose the actions have been assigned tag values of "configuration", "packages" and "install".</p>" +
|
||||||
|
"<p>If you just want to run the "configuration" and "packages" actions, you would enter the following here " +
|
||||||
|
"in the Job Tags field:<\p>\n" +
|
||||||
|
"<blockquote>configuration,packages</blockquote>\n",
|
||||||
|
dataTitle: "Job Tags",
|
||||||
|
dataPlacement: "left"
|
||||||
|
},
|
||||||
allow_callbacks: {
|
allow_callbacks: {
|
||||||
label: 'Allow Callbacks',
|
label: 'Allow Callbacks',
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
|
|||||||
@@ -9,13 +9,13 @@
|
|||||||
|
|
||||||
angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'GroupListDefinition',
|
angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'GroupListDefinition',
|
||||||
'SearchHelper', 'PaginateHelper', 'ListGenerator', 'AuthService', 'GroupsHelper',
|
'SearchHelper', 'PaginateHelper', 'ListGenerator', 'AuthService', 'GroupsHelper',
|
||||||
'InventoryHelper'
|
'InventoryHelper', 'SelectionHelper'
|
||||||
])
|
])
|
||||||
|
|
||||||
.factory('GroupsList', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupList', 'GenerateList',
|
.factory('GroupsList', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupList', 'GenerateList',
|
||||||
'Prompt', 'SearchInit', 'PaginateInit', 'ProcessErrors', 'GetBasePath', 'GroupsAdd', 'RefreshTree',
|
'Prompt', 'SearchInit', 'PaginateInit', 'ProcessErrors', 'GetBasePath', 'GroupsAdd', 'RefreshTree', 'SelectionInit',
|
||||||
function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupList, GenerateList, LoadBreadCrumbs, SearchInit,
|
function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupList, GenerateList, LoadBreadCrumbs, SearchInit,
|
||||||
PaginateInit, ProcessErrors, GetBasePath, GroupsAdd, RefreshTree) {
|
PaginateInit, ProcessErrors, GetBasePath, GroupsAdd, RefreshTree, SelectionInit) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
|
|
||||||
var inventory_id = params.inventory_id;
|
var inventory_id = params.inventory_id;
|
||||||
@@ -41,27 +41,17 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
$('#form-modal .btn-none').removeClass('btn-none').addClass('btn-success');
|
$('#form-modal .btn-none').removeClass('btn-none').addClass('btn-success');
|
||||||
$('#form-modal').modal({ backdrop: 'static', keyboard: false });
|
$('#form-modal').modal({ backdrop: 'static', keyboard: false });
|
||||||
|
|
||||||
scope.selected = [];
|
SelectionInit({ scope: scope, list: list });
|
||||||
|
|
||||||
if (scope.PostRefreshRemove) {
|
if (scope.PostRefreshRemove) {
|
||||||
scope.PostRefreshRemove();
|
scope.PostRefreshRemove();
|
||||||
}
|
}
|
||||||
scope.PostRefreshRemove = scope.$on('PostRefresh', function() {
|
scope.PostRefreshRemove = scope.$on('PostRefresh', function() {
|
||||||
$("tr.success").each(function(index) {
|
for (var i=0; i < scope.groups.length; i++) {
|
||||||
// Make sure no rows have a green background
|
if (scope.groups[i].id == group_id) {
|
||||||
var ngc = $(this).attr('ng-class');
|
scope.groups.splice(i,1);
|
||||||
scope[ngc] = "";
|
}
|
||||||
});
|
|
||||||
if ($routeParams.group_id) {
|
|
||||||
// Remove the current group from the list of available groups, thus
|
|
||||||
// preventing a group from being added to itself
|
|
||||||
for (var i=0; i < scope.groups.length; i++) {
|
|
||||||
if (scope.groups[i].id == $routeParams.group_id) {
|
|
||||||
scope.groups.splice(i,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//scope.$digest();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
SearchInit({ scope: scope, set: 'groups', list: list, url: defaultUrl });
|
SearchInit({ scope: scope, set: 'groups', list: list, url: defaultUrl });
|
||||||
@@ -91,13 +81,12 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
var errors = 0;
|
var errors = 0;
|
||||||
for (var i=0; i < scope.queue.length; i++) {
|
for (var i=0; i < scope.queue.length; i++) {
|
||||||
if (scope.queue[i].result == 'error') {
|
if (scope.queue[i].result == 'error') {
|
||||||
|
ProcessErrors(scope, scope.queue[i].data, scope.queue[i].status, null,
|
||||||
|
{ hdr: 'Group: ' + scope.queue[i].value.name, msg: 'Failed to add group. POST returned status: ' + scope.queue[i].status });
|
||||||
errors++;
|
errors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (errors > 0) {
|
if (errors == 0) {
|
||||||
Alert('Error', 'There was an error while adding one or more of the selected groups.');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('#form-modal').modal('hide');
|
$('#form-modal').modal('hide');
|
||||||
RefreshTree({ scope: scope });
|
RefreshTree({ scope: scope });
|
||||||
}
|
}
|
||||||
@@ -120,7 +109,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
scope.$emit('callFinished');
|
scope.$emit('callFinished');
|
||||||
})
|
})
|
||||||
.error( function(data, status, headers, config) {
|
.error( function(data, status, headers, config) {
|
||||||
scope.queue.push({ result: 'error', data: data, status: status, headers: headers });
|
scope.queue.push({ result: 'error', data: data, status: status, headers: headers, value: group });
|
||||||
scope.$emit('callFinished');
|
scope.$emit('callFinished');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -131,23 +120,6 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.toggle_group = function(id) {
|
|
||||||
if (scope[list.iterator + "_" + id + "_class"] == "success") {
|
|
||||||
scope[list.iterator + "_" + id + "_class"] = "";
|
|
||||||
document.getElementById('check_' + id).checked = false;
|
|
||||||
if (scope.selected.indexOf(id) > -1) {
|
|
||||||
scope.selected.splice(scope.selected.indexOf(id),1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
scope[list.iterator + "_" + id + "_class"] = "success";
|
|
||||||
document.getElementById('check_' + id).checked = true;
|
|
||||||
if (scope.selected.indexOf(id) == -1) {
|
|
||||||
scope.selected.push(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
scope.createGroup = function() {
|
scope.createGroup = function() {
|
||||||
$('#form-modal').modal('hide');
|
$('#form-modal').modal('hide');
|
||||||
GroupsAdd({ inventory_id: inventory_id, group_id: group_id });
|
GroupsAdd({ inventory_id: inventory_id, group_id: group_id });
|
||||||
|
|||||||
@@ -63,15 +63,14 @@ angular.module('Utilities',[])
|
|||||||
.factory('ProcessErrors', ['$log', 'Alert', function($log, Alert) {
|
.factory('ProcessErrors', ['$log', 'Alert', function($log, Alert) {
|
||||||
return function(scope, data, status, form, defaultMsg) {
|
return function(scope, data, status, form, defaultMsg) {
|
||||||
if (status == 403) {
|
if (status == 403) {
|
||||||
var msg = 'The API responded with a 403 Access Denied error. You do not have permission to perform the ' +
|
var msg = 'The API responded with a 403 Access Denied error. ';
|
||||||
'requested action. ';
|
|
||||||
if (data['detail']) {
|
if (data['detail']) {
|
||||||
msg += 'Detail: ' + data['detail'];
|
msg += 'Detail: ' + data['detail'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
msg += 'Please contact your system administrator.';
|
msg += 'Please contact your system administrator.';
|
||||||
}
|
}
|
||||||
Alert('Access Denied', msg);
|
Alert(defaultMsg.hdr, msg);
|
||||||
}
|
}
|
||||||
else if (data.non_field_errors) {
|
else if (data.non_field_errors) {
|
||||||
Alert('Error!', data.non_field_errors);
|
Alert('Error!', data.non_field_errors);
|
||||||
|
|||||||
Reference in New Issue
Block a user