From 3d0391173b3120834943e9a39f9c94af93f9753c Mon Sep 17 00:00:00 2001 From: kialam Date: Wed, 1 Jun 2022 10:00:59 -0700 Subject: [PATCH] Add popover help text to job details and ad hoc job details (#12261) * Add popover text to Job Details page. * Add module documentation links to ad hoc job detail page. * Add forks help text to job details. --- .../components/DetailList/DeletedDetail.js | 11 ++++- .../ExecutionEnvironmentDetail.js | 2 + awx/ui/src/screens/Job/Job.helptext.js | 45 +++++++++++++++++++ awx/ui/src/screens/Job/JobDetail/JobDetail.js | 33 ++++++++++++-- 4 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 awx/ui/src/screens/Job/Job.helptext.js diff --git a/awx/ui/src/components/DetailList/DeletedDetail.js b/awx/ui/src/components/DetailList/DeletedDetail.js index aa2ee5117a..ec0961d394 100644 --- a/awx/ui/src/components/DetailList/DeletedDetail.js +++ b/awx/ui/src/components/DetailList/DeletedDetail.js @@ -11,8 +11,15 @@ const Detail = styled(_Detail)` } `; -function DeletedDetail({ label, dataCy }) { - return ; +function DeletedDetail({ label, dataCy, helpText }) { + return ( + + ); } DeletedDetail.propTypes = { diff --git a/awx/ui/src/components/ExecutionEnvironmentDetail/ExecutionEnvironmentDetail.js b/awx/ui/src/components/ExecutionEnvironmentDetail/ExecutionEnvironmentDetail.js index f6c2a02d31..f4029a19bd 100644 --- a/awx/ui/src/components/ExecutionEnvironmentDetail/ExecutionEnvironmentDetail.js +++ b/awx/ui/src/components/ExecutionEnvironmentDetail/ExecutionEnvironmentDetail.js @@ -60,6 +60,7 @@ function ExecutionEnvironmentDetail({ return ( {t`Missing resource`} @@ -102,6 +103,7 @@ function ExecutionEnvironmentDetail({ return ( {t`Missing resource`} diff --git a/awx/ui/src/screens/Job/Job.helptext.js b/awx/ui/src/screens/Job/Job.helptext.js new file mode 100644 index 0000000000..b875fb90f4 --- /dev/null +++ b/awx/ui/src/screens/Job/Job.helptext.js @@ -0,0 +1,45 @@ +import React from 'react'; +import { t } from '@lingui/macro'; + +const jobHelpText = { + 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`The execution environment that will be used when launching this job template. The resolved execution environment can be overridden by explicitly assigning a different one to 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.`, + 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.`, + sourceControlBranch: t`Select a branch for the workflow. This branch is applied to all job template nodes that prompt for a branch.`, + 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.`} + + ), + module: (moduleName) => + moduleName ? ( + <> + {t`These arguments are used with the specified module. You can find information about ${moduleName} by clicking `}{' '} + + {t`here.`} + + + ) : ( + t`These arguments are used with the specified module.` + ), +}; + +export default jobHelpText; diff --git a/awx/ui/src/screens/Job/JobDetail/JobDetail.js b/awx/ui/src/screens/Job/JobDetail/JobDetail.js index 9126b43fab..620b276111 100644 --- a/awx/ui/src/screens/Job/JobDetail/JobDetail.js +++ b/awx/ui/src/screens/Job/JobDetail/JobDetail.js @@ -28,6 +28,7 @@ import ExecutionEnvironmentDetail from 'components/ExecutionEnvironmentDetail'; import { getJobModel, isJobRunning } from 'util/jobs'; import { formatDateString } from 'util/dates'; import { Job } from 'types'; +import jobHelpText from '../Job.helptext'; const StatusDetailValue = styled.div` align-items: center; @@ -110,6 +111,7 @@ function JobDetail({ job, inventorySourceLabels }) { ) : ( - + ); } if (job.type === 'workflow_job') { @@ -131,6 +133,7 @@ function JobDetail({ job, inventorySourceLabels }) { {project.name}} /> )} @@ -315,18 +321,26 @@ function JobDetail({ job, inventorySourceLabels }) { - + {job.type !== 'workflow_job' && !isJobRunning(job.status) && ( )} @@ -339,6 +353,7 @@ function JobDetail({ job, inventorySourceLabels }) { )} @@ -354,6 +369,7 @@ function JobDetail({ job, inventorySourceLabels }) { )} @@ -365,7 +381,12 @@ function JobDetail({ job, inventorySourceLabels }) { /> )} {typeof job.forks === 'number' && ( - + )} {credential && ( @@ -392,6 +413,7 @@ function JobDetail({ job, inventorySourceLabels }) { )} {job.artifacts && (