AC-351 latest SCM changes. Added 'Authentication Required' checkbox. Enabled SCM password prompting on job submission.

This commit is contained in:
chouseknecht
2013-09-08 17:17:35 -04:00
parent 7b57189eca
commit 5afa79a11a
5 changed files with 60 additions and 21 deletions

View File

@@ -202,7 +202,7 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
scope[fld + '_ask'] = false; scope[fld + '_ask'] = false;
$("#" + fld + "-clear-btn").removeAttr("disabled"); $("#" + fld + "-clear-btn").removeAttr("disabled");
} }
master[fld + '_ask'] = scope[fld + '_ask'];
} }
} }

View File

@@ -33,11 +33,13 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest,
scope[ngc] = ""; scope[ngc] = "";
}); });
// Convert created date to local time zone if (scope[list.name]) {
var cDate; // Convert created date to local time zone
for (var i=0; i < scope[list.name].length; i++) { var cDate;
cDate = new Date(scope[list.name][i].created); for (var i=0; i < scope[list.name].length; i++) {
scope[list.name][i].created = FormatDate(cDate); cDate = new Date(scope[list.name][i].created);
scope[list.name][i].created = FormatDate(cDate);
}
} }
}); });

View File

@@ -39,7 +39,8 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
// will contain status of last update, which is not what we want. // will contain status of last update, which is not what we want.
scope.projects[i].last_update_failed = false; scope.projects[i].last_update_failed = false;
} }
scope.projects[i].last_updated = FormatDate(new Date(scope.projects[i].last_updated)); scope.projects[i].last_updated = (scope.projects[i].last_updated !== null) ?
FormatDate(new Date(scope.projects[i].last_updated)) : null;
} }
}); });
@@ -233,6 +234,18 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam
scope.scmBranchLabel = (scope.scm_type.value == 'svn') ? 'Revision #' : 'SCM Branch'; scope.scmBranchLabel = (scope.scm_type.value == 'svn') ? 'Revision #' : 'SCM Branch';
} }
scope.authChange = function() {
if (!scope.auth_required) {
scope.scm_username = null;
scope.scm_password = null;
scope.scm_password_confirm = null;
scope.scm_key_data = null;
scope.scm_key_unlock = null;
scope.scm_key_unlock_confirm = null;
scope.scm_password_ask = false;
}
}
// Cancel // Cancel
scope.formReset = function() { scope.formReset = function() {
$rootScope.flashMessage = null; $rootScope.flashMessage = null;
@@ -288,6 +301,7 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
scope[fld + '_ask'] = false; scope[fld + '_ask'] = false;
$("#" + fld + "-clear-btn").removeAttr("disabled"); $("#" + fld + "-clear-btn").removeAttr("disabled");
} }
master[fld + '_ask'] = scope[fld + '_ask'];
} }
} }
@@ -308,6 +322,8 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
scope.project_local_paths = opts; scope.project_local_paths = opts;
scope.base_dir = 'You do not have access to view this property'; scope.base_dir = 'You do not have access to view this property';
} }
scope.auth_required = (scope.scm_type && (scope.scm_username || scope.scm_key_unlock)) ? true : false;
master.auth_required = scope.auth_required;
}); });
// Retrieve detail record and prepopulate the form // Retrieve detail record and prepopulate the form
@@ -403,6 +419,18 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
} }
}; };
scope.authChange = function() {
if (!scope.auth_required) {
scope.scm_username = null;
scope.scm_password = null;
scope.scm_password_confirm = null;
scope.scm_key_data = null;
scope.scm_key_unlock = null;
scope.scm_key_unlock_confirm = null;
scope.scm_password_ask = false;
}
}
// Related set: Add button // Related set: Add button
scope.add = function(set) { scope.add = function(set) {
$rootScope.flashMessage = null; $rootScope.flashMessage = null;

View File

@@ -109,17 +109,25 @@ angular.module('ProjectFormDefinition', [])
addRequired: false, addRequired: false,
editRequired: false editRequired: false
}, },
auth_required: {
label: 'Authorization required?',
type: 'checkbox',
ngShow: "scm_type !== '' && scm_type !== null",
addRequired: false,
editRequired: false,
ngChange: 'authChange()'
},
scm_username: { scm_username: {
label: 'SCM Username', label: 'SCM Username',
type: 'text', type: 'text',
ngShow: "scm_type !== '' && scm_type !== null", ngShow: "scm_type !== '' && scm_type !== null && auth_required",
addRequired: false, addRequired: false,
editRequired: false editRequired: false
}, },
"scm_password": { "scm_password": {
label: 'SCM Password', label: 'SCM Password',
type: 'password', type: 'password',
ngShow: "scm_type !== '' && scm_type !== null", ngShow: "scm_type !== '' && scm_type !== null && auth_required",
addRequired: false, addRequired: false,
editRequired: false, editRequired: false,
ngChange: "clearPWConfirm('scm_password_confirm')", ngChange: "clearPWConfirm('scm_password_confirm')",
@@ -129,9 +137,9 @@ angular.module('ProjectFormDefinition', [])
autocomplete: false autocomplete: false
}, },
"scm_password_confirm": { "scm_password_confirm": {
label: 'Confirm Password', label: 'Confirm SCM Password',
type: 'password', type: 'password',
ngShow: "scm_type !== '' && scm_type !== null", ngShow: "scm_type !== '' && scm_type !== null && auth_required",
addRequired: false, addRequired: false,
editRequired: false, editRequired: false,
awPassMatch: true, awPassMatch: true,
@@ -141,7 +149,7 @@ angular.module('ProjectFormDefinition', [])
"scm_key_data": { "scm_key_data": {
label: 'SCM Private Key', label: 'SCM Private Key',
type: 'textarea', type: 'textarea',
ngShow: "scm_type !== '' && scm_type !== null", ngShow: "scm_type !== '' && scm_type !== null && auth_required",
xtraWide: true, xtraWide: true,
addRequired: false, addRequired: false,
editRequired: false, editRequired: false,
@@ -151,7 +159,7 @@ angular.module('ProjectFormDefinition', [])
"scm_key_unlock": { "scm_key_unlock": {
label: 'SCM Key Password', label: 'SCM Key Password',
type: 'password', type: 'password',
ngShow: "scm_type !== '' && scm_type !== null && scm_key_data", ngShow: "scm_type !== '' && scm_type !== null && scm_key_data && auth_required",
addRequired: false, addRequired: false,
editRequired: false, editRequired: false,
ngChange: "clearPWConfirm('scm_key_unlock_confirm')", ngChange: "clearPWConfirm('scm_key_unlock_confirm')",
@@ -160,9 +168,9 @@ angular.module('ProjectFormDefinition', [])
clear: true clear: true
}, },
"scm_key_unlock_confirm": { "scm_key_unlock_confirm": {
label: 'Confirm Key Password', label: 'Confirm SCM Key Password',
type: 'password', type: 'password',
ngShow: "scm_type !== '' && scm_type !== null && scm_key_data", ngShow: "scm_type !== '' && scm_type !== null && scm_key_data && auth_required",
addRequired: false, addRequired: false,
editRequired: false, editRequired: false,
awPassMatch: true, awPassMatch: true,

View File

@@ -5,16 +5,17 @@
* *
*/ */
angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'CredentialFormDefinition', 'CredentialsListDefinition', angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'CredentialFormDefinition', 'CredentialsListDefinition',
'LookUpHelper', 'JobTemplateFormDefinition', 'ProjectFormDefinition' ]) 'LookUpHelper', 'ProjectFormDefinition' ])
.factory('PromptPasswords',['CredentialForm', '$compile', 'Rest', '$location', 'ProcessErrors', 'GetBasePath', 'Alert', .factory('PromptPasswords', ['CredentialForm', 'JobTemplateForm', 'ProjectsForm', '$compile', 'Rest', '$location', 'ProcessErrors', 'GetBasePath',
function(JobTemplateForm, $compile, Rest, $location, ProcessErrors, GetBasePath, Alert) { 'Alert',
function(CredentialForm, JobTemplateForm, ProjectsForm, $compile, Rest, $location, ProcessErrors, GetBasePath, Alert) {
return function(params) { return function(params) {
var scope = params.scope; var scope = params.scope;
var passwords = params.passwords; var passwords = params.passwords;
var start_url = params.start_url; var start_url = params.start_url;
var form = params.form; var form = CredentialForm;
var html = ''; var html = '';
var field, element, dialogScope, fld; var field, element, dialogScope, fld;
var base = $location.path().replace(/^\//,'').split('/')[0]; var base = $location.path().replace(/^\//,'').split('/')[0];
@@ -97,7 +98,7 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
html += html += "<form class=\"form-horizontal\" name=\"password_form\" novalidate>\n"; html += html += "<form class=\"form-horizontal\" name=\"password_form\" novalidate>\n";
for (var i=0; i < passwords.length; i++) { for (var i=0; i < passwords.length; i++) {
// Add the password field // Add the password field
field = form.fields[passwords[i]]; field = (form.fields[passwords[i]]) ? form.fields[passwords[i]] : ProjectsForm.fields[passwords[i]];
fld = passwords[i]; fld = passwords[i];
scope[fld] = ''; scope[fld] = '';
html += "<div class=\"form-group\">\n"; html += "<div class=\"form-group\">\n";
@@ -119,7 +120,7 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
// Add the related confirm field // Add the related confirm field
fld = field.associated; fld = field.associated;
field = form.fields[field.associated]; field = (form.fields[field.associated]) ? form.fields[field.associated] : ProjectsForm.fields[field.associated];
scope[fld] = ''; scope[fld] = '';
html += "<div class=\"form-group\">\n"; html += "<div class=\"form-group\">\n";
html += "<label class=\"control-label col-lg-3\" for=\"" + fld + '">' + field.label + '</label>' + "\n"; html += "<label class=\"control-label col-lg-3\" for=\"" + fld + '">' + field.label + '</label>' + "\n";