diff --git a/awx/ui/src/screens/Template/JobTemplateDetail/JobTemplateDetail.js b/awx/ui/src/screens/Template/JobTemplateDetail/JobTemplateDetail.js index 32722ed52f..377fad08e6 100644 --- a/awx/ui/src/screens/Template/JobTemplateDetail/JobTemplateDetail.js +++ b/awx/ui/src/screens/Template/JobTemplateDetail/JobTemplateDetail.js @@ -30,8 +30,10 @@ import { LaunchButton } from 'components/LaunchButton'; import { VariablesDetail } from 'components/CodeEditor'; import { JobTemplatesAPI } from 'api'; import useRequest, { useDismissableError } from 'hooks/useRequest'; +import useBrandName from 'hooks/useBrandName'; import ExecutionEnvironmentDetail from 'components/ExecutionEnvironmentDetail'; import { relatedResourceDeleteRequests } from 'util/getRelatedResourceDeleteDetails'; +import jtHelpTextStrings from '../shared/JobTemplate.helptext'; function JobTemplateDetail({ template }) { const { @@ -64,6 +66,8 @@ function JobTemplateDetail({ template }) { } = template; const { id: templateId } = useParams(); const history = useHistory(); + const brandName = useBrandName(); + const helpText = jtHelpTextStrings(brandName); const { isLoading: isLoadingInstanceGroups, @@ -192,6 +196,7 @@ function JobTemplateDetail({ template }) { label={t`Job Type`} value={job_type} dataCy="jt-detail-job-type" + helpText={helpText.jobType} /> {summary_fields.organization ? ( ) : ( !ask_inventory_on_launch && ( @@ -231,6 +237,7 @@ function JobTemplateDetail({ template }) { {summary_fields.project.name} } + helpText={helpText.project} /> ) : ( @@ -238,9 +245,7 @@ function JobTemplateDetail({ template }) { + - {host_config_key && ( <> @@ -290,6 +306,7 @@ function JobTemplateDetail({ template }) { label={t`Provisioning Callback URL`} value={generateCallBackUrl} dataCy="jt-detail-provisioning-callback-url" + helpText={helpText.provisioningCallbacks} /> )} @@ -298,6 +315,7 @@ function JobTemplateDetail({ template }) { label={t`Webhook Service`} value={webhook_service === 'github' ? t`GitHub` : t`GitLab`} dataCy="jt-detail-webhook-service" + helpText={helpText.webhookService} /> )} {webhook_receiver && ( @@ -305,17 +323,20 @@ function JobTemplateDetail({ template }) { label={t`Webhook URL`} value={`${document.location.origin}${webhook_receiver}`} dataCy="jt-detail-webhook-url" + helpText={helpText.webhookURL} /> )} {summary_fields.webhook_credential && ( )} {summary_fields.credentials && summary_fields.credentials.length > 0 && ( @@ -348,6 +370,7 @@ function JobTemplateDetail({ template }) { fullWidth label={t`Credentials`} dataCy="jt-detail-credentials" + helpText={helpText.credentials} value={ diff --git a/awx/ui/src/screens/Template/JobTemplateDetail/JobTemplateDetail.test.js b/awx/ui/src/screens/Template/JobTemplateDetail/JobTemplateDetail.test.js index 4535c51248..09f8e21492 100644 --- a/awx/ui/src/screens/Template/JobTemplateDetail/JobTemplateDetail.test.js +++ b/awx/ui/src/screens/Template/JobTemplateDetail/JobTemplateDetail.test.js @@ -1,6 +1,6 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; -import { JobTemplatesAPI, WorkflowJobTemplateNodesAPI } from 'api'; +import { JobTemplatesAPI, WorkflowJobTemplateNodesAPI, RootAPI } from 'api'; import { mountWithContexts, waitForElement, @@ -26,6 +26,11 @@ describe('', () => { beforeEach(async () => { JobTemplatesAPI.readInstanceGroups.mockResolvedValue(mockInstanceGroups); WorkflowJobTemplateNodesAPI.read.mockResolvedValue({ data: { count: 0 } }); + RootAPI.readAssetVariables.mockResolvedValue({ + data: { + BRAND_NAME: 'AWX', + }, + }); await act(async () => { wrapper = mountWithContexts( diff --git a/awx/ui/src/screens/Template/WorkflowJobTemplateDetail/WorkflowJobTemplateDetail.js b/awx/ui/src/screens/Template/WorkflowJobTemplateDetail/WorkflowJobTemplateDetail.js index 410a544d14..fb9f68b949 100644 --- a/awx/ui/src/screens/Template/WorkflowJobTemplateDetail/WorkflowJobTemplateDetail.js +++ b/awx/ui/src/screens/Template/WorkflowJobTemplateDetail/WorkflowJobTemplateDetail.js @@ -25,6 +25,9 @@ import Sparkline from 'components/Sparkline'; import { toTitleCase } from 'util/strings'; import { relatedResourceDeleteRequests } from 'util/getRelatedResourceDeleteDetails'; import useRequest, { useDismissableError } from 'hooks/useRequest'; +import wfHelpTextStrings from '../shared/WorkflowJobTemplate.helptext'; + +const helpText = wfHelpTextStrings(); function WorkflowJobTemplateDetail({ template }) { const { @@ -132,34 +135,48 @@ function WorkflowJobTemplateDetail({ template }) { dataCy="source-control-branch" label={t`Source Control Branch`} value={scmBranch} + helpText={helpText.sourceControlBranch} /> )} {summary_fields.inventory && ( )} - + {related.webhook_receiver && ( )} - + {webhook_credential && ( {renderOptionsField && ( - + )} {summary_fields.labels?.results?.length > 0 && ( ({ + jobType: t`For job templates, select run to execute the playbook. Select check to only check playbook syntax, test environment setup, and report problems without executing the playbook.`, + inventory: t`Select the inventory containing the hosts you want this job to manage.`, + project: t`Select the project containing the playbook you want this job to execute.`, + executionEnvironment: t`Select the execution environment for this job template.`, + playbook: t`Select the playbook to be executed by this job.`, + credentials: t`Select credentials for accessing the nodes this job will be ran against. You can only select one credential of each type. For machine credentials (SSH), checking "Prompt on launch" without selecting credentials will require you to select a machine credential at run time. If you select credentials and check "Prompt on launch", the selected credential(s) become the defaults that can be updated at run time.`, + labels: t`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.`, + variables: 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 documentation for example syntax.`, + limit: t`Provide a host pattern to further constrain the list of hosts that will be managed or affected by the playbook. Multiple patterns are allowed. Refer to Ansible documentation for more information and examples on patterns.`, + verbosity: t`Control the level of output ansible will produce as the playbook executes.`, + jobSlicing: t`Divide the work done by this job template into the specified number of job slices, each running the same tasks against a portion of the inventory.`, + timeout: t`The amount of time (in seconds) to run before the job is canceled. Defaults to 0 for no job timeout.`, + showChanges: t`If enabled, show the changes made by Ansible tasks, where supported. This is equivalent to Ansible's --diff mode.`, + instanceGroups: t`Select the Instance Groups for this Job Template to run on.`, + jobTags: t`Tags are useful when you have a large playbook, and you want to run a specific part of a play or task. Use commas to separate multiple tags. Refer to the documentation for details on the usage of tags.`, + skipTags: t`Skip tags are useful when you have a large playbook, and you want to skip specific parts of a play or task. Use commas to separate multiple tags. Refer to the documentation for details on the usage of tags.`, + webhookService: t`Select a webhook service.`, + webhookURL: t`Webhook services can launch jobs with this workflow job template by making a POST request to this URL.`, + webhookKey: t`Webhook services can use this as a shared secret.`, + webhookCredential: t`Optionally select the credential to use to send status updates back to the webhook service.`, + sourceControlBranch: t`Select a branch for the workflow. This branch is applied to all job template nodes that prompt for a branch.`, + provisioningCallbacks: t`Enables creation of a provisioning callback URL. Using the URL a host can contact ${brandName} and request a configuration update using this job template.`, + privilegeEscalation: t`If enabled, run this playbook as an administrator.`, + enableWebhook: t`Enable webhook for this template.`, + concurrentJobs: t`If enabled, simultaneous runs of this job template will be allowed.`, + enableFactStorage: t`If enabled, this will store gathered facts so they can be viewed at the host level. Facts are persisted and injected into the fact cache at runtime.`, + enabledOptions: ( + <> +

{t`Concurrent jobs: If enabled, simultaneous runs of this job template will be allowed.`}

+

{t`Fact storage: If enabled, this will store gathered facts so they can be viewed at the host level. Facts are persisted and injected into the fact cache at runtime..`}

+

{t`Privilege escalation: If enabled, run this playbook as an administrator.`}

+

{t`Provisioning callbacks: Enables creation of a provisioning callback URL. Using the URL a host can contact Ansible AWX and request a configuration update using this job template.`}

+

{t`Webhooks: Enable webhook for this template.`}

+ + ), + forks: ( + + {t`The number of parallel or simultaneous processes to use while executing the playbook. An empty value, or a value less than 1 will use the Ansible default which is usually 5. The default number of forks can be overwritten with a change to`}{' '} + ansible.cfg.{' '} + {t`Refer to the Ansible documentation for details about the configuration file.`} + + ), +}); + +export default jtHelpTextStrings; diff --git a/awx/ui/src/screens/Template/shared/JobTemplateForm.js b/awx/ui/src/screens/Template/shared/JobTemplateForm.js index 79ecfec507..c6d0f3b8af 100644 --- a/awx/ui/src/screens/Template/shared/JobTemplateForm.js +++ b/awx/ui/src/screens/Template/shared/JobTemplateForm.js @@ -45,6 +45,7 @@ import useIsMounted from 'hooks/useIsMounted'; import LabelSelect from 'components/LabelSelect'; import PlaybookSelect from './PlaybookSelect'; import WebhookSubForm from './WebhookSubForm'; +import jtHelpTextStrings from './JobTemplate.helptext'; const { origin } = document.location; @@ -67,6 +68,7 @@ function JobTemplateForm({ ); const isMounted = useIsMounted(); const brandName = useBrandName(); + const helpText = jtHelpTextStrings(brandName); const [askInventoryOnLaunchField] = useField('ask_inventory_on_launch'); const [jobTypeField, jobTypeMeta, jobTypeHelpers] = useField({ @@ -258,10 +260,7 @@ function JobTemplateForm({ label={t`Job Type`} promptId="template-ask-job-type-on-launch" promptName="ask_job_type_on_launch" - tooltip={t`For job templates, select run to execute - the playbook. Select check to only check playbook syntax, - test environment setup, and report problems without - executing the playbook.`} + tooltip={helpText.jobType} > inventoryHelpers.setTouched()} onChange={handleInventoryUpdate} required={!askInventoryOnLaunchField.value} @@ -305,8 +303,7 @@ function JobTemplateForm({ projectHelpers.setTouched()} - tooltip={t`Select the project containing the playbook - you want this job to execute.`} + tooltip={helpText.project} isValid={Boolean( !projectMeta.touched || (!projectMeta.error && projectField.value) )} @@ -326,7 +323,7 @@ function JobTemplateForm({ onBlur={() => executionEnvironmentHelpers.setTouched()} value={executionEnvironmentField.value} onChange={handleExecutionEnvironmentUpdate} - popoverContent={t`Select the execution environment for this job template.`} + popoverContent={helpText.executionEnvironment} tooltip={t`Select a project before editing the execution environment.`} globallyAvailable isDisabled={!projectField.value?.id} @@ -339,8 +336,7 @@ function JobTemplateForm({ label={t`Source Control Branch`} promptId="template-ask-scm-branch-on-launch" promptName="ask_scm_branch_on_launch" - tooltip={t`Select a branch for the job template. This branch is applied to - all job template nodes that prompt for a branch.`} + tooltip={helpText.sourceControlBranch} > - } + labelIcon={} > - } + labelIcon={} fieldId="template-labels" > - {t`The number of parallel or simultaneous - processes to use while executing the playbook. An empty value, - or a value less than 1 will use the Ansible default which is - usually 5. The default number of forks can be overwritten - with a change to`}{' '} - ansible.cfg.{' '} - {t`Refer to the Ansible documentation for details - about the configuration file.`} - - } + tooltip={helpText.forks} /> instanceGroupsHelpers.setValue(value)} - tooltip={t`Select the Instance Groups for this Job Template - to run on.`} + tooltip={helpText.instanceGroups} fieldName="instanceGroups" /> {t`Provisioning Callbacks`}   - + } id="option-callbacks" @@ -593,9 +536,7 @@ function JobTemplateForm({ {t`Enable Webhook`}   - + } id="wfjt-enabled-webhooks" @@ -609,16 +550,13 @@ function JobTemplateForm({ id="option-concurrent" name="allow_simultaneous" label={t`Concurrent Jobs`} - tooltip={t`If enabled, simultaneous runs of this job - template will be allowed.`} + tooltip={helpText.concurrentJobs} /> diff --git a/awx/ui/src/screens/Template/shared/WebhookSubForm.js b/awx/ui/src/screens/Template/shared/WebhookSubForm.js index 5f7dccd092..dfa6f9dd3a 100644 --- a/awx/ui/src/screens/Template/shared/WebhookSubForm.js +++ b/awx/ui/src/screens/Template/shared/WebhookSubForm.js @@ -22,6 +22,9 @@ import { WorkflowJobTemplatesAPI, CredentialTypesAPI, } from 'api'; +import wfHelpTextStrings from './WorkflowJobTemplate.helptext'; + +const helpText = wfHelpTextStrings(); function WebhookSubForm({ templateType }) { const { setFieldValue } = useFormikContext(); @@ -125,7 +128,7 @@ function WebhookSubForm({ templateType }) { fieldId="webhook_service" helperTextInvalid={webhookServiceMeta.error} label={t`Webhook Service`} - labelIcon={} + labelIcon={} > - } + labelIcon={} name="webhook_url" > - } + labelIcon={} fieldId="template-webhook_key" > @@ -203,7 +198,7 @@ function WebhookSubForm({ templateType }) { {credTypeId && ( ({ + inventory: t`Select an inventory for the workflow. This inventory is applied to all workflow nodes that prompt for an inventory.`, + limit: t`Provide a host pattern to further constrain + the list of hosts that will be managed or affected by the + playbook. Multiple patterns are allowed. Refer to Ansible + documentation for more information and examples on patterns.`, + sourceControlBranch: t`Select a branch for the workflow. This branch is applied to all job template nodes that prompt for a branch.`, + labels: t`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.`, + variables: 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.`, + enableWebhook: t`Enable Webhook for this workflow job template.`, + enableConcurrentJobs: t`If enabled, simultaneous runs of this workflow job template will be allowed.`, + webhookURL: t`Webhook services can launch jobs with this workflow job template by making a POST request to this URL.`, + webhookKey: t`Webhook services can use this as a shared secret.`, + webhookCredential: t`Optionally select the credential to use to send status updates back to the webhook service.`, + webhookService: t`Select a webhook service.`, + enabledOptions: ( + <> +

{t`Concurrent jobs: If enabled, simultaneous runs of this workflow job template will be allowed.`}

+

{t`Webhooks: Enable Webhook for this workflow job template.`}

+ + ), +}); + +export default wfHelpTextStrings; diff --git a/awx/ui/src/screens/Template/shared/WorkflowJobTemplateForm.js b/awx/ui/src/screens/Template/shared/WorkflowJobTemplateForm.js index 960b3172be..259cea3153 100644 --- a/awx/ui/src/screens/Template/shared/WorkflowJobTemplateForm.js +++ b/awx/ui/src/screens/Template/shared/WorkflowJobTemplateForm.js @@ -28,7 +28,9 @@ import Popover from 'components/Popover'; import { WorkFlowJobTemplate } from 'types'; import LabelSelect from 'components/LabelSelect'; import WebhookSubForm from './WebhookSubForm'; +import wfHelpTextStrings from './WorkflowJobTemplate.helptext'; +const helpText = wfHelpTextStrings(); const urlOrigin = window.location.origin; function WorkflowJobTemplateForm({ @@ -137,7 +139,7 @@ function WorkflowJobTemplateForm({ - } + labelIcon={} fieldId="template-labels" > @@ -223,9 +216,7 @@ function WorkflowJobTemplateForm({ {t`Enable Webhook`}   - + } id="wfjt-enabled-webhooks" @@ -238,7 +229,7 @@ function WorkflowJobTemplateForm({