diff --git a/x-pack/solutions/security/plugins/security_solution/public/one_discover/alert_flyout_header_component/index.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/one_discover/alert_flyout_header_component/index.test.tsx
index 87e5ce1a395c8..801ba1a8769fe 100644
--- a/x-pack/solutions/security/plugins/security_solution/public/one_discover/alert_flyout_header_component/index.test.tsx
+++ b/x-pack/solutions/security/plugins/security_solution/public/one_discover/alert_flyout_header_component/index.test.tsx
@@ -286,6 +286,24 @@ describe('AlertFlyoutHeader', () => {
);
});
+ it('renders nothing while services or store are not yet resolved', () => {
+ const hit = { id: '1', raw: {}, flattened: {} } as unknown as DataTableRecord;
+ const history = createMemoryHistory({ initialEntries: ['/discover'] });
+
+ const { container } = render(
+
+ {})}
+ storePromise={new Promise(() => {})}
+ onAlertUpdated={jest.fn()}
+ />
+
+ );
+
+ expect(container).toBeEmptyDOMElement();
+ });
+
it('shows a callout when _id or _index are missing from hit.raw', async () => {
const hit = { id: '1', raw: {}, flattened: {} } as unknown as DataTableRecord;
const store = createStore(() => ({}));
@@ -340,6 +358,39 @@ describe('AlertFlyoutHeader', () => {
});
});
+ it('shows linked project callout text for remote docs in serverless', async () => {
+ const hit = {
+ id: '1',
+ raw: { _id: '1', _index: 'remote-cluster:logs-system-default' },
+ flattened: {},
+ } as unknown as DataTableRecord;
+ const store = createStore(() => ({}));
+ const history = createMemoryHistory({ initialEntries: ['/discover'] });
+ const serverlessServicesMock = {
+ ...servicesMock,
+ cloud: { isServerlessEnabled: true },
+ } as unknown as StartServices;
+
+ render(
+
+
+
+ );
+
+ await waitFor(() => {
+ expect(
+ screen.getByText(
+ 'This event originates from a linked project. Some features may not be available.'
+ )
+ ).toBeInTheDocument();
+ });
+ });
+
it('does not show the callout when both _id and _index are present in hit.raw', async () => {
const hit = {
id: '1',
diff --git a/x-pack/solutions/security/plugins/security_solution/public/one_discover/alert_flyout_header_component/index.tsx b/x-pack/solutions/security/plugins/security_solution/public/one_discover/alert_flyout_header_component/index.tsx
index e39c2d26742da..e6f5e6b8a1c61 100644
--- a/x-pack/solutions/security/plugins/security_solution/public/one_discover/alert_flyout_header_component/index.tsx
+++ b/x-pack/solutions/security/plugins/security_solution/public/one_discover/alert_flyout_header_component/index.tsx
@@ -138,43 +138,35 @@ export const AlertFlyoutHeader = ({
};
}, [servicesPromise, storePromise]);
- const isMissingMetadata = !hit.raw._id || !hit.raw._index;
-
- const metadataCallout = isMissingMetadata ? (
- <>
-
-
- >
- ) : null;
- const remoteDocumentCallout = (
-
-
-
- );
-
if (!services || !store) {
- return (
- <>
- {metadataCallout}
- {remoteDocumentCallout}
- >
- );
+ return null;
}
+ const isMissingMetadata = !hit.raw._id || !hit.raw._index;
+
return (
<>
- {metadataCallout}
- {remoteDocumentCallout}
+ {isMissingMetadata ? (
+ <>
+
+
+ >
+ ) : null}
{flyoutProviders({
services,
store,
children: (
-
+ <>
+
+
+
+
+ >
),
})}
>