mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
implement model based copy for projects
This commit is contained in:
parent
e5fd483d06
commit
779385ddb6
@ -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) {
|
||||
// Refresh the project list
|
||||
var project = Find({ list: $scope.projects, key: 'id', val: id });
|
||||
|
||||
@ -100,6 +100,15 @@ export default ['i18n', function(i18n) {
|
||||
dataPlacement: 'top',
|
||||
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: {
|
||||
ngClick: "editProject(project.id)",
|
||||
awToolTip: i18n._('Edit the project'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user