mirror of
https://github.com/ansible/awx.git
synced 2026-05-18 06:47:41 -02:30
Merge pull request #540 from mabashian/6370-delete-inv-src
Delete inv source hosts before inv source
This commit is contained in:
@@ -9,12 +9,12 @@
|
|||||||
'ViewUpdateStatus', 'rbacUiControlService', 'GetBasePath',
|
'ViewUpdateStatus', 'rbacUiControlService', 'GetBasePath',
|
||||||
'GetSyncStatusMsg', 'Dataset', 'Find', 'QuerySet',
|
'GetSyncStatusMsg', 'Dataset', 'Find', 'QuerySet',
|
||||||
'inventoryData', '$filter', 'Prompt', 'Wait', 'SourcesService', 'inventorySourceOptions',
|
'inventoryData', '$filter', 'Prompt', 'Wait', 'SourcesService', 'inventorySourceOptions',
|
||||||
'canAdd', 'hasSyncableSources', 'i18n',
|
'canAdd', 'hasSyncableSources', 'i18n', 'ProcessErrors',
|
||||||
function($scope, $rootScope, $state, $stateParams, SourcesListDefinition,
|
function($scope, $rootScope, $state, $stateParams, SourcesListDefinition,
|
||||||
InventoryUpdate, CancelSourceUpdate,
|
InventoryUpdate, CancelSourceUpdate,
|
||||||
ViewUpdateStatus, rbacUiControlService, GetBasePath, GetSyncStatusMsg,
|
ViewUpdateStatus, rbacUiControlService, GetBasePath, GetSyncStatusMsg,
|
||||||
Dataset, Find, qs, inventoryData, $filter, Prompt,
|
Dataset, Find, qs, inventoryData, $filter, Prompt,
|
||||||
Wait, SourcesService, inventorySourceOptions, canAdd, hasSyncableSources, i18n){
|
Wait, SourcesService, inventorySourceOptions, canAdd, hasSyncableSources, i18n, ProcessErrors){
|
||||||
|
|
||||||
let list = SourcesListDefinition;
|
let list = SourcesListDefinition;
|
||||||
var inventory_source;
|
var inventory_source;
|
||||||
@@ -121,6 +121,7 @@
|
|||||||
var action = function(){
|
var action = function(){
|
||||||
delete $rootScope.promptActionBtnClass;
|
delete $rootScope.promptActionBtnClass;
|
||||||
Wait('start');
|
Wait('start');
|
||||||
|
SourcesService.deleteHosts(inventory_source.id).then(() => {
|
||||||
SourcesService.delete(inventory_source.id).then(() => {
|
SourcesService.delete(inventory_source.id).then(() => {
|
||||||
$('#prompt-modal').modal('hide');
|
$('#prompt-modal').modal('hide');
|
||||||
let reloadListStateParams = null;
|
let reloadListStateParams = null;
|
||||||
@@ -135,6 +136,27 @@
|
|||||||
$state.go('.', reloadListStateParams, {reload: true});
|
$state.go('.', reloadListStateParams, {reload: true});
|
||||||
}
|
}
|
||||||
Wait('stop');
|
Wait('stop');
|
||||||
|
})
|
||||||
|
.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. Returned status: ') +
|
||||||
|
status
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.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 hosts. Returned status: ') +
|
||||||
|
status
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// Prompt depends on having $rootScope.promptActionBtnClass available...
|
// Prompt depends on having $rootScope.promptActionBtnClass available...
|
||||||
|
|||||||
@@ -132,6 +132,15 @@ export default
|
|||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
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'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
|
|||||||
Reference in New Issue
Block a user