AC-684 Added new help text and adjusted credential labels. Fixed missing cloud credential name value on Jobs Detail view (job template accordion).

This commit is contained in:
Chris Houseknecht
2013-11-20 23:57:43 +00:00
parent ade961fd38
commit 0cd6e5412b
5 changed files with 76 additions and 22 deletions

View File

@@ -59,6 +59,7 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth
if ($location.path() == '/logout') { if ($location.path() == '/logout') {
//if logout request, clear AuthToken and user session data //if logout request, clear AuthToken and user session data
Authorization.logout(); Authorization.logout();
$location.url('/home');
} }
$rootScope.userLoggedIn = false; //hide the logout link. if you got here, you're logged out. $rootScope.userLoggedIn = false; //hide the logout link. if you got here, you're logged out.

View File

@@ -230,12 +230,13 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
getPlaybooks(scope.project); getPlaybooks(scope.project);
} }
}); });
// Retrieve each related set and populate the playbook list // Retrieve each related set and populate the playbook list
if (scope.jobLoadedRemove) { if (scope.jobLoadedRemove) {
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; 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 }); // { hdr: 'Error!', msg: 'Failed to retrieve job: ' + $routeParams.id + '. GET status: ' + status });
scope['callback_url'] = '<< Job template not found >>'; 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; return (rows > 15) ? 15 : rows;
} }
// Retrieve detail record and prepopulate the form // Retrieve detail record and prepopulate the form
Rest.setUrl(defaultUrl + ':id/'); Rest.setUrl(defaultUrl + ':id/');
Rest.get({ params: {id: id} }) Rest.get({ params: {id: id} })
@@ -399,14 +414,6 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
field: 'credential' field: 'credential'
}); });
LookUpInit({
scope: scope,
form: form,
current_item: data.cloud_credential,
list: CredentialList,
field: 'cloud_credential'
});
LookUpInit({ LookUpInit({
scope: scope, scope: scope,
form: form, form: form,
@@ -419,7 +426,7 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets }); RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets });
RelatedPaginateInit({ scope: scope, relatedSets: relatedSets }); RelatedPaginateInit({ scope: scope, relatedSets: relatedSets });
scope.template_url = data.related.job_template; scope.template_url = data.related.job_template;
scope.$emit('jobLoaded'); scope.$emit('jobLoaded', data.related.cloud_credential);
}) })
.error( function(data, status, headers, config) { .error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form, ProcessErrors(scope, data, status, form,

View File

@@ -66,8 +66,12 @@ angular.module('JobTemplateFormDefinition', [])
sourceField: 'name', sourceField: 'name',
ngClick: 'lookUpInventory()', ngClick: 'lookUpInventory()',
awRequiredWhen: {variable: "inventoryrequired", init: "true" }, awRequiredWhen: {variable: "inventoryrequired", init: "true" },
column: 1 column: 1,
}, awPopOver: "<p>Select the inventory containing the hosts you want this job to manage.</p>",
dataTitle: 'Inventory',
dataPlacement: 'right',
dataContainer: "body"
},
project: { project: {
label: 'Project', label: 'Project',
type: 'lookup', type: 'lookup',
@@ -75,7 +79,11 @@ angular.module('JobTemplateFormDefinition', [])
sourceField: 'name', sourceField: 'name',
ngClick: 'lookUpProject()', ngClick: 'lookUpProject()',
awRequiredWhen: {variable: "projectrequired", init: "true" }, awRequiredWhen: {variable: "projectrequired", init: "true" },
column: 1 column: 1,
awPopOver: "<p>Select the project containing the playbook you want this job to execute.</p>",
dataTitle: 'Project',
dataPlacement: 'right',
dataContainer: "body"
}, },
playbook: { playbook: {
label: 'Playbook', label: 'Playbook',
@@ -83,17 +91,26 @@ angular.module('JobTemplateFormDefinition', [])
ngOptions: 'book for book in playbook_options', ngOptions: 'book for book in playbook_options',
id: 'playbook-select', id: 'playbook-select',
awRequiredWhen: {variable: "playbookrequired", init: "true" }, awRequiredWhen: {variable: "playbookrequired", init: "true" },
column: 1 column: 1,
awPopOver: "<p>Select the playbook to be executed by this job.</p>",
dataTitle: 'Playbook',
dataPlacement: 'right',
dataContainer: "body"
}, },
credential: { credential: {
label: 'Credential', label: 'Machine Credential',
type: 'lookup', type: 'lookup',
sourceModel: 'credential', sourceModel: 'credential',
sourceField: 'name', sourceField: 'name',
ngClick: 'lookUpCredential()', ngClick: 'lookUpCredential()',
addRequired: true, addRequired: true,
editRequired: true, editRequired: true,
column: 1 column: 1,
awPopOver: "<p>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.</p>",
dataTitle: 'Credential',
dataPlacement: 'right',
dataContainer: "body"
}, },
cloud_credential: { cloud_credential: {
label: 'Cloud Credential', label: 'Cloud Credential',
@@ -103,7 +120,12 @@ angular.module('JobTemplateFormDefinition', [])
ngClick: 'lookUpCloudcredential()', ngClick: 'lookUpCloudcredential()',
addRequired: false, addRequired: false,
editRequired: false, editRequired: false,
column: 1 column: 1,
awPopOver: "<p>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.</p>",
dataTitle: 'Cloud Credential',
dataPlacement: 'right',
dataContainer: "body"
}, },
forks: { forks: {
label: 'Forks', label: 'Forks',

View File

@@ -78,7 +78,11 @@ angular.module('JobFormDefinition', [])
addRequired: true, addRequired: true,
editRequired: true, editRequired: true,
ngClick: 'lookUpInventory()', ngClick: 'lookUpInventory()',
column: 1 column: 1,
awPopOver: "<p>Select the inventory containing the hosts you want this job to manage.</p>",
dataTitle: 'Inventory',
dataPlacement: 'right',
dataContainer: "body"
}, },
project: { project: {
label: 'Project', label: 'Project',
@@ -88,7 +92,11 @@ angular.module('JobFormDefinition', [])
addRequired: true, addRequired: true,
editRequired: true, editRequired: true,
ngClick: 'lookUpProject()', ngClick: 'lookUpProject()',
column: 1 column: 1,
awPopOver: "<p>Select the project containing the playbook you want this job to execute.</p>",
dataTitle: 'Project',
dataPlacement: 'right',
dataContainer: "body"
}, },
playbook: { playbook: {
label: 'Playbook', label: 'Playbook',
@@ -97,7 +105,11 @@ angular.module('JobFormDefinition', [])
id: 'playbook-select', id: 'playbook-select',
addRequired: true, addRequired: true,
editRequired: true, editRequired: true,
column: 1 column: 1,
awPopOver: "<p>Select the playbook to be executed by this job.</p>",
dataTitle: 'Playbook',
dataPlacement: 'right',
dataContainer: "body"
}, },
credential: { // FIXME: Lookup only credentials with kind=ssh credential: { // FIXME: Lookup only credentials with kind=ssh
label: 'Credential', label: 'Credential',
@@ -107,7 +119,12 @@ angular.module('JobFormDefinition', [])
ngClick: 'lookUpCredential()', ngClick: 'lookUpCredential()',
addRequired: false, addRequired: false,
editRequired: false, editRequired: false,
column: 1 column: 1,
awPopOver: "<p>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.</p>",
dataTitle: 'Credential',
dataPlacement: 'right',
dataContainer: "body"
}, },
cloud_credential: { // FIXME: Lookup only credentials with kind=aws/rax cloud_credential: { // FIXME: Lookup only credentials with kind=aws/rax
label: 'Cloud Credential', label: 'Cloud Credential',
@@ -117,7 +134,12 @@ angular.module('JobFormDefinition', [])
ngClick: 'lookUpCredential()', ngClick: 'lookUpCredential()',
addRequired: false, addRequired: false,
editRequired: false, editRequired: false,
column: 1 column: 1,
awPopOver: "<p>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.</p>",
dataTitle: 'Cloud Credential',
dataPlacement: 'right',
dataContainer: "body"
}, },
forks: { forks: {
label: 'Forks', label: 'Forks',

View File

@@ -53,6 +53,7 @@ angular.module('AuthService', ['ngCookies', 'Utilities'])
$cookieStore.remove('token'); $cookieStore.remove('token');
$cookieStore.remove('token_expires'); $cookieStore.remove('token_expires');
$cookieStore.remove('current_user'); $cookieStore.remove('current_user');
$cookieStore.remove('lastPath');
$cookieStore.put('userLoggedIn', false); $cookieStore.put('userLoggedIn', false);
$cookieStore.put('sessionExpired', false); $cookieStore.put('sessionExpired', false);
$rootScope.current_user = {}; $rootScope.current_user = {};
@@ -61,6 +62,7 @@ angular.module('AuthService', ['ngCookies', 'Utilities'])
$rootScope.sessionExpired = false; $rootScope.sessionExpired = false;
$rootScope.token = null; $rootScope.token = null;
$rootScope.token_expires = null; $rootScope.token_expires = null;
$rootScope.lastPath = '/';
}, },
getLicense: function() { getLicense: function() {