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.

This commit is contained in:
chouseknecht
2013-05-08 16:26:21 -04:00
parent e5057fbd83
commit 51ef375183
7 changed files with 17 additions and 27 deletions

View File

@@ -24,7 +24,7 @@ function TeamsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Ale
var scope = view.inject(list, { mode: mode }); // Inject our view var scope = view.inject(list, { mode: mode }); // Inject our view
scope.selected = []; 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 }); SearchInit({ scope: scope, set: 'teams', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl });
scope.search(list.iterator); scope.search(list.iterator);
@@ -199,7 +199,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
var defaultUrl='/api/v1/teams/'; var defaultUrl='/api/v1/teams/';
var generator = GenerateForm; var generator = GenerateForm;
var form = InventoryForm; var form = TeamForm;
var scope = generator.inject(form, {mode: 'edit', related: true}); var scope = generator.inject(form, {mode: 'edit', related: true});
generator.reset(); generator.reset();
var base = $location.path().replace(/^\//,'').split('/')[0]; var base = $location.path().replace(/^\//,'').split('/')[0];
@@ -209,7 +209,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
TeamLookUpOrganizationInit({ scope: scope }); 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() { scope.$on('teamLoaded', function() {
Rest.setUrl(scope['organization_url']); Rest.setUrl(scope['organization_url']);
Rest.get() Rest.get()
@@ -231,6 +231,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
Rest.get({ params: {id: id} }) Rest.get({ params: {id: id} })
.success( function(data, status, headers, config) { .success( function(data, status, headers, config) {
LoadBreadCrumbs({ path: '/teams/' + id, title: data.name }); LoadBreadCrumbs({ path: '/teams/' + id, title: data.name });
console.log(data);
for (var fld in form.fields) { for (var fld in form.fields) {
if (data[fld]) { if (data[fld]) {
scope[fld] = 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 }; relatedSets[set] = { url: related[set], iterator: form.related[set].iterator };
} }
} }
// Initialize related search functions. Doing it here to make sure relatedSets object is populated. // Initialize related search functions. Doing it here to make sure relatedSets object is populated.
RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets }); RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets });
RelatedPaginateInit({ scope: scope, relatedSets: relatedSets }); RelatedPaginateInit({ scope: scope, relatedSets: relatedSets });
@@ -265,7 +265,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
Rest.put(data) Rest.put(data)
.success( function(data, status, headers, config) { .success( function(data, status, headers, config) {
var base = $location.path().replace(/^\//,'').split('/')[0]; var base = $location.path().replace(/^\//,'').split('/')[0];
(base == 'inventories') ? ReturnToCaller() : ReturnToCaller(1); (base == 'teams') ? ReturnToCaller() : ReturnToCaller(1);
}) })
.error( function(data, status, headers, config) { .error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form, ProcessErrors(scope, data, status, form,

View File

@@ -25,8 +25,8 @@ angular.module('GroupFormDefinition', [])
description: { description: {
label: 'Description', label: 'Description',
type: 'text', type: 'text',
addRequired: true, addRequired: false,
editRequired: true editRequired: false
}, },
inventory: { inventory: {
label: 'Inventory', label: 'Inventory',

View File

@@ -25,8 +25,8 @@ angular.module('HostFormDefinition', [])
description: { description: {
label: 'Description', label: 'Description',
type: 'text', type: 'text',
addRequired: true, addRequired: false,
editRequired: true editRequired: false
}, },
inventory: { inventory: {
label: 'Inventory', label: 'Inventory',

View File

@@ -26,8 +26,8 @@ angular.module('InventoryFormDefinition', [])
description: { description: {
label: 'Description', label: 'Description',
type: 'text', type: 'text',
addRequired: true, addRequired: false,
editRequired: true editRequired: false
}, },
organization: { organization: {
label: 'Organization', label: 'Organization',

View File

@@ -26,8 +26,8 @@ angular.module('OrganizationFormDefinition', [])
description: { description: {
label: 'Description', label: 'Description',
type: 'text', type: 'text',
addRequired: true, addRequired: false,
editRequired: true editRequired: false
} }
}, },

View File

@@ -26,8 +26,8 @@ angular.module('TeamFormDefinition', [])
description: { description: {
label: 'Description', label: 'Description',
type: 'text', type: 'text',
addRequired: true, addRequired: false,
editRequired: true editRequired: false
}, },
organization: { organization: {
label: 'Organization', label: 'Organization',

View File

@@ -32,18 +32,8 @@ angular.module('RefreshHelper', ['RestServices', 'Utilities'])
scope[iterator + 'PrevUrl'] = data.previous; scope[iterator + 'PrevUrl'] = data.previous;
scope[iterator + 'Count'] = data.count; scope[iterator + 'Count'] = data.count;
scope[iterator + 'PageCount'] = Math.ceil((data.count / scope[iterator + 'PageSize'])); scope[iterator + 'PageCount'] = Math.ceil((data.count / scope[iterator + 'PageSize']));
if (set == 'inventories') { scope[iterator + 'SearchSpin'] = false;
lookup_results = []; scope[set] = data['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'];
}
}) })
.error ( function(data, status, headers, config) { .error ( function(data, status, headers, config) {
scope[iterator + 'SearchSpin'] = true; scope[iterator + 'SearchSpin'] = true;