From 4227f7276b6a8b706983be03c0664214b7ea80b8 Mon Sep 17 00:00:00 2001 From: "Keith J. Grant" Date: Mon, 5 Apr 2021 10:16:51 -0700 Subject: [PATCH] add docs links to notification templates, project scm --- .../shared/CustomMessagesSubForm.jsx | 30 ++-- .../shared/ProjectSubForms/GitSubForm.jsx | 147 +++++++++--------- 2 files changed, 92 insertions(+), 85 deletions(-) diff --git a/awx/ui_next/src/screens/NotificationTemplate/shared/CustomMessagesSubForm.jsx b/awx/ui_next/src/screens/NotificationTemplate/shared/CustomMessagesSubForm.jsx index fca1b0317d..42fe7a65e2 100644 --- a/awx/ui_next/src/screens/NotificationTemplate/shared/CustomMessagesSubForm.jsx +++ b/awx/ui_next/src/screens/NotificationTemplate/shared/CustomMessagesSubForm.jsx @@ -1,6 +1,6 @@ import 'styled-components/macro'; import React, { useEffect, useRef } from 'react'; -import { Trans, withI18n } from '@lingui/react'; +import { withI18n } from '@lingui/react'; import { t } from '@lingui/macro'; import { useField, useFormikContext } from 'formik'; import { Switch, Text } from '@patternfly/react-core'; @@ -9,6 +9,8 @@ import { SubFormLayout, } from '../../../components/FormLayout'; import CodeEditorField from '../../../components/CodeEditor/CodeEditorField'; +import { useConfig } from '../../../contexts/Config'; +import getDocsBaseUrl from '../../../util/getDocsBaseUrl'; function CustomMessagesSubForm({ defaultMessages, type, i18n }) { const [useCustomField, , useCustomHelpers] = useField('useCustomMessages'); @@ -16,6 +18,7 @@ function CustomMessagesSubForm({ defaultMessages, type, i18n }) { const showBodies = ['email', 'pagerduty', 'webhook'].includes(type); const { setFieldValue } = useFormikContext(); + const config = useConfig(); const mountedRef = useRef(null); useEffect( function resetToDefaultMessages() { @@ -69,11 +72,9 @@ function CustomMessagesSubForm({ defaultMessages, type, i18n }) { css="margin-bottom: var(--pf-c-content--MarginBottom)" > - - Use custom messages to change the content of notifications sent - when a job starts, succeeds, or fails. Use curly braces to - access information about the job:{' '} - + {i18n._(t`Use custom messages to change the content of + notifications sent when a job starts, succeeds, or fails. Use + curly braces to access information about the job:`)}{' '} {'{{'} job_friendly_name {'}}'} @@ -81,23 +82,22 @@ function CustomMessagesSubForm({ defaultMessages, type, i18n }) { {'{{'} url {'}}'} - , or attributes of the job such as{' '} + ,{' '} {'{{'} job.status {'}}'} .{' '} - - You may apply a number of possible variables in the message. - Refer to the{' '} - {' '} + {i18n._(t`You may apply a number of possible variables in the + message. For more information, refer to the`)}{' '} - Ansible Tower documentation - {' '} - for more details. + {i18n._(t`Ansible Tower Documentation.`)} + diff --git a/awx/ui_next/src/screens/Project/shared/ProjectSubForms/GitSubForm.jsx b/awx/ui_next/src/screens/Project/shared/ProjectSubForms/GitSubForm.jsx index 32d2d85565..dc90e12df3 100644 --- a/awx/ui_next/src/screens/Project/shared/ProjectSubForms/GitSubForm.jsx +++ b/awx/ui_next/src/screens/Project/shared/ProjectSubForms/GitSubForm.jsx @@ -9,90 +9,97 @@ import { ScmCredentialFormField, ScmTypeOptions, } from './SharedFields'; +import { useConfig } from '../../../../contexts/Config'; +import getDocsBaseUrl from '../../../../util/getDocsBaseUrl'; const GitSubForm = ({ i18n, credential, onCredentialSelection, scmUpdateOnLaunch, -}) => ( - <> - - {i18n._(t`Example URLs for GIT Source Control include:`)} -
    -
  • - https://github.com/ansible/ansible.git -
  • -
  • - git@github.com:ansible/ansible.git -
  • -
  • - git://servername.example.com/ansible.git -
  • -
- {i18n._(t`Note: When using SSH protocol for GitHub or +}) => { + const config = useConfig(); + return ( + <> + + {i18n._(t`Example URLs for GIT Source Control include:`)} +
    +
  • + https://github.com/ansible/ansible.git +
  • +
  • + git@github.com:ansible/ansible.git +
  • +
  • + git://servername.example.com/ansible.git +
  • +
+ {i18n._(t`Note: When using SSH protocol for GitHub or Bitbucket, enter an SSH key only, do not enter a username (other than git). Additionally, GitHub and Bitbucket do not support password authentication when using SSH. GIT read only protocol (git://) does not use username or password information.`)} - - } - /> - - - {i18n._(t`A refspec to fetch (passed to the Ansible git + + } + /> + + + {i18n._(t`A refspec to fetch (passed to the Ansible git module). This parameter allows access to references via the branch field not otherwise available.`)} -
-
- {i18n._(t`Note: This field assumes the remote name is "origin".`)} -
-
- {i18n._(t`Examples include:`)} -
    -
  • - refs/*:refs/remotes/origin/* -
  • -
  • - refs/pull/62/head:refs/remotes/origin/pull/62/head -
  • -
- {i18n._(t`The first fetches all references. The second +
+
+ {i18n._(t`Note: This field assumes the remote name is "origin".`)} +
+
+ {i18n._(t`Examples include:`)} +
    +
  • + refs/*:refs/remotes/origin/* +
  • +
  • + refs/pull/62/head:refs/remotes/origin/pull/62/head +
  • +
+ {i18n._(t`The first fetches all references. The second fetches the Github pull request number 62, in this example the branch needs to be "pull/62/head".`)} -
-
- {i18n._(t`For more information, refer to the`)}{' '} - - {i18n._(t`Ansible Tower Documentation.`)} - - - } - /> - - - -); +
+
+ {i18n._(t`For more information, refer to the`)}{' '} + + {i18n._(t`Ansible Tower Documentation.`)} + + + } + /> + + + + ); +}; export default withI18n()(GitSubForm);