AC-466. Fixed issue with refresh timer randomly quitting. Fixed project authorization checkbox.

This commit is contained in:
chouseknecht 2013-09-24 03:42:23 +00:00
parent f2eb9ff343
commit 4b09ba4c83
11 changed files with 34 additions and 23 deletions

View File

@ -260,6 +260,7 @@ angular.module('ansible', [
if ($rootScope.timer) {
clearInterval($rootScope.timer);
$rootScope.timer = null;
}
// Make the correct tab active

View File

@ -107,6 +107,7 @@ function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routePa
// Save
scope.formSave = function() {
generator.clearApiErrors();
Rest.setUrl(defaultUrl);
var data = {}
for (var fld in form.fields) {
@ -252,6 +253,7 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
// Save changes to the parent
scope.formSave = function() {
generator.clearApiErrors();
Rest.setUrl(defaultUrl + id + '/');
var data = {}
for (var fld in form.fields) {

View File

@ -130,7 +130,7 @@ function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routePa
// Save
scope.formSave = function() {
generator.clearApiErrors();
try {
// Make sure we have valid variable data
if (scope.inventoryParseType == 'json') {
@ -257,6 +257,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
$location.path('/inventories');
});
scope.formSave = function() {
generator.clearApiErrors();
SaveInventory({ scope: scope });
}

View File

@ -197,6 +197,7 @@ function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeP
// Save
scope.formSave = function() {
generator.clearApiErrors();
var data = {}
try {
// Make sure we have valid variable data
@ -467,6 +468,7 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route
// Save changes to the parent
scope.formSave = function() {
generator.clearApiErrors();
var data = {}
try {
// Make sure we have valid variable data

View File

@ -397,6 +397,7 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
// Save changes to the parent
scope.formSave = function() {
generator.clearApiErrors();
Rest.setUrl(defaultUrl + $routeParams.id + '/');
var data = {}
for (var fld in form.fields) {

View File

@ -91,6 +91,7 @@ function OrganizationsAdd ($scope, $rootScope, $compile, $location, $log, $route
// Save
scope.formSave = function() {
form.clearApiErrors();s
var url = GetBasePath(base);
url += (base != 'organizations') ? $routeParams['project_id'] + '/organizations/' : '';
Rest.setUrl(url);
@ -182,6 +183,7 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout
// Save changes to the parent
scope.formSave = function() {
generator.clearApiErrors();
var params = {};
for (var fld in form.fields) {
params[fld] = scope[fld];

View File

@ -109,6 +109,7 @@ function PermissionsAdd ($scope, $rootScope, $compile, $location, $log, $routePa
// Save
scope.formSave = function() {
generator.clearApiErrors();
if (scope.PermissionAddAllowed) {
var data = {};
for (var fld in form.fields) {
@ -245,6 +246,7 @@ function PermissionsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
// Save changes to the parent
scope.formSave = function() {
generator.clearApiErrors();
var data = {}
for (var fld in form.fields) {
data[fld] = scope[fld];

View File

@ -198,6 +198,7 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam
// Save
scope.formSave = function() {
generator.clearApiErrors();
var data = {};
for (var fld in form.fields) {
if (form.fields[fld].type == 'checkbox_group') {
@ -333,7 +334,7 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
scope.project_local_paths = opts;
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;
scope.auth_required = (scope.scm_type && (scope.scm_username || scope.scm_password || scope.scm_key_data)) ? true : false;
master.auth_required = scope.auth_required;
});
@ -377,6 +378,8 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
}
master['scm_type'] = scope['scm_type'];
master['auth_required'] = scope['auth_required'];
scope.scmBranchLabel = (scope.scm_type && scope.scm_type.value && scope.scm_type.value == 'svn') ? 'Revision #' : 'SCM Branch';
setAskCheckboxes();
@ -393,6 +396,7 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
// Save changes to the parent
scope.formSave = function() {
generator.clearApiErrors();
$rootScope.flashMessage = null;
var params = {};
for (var fld in form.fields) {

View File

@ -119,6 +119,7 @@ function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams,
// Save
scope.formSave = function() {
generator.clearApiErrors();
Rest.setUrl(defaultUrl);
var data = {}
for (var fld in form.fields) {
@ -228,6 +229,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
// Save changes to the parent
scope.formSave = function() {
generator.clearApiErrors();
$rootScope.flashMessage = null;
Rest.setUrl(defaultUrl + $routeParams.team_id +'/');
var data = {}

View File

@ -120,6 +120,7 @@ function UsersAdd ($scope, $rootScope, $compile, $location, $log, $routeParams,
// Save
scope.formSave = function() {
generator.clearApiErrors();
if (scope.organization !== undefined && scope.organization !== null && scope.organization !== '') {
Rest.setUrl(defaultUrl + scope.organization + '/users/');
var data = {}
@ -250,6 +251,7 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
// Save changes to the parent
scope.formSave = function() {
generator.clearApiErrors();
$rootScope.flashMessage = null;
Rest.setUrl(defaultUrl + id + '/');
var data = {}

View File

@ -141,7 +141,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
}
if (!this.scope.$$phase) {
this.scope.$digest();
}
}
return this.scope;
},
@ -160,7 +160,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
reset: function() {
// The form field values cannot be reset with jQuery. Each field is tied to a model, so to clear the field
// value, you have clear the model.
// value, you have to clear the model.
this.scope[this.form.name + '_form'].$setPristine();
for (var fld in this.form.fields) {
if (this.form.fields[fld].type == 'checkbox_group') {
@ -284,27 +284,19 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
return html;
},
/*button: function(btn, topOrBottom) {
// pass in a button object and get back an html string containing
// a <button> element.
var html = '';
for (var i=0; i < btn.position.length; i++) {
if (btn.position[i].indexOf(topOrBottom) >= 0) {
html += "<button type=\"button\" ";
html += "class=\"btn";
html += (btn['class']) ? " " + btn['class'] : "";
if (btn.position[i] == 'top-right' || btn.position[i] == 'bottom-right') {
html += " " + "pull-right";
}
html += "\" ";
html += (btn.ngClick) ? this.attr(btn, 'ngClick') : "";
html += ">" + this.attr(btn, 'icon');
html += " " + btn.label;
html += "</button>\n";
clearApiErrors: function() {
for (fld in this.form.fields) {
if (this.form.fields[fld].sourceModel) {
this.scope[this.form.fields[fld].sourceModel + '_' + this.form.fields[fld].sourceField + '_api_error'] = '';
}
else {
this.scope[fld + '_api_error'] = '';
}
}
return html;
},*/
if (!this.scope.$$phase) {
this.scope.$digest();
}
},
button: Button,