mirror of
https://github.com/ansible/awx.git
synced 2026-03-26 21:35:01 -02:30
implement model based copy for projects
This commit is contained in:
@@ -154,6 +154,21 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert',
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.copyProject = project => {
|
||||||
|
Wait('start');
|
||||||
|
new Project('get', project.id)
|
||||||
|
.then(model => model.copy())
|
||||||
|
.then(({ id }) => {
|
||||||
|
const params = { project_id: id };
|
||||||
|
$state.go('projects.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.showSCMStatus = function(id) {
|
$scope.showSCMStatus = function(id) {
|
||||||
// Refresh the project list
|
// Refresh the project list
|
||||||
var project = Find({ list: $scope.projects, key: 'id', val: id });
|
var project = Find({ list: $scope.projects, key: 'id', val: id });
|
||||||
|
|||||||
@@ -100,6 +100,15 @@ export default ['i18n', function(i18n) {
|
|||||||
dataPlacement: 'top',
|
dataPlacement: 'top',
|
||||||
ngShow: "project.summary_fields.user_capabilities.schedule"
|
ngShow: "project.summary_fields.user_capabilities.schedule"
|
||||||
},
|
},
|
||||||
|
copy: {
|
||||||
|
label: i18n._('Copy'),
|
||||||
|
ngClick: 'copyProject(project)',
|
||||||
|
"class": 'btn-danger btn-xs',
|
||||||
|
awToolTip: i18n._('Copy project'),
|
||||||
|
dataPlacement: 'top',
|
||||||
|
// requires future api rbac changes
|
||||||
|
//ngShow: 'project.summary_fields.user_capabilities.copy'
|
||||||
|
},
|
||||||
edit: {
|
edit: {
|
||||||
ngClick: "editProject(project.id)",
|
ngClick: "editProject(project.id)",
|
||||||
awToolTip: i18n._('Edit the project'),
|
awToolTip: i18n._('Edit the project'),
|
||||||
|
|||||||
Reference in New Issue
Block a user