diff --git a/lib/static/web/app/js/controllers/Admins.js b/lib/static/web/app/js/controllers/Admins.js
index b483e3a980..c2a86a1c7f 100644
--- a/lib/static/web/app/js/controllers/Admins.js
+++ b/lib/static/web/app/js/controllers/Admins.js
@@ -63,17 +63,25 @@ function AdminsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
});
if (scope.selected.length > 0 ) {
+ var user;
for (var i=0; i < scope.selected.length; i++) {
- //var admin = scope.admins[scope.selected[i]].username;
- Rest.post(scope.admins[scope.selected[i]])
- .success( function(data, status, headers, config) {
- scope.queue.push({ result: 'success', data: data, status: status });
- scope.$emit('callFinished');
- })
- .error( function(data, status, headers, config) {
- scope.queue.push({ result: 'error', data: data, status: status, headers: headers });
- scope.$emit('callFinished');
- });
+ user = null;
+ for (var j=0; j < scope.admins.length; j++) {
+ if (scope.admins[j].id == scope.selected[i]) {
+ user = scope.admins[j];
+ }
+ }
+ if (user !== null) {
+ Rest.post(user)
+ .success( function(data, status, headers, config) {
+ scope.queue.push({ result: 'success', data: data, status: status });
+ scope.$emit('callFinished');
+ })
+ .error( function(data, status, headers, config) {
+ scope.queue.push({ result: 'error', data: data, status: status, headers: headers });
+ scope.$emit('callFinished');
+ });
+ }
}
}
else {
diff --git a/lib/static/web/app/js/controllers/Groups.js b/lib/static/web/app/js/controllers/Groups.js
index 5e2ea80af2..4f30a03cce 100644
--- a/lib/static/web/app/js/controllers/Groups.js
+++ b/lib/static/web/app/js/controllers/Groups.js
@@ -11,8 +11,8 @@
'use strict';
function GroupsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
- Alert, GroupList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit,
- ReturnToCaller, ClearScope)
+ Alert, GroupList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit,
+ PaginateInit, ReturnToCaller, ClearScope, ProcessErrors)
{
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
//scope.
@@ -149,8 +149,7 @@ function GroupsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams
LookUpInventoryInit({ scope: scope });
// After the Organization is loaded, retrieve each related set
- scope.$on('dataLoaded', function() {
-
+ scope.$on('groupLoaded', function() {
Rest.setUrl(scope['inventory_url']);
Rest.get()
.success( function(data, status, headers, config) {
@@ -161,11 +160,9 @@ function GroupsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams
ProcessErrors(scope, data, status, null,
{ hdr: 'Error!', msg: 'Failed to retrieve: ' + scope.orgnization_url + '. GET status: ' + status });
});
-
for (var set in relatedSets) {
scope.search(relatedSets[set].iterator);
}
-
});
// Retrieve detail record and prepopulate the form
@@ -189,7 +186,7 @@ function GroupsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams
RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets });
RelatedPaginateInit({ scope: scope, relatedSets: relatedSets });
scope['inventory_url'] = data.related.inventory;
- scope.$emit('dataLoaded');
+ scope.$emit('groupLoaded');
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
diff --git a/lib/static/web/app/js/controllers/Hosts.js b/lib/static/web/app/js/controllers/Hosts.js
index fdefc49c9c..f4d4bc6fbe 100644
--- a/lib/static/web/app/js/controllers/Hosts.js
+++ b/lib/static/web/app/js/controllers/Hosts.js
@@ -12,7 +12,7 @@
function HostsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
Alert, HostList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit,
- ReturnToCaller, ClearScope)
+ ReturnToCaller, ClearScope, ProcessErrors)
{
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
//scope.
@@ -65,7 +65,7 @@ function HostsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
}
HostsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostList', 'GenerateList',
- 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope' ];
+ 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors' ];
function HostsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, HostForm,
@@ -150,8 +150,7 @@ function HostsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
LookUpInventoryInit({ scope: scope });
// After form data loads, load related sets and lookups
- scope.$on('dataLoaded', function() {
-
+ scope.$on('hostLoaded', function() {
Rest.setUrl(scope['inventory_url']);
Rest.get()
.success( function(data, status, headers, config) {
@@ -162,11 +161,9 @@ function HostsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
ProcessErrors(scope, data, status, null,
{ hdr: 'Error!', msg: 'Failed to retrieve: ' + scope.inventory_url + '. GET status: ' + status });
});
-
for (var set in relatedSets) {
scope.search(relatedSets[set].iterator);
}
-
});
// Retrieve detail record and prepopulate the form
@@ -190,7 +187,7 @@ function HostsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets });
RelatedPaginateInit({ scope: scope, relatedSets: relatedSets });
scope['inventory_url'] = data.related.inventory;
- scope.$emit('dataLoaded');
+ scope.$emit('hostLoaded');
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
diff --git a/lib/static/web/app/js/controllers/Inventories.js b/lib/static/web/app/js/controllers/Inventories.js
index 42439b6979..c1d48d68e2 100644
--- a/lib/static/web/app/js/controllers/Inventories.js
+++ b/lib/static/web/app/js/controllers/Inventories.js
@@ -167,7 +167,7 @@ function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routePa
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
- { hdr: 'Error!', msg: 'Failed to add new user. Post returned status: ' + status });
+ { hdr: 'Error!', msg: 'Failed to add new inventory. Post returned status: ' + status });
});
};
@@ -203,8 +203,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
LookUpOrganizationInit({ scope: scope });
// After inventory is loaded, retrieve each related set and any lookups
- scope.$on('dataLoaded', function() {
-
+ scope.$on('inventoryLoaded', function() {
Rest.setUrl(scope['organization_url']);
Rest.get()
.success( function(data, status, headers, config) {
@@ -215,11 +214,10 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
ProcessErrors(scope, data, status, null,
{ hdr: 'Error!', msg: 'Failed to retrieve: ' + scope.orgnization_url + '. GET status: ' + status });
});
-
for (var set in relatedSets) {
+ console.log('inventory edit set: ' + set);
scope.search(relatedSets[set].iterator);
- }
-
+ }
});
// Retrieve detail record and prepopulate the form
@@ -243,7 +241,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets });
RelatedPaginateInit({ scope: scope, relatedSets: relatedSets });
scope['organization_url'] = data.related.organization;
- scope.$emit('dataLoaded');
+ scope.$emit('inventoryLoaded');
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
@@ -264,7 +262,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
- { hdr: 'Error!', msg: 'Failed to update users: ' + $routeParams.id + '. PUT status: ' + status });
+ { hdr: 'Error!', msg: 'Failed to update inventory: ' + $routeParams.id + '. PUT status: ' + status });
});
};
diff --git a/lib/static/web/app/js/controllers/Organizations.js b/lib/static/web/app/js/controllers/Organizations.js
index e7448fbe0e..d0cb1d32fc 100644
--- a/lib/static/web/app/js/controllers/Organizations.js
+++ b/lib/static/web/app/js/controllers/Organizations.js
@@ -11,7 +11,7 @@
'use strict';
function OrganizationsList ($scope, $rootScope, $location, $log, Rest, Alert, LoadBreadCrumbs, Prompt, GetAPIDefaults,
- GenerateList, OrganizationList, SearchInit, PaginateInit, ClearScope)
+ GenerateList, OrganizationList, SearchInit, PaginateInit, ClearScope, ProcessErrors)
{
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
//scope.
@@ -67,7 +67,7 @@ function OrganizationsList ($scope, $rootScope, $location, $log, Rest, Alert, Lo
}
OrganizationsList.$inject=[ '$scope', '$rootScope', '$location', '$log', 'Rest', 'Alert', 'LoadBreadCrumbs', 'Prompt', 'GetAPIDefaults',
- 'GenerateList', 'OrganizationList', 'SearchInit', 'PaginateInit', 'ClearScope' ];
+ 'GenerateList', 'OrganizationList', 'SearchInit', 'PaginateInit', 'ClearScope', 'ProcessErrors'];
function OrganizationsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, OrganizationForm,
@@ -129,7 +129,7 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout
var relatedSets = {};
// After the Organization is loaded, retrieve each related set
- scope.$on('dataLoaded', function() {
+ scope.$on('organizationLoaded', function() {
for (var set in relatedSets) {
scope.search(relatedSets[set].iterator);
}
@@ -155,7 +155,7 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout
// Initialize related search functions. Doing it here to make sure relatedSets object is populated.
RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets });
RelatedPaginateInit({ scope: scope, relatedSets: relatedSets });
- scope.$emit('dataLoaded');
+ scope.$emit('organizationLoaded');
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
diff --git a/lib/static/web/app/js/controllers/Users.js b/lib/static/web/app/js/controllers/Users.js
index 5986c72c2f..ea944e55c6 100644
--- a/lib/static/web/app/js/controllers/Users.js
+++ b/lib/static/web/app/js/controllers/Users.js
@@ -12,7 +12,7 @@
function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest,
Alert, UserList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit,
- ReturnToCaller, ClearScope)
+ ReturnToCaller, ClearScope, ProcessErrors)
{
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
//scope.
@@ -98,17 +98,25 @@ function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest,
});
if (scope.selected.length > 0 ) {
+ var user;
for (var i=0; i < scope.selected.length; i++) {
- var user = scope.users[scope.selected[i]].username;
- Rest.post(scope.users[scope.selected[i]])
- .success( function(data, status, headers, config) {
- scope.queue.push({ result: 'success', data: data, status: status });
- scope.$emit('callFinished');
- })
- .error( function(data, status, headers, config) {
- scope.queue.push({ result: 'error', data: data, status: status, headers: headers });
- scope.$emit('callFinished');
- });
+ user = null;
+ for (var j=0; j < scope.users.length; j++) {
+ if (scope.users[j].id == scope.selected[i]) {
+ user = scope.users[j];
+ }
+ }
+ if (user !== null) {
+ Rest.post(user)
+ .success( function(data, status, headers, config) {
+ scope.queue.push({ result: 'success', data: data, status: status });
+ scope.$emit('callFinished');
+ })
+ .error( function(data, status, headers, config) {
+ scope.queue.push({ result: 'error', data: data, status: status, headers: headers });
+ scope.$emit('callFinished');
+ });
+ }
}
}
else {
@@ -127,7 +135,7 @@ function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest,
}
UsersList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'UserList', 'GenerateList',
- 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope' ];
+ 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors' ];
function UsersAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, UserForm,
@@ -197,7 +205,7 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
var relatedSets = {};
// After the Organization is loaded, retrieve each related set
- scope.$on('dataLoaded', function() {
+ scope.$on('userLoaded', function() {
for (var set in relatedSets) {
scope.search(relatedSets[set].iterator);
}
@@ -228,7 +236,7 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
// Initialize related search functions. Doing it here to make sure relatedSets object is populated.
RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets });
RelatedPaginateInit({ scope: scope, relatedSets: relatedSets });
- scope.$emit('dataLoaded');
+ scope.$emit('userLoaded');
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
diff --git a/lib/static/web/app/js/forms/Organizations.js b/lib/static/web/app/js/forms/Organizations.js
index e906631048..ca280c322f 100644
--- a/lib/static/web/app/js/forms/Organizations.js
+++ b/lib/static/web/app/js/forms/Organizations.js
@@ -119,7 +119,7 @@ angular.module('OrganizationFormDefinition', [])
class: 'btn-danger'
}
}
- },
+ }
}
diff --git a/lib/static/web/app/lib/ansible/list-generator.js b/lib/static/web/app/lib/ansible/list-generator.js
index 6bdfb999a0..3319ef71f2 100644
--- a/lib/static/web/app/lib/ansible/list-generator.js
+++ b/lib/static/web/app/lib/ansible/list-generator.js
@@ -142,7 +142,7 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
}
}
if (options.mode == 'select') {
- html += " \n";
+ html += " \n";
}
html += "\n";
}