Skip to content

Commit

Permalink
[9.0] [ Siem Migrations ] Upsell Siem Migrations Start (#212607) (#21…
Browse files Browse the repository at this point in the history
…3044)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[ Siem Migrations ] Upsell Siem Migrations Start
(#212607)](#212607)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Jatin
Kathuria","email":"jatin.kathuria@elastic.co"},"sourceCommit":{"committedDate":"2025-02-28T03:51:31Z","message":"[
Siem Migrations ] Upsell Siem Migrations Start (#212607)\n\n##
Summary\n\nThis PR adds the Upsell section for SIEM Migration Start
section.\n\n-
[Design\nSource](https://www.figma.com/design/BD9GZZz6y8pfSbubAt5H2W/%5B8.18%5D-GenAI-Powered-SIEM-Migration%3A-Rule-translation?node-id=63-81202&p=f&t=8x9RlFegceXzwYQf-0)\n\nSIEM
migrations has below requirements in ESS and Serverless and if\nthese
requirements are not met, We show the upsell sections.\n\n- ESS\n -
`Enterprise` license.\n- Serverless\n - `Complete` Product tier\n\n##
Demo\n\n|Instance|Demo|\n|---|---|\n|Serverless|<video\nsrc=\"https://github.com/user-attachments/assets/58d3ce98-7108-4d74-9f5c-e270804f2666\"/>|\n|ESS|<video\nsrc=\"https://github.com/user-attachments/assets/85b650a7-fa11-4855-9927-aab89a2ed8ef\"/>|\n\n\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n###
Identify risks\n\nDoes this PR introduce any risks? For example,
consider risks like hard\nto test bugs, performance regression,
potential of data loss.\n\nDescribe the risk, its severity, and
mitigation for each identified\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\n\n- [ ] [See some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ]
...","sha":"44a184c701c09e1d69a3432d607b269932ea928d","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport
missing","v9.0.0","Team:Threat
Hunting","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[
Siem Migrations ] Upsell Siem Migrations
Start","number":212607,"url":"https://github.com/elastic/kibana/pull/212607","mergeCommit":{"message":"[
Siem Migrations ] Upsell Siem Migrations Start (#212607)\n\n##
Summary\n\nThis PR adds the Upsell section for SIEM Migration Start
section.\n\n-
[Design\nSource](https://www.figma.com/design/BD9GZZz6y8pfSbubAt5H2W/%5B8.18%5D-GenAI-Powered-SIEM-Migration%3A-Rule-translation?node-id=63-81202&p=f&t=8x9RlFegceXzwYQf-0)\n\nSIEM
migrations has below requirements in ESS and Serverless and if\nthese
requirements are not met, We show the upsell sections.\n\n- ESS\n -
`Enterprise` license.\n- Serverless\n - `Complete` Product tier\n\n##
Demo\n\n|Instance|Demo|\n|---|---|\n|Serverless|<video\nsrc=\"https://github.com/user-attachments/assets/58d3ce98-7108-4d74-9f5c-e270804f2666\"/>|\n|ESS|<video\nsrc=\"https://github.com/user-attachments/assets/85b650a7-fa11-4855-9927-aab89a2ed8ef\"/>|\n\n\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n###
Identify risks\n\nDoes this PR introduce any risks? For example,
consider risks like hard\nto test bugs, performance regression,
potential of data loss.\n\nDescribe the risk, its severity, and
mitigation for each identified\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\n\n- [ ] [See some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ]
...","sha":"44a184c701c09e1d69a3432d607b269932ea928d"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/212607","number":212607,"mergeCommit":{"message":"[
Siem Migrations ] Upsell Siem Migrations Start (#212607)\n\n##
Summary\n\nThis PR adds the Upsell section for SIEM Migration Start
section.\n\n-
[Design\nSource](https://www.figma.com/design/BD9GZZz6y8pfSbubAt5H2W/%5B8.18%5D-GenAI-Powered-SIEM-Migration%3A-Rule-translation?node-id=63-81202&p=f&t=8x9RlFegceXzwYQf-0)\n\nSIEM
migrations has below requirements in ESS and Serverless and if\nthese
requirements are not met, We show the upsell sections.\n\n- ESS\n -
`Enterprise` license.\n- Serverless\n - `Complete` Product tier\n\n##
Demo\n\n|Instance|Demo|\n|---|---|\n|Serverless|<video\nsrc=\"https://github.com/user-attachments/assets/58d3ce98-7108-4d74-9f5c-e270804f2666\"/>|\n|ESS|<video\nsrc=\"https://github.com/user-attachments/assets/85b650a7-fa11-4855-9927-aab89a2ed8ef\"/>|\n\n\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n###
Identify risks\n\nDoes this PR introduce any risks? For example,
consider risks like hard\nto test bugs, performance regression,
potential of data loss.\n\nDescribe the risk, its severity, and
mitigation for each identified\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\n\n- [ ] [See some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ]
...","sha":"44a184c701c09e1d69a3432d607b269932ea928d"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
  • Loading branch information
logeekal authored Mar 5, 2025
1 parent 6517579 commit 44d6892
Show file tree
Hide file tree
Showing 26 changed files with 612 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React from 'react';
import { render, screen } from '@testing-library/react';
import { SiemMigrationStartUpsellSection } from './siem_migrations_start';

describe('SiemMigrationStartUpsellSection', () => {
it('should render the component with all sections correctly', () => {
render(
<SiemMigrationStartUpsellSection
title="title"
upgradeMessage="upgradeMessage"
upgradeHref="https://upgrade.Href"
/>
);

expect(screen.getByTestId('siemMigrationStartUpsellSection')).toBeVisible();

expect(screen.getByTestId('siemMigrationStartUpsellTitle')).toBeVisible();
expect(screen.getByTestId('siemMigrationStartUpsellTitle')).toHaveTextContent('title');

expect(screen.getByTestId('siemMigrationStartUpsellMessage')).toBeVisible();
expect(screen.getByTestId('siemMigrationStartUpsellMessage')).toHaveTextContent(
'upgradeMessage'
);

expect(screen.getByTestId('siemMigrationStartUpsellHref')).toBeVisible();
expect(screen.getByTestId('siemMigrationStartUpsellHref')).toHaveAttribute(
'href',
'https://upgrade.Href'
);
});

it('should render the component without upgradeHref', () => {
render(<SiemMigrationStartUpsellSection title="title" upgradeMessage="upgradeMessage" />);

expect(screen.queryByTestId('SiemMigrationStartUpsellHref')).not.toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { EuiButton, EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiPanel, EuiText } from '@elastic/eui';
import React from 'react';

export const SiemMigrationStartUpsellSection = React.memo(function SiemMigrationStartUpsellSection({
title,
upgradeMessage,
upgradeHref,
}: {
title: React.ReactNode;
upgradeMessage: React.ReactNode;
upgradeHref?: string;
}) {
return (
<>
<EuiPanel data-test-subj="siemMigrationStartUpsellSection" paddingSize="none" hasBorder>
<EuiCallOut
data-test-subj="siemMigrationStartUpsellTitle"
title={title}
color="warning"
iconType="lock"
>
<EuiFlexGroup>
<EuiFlexItem grow={true}>
<EuiText size="s" data-test-subj="siemMigrationStartUpsellMessage">
{upgradeMessage}
</EuiText>
</EuiFlexItem>
{upgradeHref ? (
<EuiFlexItem grow={false}>
<EuiButton
data-test-subj="siemMigrationStartUpsellHref"
href={upgradeHref}
color="warning"
fill
>
{'Manage License'}
</EuiButton>
</EuiFlexItem>
) : null}
</EuiFlexGroup>
</EuiCallOut>
</EuiPanel>
</>
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export type UpsellingSectionId =
| 'endpoint_custom_notification'
| 'cloud_security_posture_integration_installation'
| 'ruleDetailsEndpointExceptions'
| 'automatic_import';
| 'automatic_import'
| 'siem_migrations_start';

export type UpsellingMessageId =
| 'investigation_guide'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ export const CenteredLoadingSpinner = React.memo<CenteredLoadingSpinnerProps>(
[topOffset, euiTheme]
);

return <EuiLoadingSpinner {...euiLoadingSpinnerProps} style={style} />;
return (
<EuiLoadingSpinner
data-test-subj="centeredLoadingSpinner"
{...euiLoadingSpinnerProps}
style={style}
/>
);
}
);
CenteredLoadingSpinner.displayName = 'CenteredLoadingSpinner';
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { UpsellingService } from '@kbn/security-solution-upselling/service';
import { calculateBounds } from '@kbn/data-plugin/common';
import { alertingPluginMock } from '@kbn/alerting-plugin/public/mocks';
import { createTelemetryServiceMock } from '../telemetry/telemetry_service.mock';
import { createSiemMigrationsMock } from '../../mock/mock_siem_migrations_service';

const mockUiSettings: Record<string, unknown> = {
[DEFAULT_TIME_RANGE]: { from: 'now-15m', to: 'now', mode: 'quick' },
Expand Down Expand Up @@ -128,6 +129,7 @@ export const createStartServicesMock = (
const mockSetHeaderActionMenu = jest.fn();
const timelineDataService = dataPluginMock.createStartContract();
const alerting = alertingPluginMock.createStartContract();
const siemMigrations = createSiemMigrationsMock();

/*
* Below mocks are needed by unified field list
Expand Down Expand Up @@ -258,6 +260,7 @@ export const createStartServicesMock = (
upselling: new UpsellingService(),
timelineDataService,
alerting,
siemMigrations,
} as unknown as StartServices;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ export * from './timeline_results';
export * from './utils';
export * from './create_store';
export * from './create_react_query_wrapper';
export * from './mock_siem_migrations_service';
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { createTelemetryServiceMock } from '../lib/telemetry/telemetry_service.mock';

const createRuleMigrationStorageMock = () => {
return {
get: jest.fn(),
set: jest.fn(),
remove: jest.fn(),
};
};

export const createSiemMigrationsMock = () => {
return {
rules: {
getLatestStats$: jest.fn(),
getMissingCapabilities: jest.fn(),
hasMissingCapabilities: jest.fn(),
isAvailable: jest.fn(),
startPolling: jest.fn(),
createRuleMigration: jest.fn(),
upsertMigrationResources: jest.fn(),
startRuleMigration: jest.fn(),
getRuleMigrationStats: jest.fn(),
getRuleMigrationsStats: jest.fn(),
getMissingResources: jest.fn(),
getIntegrations: jest.fn(),
connectorIdStorage: createRuleMigrationStorageMock(),
traceOptionsStorage: createRuleMigrationStorageMock(),
telemetry: createTelemetryServiceMock(),
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ export const aiConnectorCardConfig: OnboardingCardConfig<AIConnectorCardMetadata
)
),
checkComplete: checkAiConnectorsCardComplete,
licenseTypeRequired: 'enterprise',
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const startMigrationCardConfig: OnboardingCardConfig<StartMigrationCardMe
id: OnboardingCardId.siemMigrationsStart,
title: START_MIGRATION_CARD_TITLE,
icon: () => getCardIcon(OnboardingCardId.siemMigrationsStart),
licenseTypeRequired: 'enterprise',
Component: React.lazy(
() =>
import(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const RuleMigrationsPanels = React.memo<RuleMigrationsPanelsProps>(
);

return (
<EuiFlexGroup direction="column" gutterSize="m">
<EuiFlexGroup data-test-subj="ruleMigrationPanelGroup" direction="column" gutterSize="m">
<EuiFlexItem grow={false}>
{!isConnectorsCardComplete && (
<>
Expand Down
Loading

0 comments on commit 44d6892

Please sign in to comment.