1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

Internationalized workflow related forms

This commit is contained in:
Michael Abashian 2016-11-10 17:27:07 -05:00
parent ca32c34036
commit c3a3b2662e
2 changed files with 64 additions and 57 deletions

View File

@ -10,10 +10,16 @@
* @description This form is for adding/editing a Job Template
*/
// export default
// angular.module('WorkflowMakerFormDefinition', [])
//
// .value ('WorkflowMakerFormObject', {
export default
angular.module('WorkflowMakerFormDefinition', [])
.value ('WorkflowMakerFormObject', {
.factory('WorkflowMakerFormObject', ['i18n', function(i18n) {
return {
addTitle: '',
editTitle: '',
@ -25,23 +31,23 @@ export default
fields: {
edgeType: {
label: 'Type',
label: i18n._('Type'),
type: 'radio_group',
ngShow: 'selectedTemplate && showTypeOptions',
ngDisabled: '!canAddWorkflowJobTemplate',
options: [
{
label: 'On Success',
label: i18n._('On Success'),
value: 'success',
ngShow: '!edgeTypeRestriction || edgeTypeRestriction === "successFailure"'
},
{
label: 'On Failure',
label: i18n._('On Failure'),
value: 'failure',
ngShow: '!edgeTypeRestriction || edgeTypeRestriction === "successFailure"'
},
{
label: 'Always',
label: i18n._('Always'),
value: 'always',
ngShow: '!edgeTypeRestriction || edgeTypeRestriction === "always"'
}
@ -51,16 +57,16 @@ export default
}
},
credential: {
label: 'Credential',
label: i18n._('Credential'),
type: 'lookup',
sourceModel: 'credential',
sourceField: 'name',
ngClick: 'lookUpCredential()',
requiredErrorMsg: "Please select a Credential.",
requiredErrorMsg: i18n._("Please select a Credential."),
class: 'Form-formGroup--fullWidth',
awPopOver: "<p>Select the credential you want the job to use when accessing the remote hosts. Choose the credential containing " +
" the username and SSH key or password that Ansible will need to log into the remote hosts.</p>",
dataTitle: 'Credential',
awPopOver: i18n._("<p>Select the credential you want the job to use when accessing the remote hosts. Choose the credential containing " +
" the username and SSH key or password that Ansible will need to log into the remote hosts.</p>"),
dataTitle: i18n._('Credential'),
dataPlacement: 'right',
dataContainer: "body",
ngShow: "selectedTemplate.ask_credential_on_launch",
@ -70,17 +76,17 @@ export default
}
},
inventory: {
label: 'Inventory',
label: i18n._('Inventory'),
type: 'lookup',
sourceModel: 'inventory',
sourceField: 'name',
list: 'OrganizationList',
basePath: 'organization',
ngClick: 'lookUpInventory()',
requiredErrorMsg: "Please select an Inventory.",
requiredErrorMsg: i18n._("Please select an Inventory."),
class: 'Form-formGroup--fullWidth',
awPopOver: "<p>Select the inventory containing the hosts you want this job to manage.</p>",
dataTitle: 'Inventory',
awPopOver: i18n._("<p>Select the inventory containing the hosts you want this job to manage.</p>"),
dataTitle: i18n._('Inventory'),
dataPlacement: 'right',
dataContainer: "body",
ngShow: "selectedTemplate.ask_inventory_on_launch",
@ -90,16 +96,16 @@ export default
}
},
job_type: {
label: 'Job Type',
label: i18n._('Job Type'),
type: 'select',
ngOptions: 'type.label for type in job_type_options track by type.value',
"default": 0,
class: 'Form-formGroup--fullWidth',
awPopOver: "<p>When this template is submitted as a job, setting the type to <em>run</em> will execute the playbook, running tasks " +
awPopOver: i18n._("<p>When this template is submitted as a job, setting the type to <em>run</em> will execute the playbook, running tasks " +
" on the selected hosts.</p> <p>Setting the type to <em>check</em> will not execute the playbook. Instead, <code>ansible</code> will check playbook " +
" syntax, test environment setup and report problems.</p> <p>Setting the type to <em>scan</em> will execute the playbook and store any " +
" scanned facts for use with Tower's System Tracking feature.</p>",
dataTitle: 'Job Type',
" scanned facts for use with Tower's System Tracking feature.</p>"),
dataTitle: i18n._('Job Type'),
dataPlacement: 'right',
dataContainer: "body",
ngShow: "selectedTemplate.ask_job_type_on_launch",
@ -109,43 +115,43 @@ export default
}
},
limit: {
label: 'Limit',
label: i18n._('Limit'),
type: 'text',
class: 'Form-formGroup--fullWidth',
awPopOver: "<p>Provide a host pattern to further constrain the list of hosts that will be managed or affected by the playbook. " +
awPopOver: i18n._("<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 " +
"<a href=\"http://docs.ansible.com/intro_patterns.html\" target=\"_blank\">the Patterns topic at docs.ansible.com</a>.</p>",
dataTitle: 'Limit',
"<a href=\"http://docs.ansible.com/intro_patterns.html\" target=\"_blank\">the Patterns topic at docs.ansible.com</a>.</p>"),
dataTitle: i18n._('Limit'),
dataPlacement: 'right',
dataContainer: "body",
ngShow: "selectedTemplate.ask_limit_on_launch",
ngDisabled: '!canAddWorkflowJobTemplate'
},
job_tags: {
label: 'Job Tags',
label: i18n._('Job Tags'),
type: 'textarea',
rows: 5,
'elementClass': 'Form-textInput',
class: 'Form-formGroup--fullWidth',
awPopOver: "<p>Provide a comma separated list of tags.</p>\n" +
awPopOver: i18n._("<p>Provide a comma separated list of tags.</p>\n" +
"<p>Tags are useful when you have a large playbook, and you want to run a specific part of a play or task.</p>" +
"<p>Consult the Ansible documentation for further details on the usage of tags.</p>",
dataTitle: "Job Tags",
"<p>Consult the Ansible documentation for further details on the usage of tags.</p>"),
dataTitle: i18n._("Job Tags"),
dataPlacement: "right",
dataContainer: "body",
ngShow: "selectedTemplate.ask_tags_on_launch",
ngDisabled: '!canAddWorkflowJobTemplate'
},
skip_tags: {
label: 'Skip Tags',
label: i18n._('Skip Tags'),
type: 'textarea',
rows: 5,
'elementClass': 'Form-textInput',
class: 'Form-formGroup--fullWidth',
awPopOver: "<p>Provide a comma separated list of tags.</p>\n" +
awPopOver: i18n._("<p>Provide a comma separated list of tags.</p>\n" +
"<p>Skip tags are useful when you have a large playbook, and you want to skip specific parts of a play or task.</p>" +
"<p>Consult the Ansible documentation for further details on the usage of tags.</p>",
dataTitle: "Skip Tags",
"<p>Consult the Ansible documentation for further details on the usage of tags.</p>"),
dataTitle: i18n._("Skip Tags"),
dataPlacement: "right",
dataContainer: "body",
ngShow: "selectedTemplate.ask_skip_tags_on_launch",
@ -167,7 +173,7 @@ export default
ngShow: 'canAddWorkflowJobTemplate'
}
}
})
};}])
.factory('WorkflowMakerForm', ['WorkflowMakerFormObject', 'NotificationsList', function(WorkflowMakerFormObject, NotificationsList) {
return function() {
var itm;

View File

@ -13,9 +13,10 @@
export default
angular.module('WorkflowFormDefinition', [])
.value ('WorkflowFormObject', {
.factory('WorkflowFormObject', ['i18n', function(i18n) {
return {
addTitle: 'New Workflow',
addTitle: i18n._('New Workflow'),
editTitle: '{{ name }}',
name: 'workflow_job_template',
base: 'workflow',
@ -27,57 +28,57 @@ export default
fields: {
name: {
label: 'Name',
label: i18n._('Name'),
type: 'text',
required: true,
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)',
column: 1
},
description: {
label: 'Description',
label: i18n._('Description'),
type: 'text',
column: 1,
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)'
},
organization: {
label: 'Organization',
label: i18n._('Organization'),
type: 'lookup',
sourceModel: 'organization',
basePath: 'organizations',
list: 'OrganizationList',
sourceField: 'name',
dataTitle: 'Organization',
dataTitle: i18n._('Organization'),
dataContainer: 'body',
dataPlacement: 'right',
column: 1,
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)'
},
labels: {
label: 'Labels',
label: i18n._('Labels'),
type: 'select',
class: 'Form-formGroup--fullWidth',
ngOptions: 'label.label for label in labelOptions track by label.value',
multiSelect: true,
dataTitle: 'Labels',
dataTitle: i18n._('Labels'),
dataPlacement: 'right',
awPopOver: "<p>Optional labels that describe this job template, such as 'dev' or 'test'. Labels can be used to group and filter job templates and completed jobs in the Tower display.</p>",
awPopOver: i18n._("<p>Optional labels that describe this job template, such as 'dev' or 'test'. Labels can be used to group and filter job templates and completed jobs in the Tower display.</p>"),
dataContainer: 'body',
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)'
},
variables: {
label: 'Extra Variables',
label: i18n._('Extra Variables'),
type: 'textarea',
class: 'Form-textAreaLabel Form-formGroup--fullWidth',
rows: 6,
"default": "---",
column: 2,
awPopOver: "<p>Pass extra command line variables to the playbook. This is the <code>-e</code> or <code>--extra-vars</code> command line parameter " +
awPopOver: i18n._("<p>Pass extra command line variables to the playbook. This is the <code>-e</code> or <code>--extra-vars</code> command line parameter " +
"for <code>ansible-playbook</code>. Provide key/value pairs using either YAML or JSON.</p>" +
"JSON:<br />\n" +
"<blockquote>{<br />&emsp;\"somevar\": \"somevalue\",<br />&emsp;\"password\": \"magic\"<br /> }</blockquote>\n" +
"YAML:<br />\n" +
"<blockquote>---<br />somevar: somevalue<br />password: magic<br /></blockquote>\n",
dataTitle: 'Extra Variables',
"<blockquote>---<br />somevar: somevalue<br />password: magic<br /></blockquote>\n"),
dataTitle: i18n._('Extra Variables'),
dataPlacement: 'right',
dataContainer: "body",
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)' // TODO: get working
@ -102,18 +103,20 @@ export default
related: {
permissions: {
awToolTip: 'Please save before assigning permissions',
awToolTip: i18n._('Please save before assigning permissions'),
dataPlacement: 'top',
basePath: 'job_templates/:id/access_list/',
basePath: 'api/v1/workflow_job_templates/{{$stateParams.workflow_job_template_id}}/access_list/',
search: {
order_by: 'username'
},
type: 'collection',
title: 'Permissions',
title: i18n._('Permissions'),
iterator: 'permission',
index: false,
open: false,
searchType: 'select',
actions: {
add: {
ngClick: "addPermission",
ngClick: "$state.go('.add')",
label: 'Add',
awToolTip: 'Add a permission',
actionClass: 'btn List-buttonSubmit',
@ -134,14 +137,12 @@ export default
type: 'role',
noSort: true,
class: 'col-lg-4 col-md-4 col-sm-4 col-xs-4',
searchable: false
},
team_roles: {
label: 'Team Roles',
type: 'team_roles',
noSort: true,
class: 'col-lg-5 col-md-5 col-sm-5 col-xs-4',
searchable: false
}
}
},
@ -155,23 +156,23 @@ export default
ngClick: 'addSurvey()',
ngShow: '!survey_exists',
awFeature: 'surveys',
awToolTip: 'Please save before adding a survey',
awToolTip: i18n._('Please save before adding a survey'),
dataPlacement: 'top',
label: 'Add Survey',
label: i18n._('Add Survey'),
class: 'Form-primaryButton'
},
edit_survey: {
ngClick: 'editSurvey()',
awFeature: 'surveys',
ngShow: 'survey_exists',
label: 'Edit Survey',
label: i18n._('Edit Survey'),
class: 'Form-primaryButton'
},
workflow_editor: {
ngClick: 'openWorkflowMaker()',
awToolTip: 'Please save before defining the workflow graph',
awToolTip: i18n._('Please save before defining the workflow graph'),
dataPlacement: 'top',
label: 'Workflow Editor',
label: i18n._('Workflow Editor'),
class: 'Form-primaryButton'
}
},
@ -188,7 +189,7 @@ export default
}
};
}
})
};}])
.factory('WorkflowForm', ['WorkflowFormObject', 'NotificationsList',
function(WorkflowFormObject, NotificationsList) {