mirror of
https://github.com/ansible/awx.git
synced 2026-03-09 13:39:27 -02:30
AC-1259 inventory delete/promote.
This commit is contained in:
@@ -1290,6 +1290,11 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
|||||||
|
|
||||||
scope.deleteOption = "preserve-all";
|
scope.deleteOption = "preserve-all";
|
||||||
|
|
||||||
|
scope.helpText = "<dl><dt>Delete</dt><dd>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.</dd>\n" +
|
||||||
|
"<dt style=\"margin-top: 5px;\">Promote</dt><dd>Groups and hosts associated with the group being removed will be promoted one level.</dd></dl>\n" +
|
||||||
|
"<div class=\"popover-footer\"><span class=\"key\">esc</span> or click to close</div>";
|
||||||
|
|
||||||
buttonSet = [{
|
buttonSet = [{
|
||||||
label: "Cancel",
|
label: "Cancel",
|
||||||
onClick: function() {
|
onClick: function() {
|
||||||
@@ -1389,14 +1394,10 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
|||||||
scope.$emit('ChildrenReady');
|
scope.$emit('ChildrenReady');
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.cancel = function() {
|
if (scope.removeDisassociateGroup) {
|
||||||
$('#group-delete-dialog').dialog('close');
|
scope.removeDisassociateGroup();
|
||||||
};
|
|
||||||
|
|
||||||
if (scope.removeChildDeleteFinished) {
|
|
||||||
scope.removeChildDeleteFinished();
|
|
||||||
}
|
}
|
||||||
scope.removeChildDeleteFinished = scope.$on('ChildDeleteFinished', function() {
|
scope.removeDisassociateGroup = scope.$on('DisassociateGroup', function() {
|
||||||
var url = GetBasePath('inventory') + scope.inventory_id + '/groups/';
|
var url = GetBasePath('inventory') + scope.inventory_id + '/groups/';
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.post({ id: node.group_id, disassociate: 1 })
|
Rest.post({ id: node.group_id, disassociate: 1 })
|
||||||
@@ -1410,7 +1411,32 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (scope.removeDeleteNextGroup) {
|
if (scope.removeDeleteGroup) {
|
||||||
|
scope.removeDeleteGroup();
|
||||||
|
}
|
||||||
|
scope.removeDeleteGroup = scope.$on('DeleteGroup', function() {
|
||||||
|
var parent, url;
|
||||||
|
if (node.parent === 0) {
|
||||||
|
// this is a top level group
|
||||||
|
url = GetBasePath('inventory') + scope.inventory_id + '/groups/' + node.group_id + '/';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
parent = Find({ list: scope.groups, key: 'id', val: node.parent });
|
||||||
|
url = GetBasePath('groups') + parent.group_id + '/children/' + node.group_id + '/';
|
||||||
|
}
|
||||||
|
Rest.setUrl(url);
|
||||||
|
Rest.destroy()
|
||||||
|
.success( function() {
|
||||||
|
scope.$emit('GroupDeleteCompleted'); // Signal a group refresh to start
|
||||||
|
})
|
||||||
|
.error( function(data, status) {
|
||||||
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Call to ' + url + ' failed. DELETE returned: ' + status
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/*if (scope.removeDeleteNextGroup) {
|
||||||
scope.removeDeleteNextGroup();
|
scope.removeDeleteNextGroup();
|
||||||
}
|
}
|
||||||
scope.removeDeleteNextGroup = scope.$on('DeleteNextGroup', function() {
|
scope.removeDeleteNextGroup = scope.$on('DeleteNextGroup', function() {
|
||||||
@@ -1433,8 +1459,9 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
|||||||
scope.$emit('ChildDeleteFinished');
|
scope.$emit('ChildDeleteFinished');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
if (scope.removeDeleteNextHost) {
|
/*if (scope.removeDeleteNextHost) {
|
||||||
scope.removeDeleteNextHost();
|
scope.removeDeleteNextHost();
|
||||||
}
|
}
|
||||||
scope.removeDeleteNextHost = scope.$on('DeleteNextHost', function() {
|
scope.removeDeleteNextHost = scope.$on('DeleteNextHost', function() {
|
||||||
@@ -1454,16 +1481,20 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
|||||||
else {
|
else {
|
||||||
scope.$emit('DeleteNextGroup');
|
scope.$emit('DeleteNextGroup');
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
|
scope.cancel = function() {
|
||||||
|
$('#group-delete-dialog').dialog('close');
|
||||||
|
};
|
||||||
|
|
||||||
scope.performDelete = function() {
|
scope.performDelete = function() {
|
||||||
$('#group-delete-dialog').dialog('close');
|
$('#group-delete-dialog').dialog('close');
|
||||||
Wait('start');
|
Wait('start');
|
||||||
if (scope.deleteOption === 'delete-all') {
|
if (scope.deleteOption === 'delete-all') {
|
||||||
scope.$emit('DeleteNextHost');
|
scope.$emit('DeleteGroup');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope.$emit('ChildDeleteFinished');
|
scope.$emit('DisassociateGroup');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -57,44 +57,50 @@
|
|||||||
<span ng-show="groupsCount > 0 && hostsCount > 0"> This group contains {{ groupsCount }} groups and {{ hostsCount }} hosts. </span>
|
<span ng-show="groupsCount > 0 && hostsCount > 0"> This group contains {{ groupsCount }} groups and {{ hostsCount }} hosts. </span>
|
||||||
<span ng-show="groupsCount == 0 && hostsCount > 0"> This group contains {{ hostsCount }} hosts. </span>
|
<span ng-show="groupsCount == 0 && hostsCount > 0"> This group contains {{ hostsCount }} hosts. </span>
|
||||||
<span ng-show="groupsCopunt > 0 && hostsCount == 0"> This group contains {{ groupsCount }} groups. </span>
|
<span ng-show="groupsCopunt > 0 && hostsCount == 0"> This group contains {{ groupsCount }} groups. </span>
|
||||||
Delete or preserve the group's children?</p>
|
Delete or promote the group's children?</p>
|
||||||
<div style="width: 50%; margin: 15px auto;">
|
<div style="width: 50%; margin: 15px auto;">
|
||||||
|
|
||||||
<div class="radio" ng-show="groupsCount > 0 && hostsCount > 0">
|
<div class="radio" ng-show="groupsCount > 0 && hostsCount > 0">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" ng-model="deleteOption" name="delete_option1" value="preserve-all"> Preserve groups and hosts
|
<input type="radio" ng-model="deleteOption" name="delete_option1" value="preserve-all"> Promote groups and hosts
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="radio" ng-show="groupsCount > 0 && hostsCount > 0">
|
<div class="radio" ng-show="groupsCount > 0 && hostsCount > 0">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" ng-model="deleteOption" name="delete_option1" value="delete-all"> Delete groups and hosts
|
<input type="radio" ng-model="deleteOption" name="delete_option1" value="delete-all"> Delete groups and hosts
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="radio" ng-show="groupsCount > 0 && hostsCount == 0">
|
<div class="radio" ng-show="groupsCount > 0 && hostsCount == 0">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" ng-model="deleteOption" name="delete_option2" value="preserve-all"> Preserve groups
|
<input type="radio" ng-model="deleteOption" name="delete_option2" value="preserve-all"> Promote groups
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="radio" ng-show="groupsCount > 0 && hostsCount == 0">
|
<div class="radio" ng-show="groupsCount > 0 && hostsCount == 0">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" ng-model="deleteOption" name="delete_option2" value="delete-all"> Delete groups
|
<input type="radio" ng-model="deleteOption" name="delete_option2" value="delete-all"> Delete groups
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="radio" ng-show="groupsCount == 0 && hostsCount > 0">
|
<div class="radio" ng-show="groupsCount == 0 && hostsCount > 0">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" ng-model="deleteOption" name="delete_option3" value="preserve-all"> Preserve hosts
|
<input type="radio" ng-model="deleteOption" name="delete_option3" value="preserve-all"> Promote hosts
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="radio" ng-show="groupsCount == 0 && hostsCount > 0">
|
<div class="radio" ng-show="groupsCount == 0 && hostsCount > 0">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" ng-model="deleteOption" name="delete_option3" value="delete-all"> Delete hosts
|
<input type="radio" ng-model="deleteOption" name="delete_option3" value="delete-all"> Delete hosts
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="help-container">
|
||||||
|
<a href="" id="awp-promote" href="" aw-pop-over="{{ helpText }}" aw-tool-tip="Click for help" aw-pop-over-watch="helpText" data-placement="top" data-container="body" data-title="Help" class="help-link"><i class="fa fa-question-circle"></i> click for help</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="groupsCount == 0 && hostsCount == 0">
|
<div ng-show="groupsCount == 0 && hostsCount == 0">
|
||||||
<div class="alert alert-info">Delete group <em>{{ group_name }}</em>?</div>
|
<div class="alert alert-info">Delete group <em>{{ group_name }}</em>?</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user