From 51ef37518396101228771985e1852a2b70eb1cf7 Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Wed, 8 May 2013 16:26:21 -0400 Subject: [PATCH] Team add/edit now working. Temporarily disabled organization name lookup on Team and Inventory lists. This will get fixed with AC-93 -add summary fields to response. --- lib/ui/static/js/controllers/Teams.js | 10 +++++----- lib/ui/static/js/forms/Groups.js | 4 ++-- lib/ui/static/js/forms/Hosts.js | 4 ++-- lib/ui/static/js/forms/Inventories.js | 4 ++-- lib/ui/static/js/forms/Organizations.js | 4 ++-- lib/ui/static/js/forms/Teams.js | 4 ++-- lib/ui/static/js/helpers/refresh.js | 14 ++------------ 7 files changed, 17 insertions(+), 27 deletions(-) diff --git a/lib/ui/static/js/controllers/Teams.js b/lib/ui/static/js/controllers/Teams.js index 4507b7a773..c9eddba899 100644 --- a/lib/ui/static/js/controllers/Teams.js +++ b/lib/ui/static/js/controllers/Teams.js @@ -24,7 +24,7 @@ function TeamsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Ale var scope = view.inject(list, { mode: mode }); // Inject our view scope.selected = []; - SetTeamListeners({ scope: scope, set: 'teams', iterator: list.iterator }); + //SetTeamListeners({ scope: scope, set: 'teams', iterator: list.iterator }); SearchInit({ scope: scope, set: 'teams', list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl }); scope.search(list.iterator); @@ -199,7 +199,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, var defaultUrl='/api/v1/teams/'; var generator = GenerateForm; - var form = InventoryForm; + var form = TeamForm; var scope = generator.inject(form, {mode: 'edit', related: true}); generator.reset(); var base = $location.path().replace(/^\//,'').split('/')[0]; @@ -209,7 +209,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, TeamLookUpOrganizationInit({ scope: scope }); - // After inventory is loaded, retrieve each related set and any lookups + // Retrieve each related set and any lookups scope.$on('teamLoaded', function() { Rest.setUrl(scope['organization_url']); Rest.get() @@ -231,6 +231,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, Rest.get({ params: {id: id} }) .success( function(data, status, headers, config) { LoadBreadCrumbs({ path: '/teams/' + id, title: data.name }); + console.log(data); for (var fld in form.fields) { if (data[fld]) { scope[fld] = data[fld]; @@ -243,7 +244,6 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, relatedSets[set] = { url: related[set], iterator: form.related[set].iterator }; } } - // 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 }); @@ -265,7 +265,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, Rest.put(data) .success( function(data, status, headers, config) { var base = $location.path().replace(/^\//,'').split('/')[0]; - (base == 'inventories') ? ReturnToCaller() : ReturnToCaller(1); + (base == 'teams') ? ReturnToCaller() : ReturnToCaller(1); }) .error( function(data, status, headers, config) { ProcessErrors(scope, data, status, form, diff --git a/lib/ui/static/js/forms/Groups.js b/lib/ui/static/js/forms/Groups.js index 71e9fb5acf..549de8a61d 100644 --- a/lib/ui/static/js/forms/Groups.js +++ b/lib/ui/static/js/forms/Groups.js @@ -25,8 +25,8 @@ angular.module('GroupFormDefinition', []) description: { label: 'Description', type: 'text', - addRequired: true, - editRequired: true + addRequired: false, + editRequired: false }, inventory: { label: 'Inventory', diff --git a/lib/ui/static/js/forms/Hosts.js b/lib/ui/static/js/forms/Hosts.js index 171b5ad5af..1b8c3de10b 100644 --- a/lib/ui/static/js/forms/Hosts.js +++ b/lib/ui/static/js/forms/Hosts.js @@ -25,8 +25,8 @@ angular.module('HostFormDefinition', []) description: { label: 'Description', type: 'text', - addRequired: true, - editRequired: true + addRequired: false, + editRequired: false }, inventory: { label: 'Inventory', diff --git a/lib/ui/static/js/forms/Inventories.js b/lib/ui/static/js/forms/Inventories.js index 819f281ce4..ccd2918c74 100644 --- a/lib/ui/static/js/forms/Inventories.js +++ b/lib/ui/static/js/forms/Inventories.js @@ -26,8 +26,8 @@ angular.module('InventoryFormDefinition', []) description: { label: 'Description', type: 'text', - addRequired: true, - editRequired: true + addRequired: false, + editRequired: false }, organization: { label: 'Organization', diff --git a/lib/ui/static/js/forms/Organizations.js b/lib/ui/static/js/forms/Organizations.js index ca280c322f..e9fc0a97ce 100644 --- a/lib/ui/static/js/forms/Organizations.js +++ b/lib/ui/static/js/forms/Organizations.js @@ -26,8 +26,8 @@ angular.module('OrganizationFormDefinition', []) description: { label: 'Description', type: 'text', - addRequired: true, - editRequired: true + addRequired: false, + editRequired: false } }, diff --git a/lib/ui/static/js/forms/Teams.js b/lib/ui/static/js/forms/Teams.js index 3a90f110e2..f529ec662d 100644 --- a/lib/ui/static/js/forms/Teams.js +++ b/lib/ui/static/js/forms/Teams.js @@ -26,8 +26,8 @@ angular.module('TeamFormDefinition', []) description: { label: 'Description', type: 'text', - addRequired: true, - editRequired: true + addRequired: false, + editRequired: false }, organization: { label: 'Organization', diff --git a/lib/ui/static/js/helpers/refresh.js b/lib/ui/static/js/helpers/refresh.js index 757cf2a9ed..21f54c6762 100644 --- a/lib/ui/static/js/helpers/refresh.js +++ b/lib/ui/static/js/helpers/refresh.js @@ -32,18 +32,8 @@ angular.module('RefreshHelper', ['RestServices', 'Utilities']) scope[iterator + 'PrevUrl'] = data.previous; scope[iterator + 'Count'] = data.count; scope[iterator + 'PageCount'] = Math.ceil((data.count / scope[iterator + 'PageSize'])); - if (set == 'inventories') { - lookup_results = []; - scope.$emit('refreshFinished', data['results']); - } - else if (set == 'teams') { - lookup_results = []; - scope.$emit('TeamRefreshFinished', data['results']); - } - else { - scope[iterator + 'SearchSpin'] = false; - scope[set] = data['results']; - } + scope[iterator + 'SearchSpin'] = false; + scope[set] = data['results']; }) .error ( function(data, status, headers, config) { scope[iterator + 'SearchSpin'] = true;