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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,6 +12,8 @@ import {
SourceVarsField,
} from './SharedFields';
import { required } from '../../../../util/validators';
import getDocsBaseUrl from '../../../../util/getDocsBaseUrl';
import { useConfig } from '../../../../contexts/Config';
const VirtualizationSubForm = ({ autoPopulateCredential, i18n }) => {
const { setFieldValue } = useFormikContext();
@ -19,6 +21,7 @@ const VirtualizationSubForm = ({ autoPopulateCredential, i18n }) => {
name: 'credential',
validate: required(i18n._(t`Select a value for this field`), i18n),
});
const config = useConfig();
const handleCredentialUpdate = useCallback(
value => {
@ -27,8 +30,9 @@ const VirtualizationSubForm = ({ autoPopulateCredential, i18n }) => {
[setFieldValue]
);
const pluginLink =
'http://docs.ansible.com/ansible-tower/latest/html/userguide/inventories.html#inventory-plugins';
const pluginLink = `${getDocsBaseUrl(
config
)}/html/userguide/inventories.html#inventory-plugins`;
const configLink =
'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 WorkflowJobTemplatesList from './WorkflowJobTemplatesList';
import FormField from '../../../../../../components/FormField';
import getDocsBaseUrl from '../../../../../../util/getDocsBaseUrl';
import { useConfig } from '../../../../../../contexts/Config';
const NodeTypeErrorAlert = styled(Alert)`
margin-bottom: 20px;
@ -59,6 +61,7 @@ function NodeTypeStep({ i18n }) {
const [convergenceField, , convergenceFieldHelpers] = useField('convergence');
const [isConvergenceOpen, setIsConvergenceOpen] = useState(false);
const config = useConfig();
const isValid = !approvalNameMeta.touched || !approvalNameMeta.error;
return (
@ -212,7 +215,9 @@ function NodeTypeStep({ i18n }) {
t`Preconditions for running this node when there are multiple parents. Refer to the`
)}{' '}
<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"
rel="noopener noreferrer"
>

View File

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