Skip to content

Commit 12a4fe4

Browse files
authored
[bugfix] Replace panel flyout opens 2 flyouts (#76931) (#77140)
* fix replace panel flyout opens 2 flyouts * fix sample action flyout
1 parent 80ec47e commit 12a4fe4

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

src/plugins/dashboard/public/application/actions/open_replace_panel_flyout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export async function openReplacePanelFlyout(options: {
6060
/>
6161
),
6262
{
63-
'data-test-subj': 'replacePanelFlyout',
63+
'data-test-subj': 'dashboardReplacePanel',
64+
ownFocus: true,
6465
}
6566
);
6667
}

src/plugins/dashboard/public/application/actions/replace_panel_flyout.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@
1919

2020
import { i18n } from '@kbn/i18n';
2121
import React from 'react';
22-
import _ from 'lodash';
23-
import { EuiFlyout, EuiFlyoutBody, EuiFlyoutHeader, EuiTitle } from '@elastic/eui';
22+
import { EuiFlyoutBody, EuiFlyoutHeader, EuiTitle } from '@elastic/eui';
2423
import { NotificationsStart, Toast } from 'src/core/public';
2524
import { DashboardPanelState } from '../embeddable';
2625
import {
27-
IContainer,
28-
IEmbeddable,
2926
EmbeddableInput,
3027
EmbeddableOutput,
3128
EmbeddableStart,
29+
IContainer,
30+
IEmbeddable,
3231
SavedObjectEmbeddableInput,
3332
} from '../../embeddable_plugin';
3433

@@ -122,7 +121,7 @@ export class ReplacePanelFlyout extends React.Component<Props> {
122121
const panelToReplace = 'Replace panel ' + this.props.panelToRemove.getTitle() + ' with:';
123122

124123
return (
125-
<EuiFlyout ownFocus onClose={this.props.onClose} data-test-subj="dashboardReplacePanel">
124+
<>
126125
<EuiFlyoutHeader hasBorder>
127126
<EuiTitle size="m">
128127
<h2>
@@ -131,7 +130,7 @@ export class ReplacePanelFlyout extends React.Component<Props> {
131130
</EuiTitle>
132131
</EuiFlyoutHeader>
133132
<EuiFlyoutBody>{savedObjectsFinder}</EuiFlyoutBody>
134-
</EuiFlyout>
133+
</>
135134
);
136135
}
137136
}

src/plugins/ui_actions/public/tests/test_samples/hello_world_action.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
import React from 'react';
21-
import { EuiFlyout, EuiFlexGroup, EuiFlexItem, EuiBadge } from '@elastic/eui';
21+
import { EuiFlexGroup, EuiFlexItem, EuiBadge, EuiFlyoutBody } from '@elastic/eui';
2222
import { CoreStart } from 'src/core/public';
2323
import { createAction, ActionByType } from '../../actions';
2424
import { toMountPoint, reactToUiComponent } from '../../../../kibana_react/public';
@@ -49,14 +49,11 @@ export function createHelloWorldAction(
4949
getIconType: () => 'lock',
5050
MenuItem: UiMenuItem,
5151
execute: async () => {
52-
const flyoutSession = overlays.openFlyout(
53-
toMountPoint(
54-
<EuiFlyout ownFocus onClose={() => flyoutSession && flyoutSession.close()}>
55-
Hello World, I am a hello world action!
56-
</EuiFlyout>
57-
),
52+
overlays.openFlyout(
53+
toMountPoint(<EuiFlyoutBody>Hello World, I am a hello world action!</EuiFlyoutBody>),
5854
{
5955
'data-test-subj': 'helloWorldAction',
56+
ownFocus: true,
6057
}
6158
);
6259
},

0 commit comments

Comments
 (0)