mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
implement model based copy for inventory scripts
This commit is contained in:
parent
d56f1a0120
commit
a680d188c0
@ -57,6 +57,15 @@ export default ['i18n', function(i18n){
|
||||
dataPlacement: 'top',
|
||||
ngShow: 'inventory_script.summary_fields.user_capabilities.edit'
|
||||
},
|
||||
copy: {
|
||||
label: i18n._('Copy'),
|
||||
ngClick: 'copyCustomInv(inventory_script)',
|
||||
"class": 'btn-danger btn-xs',
|
||||
awToolTip: i18n._('Copy inventory scruot'),
|
||||
dataPlacement: 'top',
|
||||
// requires future api rbac changes
|
||||
//ngShow: 'inventory_script.summary_fields.user_capabilities.copy'
|
||||
},
|
||||
view: {
|
||||
ngClick: "editCustomInv(inventory_script.id)",
|
||||
label: i18n._('View'),
|
||||
|
||||
@ -47,6 +47,21 @@ export default ['$rootScope', '$scope', 'Wait', 'InventoryScriptsList',
|
||||
});
|
||||
};
|
||||
|
||||
$scope.copyCustomInv = inventoryScript => {
|
||||
Wait('start');
|
||||
new InventoryScript('get', inventoryScript.id)
|
||||
.then(model => model.copy())
|
||||
.then(({ id }) => {
|
||||
const params = { inventory_script_id: id };
|
||||
$state.go('inventoryScripts.edit', params, { reload: true });
|
||||
})
|
||||
.catch(({ data, status }) => {
|
||||
const params = { hdr: 'Error!', msg: `Call to copy failed. Return status: ${status}` };
|
||||
ProcessErrors($scope, data, status, null, params);
|
||||
})
|
||||
.finally(() => Wait('stop'));
|
||||
};
|
||||
|
||||
$scope.deleteCustomInv = function(id, name) {
|
||||
|
||||
var action = function() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user