[Fleet] Fix add agent help not closing when button clicked (#117104)

* close help popover when button clicked

* reduce popover z-index to hide behind modals
This commit is contained in:
Mark Hopkin 2021-11-02 13:12:14 +00:00 committed by GitHub
parent 4d8363a92d
commit f130759e82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -22,8 +22,12 @@ const AddAgentButton = ({ onAddAgent }: { onAddAgent: () => void }) => (
);
const AddAgentButtonWithPopover = ({ onAddAgent }: { onAddAgent: () => void }) => {
const button = <AddAgentButton onAddAgent={onAddAgent} />;
const [isHelpOpen, setIsHelpOpen] = useState<boolean>(true);
const onAddAgentCloseHelp = () => {
setIsHelpOpen(false);
onAddAgent();
};
const button = <AddAgentButton onAddAgent={onAddAgentCloseHelp} />;
return (
<AddAgentHelpPopover
button={button}

View file

@ -11,6 +11,9 @@ import { FormattedMessage } from '@kbn/i18n/react';
import type { NoArgCallback } from '@elastic/eui';
import { EuiTourStep, EuiLink, EuiText } from '@elastic/eui';
import { useTheme } from 'styled-components';
import type { EuiTheme } from '../../../../../src/plugins/kibana_react/common';
import { useStartServices } from '../hooks';
@ -26,7 +29,7 @@ export const AddAgentHelpPopover = ({
closePopover: NoArgCallback<void>;
}) => {
const { docLinks } = useStartServices();
const theme = useTheme() as EuiTheme;
const optionalProps: { offset?: number } = {};
if (offset !== undefined) {
@ -55,6 +58,7 @@ export const AddAgentHelpPopover = ({
/>
</EuiText>
}
zIndex={theme.eui.euiZLevel1 - 1} // put popover behind any modals that happen to be open
isStepOpen={isOpen}
minWidth={300}
onFinish={() => {}}