Latest inventory tree updates. Now using root_groups to retrieve top-level inventory groups. Ajax group load now works -hosts and subgroups loading. Need to add sorting, but all works.

This commit is contained in:
chouseknecht
2013-05-15 17:24:49 -04:00
parent 01ec33ec8f
commit 1bc85f608c
6 changed files with 135 additions and 74 deletions

View File

@@ -162,9 +162,9 @@ function GroupsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams,
data[fld] = scope[fld];
}
//if ($routeParams.group_id) {
// data['inventory'] = $routeParams.inventory_id;
//}
if ($routeParams.inventory_id) {
data['inventory'] = $routeParams.inventory_id;
}
Rest.post(data)
.success( function(data, status, headers, config) {
@@ -197,11 +197,11 @@ function GroupsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams
var generator = GenerateForm;
var form = GroupForm;
var defaultUrl = GetBasePath('groups') + $routeParams.id + '/';
var defaultUrl = GetBasePath('groups') + $routeParams.group_id + '/';
var scope = generator.inject(form, {mode: 'edit', related: true});
generator.reset();
var master = {};
var id = $routeParams.id;
var id = $routeParams.group_id;
var relatedSets = {};
// After the Organization is loaded, retrieve each related set
@@ -238,7 +238,7 @@ function GroupsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
{ hdr: 'Error!', msg: 'Failed to retrieve group: ' + $routeParams.id + '. GET status: ' + status });
{ hdr: 'Error!', msg: 'Failed to retrieve group: ' + id + '. GET status: ' + status });
});
// Save changes to the parent
@@ -255,7 +255,7 @@ function GroupsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
{ hdr: 'Error!', msg: 'Failed to update group: ' + $routeParams.id + '. PUT status: ' + status });
{ hdr: 'Error!', msg: 'Failed to update group: ' + id + '. PUT status: ' + status });
});
};

View File

@@ -160,11 +160,9 @@ function HostsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams,
for (var fld in form.fields) {
data[fld] = scope[fld];
}
if ($routeParams.group_id) {
if ($routeParams.inventory_id) {
data['inventory'] = $routeParams.inventory_id;
}
Rest.post(data)
.success( function(data, status, headers, config) {
ReturnToCaller(1);
@@ -201,7 +199,7 @@ function HostsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
var scope = generator.inject(form, {mode: 'edit', related: true});
generator.reset();
var master = {};
var id = $routeParams.id;
var id = $routeParams.host_id;
var relatedSets = {};
// After form data loads, load related sets and lookups
@@ -235,7 +233,7 @@ function HostsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
{ hdr: 'Error!', msg: 'Failed to retrieve host: ' + $routeParams.id + '. GET status: ' + status });
{ hdr: 'Error!', msg: 'Failed to retrieve host: ' + id + '. GET status: ' + status });
});
// Save changes to the parent
@@ -251,7 +249,7 @@ function HostsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
{ hdr: 'Error!', msg: 'Failed to update host: ' + $routeParams.id + '. PUT status: ' + status });
{ hdr: 'Error!', msg: 'Failed to update host: ' + id + '. PUT status: ' + status });
});
};

View File

@@ -166,6 +166,9 @@ function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routePa
for (var fld in form.fields) {
data[fld] = scope[fld];
}
if ($routeParams.inventory_id) {
data.inventory = $routeParams.inventory_id;
}
Rest.post(data)
.success( function(data, status, headers, config) {
ReturnToCaller();