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,
InputGroup,
Modal,
Tooltip,
} from '@patternfly/react-core';
import ChipGroup from '../ChipGroup';
import Popover from '../Popover';
@@ -243,24 +244,7 @@ function HostFilterLookup({
});
};
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.`
)}
/>
}
>
const renderLookup = () => (
<InputGroup onBlur={onBlur}>
<Button
aria-label={i18n._(t`Search`)}
@@ -288,6 +272,37 @@ function HostFilterLookup({
))}
</ChipHolder>
</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
aria-label={i18n._(t`Lookup modal`)}
isOpen={isModalOpen}