Skip to content

Commit

Permalink
[8.6] [Fleet] Fix fleet server flyout not closing when clicking conti…
Browse files Browse the repository at this point in the history
…nue enrolling (elastic#145874) (elastic#145899)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Fleet] Fix fleet server flyout not closing when clicking continue
enrolling (elastic#145874)](elastic#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
(elastic#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
(elastic#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
(elastic#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>
  • Loading branch information
kibanamachine and criamico authored Nov 21, 2022
1 parent 87ac652 commit e1c4607
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const ConfirmFleetServerConnectionStepContent: React.FunctionComponent<{

const handleContinueClick = () => {
fleetStatus.forceDisplayInstructions = false;
flyoutContext.closeFleetServerFlyout();
flyoutContext.openEnrollmentFlyout();
};

Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

/* eslint-disable @elastic/eui/href-or-on-click */
import React from 'react';

import type { EuiStepProps } from '@elastic/eui';
Expand All @@ -14,7 +15,7 @@ import {
EuiCode,
EuiForm,
EuiFormErrorText,
EuiLink,
EuiButtonEmpty,
EuiSpacer,
EuiText,
EuiFormRow,
Expand All @@ -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';
Expand All @@ -51,6 +52,7 @@ const GettingStartedStepContent: React.FunctionComponent<QuickStartCreateForm> =
submit,
}) => {
const { getHref } = useLink();
const flyoutContext = useFlyoutContext();

if (status === 'success') {
return (
Expand All @@ -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>
),
}}
/>
Expand Down

0 comments on commit e1c4607

Please sign in to comment.