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", "src",
"theme", "theme",
"gridColumns", "gridColumns",
"rows" "rows",
"href"
], ],
"ignore": ["Ansible", "Tower", "JSON", "YAML", "lg"], "ignore": ["Ansible", "Tower", "JSON", "YAML", "lg"],
"ignoreComponent": [ "ignoreComponent": [

View File

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

View File

@@ -11,9 +11,12 @@ import {
SelectOption, SelectOption,
SelectVariant, SelectVariant,
TextInput, TextInput,
Tooltip,
} from '@patternfly/react-core'; } from '@patternfly/react-core';
import { SearchIcon } from '@patternfly/react-icons'; import { SearchIcon, QuestionCircleIcon } from '@patternfly/react-icons';
import styled from 'styled-components'; import styled from 'styled-components';
import { useConfig } from '../../contexts/Config';
import getDocsBaseUrl from '../../util/getDocsBaseUrl';
const AdvancedGroup = styled.div` const AdvancedGroup = styled.div`
display: flex; display: flex;
@@ -45,6 +48,7 @@ function AdvancedSearch({
const [lookupSelection, setLookupSelection] = useState(null); const [lookupSelection, setLookupSelection] = useState(null);
const [keySelection, setKeySelection] = useState(null); const [keySelection, setKeySelection] = useState(null);
const [searchValue, setSearchValue] = useState(''); const [searchValue, setSearchValue] = useState('');
const config = useConfig();
const handleAdvancedSearch = e => { const handleAdvancedSearch = e => {
// keeps page from fully reloading // keeps page from fully reloading
@@ -262,6 +266,19 @@ function AdvancedSearch({
</Button> </Button>
</div> </div>
</InputGroup> </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> </AdvancedGroup>
); );
} }

View File

@@ -21,7 +21,7 @@ import {
ToolbarToggleGroup, ToolbarToggleGroup,
Tooltip, Tooltip,
} from '@patternfly/react-core'; } from '@patternfly/react-core';
import { SearchIcon } from '@patternfly/react-icons'; import { SearchIcon, QuestionCircleIcon } from '@patternfly/react-icons';
import AlertModal from '../../../components/AlertModal'; import AlertModal from '../../../components/AlertModal';
import { CardBody as _CardBody } from '../../../components/Card'; import { CardBody as _CardBody } from '../../../components/Card';
@@ -47,6 +47,8 @@ import {
removeParams, removeParams,
getQSConfig, getQSConfig,
} from '../../../util/qs'; } from '../../../util/qs';
import getDocsBaseUrl from '../../../util/getDocsBaseUrl';
import { useConfig } from '../../../contexts/Config';
const QS_CONFIG = getQSConfig('job_output', { const QS_CONFIG = getQSConfig('job_output', {
order_by: 'start_line', order_by: 'start_line',
@@ -280,6 +282,7 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
const jobSocketCounter = useRef(0); const jobSocketCounter = useRef(0);
const interval = useRef(null); const interval = useRef(null);
const history = useHistory(); const history = useHistory();
const config = useConfig();
const [contentError, setContentError] = useState(null); const [contentError, setContentError] = useState(null);
const [cssMap, setCssMap] = useState({}); const [cssMap, setCssMap] = useState({});
const [currentlyLoading, setCurrentlyLoading] = useState([]); const [currentlyLoading, setCurrentlyLoading] = useState([]);
@@ -730,6 +733,21 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
) : ( ) : (
renderSearchComponent(i18n) 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> </ToolbarItem>
</ToolbarToggleGroup> </ToolbarToggleGroup>
</SearchToolbarContent> </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}`;
}