AC-536 No longer dissaociating hosts from /inventories/N/groups, so no more cases where dragging-n-dropping groups results in lost hosts. Fixed tree styling to better align nodes.

This commit is contained in:
Chris Houseknecht
2013-11-05 20:37:51 +00:00
parent 09e64e3685
commit be74d9d932
2 changed files with 25 additions and 20 deletions

View File

@@ -1060,7 +1060,7 @@ input[type="checkbox"].checkbox-no-label {
ul { ul {
list-style-type: none; list-style-type: none;
padding-left: 16px; padding-left: 15px;
} }
.tree-root { .tree-root {
@@ -1105,13 +1105,14 @@ input[type="checkbox"].checkbox-no-label {
.expand-container { .expand-container {
width: 14px; width: 14px;
text-align: center; text-align: left;
} }
.badge-container { .badge-container {
vertical-align: none; vertical-align: none;
padding-top: 2px; padding-top: 2px;
padding-bottom: 2px; padding-bottom: 2px;
margin-left: 3px;
} }
#root-badge-container { #root-badge-container {

View File

@@ -252,12 +252,11 @@ angular.module('TreeSelector', ['Utilities', 'RestServices', 'TreeSelector', 'Gr
var sublist, subicon; var sublist, subicon;
if (childlists && childlists.length > 0) { if (childlists && childlists.length > 0) {
// has childen // has childen
for (var i=0; i < childlists.length; i++) { childlists.each(function(idx) {
sublist = angular.element(childlists[i]); $(this).addClass('hidden');
sublist.addClass('hidden'); subicon = $(this).find('li').first().find('.expand-container i');
subicon = list.find('li')[0].children()[0];
subicon.removeClass('icon-caret-down').addClass('icon-caret-right'); subicon.removeClass('icon-caret-down').addClass('icon-caret-right');
} });
} }
/* When the active node's parent is closed, activate the parent */ /* When the active node's parent is closed, activate the parent */
if ($(parent).find('.active').length > 0) { if ($(parent).find('.active').length > 0) {
@@ -329,19 +328,24 @@ angular.module('TreeSelector', ['Utilities', 'RestServices', 'TreeSelector', 'Gr
scope.removeGroupRemove(); scope.removeGroupRemove();
} }
scope.removeGroupRemove = scope.$on('removeGroup', function() { scope.removeGroupRemove = scope.$on('removeGroup', function() {
var url = (parent.attr('data-group-id')) ? GetBasePath('base') + 'groups/' + parent.attr('data-group-id') + '/children/' : if (parent.attr('data-group-id')) {
GetBasePath('inventory') + inv_id + '/groups/'; // Only remove a group from a parent when the parent is a group and not the inventory root
Rest.setUrl(url); var url = GetBasePath('base') + 'groups/' + parent.attr('data-group-id') + '/children/';
Rest.post({ id: node.attr('data-group-id'), disassociate: 1 }) Rest.setUrl(url);
.success( function(data, status, headers, config) { Rest.post({ id: node.attr('data-group-id'), disassociate: 1 })
cleanUp('success'); .success( function(data, status, headers, config) {
}) cleanUp('success');
.error( function(data, status, headers, config) { })
cleanUp('fail'); .error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, null, cleanUp('fail');
{ hdr: 'Error!', msg: 'Failed to remove ' + node.attr('name') + ' from ' + ProcessErrors(scope, data, status, null,
parent.attr('name') + '. POST returned status: ' + status }); { hdr: 'Error!', msg: 'Failed to remove ' + node.attr('name') + ' from ' +
}); parent.attr('name') + '. POST returned status: ' + status });
});
}
else {
cleanUp('success');
}
}); });
if (scope['addToTargetRemove']) { if (scope['addToTargetRemove']) {