From 66862abd0c7bd0fdaeeb0a743824e380fce686ab Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Mon, 19 May 2014 11:24:29 -0400 Subject: [PATCH] Tweaked inventory group delete help link and text. --- awx/ui/static/js/helpers/Groups.js | 55 ++-------------------- awx/ui/static/partials/inventory-edit.html | 2 +- 2 files changed, 6 insertions(+), 51 deletions(-) diff --git a/awx/ui/static/js/helpers/Groups.js b/awx/ui/static/js/helpers/Groups.js index c4b12cdd49..625b8a68f1 100644 --- a/awx/ui/static/js/helpers/Groups.js +++ b/awx/ui/static/js/helpers/Groups.js @@ -1290,8 +1290,9 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched scope.deleteOption = "preserve-all"; - scope.helpText = "
Delete
Remove from inventory all groups and hosts associated with the group being deleted. " + - "If a group or host is associated with other groups, it will not be removed from the inventory.
\n" + + scope.helpText = "
Delete
Deletes all groups and hosts associated with the group being deleted. " + + "If a group or host is associated with other groups, it will still exist within those groups. Otherwise, " + + "the associated groups and hosts will no longer appear in the inventory.
\n" + "
Promote
Groups and hosts associated with the group being removed will be promoted one level.
\n" + "
esc or click to close
"; @@ -1436,53 +1437,6 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched }); }); - /*if (scope.removeDeleteNextGroup) { - scope.removeDeleteNextGroup(); - } - scope.removeDeleteNextGroup = scope.$on('DeleteNextGroup', function() { - var group, - url = GetBasePath('inventory') + scope.inventory_id + '/groups/'; - if (groups && groups.length > 0) { - group = groups.pop(); - // GetBasePath('groups') + group.id + '/' - Rest.setUrl(url); - Rest.post({ id: group.id, disassociate: 1 }) - .success(function() { - scope.$emit('DeleteNextGroup'); - }) - .error( function(data, status) { - $log.error('Failed to delete group ' + group.group_id + '. Status: ' + status); - scope.$emit('DeleteNextGroup'); - }); - } - else { - scope.$emit('ChildDeleteFinished'); - } - }); - */ - - /*if (scope.removeDeleteNextHost) { - scope.removeDeleteNextHost(); - } - scope.removeDeleteNextHost = scope.$on('DeleteNextHost', function() { - var host; - if (hosts && hosts.length > 0) { - host = hosts.pop(); - Rest.setUrl(GetBasePath('hosts') + host.id + '/'); - Rest.destroy() - .success(function() { - scope.$emit('DeleteNextHost'); - }) - .error( function(data, status) { - $log.error('Failed to delete host ' + host.id + '. Status: ' + status); - scope.$emit('DeleteNextHost'); - }); - } - else { - scope.$emit('DeleteNextGroup'); - } - });*/ - scope.cancel = function() { $('#group-delete-dialog').dialog('close'); }; @@ -1490,7 +1444,8 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched scope.performDelete = function() { $('#group-delete-dialog').dialog('close'); Wait('start'); - if (scope.deleteOption === 'delete-all') { + if (scope.deleteOption === 'delete-all' || (scope.groupsCount === 0 && scope.hostsCount === 0)) { + // If user chooses Delete or there are no children, send DELETE request scope.$emit('DeleteGroup'); } else { diff --git a/awx/ui/static/partials/inventory-edit.html b/awx/ui/static/partials/inventory-edit.html index 99db9ed344..adcd7b9415 100644 --- a/awx/ui/static/partials/inventory-edit.html +++ b/awx/ui/static/partials/inventory-edit.html @@ -97,7 +97,7 @@ -