diff --git a/awx/ui/static/js/controllers/Authentication.js b/awx/ui/static/js/controllers/Authentication.js index 163bededd3..d2e16d8783 100644 --- a/awx/ui/static/js/controllers/Authentication.js +++ b/awx/ui/static/js/controllers/Authentication.js @@ -59,6 +59,7 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth if ($location.path() == '/logout') { //if logout request, clear AuthToken and user session data Authorization.logout(); + $location.url('/home'); } $rootScope.userLoggedIn = false; //hide the logout link. if you got here, you're logged out. diff --git a/awx/ui/static/js/controllers/Jobs.js b/awx/ui/static/js/controllers/Jobs.js index 4c8df06daa..64c8a72b48 100644 --- a/awx/ui/static/js/controllers/Jobs.js +++ b/awx/ui/static/js/controllers/Jobs.js @@ -230,12 +230,13 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, getPlaybooks(scope.project); } }); + // Retrieve each related set and populate the playbook list if (scope.jobLoadedRemove) { scope.jobLoadedRemove(); } - scope.jobLoadedRemove = scope.$on('jobLoaded', function() { + scope.jobLoadedRemove = scope.$on('jobLoaded', function(e, related_cloud_credential) { scope[form.name + 'ReadOnly'] = (scope.status == 'new') ? false : true; @@ -272,6 +273,19 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, // { hdr: 'Error!', msg: 'Failed to retrieve job: ' + $routeParams.id + '. GET status: ' + status }); scope['callback_url'] = '<< Job template not found >>'; }); + + if (related_cloud_credential) { + //Get the name of the cloud credential + Rest.setUrl(related_cloud_credential); + Rest.get() + .success( function(data, status, headers, config) { + scope['cloud_credential_name'] = data.name; + }) + .error( function(data, status, headers, config) { + ProcessErrors(scope, data, status, null, + { hdr: 'Error!', msg: 'Failed to related cloud credential. GET returned status: ' + status }); + }); + } }); @@ -290,6 +304,7 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, return (rows > 15) ? 15 : rows; } + // Retrieve detail record and prepopulate the form Rest.setUrl(defaultUrl + ':id/'); Rest.get({ params: {id: id} }) @@ -399,14 +414,6 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, field: 'credential' }); - LookUpInit({ - scope: scope, - form: form, - current_item: data.cloud_credential, - list: CredentialList, - field: 'cloud_credential' - }); - LookUpInit({ scope: scope, form: form, @@ -419,7 +426,7 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets }); RelatedPaginateInit({ scope: scope, relatedSets: relatedSets }); scope.template_url = data.related.job_template; - scope.$emit('jobLoaded'); + scope.$emit('jobLoaded', data.related.cloud_credential); }) .error( function(data, status, headers, config) { ProcessErrors(scope, data, status, form, diff --git a/awx/ui/static/js/forms/JobTemplates.js b/awx/ui/static/js/forms/JobTemplates.js index 5bdb90eaef..8119bdc08f 100644 --- a/awx/ui/static/js/forms/JobTemplates.js +++ b/awx/ui/static/js/forms/JobTemplates.js @@ -66,8 +66,12 @@ angular.module('JobTemplateFormDefinition', []) sourceField: 'name', ngClick: 'lookUpInventory()', awRequiredWhen: {variable: "inventoryrequired", init: "true" }, - column: 1 - }, + column: 1, + awPopOver: "

Select the inventory containing the hosts you want this job to manage.

", + dataTitle: 'Inventory', + dataPlacement: 'right', + dataContainer: "body" + }, project: { label: 'Project', type: 'lookup', @@ -75,7 +79,11 @@ angular.module('JobTemplateFormDefinition', []) sourceField: 'name', ngClick: 'lookUpProject()', awRequiredWhen: {variable: "projectrequired", init: "true" }, - column: 1 + column: 1, + awPopOver: "

Select the project containing the playbook you want this job to execute.

", + dataTitle: 'Project', + dataPlacement: 'right', + dataContainer: "body" }, playbook: { label: 'Playbook', @@ -83,17 +91,26 @@ angular.module('JobTemplateFormDefinition', []) ngOptions: 'book for book in playbook_options', id: 'playbook-select', awRequiredWhen: {variable: "playbookrequired", init: "true" }, - column: 1 + column: 1, + awPopOver: "

Select the playbook to be executed by this job.

", + dataTitle: 'Playbook', + dataPlacement: 'right', + dataContainer: "body" }, credential: { - label: 'Credential', + label: 'Machine Credential', type: 'lookup', sourceModel: 'credential', sourceField: 'name', ngClick: 'lookUpCredential()', addRequired: true, editRequired: true, - column: 1 + column: 1, + awPopOver: "

Select the credential you want the job to use when accessing the remote hosts. Choose the credential containing " + + " the username and SSH key or password that Ansbile will need to log into the remote hosts.

", + dataTitle: 'Credential', + dataPlacement: 'right', + dataContainer: "body" }, cloud_credential: { label: 'Cloud Credential', @@ -103,7 +120,12 @@ angular.module('JobTemplateFormDefinition', []) ngClick: 'lookUpCloudcredential()', addRequired: false, editRequired: false, - column: 1 + column: 1, + awPopOver: "

Selecting an optional cloud credential in the job template will pass along the access credentials to the " + + "running playbook, allowing provisioning into the cloud without manually passing parameters to the included modules.

", + dataTitle: 'Cloud Credential', + dataPlacement: 'right', + dataContainer: "body" }, forks: { label: 'Forks', diff --git a/awx/ui/static/js/forms/Jobs.js b/awx/ui/static/js/forms/Jobs.js index 919d92ff81..4aa874facf 100644 --- a/awx/ui/static/js/forms/Jobs.js +++ b/awx/ui/static/js/forms/Jobs.js @@ -78,7 +78,11 @@ angular.module('JobFormDefinition', []) addRequired: true, editRequired: true, ngClick: 'lookUpInventory()', - column: 1 + column: 1, + awPopOver: "

Select the inventory containing the hosts you want this job to manage.

", + dataTitle: 'Inventory', + dataPlacement: 'right', + dataContainer: "body" }, project: { label: 'Project', @@ -88,7 +92,11 @@ angular.module('JobFormDefinition', []) addRequired: true, editRequired: true, ngClick: 'lookUpProject()', - column: 1 + column: 1, + awPopOver: "

Select the project containing the playbook you want this job to execute.

", + dataTitle: 'Project', + dataPlacement: 'right', + dataContainer: "body" }, playbook: { label: 'Playbook', @@ -97,7 +105,11 @@ angular.module('JobFormDefinition', []) id: 'playbook-select', addRequired: true, editRequired: true, - column: 1 + column: 1, + awPopOver: "

Select the playbook to be executed by this job.

", + dataTitle: 'Playbook', + dataPlacement: 'right', + dataContainer: "body" }, credential: { // FIXME: Lookup only credentials with kind=ssh label: 'Credential', @@ -107,7 +119,12 @@ angular.module('JobFormDefinition', []) ngClick: 'lookUpCredential()', addRequired: false, editRequired: false, - column: 1 + column: 1, + awPopOver: "

Select the credential you want the job to use when accessing the remote hosts. Choose the credential containing " + + " the username and SSH key or password that Ansbile will need to log into the remote hosts.

", + dataTitle: 'Credential', + dataPlacement: 'right', + dataContainer: "body" }, cloud_credential: { // FIXME: Lookup only credentials with kind=aws/rax label: 'Cloud Credential', @@ -117,7 +134,12 @@ angular.module('JobFormDefinition', []) ngClick: 'lookUpCredential()', addRequired: false, editRequired: false, - column: 1 + column: 1, + awPopOver: "

Selecting an optional cloud credential in the job template will pass along the access credentials to the " + + "running playbook, allowing provisioning into the cloud without manually passing parameters to the included modules.

", + dataTitle: 'Cloud Credential', + dataPlacement: 'right', + dataContainer: "body" }, forks: { label: 'Forks', diff --git a/awx/ui/static/lib/ansible/AuthService.js b/awx/ui/static/lib/ansible/AuthService.js index e6796ee731..55ededb053 100644 --- a/awx/ui/static/lib/ansible/AuthService.js +++ b/awx/ui/static/lib/ansible/AuthService.js @@ -53,6 +53,7 @@ angular.module('AuthService', ['ngCookies', 'Utilities']) $cookieStore.remove('token'); $cookieStore.remove('token_expires'); $cookieStore.remove('current_user'); + $cookieStore.remove('lastPath'); $cookieStore.put('userLoggedIn', false); $cookieStore.put('sessionExpired', false); $rootScope.current_user = {}; @@ -61,6 +62,7 @@ angular.module('AuthService', ['ngCookies', 'Utilities']) $rootScope.sessionExpired = false; $rootScope.token = null; $rootScope.token_expires = null; + $rootScope.lastPath = '/'; }, getLicense: function() {