mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
When deleting a source, delete the source's groups too
This commit is contained in:
parent
5e37d6ea7e
commit
9d39ac83f9
@ -117,11 +117,14 @@
|
||||
$state.go('inventories.edit.inventory_sources.edit', {inventory_source_id: id});
|
||||
};
|
||||
$scope.deleteSource = function(inventory_source){
|
||||
var body = '<div class=\"Prompt-bodyQuery\">' + i18n._('Are you sure you want to permanently delete the inventory source below from the inventory?') + '</div><div class=\"Prompt-bodyTarget\">' + $filter('sanitize')(inventory_source.name) + '</div>';
|
||||
var body = '<div class=\"Prompt-bodyQuery\">' + i18n._('Are you sure you want to permanently delete the inventory source below from the inventory? Groups and hosts associated with this inventory source will be deleted as well.') + '</div><div class=\"Prompt-bodyTarget\">' + $filter('sanitize')(inventory_source.name) + '</div>';
|
||||
var action = function(){
|
||||
delete $rootScope.promptActionBtnClass;
|
||||
$rootScope.promptActionBtnClass = "Modal-errorButton--sourcesDelete";
|
||||
Wait('start');
|
||||
SourcesService.deleteHosts(inventory_source.id).then(() => {
|
||||
Wait('start');
|
||||
SourcesService.deleteGroups(inventory_source.id).then(() => {
|
||||
Wait('start');
|
||||
SourcesService.delete(inventory_source.id).then(() => {
|
||||
$('#prompt-modal').modal('hide');
|
||||
let reloadListStateParams = null;
|
||||
@ -148,6 +151,17 @@
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(({data, status}) => {
|
||||
$('#prompt-modal').modal('hide');
|
||||
Wait('stop');
|
||||
ProcessErrors($scope, data, status, null,
|
||||
{
|
||||
hdr: i18n._('Error!'),
|
||||
msg: i18n._('There was an error deleting inventory source groups. Returned status: ') +
|
||||
status
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(({data, status}) => {
|
||||
$('#prompt-modal').modal('hide');
|
||||
Wait('stop');
|
||||
|
@ -134,13 +134,20 @@ export default
|
||||
}
|
||||
},
|
||||
deleteHosts(id) {
|
||||
Wait('start');
|
||||
this.url = GetBasePath('inventory_sources') + id + '/hosts/';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.destroy()
|
||||
.success(this.success.bind(this))
|
||||
.error(this.error.bind(this))
|
||||
.finally(Wait('stop'));
|
||||
.finally();
|
||||
},
|
||||
deleteGroups(id) {
|
||||
this.url = GetBasePath('inventory_sources') + id + '/groups/';
|
||||
Rest.setUrl(this.url);
|
||||
return Rest.destroy()
|
||||
.success(this.success.bind(this))
|
||||
.error(this.error.bind(this))
|
||||
.finally();
|
||||
}
|
||||
};
|
||||
}];
|
||||
|
@ -97,6 +97,10 @@
|
||||
color: @btn-txt-sel;
|
||||
}
|
||||
|
||||
.Modal-errorButton--sourcesDelete:hover{
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.Modal-primaryButton {
|
||||
background-color: @default-link;
|
||||
color: @default-bg;
|
||||
|
Loading…
Reference in New Issue
Block a user