Add source control branch to prompt launch

Add source control branch to prompt launch.

Also, add missing tooltips for `JobTemplateForm`.

closes: https://github.com/ansible/awx/issues/7011
This commit is contained in:
nixocio 2020-05-15 08:42:27 -04:00
parent c2c6f2a197
commit 226dac7b24
4 changed files with 37 additions and 0 deletions

View File

@ -45,6 +45,7 @@ function LaunchPrompt({ config, resource, onLaunch, onCancel, i18n }) {
setValue('job_tags', values.job_tags);
setValue('skip_tags', values.skip_tags);
setValue('extra_vars', mergeExtraVars(values.extra_vars, surveyValues));
setValue('scm_branch', values.scm_branch);
onLaunch(postValues);
};

View File

@ -34,6 +34,16 @@ function OtherPromptsStep({ config, i18n }) {
information and examples on patterns.`)}
/>
)}
{config.ask_scm_branch_on_launch && (
<FormField
id="prompt-scm-branch"
name="scm_branch"
label={i18n._(t`Source Control Branch`)}
tooltip={i18n._(
t`Select a branch for the workflow. This branch is applied to all job template nodes that prompt for a branch`
)}
/>
)}
{config.ask_verbosity_on_launch && <VerbosityField i18n={i18n} />}
{config.ask_diff_mode_on_launch && <ShowChangesToggle i18n={i18n} />}
{config.ask_tags_on_launch && (

View File

@ -48,6 +48,26 @@ describe('OtherPromptsStep', () => {
);
});
test('should render source control branch field', async () => {
let wrapper;
await act(async () => {
wrapper = mountWithContexts(
<Formik>
<OtherPromptsStep
config={{
ask_scm_branch_on_launch: true,
}}
/>
</Formik>
);
});
expect(wrapper.find('FormField#prompt-scm-branch')).toHaveLength(1);
expect(
wrapper.find('FormField#prompt-scm-branch input').prop('name')
).toEqual('scm_branch');
});
test('should render verbosity field', async () => {
let wrapper;
await act(async () => {

View File

@ -278,6 +278,9 @@ function JobTemplateForm({
label={i18n._(t`Source Control Branch`)}
promptId="template-ask-scm-branch-on-launch"
promptName="ask_scm_branch_on_launch"
tooltip={i18n._(
t`Select a branch for the job template. This branch is applied to all job template nodes that prompt for a branch.`
)}
>
<TextInput
id="template-scm-branch"
@ -344,6 +347,9 @@ function JobTemplateForm({
name="extra_vars"
label={i18n._(t`Variables`)}
promptId="template-ask-variables-on-launch"
tooltip={i18n._(
t`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 using either YAML or JSON. Refer to the Ansible Tower documentation for example syntax.`
)}
/>
<FormColumnLayout>
<FormField