mirror of
https://github.com/ansible/awx.git
synced 2026-04-04 17:55:06 -02:30
Fixes bug where the delete inventory event would wipe or reset inventory form fields
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function InventoriesList($scope,
|
function InventoriesList($scope,
|
||||||
$filter, Rest, InventoryList, Prompt,
|
$filter, qs, InventoryList, Prompt,
|
||||||
ProcessErrors, GetBasePath, Wait, $state,
|
ProcessErrors, GetBasePath, Wait, $state,
|
||||||
Dataset, canAdd, i18n, Inventory, InventoryHostsStrings,
|
Dataset, canAdd, i18n, Inventory, InventoryHostsStrings,
|
||||||
ngToast) {
|
ngToast) {
|
||||||
@@ -168,24 +168,31 @@ function InventoriesList($scope,
|
|||||||
inventory.pending_deletion = true;
|
inventory.pending_deletion = true;
|
||||||
}
|
}
|
||||||
if (data.status === 'deleted') {
|
if (data.status === 'deleted') {
|
||||||
let reloadListStateParams = null;
|
let reloadListStateParams = _.cloneDeep($state.params);
|
||||||
|
|
||||||
if($scope.inventories.length === 1 && $state.params.inventory_search && _.has($state, 'params.inventory_search.page') && $state.params.inventory_search.page !== '1') {
|
if($scope.inventories.length === 1 && $state.params.inventory_search && _.hasIn($state, 'params.inventory_search.page') && $state.params.inventory_search.page !== '1') {
|
||||||
reloadListStateParams = _.cloneDeep($state.params);
|
|
||||||
reloadListStateParams.inventory_search.page = (parseInt(reloadListStateParams.inventory_search.page)-1).toString();
|
reloadListStateParams.inventory_search.page = (parseInt(reloadListStateParams.inventory_search.page)-1).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseInt($state.params.inventory_id) === data.inventory_id || parseInt($state.params.smartinventory_id) === data.inventory_id) {
|
if (parseInt($state.params.inventory_id) === data.inventory_id || parseInt($state.params.smartinventory_id) === data.inventory_id) {
|
||||||
$state.go("inventories", reloadListStateParams, {reload: true});
|
$state.go("inventories", reloadListStateParams, {reload: true});
|
||||||
} else {
|
} else {
|
||||||
$state.go('.', reloadListStateParams, {reload: true});
|
Wait('start');
|
||||||
|
$state.go('.', reloadListStateParams);
|
||||||
|
const path = GetBasePath($scope.list.basePath) || GetBasePath($scope.list.name);
|
||||||
|
qs.search(path, reloadListStateParams.inventory_search)
|
||||||
|
.then((searchResponse) => {
|
||||||
|
$scope.inventories_dataset = searchResponse.data;
|
||||||
|
$scope.inventories = searchResponse.data.results;
|
||||||
|
})
|
||||||
|
.finally(() => Wait('stop'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ['$scope',
|
export default ['$scope',
|
||||||
'$filter', 'Rest', 'InventoryList', 'Prompt',
|
'$filter', 'QuerySet', 'InventoryList', 'Prompt',
|
||||||
'ProcessErrors', 'GetBasePath', 'Wait',
|
'ProcessErrors', 'GetBasePath', 'Wait',
|
||||||
'$state', 'Dataset', 'canAdd', 'i18n', 'InventoryModel',
|
'$state', 'Dataset', 'canAdd', 'i18n', 'InventoryModel',
|
||||||
'InventoryHostsStrings', 'ngToast', InventoriesList
|
'InventoryHostsStrings', 'ngToast', InventoriesList
|
||||||
|
|||||||
Reference in New Issue
Block a user