[8.6] [Fleet] Fix fleet server flyout not closing when clicking continue enrolling (#145874) (#145899)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Fleet] Fix fleet server flyout not closing when clicking continue
enrolling (#145874)](https://github.com/elastic/kibana/pull/145874)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Cristina
Amico","email":"criamico@users.noreply.github.com"},"sourceCommit":{"committedDate":"2022-11-21T17:30:06Z","message":"[Fleet]
Fix fleet server flyout not closing when clicking continue enrolling
(#145874)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/144965\r\n\r\nSmall bugfix for
fleet server flyout. \r\n\r\n- When clicking on \"fleet settings\" link
the user was navigated to\r\nsettings but the flyout was staying
open\r\n\r\n- Also, After clicking on \"Continue enrolling\", the agent
flyout was\r\nopening on top of the fleet server flyout, which then
stayed open.\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"9417bc11c4d0d531b640a15417a3e9d809d18014","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v8.6.0","v8.7.0"],"number":145874,"url":"https://github.com/elastic/kibana/pull/145874","mergeCommit":{"message":"[Fleet]
Fix fleet server flyout not closing when clicking continue enrolling
(#145874)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/144965\r\n\r\nSmall bugfix for
fleet server flyout. \r\n\r\n- When clicking on \"fleet settings\" link
the user was navigated to\r\nsettings but the flyout was staying
open\r\n\r\n- Also, After clicking on \"Continue enrolling\", the agent
flyout was\r\nopening on top of the fleet server flyout, which then
stayed open.\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"9417bc11c4d0d531b640a15417a3e9d809d18014"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145874","number":145874,"mergeCommit":{"message":"[Fleet]
Fix fleet server flyout not closing when clicking continue enrolling
(#145874)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/144965\r\n\r\nSmall bugfix for
fleet server flyout. \r\n\r\n- When clicking on \"fleet settings\" link
the user was navigated to\r\nsettings but the flyout was staying
open\r\n\r\n- Also, After clicking on \"Continue enrolling\", the agent
flyout was\r\nopening on top of the fleet server flyout, which then
stayed open.\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"9417bc11c4d0d531b640a15417a3e9d809d18014"}}]}]
BACKPORT-->

Co-authored-by: Cristina Amico <criamico@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2022-11-21 13:33:55 -05:00 committed by GitHub
parent 87ac6522e3
commit e1c4607e48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View file

@ -47,6 +47,7 @@ const ConfirmFleetServerConnectionStepContent: React.FunctionComponent<{
const handleContinueClick = () => {
fleetStatus.forceDisplayInstructions = false;
flyoutContext.closeFleetServerFlyout();
flyoutContext.openEnrollmentFlyout();
};
@ -61,7 +62,11 @@ const ConfirmFleetServerConnectionStepContent: React.FunctionComponent<{
<EuiSpacer size="m" />
<EuiButton color="primary" onClick={handleContinueClick}>
<EuiButton
color="primary"
onClick={handleContinueClick}
data-test-subj="fleetServerFlyoutContinueEnrollingButton"
>
<FormattedMessage
id="xpack.fleet.fleetServerFlyout.continueEnrollingButton"
defaultMessage="Continue enrolling Elastic Agent"

View file

@ -5,6 +5,7 @@
* 2.0.
*/
/* eslint-disable @elastic/eui/href-or-on-click */
import React from 'react';
import type { EuiStepProps } from '@elastic/eui';
@ -14,7 +15,7 @@ import {
EuiCode,
EuiForm,
EuiFormErrorText,
EuiLink,
EuiButtonEmpty,
EuiSpacer,
EuiText,
EuiFormRow,
@ -26,7 +27,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { MultiRowInput } from '../../../sections/settings/components/multi_row_input';
import { useLink } from '../../../hooks';
import { useLink, useFlyoutContext } from '../../../hooks';
import type { QuickStartCreateForm } from '../hooks';
import { FleetServerHostSelect } from '../components';
@ -51,6 +52,7 @@ const GettingStartedStepContent: React.FunctionComponent<QuickStartCreateForm> =
submit,
}) => {
const { getHref } = useLink();
const flyoutContext = useFlyoutContext();
if (status === 'success') {
return (
@ -71,12 +73,16 @@ const GettingStartedStepContent: React.FunctionComponent<QuickStartCreateForm> =
values={{
hostUrl: <EuiCode>{selectedFleetServerHost?.host_urls[0]}</EuiCode>,
fleetSettingsLink: (
<EuiLink href={getHref('settings')}>
<EuiButtonEmpty
href={getHref('settings')}
onClick={() => flyoutContext.closeFleetServerFlyout()}
flush="left"
>
<FormattedMessage
id="xpack.fleet.fleetServerSetup.fleetSettingsLink"
defaultMessage="Fleet Settings"
/>
</EuiLink>
</EuiButtonEmpty>
),
}}
/>