mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 19:30:39 -03:30
Fixed up organizations/job templates list
This commit is contained in:
parent
81805c780f
commit
8da10a9183
@ -6,11 +6,11 @@
|
||||
|
||||
export default ['$scope', '$rootScope', '$location', '$log',
|
||||
'$stateParams', 'Rest', 'Alert', 'Prompt', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
|
||||
'GetBasePath', 'JobTemplateForm', 'InitiatePlaybookRun', 'Wait',
|
||||
'GetBasePath', 'JobTemplateForm', 'InitiatePlaybookRun', 'Wait', 'TemplateCopyService',
|
||||
'$compile', '$state', 'OrgJobTemplateList', 'OrgJobTemplateDataset', 'QuerySet',
|
||||
function($scope, $rootScope, $location, $log,
|
||||
$stateParams, Rest, Alert, Prompt, ReturnToCaller, ClearScope, ProcessErrors,
|
||||
GetBasePath, JobTemplateForm, InitiatePlaybookRun, Wait,
|
||||
GetBasePath, JobTemplateForm, InitiatePlaybookRun, Wait, TemplateCopyService,
|
||||
$compile, $state, OrgJobTemplateList, Dataset, qs) {
|
||||
|
||||
var list = OrgJobTemplateList,
|
||||
@ -71,12 +71,8 @@ export default ['$scope', '$rootScope', '$location', '$log',
|
||||
});
|
||||
}
|
||||
|
||||
$scope.addJobTemplate = function() {
|
||||
$state.go('jobTemplates.add');
|
||||
};
|
||||
|
||||
$scope.editJobTemplate = function(id) {
|
||||
$state.go('jobTemplates.edit', { id: id });
|
||||
$state.go('templates.editJobTemplate', { job_template_id: id });
|
||||
};
|
||||
|
||||
$scope.submitJob = function(id) {
|
||||
@ -87,8 +83,23 @@ export default ['$scope', '$rootScope', '$location', '$log',
|
||||
$state.go('jobTemplateSchedules', { id: id });
|
||||
};
|
||||
|
||||
$scope.formCancel = function() {
|
||||
$state.go('organizations');
|
||||
$scope.copyTemplate = function(id) {
|
||||
Wait('start');
|
||||
TemplateCopyService.get(id)
|
||||
.success(function(res){
|
||||
TemplateCopyService.set(res)
|
||||
.success(function(res){
|
||||
Wait('stop');
|
||||
if(res.type && res.type === 'job_template') {
|
||||
$state.go('templates.editJobTemplate', {job_template_id: res.id}, {reload: true});
|
||||
}
|
||||
});
|
||||
})
|
||||
.error(function(res, status){
|
||||
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
|
||||
msg: 'Call failed. Return status: '+ status});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -295,13 +295,24 @@ export default [{
|
||||
delete list.actions;
|
||||
// @issue Why is the delete action unavailable in this view?
|
||||
delete list.fieldActions.delete;
|
||||
list.emptyListText = "This list is populated by job templates added from the <a ui-sref='jobTemplates.add'>Job Templates</a> section";
|
||||
delete list.fields.type;
|
||||
list.listTitle = N_('Job Templates');
|
||||
list.emptyListText = "This list is populated by job templates added from the <a ui-sref='templates.addJobTemplate'>Job Templates</a> section";
|
||||
list.searchSize = "col-lg-12 col-md-12 col-sm-12 col-xs-12";
|
||||
list.iterator = 'job_template';
|
||||
list.name = 'job_templates';
|
||||
list.basePath = "job_templates";
|
||||
list.fields.type.ngBind = "job_template.type_label";
|
||||
list.fields.smart_status.ngInclude = "'/static/partials/organizations-job-template-smart-status.html'";
|
||||
list.fields.name.ngHref = '#/templates/job_template/{{job_template.id}}';
|
||||
list.fieldActions.submit.ngClick = 'submitJob(job_template.id)';
|
||||
list.fieldActions.submit.ngShow = 'job_template.summary_fields.user_capabilities.start';
|
||||
list.fieldActions.schedule.ngClick = 'scheduleJob(job_template.id)';
|
||||
list.fieldActions.copy.ngClick = 'copyTemplate(job_template.id)';
|
||||
list.fieldActions.copy.ngShow = 'job_template.summary_fields.user_capabilities.copy';
|
||||
list.fieldActions.edit.ngClick = "editJobTemplate(job_template.id)";
|
||||
list.fieldActions.edit.ngShow = 'job_template.summary_fields.user_capabilities.edit';
|
||||
list.fieldActions.view.ngClick = "editJobTemplate(job_template.id)";
|
||||
list.fieldActions.view.ngShow = '!job_template.summary_fields.user_capabilities.edit';
|
||||
return list;
|
||||
}],
|
||||
OrgJobTemplateDataset: ['OrgJobTemplateList', 'QuerySet', '$stateParams', 'GetBasePath',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user