update existing docs links to use current version util

This commit is contained in:
Keith J. Grant
2021-04-06 10:46:28 -07:00
parent 4227f7276b
commit d924b873b3
11 changed files with 96 additions and 56 deletions

View File

@@ -22,6 +22,8 @@ import {
} from '@patternfly/react-icons'; } from '@patternfly/react-icons';
import { WorkflowApprovalsAPI } from '../../api'; import { WorkflowApprovalsAPI } from '../../api';
import useRequest from '../../util/useRequest'; import useRequest from '../../util/useRequest';
import getDocsBaseUrl from '../../util/getDocsBaseUrl';
import { useConfig } from '../../contexts/Config';
import useWsPendingApprovalCount from './useWsPendingApprovalCount'; import useWsPendingApprovalCount from './useWsPendingApprovalCount';
const PendingWorkflowApprovals = styled.div` const PendingWorkflowApprovals = styled.div`
@@ -35,9 +37,6 @@ const PendingWorkflowApprovalBadge = styled(Badge)`
margin-left: 10px; margin-left: 10px;
`; `;
const DOCLINK =
'https://docs.ansible.com/ansible-tower/latest/html/userguide/index.html';
function PageHeaderToolbar({ function PageHeaderToolbar({
isAboutDisabled, isAboutDisabled,
onAboutClick, onAboutClick,
@@ -47,6 +46,7 @@ function PageHeaderToolbar({
}) { }) {
const [isHelpOpen, setIsHelpOpen] = useState(false); const [isHelpOpen, setIsHelpOpen] = useState(false);
const [isUserOpen, setIsUserOpen] = useState(false); const [isUserOpen, setIsUserOpen] = useState(false);
const config = useConfig();
const { const {
request: fetchPendingApprovalCount, request: fetchPendingApprovalCount,
@@ -101,37 +101,39 @@ function PageHeaderToolbar({
</Link> </Link>
</PageHeaderToolsItem> </PageHeaderToolsItem>
</Tooltip> </Tooltip>
<Tooltip position="bottom" content={<div>{i18n._(t`Info`)}</div>}> <PageHeaderToolsItem>
<PageHeaderToolsItem> <Dropdown
<Dropdown isPlain
isPlain isOpen={isHelpOpen}
isOpen={isHelpOpen} position={DropdownPosition.right}
position={DropdownPosition.right} onSelect={handleHelpSelect}
onSelect={handleHelpSelect} toggle={
toggle={ <DropdownToggle
<DropdownToggle onToggle={setIsHelpOpen}
onToggle={setIsHelpOpen} aria-label={i18n._(t`Info`)}
aria-label={i18n._(t`Info`)} >
> <QuestionCircleIcon />
<QuestionCircleIcon /> </DropdownToggle>
</DropdownToggle> }
} dropdownItems={[
dropdownItems={[ <DropdownItem
<DropdownItem key="help" target="_blank" href={DOCLINK}> key="help"
{i18n._(t`Help`)} target="_blank"
</DropdownItem>, href={`${getDocsBaseUrl(config)}//html/userguide/index.html`}
<DropdownItem >
key="about" {i18n._(t`Help`)}
component="button" </DropdownItem>,
isDisabled={isAboutDisabled} <DropdownItem
onClick={onAboutClick} key="about"
> component="button"
{i18n._(t`About`)} isDisabled={isAboutDisabled}
</DropdownItem>, onClick={onAboutClick}
]} >
/> {i18n._(t`About`)}
</PageHeaderToolsItem> </DropdownItem>,
</Tooltip> ]}
/>
</PageHeaderToolsItem>
<Tooltip position="left" content={<div>{i18n._(t`User`)}</div>}> <Tooltip position="left" content={<div>{i18n._(t`User`)}</div>}>
<PageHeaderToolsItem> <PageHeaderToolsItem>
<Dropdown <Dropdown

View File

@@ -12,6 +12,8 @@ import {
HostFilterField, HostFilterField,
} from './SharedFields'; } from './SharedFields';
import { required } from '../../../../util/validators'; import { required } from '../../../../util/validators';
import getDocsBaseUrl from '../../../../util/getDocsBaseUrl';
import { useConfig } from '../../../../contexts/Config';
const AzureSubForm = ({ autoPopulateCredential, i18n }) => { const AzureSubForm = ({ autoPopulateCredential, i18n }) => {
const { setFieldValue } = useFormikContext(); const { setFieldValue } = useFormikContext();
@@ -19,6 +21,7 @@ const AzureSubForm = ({ autoPopulateCredential, i18n }) => {
name: 'credential', name: 'credential',
validate: required(i18n._(t`Select a value for this field`), i18n), validate: required(i18n._(t`Select a value for this field`), i18n),
}); });
const config = useConfig();
const handleCredentialUpdate = useCallback( const handleCredentialUpdate = useCallback(
value => { value => {
@@ -27,8 +30,9 @@ const AzureSubForm = ({ autoPopulateCredential, i18n }) => {
[setFieldValue] [setFieldValue]
); );
const pluginLink = const pluginLink = `${getDocsBaseUrl(
'http://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html#inventory-plugins'; config
)}/html/userguide/inventories.html#inventory-plugins`;
const configLink = const configLink =
'https://docs.ansible.com/ansible/latest/collections/azure/azcollection/azure_rm_inventory.html'; 'https://docs.ansible.com/ansible/latest/collections/azure/azcollection/azure_rm_inventory.html';

View File

@@ -11,10 +11,13 @@ import {
EnabledValueField, EnabledValueField,
HostFilterField, HostFilterField,
} from './SharedFields'; } from './SharedFields';
import getDocsBaseUrl from '../../../../util/getDocsBaseUrl';
import { useConfig } from '../../../../contexts/Config';
const EC2SubForm = ({ i18n }) => { const EC2SubForm = ({ i18n }) => {
const { setFieldValue } = useFormikContext(); const { setFieldValue } = useFormikContext();
const [credentialField] = useField('credential'); const [credentialField] = useField('credential');
const config = useConfig();
const handleCredentialUpdate = useCallback( const handleCredentialUpdate = useCallback(
value => { value => {
@@ -23,8 +26,9 @@ const EC2SubForm = ({ i18n }) => {
[setFieldValue] [setFieldValue]
); );
const pluginLink = const pluginLink = `${getDocsBaseUrl(
'http://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html#inventory-plugins'; config
)}/html/userguide/inventories.html#inventory-plugins`;
const configLink = const configLink =
'https://docs.ansible.com/ansible/latest/collections/amazon/aws/aws_ec2_inventory.html'; 'https://docs.ansible.com/ansible/latest/collections/amazon/aws/aws_ec2_inventory.html';

View File

@@ -12,6 +12,8 @@ import {
SourceVarsField, SourceVarsField,
} from './SharedFields'; } from './SharedFields';
import { required } from '../../../../util/validators'; import { required } from '../../../../util/validators';
import getDocsBaseUrl from '../../../../util/getDocsBaseUrl';
import { useConfig } from '../../../../contexts/Config';
const GCESubForm = ({ autoPopulateCredential, i18n }) => { const GCESubForm = ({ autoPopulateCredential, i18n }) => {
const { setFieldValue } = useFormikContext(); const { setFieldValue } = useFormikContext();
@@ -19,6 +21,7 @@ const GCESubForm = ({ autoPopulateCredential, i18n }) => {
name: 'credential', name: 'credential',
validate: required(i18n._(t`Select a value for this field`), i18n), validate: required(i18n._(t`Select a value for this field`), i18n),
}); });
const config = useConfig();
const handleCredentialUpdate = useCallback( const handleCredentialUpdate = useCallback(
value => { value => {
@@ -27,8 +30,9 @@ const GCESubForm = ({ autoPopulateCredential, i18n }) => {
[setFieldValue] [setFieldValue]
); );
const pluginLink = const pluginLink = `${getDocsBaseUrl(
'http://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html#inventory-plugins'; config
)}/html/userguide/inventories.html#inventory-plugins`;
const configLink = const configLink =
'https://docs.ansible.com/ansible/latest/collections/google/cloud/gcp_compute_inventory.html'; 'https://docs.ansible.com/ansible/latest/collections/google/cloud/gcp_compute_inventory.html';

View File

@@ -12,6 +12,8 @@ import {
HostFilterField, HostFilterField,
} from './SharedFields'; } from './SharedFields';
import { required } from '../../../../util/validators'; import { required } from '../../../../util/validators';
import getDocsBaseUrl from '../../../../util/getDocsBaseUrl';
import { useConfig } from '../../../../contexts/Config';
const OpenStackSubForm = ({ autoPopulateCredential, i18n }) => { const OpenStackSubForm = ({ autoPopulateCredential, i18n }) => {
const { setFieldValue } = useFormikContext(); const { setFieldValue } = useFormikContext();
@@ -19,6 +21,7 @@ const OpenStackSubForm = ({ autoPopulateCredential, i18n }) => {
name: 'credential', name: 'credential',
validate: required(i18n._(t`Select a value for this field`), i18n), validate: required(i18n._(t`Select a value for this field`), i18n),
}); });
const config = useConfig();
const handleCredentialUpdate = useCallback( const handleCredentialUpdate = useCallback(
value => { value => {
@@ -27,8 +30,9 @@ const OpenStackSubForm = ({ autoPopulateCredential, i18n }) => {
[setFieldValue] [setFieldValue]
); );
const pluginLink = const pluginLink = `${getDocsBaseUrl(
'http://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html#inventory-plugins'; config
)}/html/userguide/inventories.html#inventory-plugins`;
const configLink = const configLink =
'https://docs.ansible.com/ansible/latest/collections/openstack/cloud/openstack_inventory.html'; 'https://docs.ansible.com/ansible/latest/collections/openstack/cloud/openstack_inventory.html';

View File

@@ -12,6 +12,8 @@ import {
HostFilterField, HostFilterField,
} from './SharedFields'; } from './SharedFields';
import { required } from '../../../../util/validators'; import { required } from '../../../../util/validators';
import getDocsBaseUrl from '../../../../util/getDocsBaseUrl';
import { useConfig } from '../../../../contexts/Config';
const SatelliteSubForm = ({ autoPopulateCredential, i18n }) => { const SatelliteSubForm = ({ autoPopulateCredential, i18n }) => {
const { setFieldValue } = useFormikContext(); const { setFieldValue } = useFormikContext();
@@ -19,6 +21,7 @@ const SatelliteSubForm = ({ autoPopulateCredential, i18n }) => {
name: 'credential', name: 'credential',
validate: required(i18n._(t`Select a value for this field`), i18n), validate: required(i18n._(t`Select a value for this field`), i18n),
}); });
const config = useConfig();
const handleCredentialUpdate = useCallback( const handleCredentialUpdate = useCallback(
value => { value => {
@@ -27,8 +30,9 @@ const SatelliteSubForm = ({ autoPopulateCredential, i18n }) => {
[setFieldValue] [setFieldValue]
); );
const pluginLink = const pluginLink = `${getDocsBaseUrl(
'http://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html#inventory-plugins'; config
)}/html/userguide/inventories.html#inventory-plugins`;
const configLink = const configLink =
'https://docs.ansible.com/ansible/latest/collections/theforeman/foreman/foreman_inventory.html'; 'https://docs.ansible.com/ansible/latest/collections/theforeman/foreman/foreman_inventory.html';

View File

@@ -12,6 +12,8 @@ import {
SourceVarsField, SourceVarsField,
} from './SharedFields'; } from './SharedFields';
import { required } from '../../../../util/validators'; import { required } from '../../../../util/validators';
import getDocsBaseUrl from '../../../../util/getDocsBaseUrl';
import { useConfig } from '../../../../contexts/Config';
const TowerSubForm = ({ autoPopulateCredential, i18n }) => { const TowerSubForm = ({ autoPopulateCredential, i18n }) => {
const { setFieldValue } = useFormikContext(); const { setFieldValue } = useFormikContext();
@@ -19,6 +21,7 @@ const TowerSubForm = ({ autoPopulateCredential, i18n }) => {
name: 'credential', name: 'credential',
validate: required(i18n._(t`Select a value for this field`), i18n), validate: required(i18n._(t`Select a value for this field`), i18n),
}); });
const config = useConfig();
const handleCredentialUpdate = useCallback( const handleCredentialUpdate = useCallback(
value => { value => {
@@ -27,8 +30,9 @@ const TowerSubForm = ({ autoPopulateCredential, i18n }) => {
[setFieldValue] [setFieldValue]
); );
const pluginLink = const pluginLink = `${getDocsBaseUrl(
'http://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html#inventory-plugins'; config
)}/html/userguide/inventories.html#inventory-plugins`;
const configLink = const configLink =
'https://docs.ansible.com/ansible/latest/collections/awx/awx/tower_inventory.html'; 'https://docs.ansible.com/ansible/latest/collections/awx/awx/tower_inventory.html';

View File

@@ -12,6 +12,8 @@ import {
HostFilterField, HostFilterField,
} from './SharedFields'; } from './SharedFields';
import { required } from '../../../../util/validators'; import { required } from '../../../../util/validators';
import getDocsBaseUrl from '../../../../util/getDocsBaseUrl';
import { useConfig } from '../../../../contexts/Config';
const VMwareSubForm = ({ autoPopulateCredential, i18n }) => { const VMwareSubForm = ({ autoPopulateCredential, i18n }) => {
const { setFieldValue } = useFormikContext(); const { setFieldValue } = useFormikContext();
@@ -19,6 +21,7 @@ const VMwareSubForm = ({ autoPopulateCredential, i18n }) => {
name: 'credential', name: 'credential',
validate: required(i18n._(t`Select a value for this field`), i18n), validate: required(i18n._(t`Select a value for this field`), i18n),
}); });
const config = useConfig();
const handleCredentialUpdate = useCallback( const handleCredentialUpdate = useCallback(
value => { value => {
@@ -27,8 +30,9 @@ const VMwareSubForm = ({ autoPopulateCredential, i18n }) => {
[setFieldValue] [setFieldValue]
); );
const pluginLink = const pluginLink = `${getDocsBaseUrl(
'http://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html#inventory-plugins'; config
)}/html/userguide/inventories.html#inventory-plugins`;
const configLink = const configLink =
'https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_vm_inventory_inventory.html'; 'https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_vm_inventory_inventory.html';

View File

@@ -12,6 +12,8 @@ import {
SourceVarsField, SourceVarsField,
} from './SharedFields'; } from './SharedFields';
import { required } from '../../../../util/validators'; import { required } from '../../../../util/validators';
import getDocsBaseUrl from '../../../../util/getDocsBaseUrl';
import { useConfig } from '../../../../contexts/Config';
const VirtualizationSubForm = ({ autoPopulateCredential, i18n }) => { const VirtualizationSubForm = ({ autoPopulateCredential, i18n }) => {
const { setFieldValue } = useFormikContext(); const { setFieldValue } = useFormikContext();
@@ -19,6 +21,7 @@ const VirtualizationSubForm = ({ autoPopulateCredential, i18n }) => {
name: 'credential', name: 'credential',
validate: required(i18n._(t`Select a value for this field`), i18n), validate: required(i18n._(t`Select a value for this field`), i18n),
}); });
const config = useConfig();
const handleCredentialUpdate = useCallback( const handleCredentialUpdate = useCallback(
value => { value => {
@@ -27,8 +30,9 @@ const VirtualizationSubForm = ({ autoPopulateCredential, i18n }) => {
[setFieldValue] [setFieldValue]
); );
const pluginLink = const pluginLink = `${getDocsBaseUrl(
'http://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html#inventory-plugins'; config
)}/html/userguide/inventories.html#inventory-plugins`;
const configLink = const configLink =
'https://docs.ansible.com/ansible/latest/collections/ovirt/ovirt/ovirt_inventory.html'; 'https://docs.ansible.com/ansible/latest/collections/ovirt/ovirt/ovirt_inventory.html';

View File

@@ -26,6 +26,8 @@ import JobTemplatesList from './JobTemplatesList';
import ProjectsList from './ProjectsList'; import ProjectsList from './ProjectsList';
import WorkflowJobTemplatesList from './WorkflowJobTemplatesList'; import WorkflowJobTemplatesList from './WorkflowJobTemplatesList';
import FormField from '../../../../../../components/FormField'; import FormField from '../../../../../../components/FormField';
import getDocsBaseUrl from '../../../../../../util/getDocsBaseUrl';
import { useConfig } from '../../../../../../contexts/Config';
const NodeTypeErrorAlert = styled(Alert)` const NodeTypeErrorAlert = styled(Alert)`
margin-bottom: 20px; margin-bottom: 20px;
@@ -59,6 +61,7 @@ function NodeTypeStep({ i18n }) {
const [convergenceField, , convergenceFieldHelpers] = useField('convergence'); const [convergenceField, , convergenceFieldHelpers] = useField('convergence');
const [isConvergenceOpen, setIsConvergenceOpen] = useState(false); const [isConvergenceOpen, setIsConvergenceOpen] = useState(false);
const config = useConfig();
const isValid = !approvalNameMeta.touched || !approvalNameMeta.error; const isValid = !approvalNameMeta.touched || !approvalNameMeta.error;
return ( return (
@@ -212,7 +215,9 @@ function NodeTypeStep({ i18n }) {
t`Preconditions for running this node when there are multiple parents. Refer to the` t`Preconditions for running this node when there are multiple parents. Refer to the`
)}{' '} )}{' '}
<a <a
href="https://docs.ansible.com/ansible-tower/latest/html/userguide/workflow_templates.html#convergence-node" href={`${getDocsBaseUrl(
config
)}/html/userguide/workflow_templates.html#convergence-node`}
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
> >

View File

@@ -23,6 +23,8 @@ import {
WorkflowDispatchContext, WorkflowDispatchContext,
WorkflowStateContext, WorkflowStateContext,
} from '../../../contexts/Workflow'; } from '../../../contexts/Workflow';
import getDocsBaseUrl from '../../../util/getDocsBaseUrl';
import { useConfig } from '../../../contexts/Config';
const Badge = styled(PFBadge)` const Badge = styled(PFBadge)`
align-items: center; align-items: center;
@@ -47,9 +49,6 @@ const ActionButton = styled(Button)`
`; `;
ActionButton.displayName = 'ActionButton'; ActionButton.displayName = 'ActionButton';
const DOCLINK =
'https://docs.ansible.com/ansible-tower/latest/html/userguide/workflow_templates.html#ug-wf-editor';
function VisualizerToolbar({ function VisualizerToolbar({
i18n, i18n,
onClose, onClose,
@@ -59,8 +58,8 @@ function VisualizerToolbar({
readOnly, readOnly,
}) { }) {
const dispatch = useContext(WorkflowDispatchContext); const dispatch = useContext(WorkflowDispatchContext);
const { nodes, showLegend, showTools } = useContext(WorkflowStateContext); const { nodes, showLegend, showTools } = useContext(WorkflowStateContext);
const config = useConfig();
const totalNodes = nodes.reduce((n, node) => n + !node.isDeleted, 0) - 1; const totalNodes = nodes.reduce((n, node) => n + !node.isDeleted, 0) - 1;
@@ -113,7 +112,9 @@ function VisualizerToolbar({
variant="plain" variant="plain"
component="a" component="a"
target="_blank" target="_blank"
href={DOCLINK} href={`${getDocsBaseUrl(
config
)}/html/userguide/workflow_templates.html#ug-wf-editor`}
> >
<BookIcon /> <BookIcon />
</ActionButton> </ActionButton>