Files
awx/ansibleworks/ui/static/js/forms/Jobs.js

212 lines
7.5 KiB
JavaScript

/*********************************************
* Copyright (c) 2013 AnsibleWorks, Inc.
*
* Jobs.js
* Form definition for Jobs model
*
* @dict
*/
angular.module('JobFormDefinition', [])
.value(
'JobForm', {
addTitle: 'Create Job', //Legend in add mode
editTitle: '{{ name }}', //Legend in edit mode
name: 'jobs',
well: true,
twoColumns: true,
fields: {
name: {
label: 'Name',
type: 'text',
addRequired: true,
editRequired: true,
column: 1
},
description: {
label: 'Description',
type: 'text',
addRequired: false,
editRequired: false,
column: 1
},
job_type: {
label: 'Job Type',
type: 'select',
ngOptions: 'type.label for type in job_type_options',
"default": 'run',
addRequired: true,
editRequired: true,
column: 1
},
inventory: {
label: 'Inventory',
type: 'lookup',
sourceModel: 'inventory',
sourceField: 'name',
addRequired: true,
editRequired: true,
ngClick: 'lookUpInventory()',
column: 1
},
project: {
label: 'Project',
type: 'lookup',
sourceModel: 'project',
sourceField: 'name',
addRequired: true,
editRequired: true,
ngClick: 'lookUpProject()',
column: 1
},
playbook: {
label: 'Playbook',
type:'select',
ngOptions: 'book for book in playbook_options',
id: 'playbook-select',
addRequired: true,
editRequired: true,
column: 1
},
credential: {
label: 'Credential',
type: 'lookup',
sourceModel: 'credential',
sourceField: 'name',
ngClick: 'lookUpCredential()',
addRequired: false,
editRequired: false,
column: 2
},
forks: {
label: 'Forks',
id: 'forks-number',
type: 'number',
integer: true,
min: 0,
max: 100,
slider: true,
"class": 'input-mini',
"default": '0',
addRequired: false,
editRequired: false,
column: 2,
awPopOver: "<p>The number of parallel or simultaneous processes to use while executing the playbook. Provide a value between 0 and 100. " +
"A value of zero will use the ansible default setting of 5 parallel processes.</p>",
dataTitle: 'Forks',
dataPlacement: 'left'
},
limit: {
label: 'Limit',
type: 'text',
addRequired: false,
editRequired: false,
column: 2,
awPopOver: "<p>Provide a host pattern to further constrain the list of hosts that will be managed or affected by the playbook. " +
"Multiple patterns can be separated by &#59; &#58; or &#44;</p><p>For more information and examples see the " +
"<a href=\"http://ansible.cc/docs/patterns.html#selecting-targets\" target=\"_blank\">Selecting Targets section</a> under Inventory and Patterns " +
" in the Ansible documentation.</p>",
dataTitle: 'Forks',
dataPlacement: 'left'
},
verbosity: {
label: 'Verbosity',
type: 'select',
ngOptions: 'v.label for v in verbosity_options',
"default": 0,
addRequired: true,
editRequired: true,
column: 2,
awPopOver: "<p>Control the level of output ansible will produce as the playbook executes.</p>",
dataTitle: 'Verbosity',
dataPlacement: 'left'
},
extra_vars: {
label: 'Extra Variables',
type: 'textarea',
rows: 6,
"class": 'span12',
addRequired: false,
editRequired: false,
awPopOver: "<p>Pass extra command line variables to the playbook. This is the -e or --extra-vars command line parameter " +
"for ansible-playbook. Provide key=value pairs or JSON. <p><a href=\"http://www.ansibleworks.com/docs/playbooks2.html" +
"#passing-variables-on-the-command-line\" target=\"_blank\">Click here to view documentation and examples.</a></p>",
column: 2
}
},
buttons: { //for now always generates <button> tags
save: {
label: 'Save',
icon: 'icon-ok',
"class": 'btn-success',
ngClick: 'formSave()', //$scope.function to call on click, optional
ngDisabled: true //Disable when $pristine or $invalid, optional
},
reset: {
ngClick: 'formReset()',
label: 'Reset',
icon: 'icon-remove',
ngDisabled: true //Disabled when $pristine
}
},
statusFields: {
status: {
label: 'Job Status <span class="job-detail-status job-\{\{ status \}\}"><i class="icon-circle"></i> \{\{ status \}\}</span>',
type: 'text',
readonly: true,
control: false
},
result_stdout: {
label: 'Standard Out',
type: 'textarea',
readonly: true,
rows: 20,
"class": 'span12'
},
result_traceback: {
label: 'Traceback',
type: 'textarea',
readonly: true,
rows: 10,
"class": 'span12',
ngShow: "result_traceback != ''"
}
},
statusActions: {
refresh: {
label: 'Refresh',
icon: 'icon-refresh',
ngClick: "refresh()",
"class": 'btn-small btn-success',
awToolTip: 'Refresh job status &amp; output',
mode: 'all'
},
summary: {
label: 'Hosts',
icon: 'icon-th-large',
ngClick: "jobSummary()",
"class": 'btn-info btn-small',
awToolTip: 'View host summary',
mode: 'all'
},
events: {
label: 'Events',
icon: 'icon-list-ul',
ngClick: "jobEvents()",
"class": 'btn-info btn-small',
awToolTip: 'Edit job events',
mode: 'all'
}
},
related: { //related colletions (and maybe items?)
}
}); //Form