mirror of
https://github.com/ansible/awx.git
synced 2026-03-02 17:28:51 -03:30
implement model based copy for inventory scripts
This commit is contained in:
@@ -57,6 +57,15 @@ export default ['i18n', function(i18n){
|
|||||||
dataPlacement: 'top',
|
dataPlacement: 'top',
|
||||||
ngShow: 'inventory_script.summary_fields.user_capabilities.edit'
|
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: {
|
view: {
|
||||||
ngClick: "editCustomInv(inventory_script.id)",
|
ngClick: "editCustomInv(inventory_script.id)",
|
||||||
label: i18n._('View'),
|
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) {
|
$scope.deleteCustomInv = function(id, name) {
|
||||||
|
|
||||||
var action = function() {
|
var action = function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user