import React, { useContext } from 'react'; import { translate as __ } from 'foremanReact/common/I18n'; import { ClipboardCopy, Form, FormGroup, TextInput, TextArea, } from '@patternfly/react-core'; import ACSCreateContext from '../ACSCreateContext'; import WizardHeader from '../../../ContentViews/components/WizardHeader'; import { areSubPathsValid, isValidUrl } from '../../helpers'; const AcsUrlPaths = () => { const { acsType, url, setUrl, subpaths, setSubpaths, } = useContext(ACSCreateContext); const subPathValidated = areSubPathsValid(subpaths) ? 'default' : 'error'; const [urlValidated, setUrlValidated] = React.useState('default'); const handleUrlChange = (newUrl, _event) => { setUrl(newUrl); if (isValidUrl(newUrl, acsType)) { setUrlValidated('success'); } else { setUrlValidated('error'); } }; const baseURLplaceholder = acsType === 'rhui' ? 'https://rhui-server.example.com/pulp/content' : 'http:// or https://'; const helperTextInvalid = acsType === 'rhui' ? 'http://rhui-server.example.com/pulp/content or https://rhui-server.example.com/pulp/content' : 'http://, https:// or file://'; let headerDescription = __('Enter in the base path and any subpaths that should be searched for alternate content.'); headerDescription = acsType === 'rhui' ? `${headerDescription}${__(' The base path must be a web address pointing to the root RHUI content directory.')}` : `${headerDescription}${__(' The base path can be a web address or a filesystem location.')}`; return ( <>
{acsType === 'rhui' && <> {__('On the RHUA Instance, check the available repositories.')} rhui-manager repo list {__('Find the relative path for each RHUI repository and combine them in a comma-separated list.')} rhui-manager repo info --repo_id your_repo_id }