Inventory group delete -implemented disassociate 'all' when deleteing a subgroup and promoting children.

This commit is contained in:
chouseknecht
2014-05-20 14:23:18 -04:00
parent 2055919322
commit 3711409237

View File

@@ -1401,16 +1401,18 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
scope.removeDisassociateGroup();
}
scope.removeDisassociateGroup = scope.$on('DisassociateGroup', function() {
var parent, url;
var data, parent, url;
if (node.parent === 0) {
url = GetBasePath('inventory') + scope.inventory_id + '/groups/';
data = { id: node.group_id, disassociate: 1 };
}
else {
parent = Find({ list: scope.groups, key: 'id', val: node.parent });
url = GetBasePath('groups') + parent.group_id + '/children/';
url = GetBasePath('groups') + parent.group_id + '/children/' + node.group_id + '/';
data = { disassociate: 'all' };
}
Rest.setUrl(url);
Rest.post({ id: node.group_id, disassociate: 1 })
Rest.post(data)
.success(function () {
scope.$emit('GroupDeleteCompleted'); // Signal a group refresh to start
})