Adds tooltip around host filter lookup when an organization is not selected

This commit is contained in:
mabashian
2021-01-14 13:30:02 -05:00
parent fa6de04e79
commit bb2248cb24

View File

@@ -12,6 +12,7 @@ import {
FormGroup, FormGroup,
InputGroup, InputGroup,
Modal, Modal,
Tooltip,
} from '@patternfly/react-core'; } from '@patternfly/react-core';
import ChipGroup from '../ChipGroup'; import ChipGroup from '../ChipGroup';
import Popover from '../Popover'; import Popover from '../Popover';
@@ -243,24 +244,7 @@ function HostFilterLookup({
}); });
}; };
return ( const renderLookup = () => (
<FormGroup
fieldId="host-filter"
helperTextInvalid={helperTextInvalid}
isRequired
label={i18n._(t`Smart host filter`)}
validated={isValid ? 'default' : 'error'}
labelIcon={
<Popover
content={i18n._(
t`Populate the hosts for this inventory by using a search
filter. Example: ansible_facts.ansible_distribution:"RedHat".
Refer to the Ansible Tower documentation for further syntax and
examples.`
)}
/>
}
>
<InputGroup onBlur={onBlur}> <InputGroup onBlur={onBlur}>
<Button <Button
aria-label={i18n._(t`Search`)} aria-label={i18n._(t`Search`)}
@@ -288,6 +272,37 @@ function HostFilterLookup({
))} ))}
</ChipHolder> </ChipHolder>
</InputGroup> </InputGroup>
);
return (
<FormGroup
fieldId="host-filter"
helperTextInvalid={helperTextInvalid}
isRequired
label={i18n._(t`Smart host filter`)}
validated={isValid ? 'default' : 'error'}
labelIcon={
<Popover
content={i18n._(
t`Populate the hosts for this inventory by using a search
filter. Example: ansible_facts.ansible_distribution:"RedHat".
Refer to the Ansible Tower documentation for further syntax and
examples.`
)}
/>
}
>
{isDisabled ? (
<Tooltip
content={i18n._(
t`Please select an organization before editing the host filter`
)}
>
{renderLookup()}
</Tooltip>
) : (
renderLookup()
)}
<Modal <Modal
aria-label={i18n._(t`Lookup modal`)} aria-label={i18n._(t`Lookup modal`)}
isOpen={isModalOpen} isOpen={isModalOpen}