add some links to docs

This commit is contained in:
Keith J. Grant 2021-03-24 10:39:53 -07:00
parent 775c0b02ee
commit 64b9d61dd4
6 changed files with 47 additions and 3 deletions

View File

@ -78,7 +78,8 @@
"src",
"theme",
"gridColumns",
"rows"
"rows",
"href"
],
"ignore": ["Ansible", "Tower", "JSON", "YAML", "lg"],
"ignoreComponent": [

View File

@ -0,0 +1 @@
export { default } from './DocsLink';

View File

@ -11,9 +11,12 @@ import {
SelectOption,
SelectVariant,
TextInput,
Tooltip,
} from '@patternfly/react-core';
import { SearchIcon } from '@patternfly/react-icons';
import { SearchIcon, QuestionCircleIcon } from '@patternfly/react-icons';
import styled from 'styled-components';
import { useConfig } from '../../contexts/Config';
import getDocsBaseUrl from '../../util/getDocsBaseUrl';
const AdvancedGroup = styled.div`
display: flex;
@ -45,6 +48,7 @@ function AdvancedSearch({
const [lookupSelection, setLookupSelection] = useState(null);
const [keySelection, setKeySelection] = useState(null);
const [searchValue, setSearchValue] = useState('');
const config = useConfig();
const handleAdvancedSearch = e => {
// keeps page from fully reloading
@ -262,6 +266,19 @@ function AdvancedSearch({
</Button>
</div>
</InputGroup>
<Tooltip
content={i18n._(t`Advanced search documentation`)}
position="bottom"
>
<Button
component="a"
variant="plain"
target="_blank"
href={`${getDocsBaseUrl(config)}/html/userguide/search_sort.html`}
>
<QuestionCircleIcon />
</Button>
</Tooltip>
</AdvancedGroup>
);
}

View File

@ -21,7 +21,7 @@ import {
ToolbarToggleGroup,
Tooltip,
} from '@patternfly/react-core';
import { SearchIcon } from '@patternfly/react-icons';
import { SearchIcon, QuestionCircleIcon } from '@patternfly/react-icons';
import AlertModal from '../../../components/AlertModal';
import { CardBody as _CardBody } from '../../../components/Card';
@ -47,6 +47,8 @@ import {
removeParams,
getQSConfig,
} from '../../../util/qs';
import getDocsBaseUrl from '../../../util/getDocsBaseUrl';
import { useConfig } from '../../../contexts/Config';
const QS_CONFIG = getQSConfig('job_output', {
order_by: 'start_line',
@ -280,6 +282,7 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
const jobSocketCounter = useRef(0);
const interval = useRef(null);
const history = useHistory();
const config = useConfig();
const [contentError, setContentError] = useState(null);
const [cssMap, setCssMap] = useState({});
const [currentlyLoading, setCurrentlyLoading] = useState([]);
@ -730,6 +733,21 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
) : (
renderSearchComponent(i18n)
)}
<Tooltip
content={i18n._(t`Job output documentation`)}
position="bottom"
>
<Button
component="a"
variant="plain"
target="_blank"
href={`${getDocsBaseUrl(
config
)}/html/userguide/jobs.html#standard-out-pane`}
>
<QuestionCircleIcon />
</Button>
</Tooltip>
</ToolbarItem>
</ToolbarToggleGroup>
</SearchToolbarContent>

View File

@ -0,0 +1,7 @@
export default function getDocsBaseUrl(config) {
let version = 'latest';
if (config?.license_info?.license_type !== 'open') {
version = config?.version ? config.version.split('-')[0] : 'latest';
}
return `https://docs.ansible.com/ansible-tower/${version}`;
}