[Siem Migrations] Translated Rules Upsell Page (#212777)

## Summary

This PR adds the Upsell for `Translated Rules` Page as per
[design](https://www.figma.com/design/BD9GZZz6y8pfSbubAt5H2W/%5B8.18%5D-GenAI-Powered-SIEM-Migration%3A-Rule-translation?node-id=63-81202&p=f&t=oJug1zebtufPlNKM-0).


Below is the Demo for the same.

|Instance|Demo|
|---|---|
|ESS|<video
src="https://github.com/user-attachments/assets/d7484635-292d-4bf0-883b-c9fd93b72096"/>|
|Serverless|<video
src="https://github.com/user-attachments/assets/767d8409-a391-41b8-b4d1-1c838dffc363"/>|




### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios


### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Jatin Kathuria 2025-03-05 15:53:26 +01:00 committed by GitHub
parent d5d1c8fa75
commit 197a281bf9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 239 additions and 3 deletions

View file

@ -79,3 +79,10 @@ export const PREBUILT_RULE_CUSTOMIZATION_DESCRIPTION = (
},
}
);
export const SIEM_MIGRATION_MANAGER_LICENSE_BTN = i18n.translate(
'securitySolutionPackages.upselling.siemMigrations.manageLicenseBtn',
{
defaultMessage: 'Manage license',
}
);

View file

@ -0,0 +1,50 @@
/*
* 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 { SiemMigrationsTranslatedRulesUpsellPage } from './siem_migrations_translated_rules';
import { render, screen } from '@testing-library/react';
describe('SiemMigrationsTranslatedRulesUpsellPage', () => {
it('should render the component with all sections correctly', () => {
render(
<SiemMigrationsTranslatedRulesUpsellPage
title="title"
upgradeMessage="upgradeMessage"
upgradeHref="https://upgrade.Href"
/>
);
expect(screen.getByTestId('siemMigrationTranslatedRulesUpsellButton')).toBeVisible();
expect(screen.getByTestId('siemMigrationTranslatedRulesUpsellTitle')).toBeVisible();
expect(screen.getByTestId('siemMigrationTranslatedRulesUpsellTitle')).toHaveTextContent(
'title'
);
expect(screen.getByTestId('siemMigrationTranslatedRulesUpsellUpgradeMessage')).toBeVisible();
expect(
screen.getByTestId('siemMigrationTranslatedRulesUpsellUpgradeMessage')
).toHaveTextContent('upgradeMessage');
expect(screen.getByTestId('siemMigrationTranslatedRulesUpsellButton')).toBeVisible();
expect(screen.getByTestId('siemMigrationTranslatedRulesUpsellButton')).toHaveAttribute(
'href',
'https://upgrade.Href'
);
});
it('should render the component without upgradeHref', () => {
render(
<SiemMigrationsTranslatedRulesUpsellPage title="title" upgradeMessage="upgradeMessage" />
);
expect(
screen.queryByTestId('siemMigrationTranslatedRulesUpsellButton')
).not.toBeInTheDocument();
});
});

View file

@ -0,0 +1,74 @@
/*
* 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, EuiEmptyPrompt, EuiPageHeader, EuiFlexItem, EuiFlexGroup } from '@elastic/eui';
import React, { useMemo } from 'react';
import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template';
import { css } from '@emotion/react';
import { SIEM_MIGRATION_MANAGER_LICENSE_BTN } from '../messages';
import * as i18n from './translations';
export const SiemMigrationsTranslatedRulesUpsellPage = React.memo(
function SiemMigrationsTranslatedRulesUpsellPage({
title,
upgradeMessage,
upgradeHref,
}: {
title: React.ReactNode;
upgradeMessage: React.ReactNode;
upgradeHref?: string;
}) {
const CTAButton = useMemo(() => {
return (
<EuiButton
data-test-subj="siemMigrationTranslatedRulesUpsellButton"
href={upgradeHref}
color="primary"
iconType="gear"
>
{SIEM_MIGRATION_MANAGER_LICENSE_BTN}
</EuiButton>
);
}, [upgradeHref]);
return (
<KibanaPageTemplate contentBorder={false} grow={true} restrictWidth={false}>
<KibanaPageTemplate.Section color="plain" paddingSize="none">
<EuiPageHeader bottomBorder pageTitle={i18n.SIEM_MIGRATION_UPSELLING_PAGE_TITLE} />
<EuiFlexGroup
css={css`
/**
* Height of 210px applies to both ESS and Serverless.
* It is combination of height of Kibana Header + Action Bar and Page Header
*
*/
min-height: calc(100vh - 210px);
`}
justifyContent="center"
alignItems="center"
direction="column"
>
<EuiFlexItem>
<EuiEmptyPrompt
title={
<span data-test-subj="siemMigrationTranslatedRulesUpsellTitle">{title}</span>
}
actions={upgradeHref ? CTAButton : null}
iconType={'logoSecurity'}
body={
<span data-test-subj="siemMigrationTranslatedRulesUpsellUpgradeMessage">
{upgradeMessage}
</span>
}
/>
</EuiFlexItem>
</EuiFlexGroup>
</KibanaPageTemplate.Section>
</KibanaPageTemplate>
);
}
);

View file

@ -28,3 +28,10 @@ export const ENTITY_ANALYTICS_TITLE = i18n.translate(
defaultMessage: 'Entity Analytics',
}
);
export const SIEM_MIGRATION_UPSELLING_PAGE_TITLE = i18n.translate(
'securitySolutionPackages.siemMigration.pageTitle',
{
defaultMessage: 'Translate Rules',
}
);

View file

@ -7,6 +7,7 @@
import { EuiButton, EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiPanel, EuiText } from '@elastic/eui';
import React from 'react';
import { SIEM_MIGRATION_MANAGER_LICENSE_BTN } from '../messages';
export const SiemMigrationStartUpsellSection = React.memo(function SiemMigrationStartUpsellSection({
title,
@ -40,7 +41,7 @@ export const SiemMigrationStartUpsellSection = React.memo(function SiemMigration
color="warning"
fill
>
{'Manage License'}
{SIEM_MIGRATION_MANAGER_LICENSE_BTN}
</EuiButton>
</EuiFlexItem>
) : null}

View file

@ -27,6 +27,16 @@ export const SiemMigrationsStartUpsellSectionLazy = withSuspenseUpsell(
)
);
export const SiemMigrationsTranslatedRulesUpsellPageLazy = withSuspenseUpsell(
lazy(() =>
import('./pages/siem_migrations_translated_rules').then(
({ SiemMigrationsTranslatedRulesPage }) => ({
default: SiemMigrationsTranslatedRulesPage,
})
)
)
);
export const EntityAnalyticsUpsellingPageLazy = lazy(() =>
import('./pages/entity_analytics_upselling').then(({ EntityAnalyticsUpsellingPageESS }) => ({
default: EntityAnalyticsUpsellingPageESS,

View file

@ -0,0 +1,27 @@
/*
* 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 { SiemMigrationsTranslatedRulesUpsellPage as SiemMigrationsTranslatedRulesUpsellPageCommonn } from '@kbn/security-solution-upselling/pages/siem_migrations_translated_rules';
import { useKibana } from '../../common/services';
import * as i18n from '../translations';
export const SiemMigrationsTranslatedRulesPage = React.memo(
function SiemMigrationsTranslatedRulesPage() {
const { services } = useKibana();
return (
<SiemMigrationsTranslatedRulesUpsellPageCommonn
title={i18n.SIEM_MIGRATION_UPSELLING_TITLE('Enterprise')}
upgradeMessage={i18n.SIEM_MIGRATION_RULES_PAGE_UPGRADE_LICENSE_MESSAGE}
upgradeHref={services.application.getUrlForApp('management', {
path: 'stack/license_management',
})}
/>
);
}
);

View file

@ -10,7 +10,7 @@ import { SecurityPageName } from '@kbn/security-solution-plugin/common';
import { upsellingPages } from './register_upsellings';
describe('upsellingPages', () => {
it('registers the Attack discovery page with the expected minimum license for self managed', () => {
it('should register the Attack discovery page with the expected minimum license for self managed', () => {
const attackDiscoveryPage = upsellingPages.find(
({ pageName }) => pageName === SecurityPageName.attackDiscovery
);

View file

@ -32,6 +32,7 @@ import {
EntityAnalyticsUpsellingPageLazy,
EntityAnalyticsUpsellingSectionLazy,
SiemMigrationsStartUpsellSectionLazy,
SiemMigrationsTranslatedRulesUpsellPageLazy,
} from './lazy_upselling';
interface UpsellingsConfig {
@ -102,6 +103,12 @@ export const upsellingPages: UpsellingPages = [
minimumLicenseRequired: 'enterprise',
component: AttackDiscoveryUpsellingPageLazy,
},
{
pageName: SecurityPageName.siemMigrationsRules,
minimumLicenseRequired: 'enterprise',
component: SiemMigrationsTranslatedRulesUpsellPageLazy,
},
];
// Upsellings for sections, linked by arbitrary ids

View file

@ -29,3 +29,11 @@ export const SIEM_MIGRATION_UPGRADE_LICENSE_MESSAGE = i18n.translate(
defaultMessage: 'To use this feature, upgrade your Elastic subscription level.',
}
);
export const SIEM_MIGRATION_RULES_PAGE_UPGRADE_LICENSE_MESSAGE = i18n.translate(
'xpack.securitySolutionEss.upselling.siemMigrations.rulesPageUpgradeLicenseMessage',
{
defaultMessage:
'To use this feature, upgrade your Elastic subscription level. If you have created a migration previously, you will be able to access it after upgrade.',
}
);

View file

@ -49,6 +49,16 @@ export const SiemMigrationsStartUpsellSectionLazy = withSuspenseUpsell(
)
);
export const SiemMigrationsTranslatedRulesUpsellPageLazy = withSuspenseUpsell(
lazy(() =>
import('./pages/siem_migrations_translated_rules').then(
({ SiemMigrationsTranslatedRulesUpsellPage }) => ({
default: SiemMigrationsTranslatedRulesUpsellPage,
})
)
)
);
export const AttackDiscoveryUpsellingPageLazy = withSuspenseUpsell(
lazy(() =>
import('./pages/attack_discovery').then(({ AttackDiscoveryUpsellingPageServerless }) => ({

View file

@ -0,0 +1,21 @@
/*
* 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 { SiemMigrationsTranslatedRulesUpsellPage as SiemMigrationsTranslatedRulesUpsellPageCommon } from '@kbn/security-solution-upselling/pages/siem_migrations_translated_rules';
import * as i18n from '../translations';
export const SiemMigrationsTranslatedRulesUpsellPage = React.memo(
function SiemMigrationsTranslatedRulesUpsellPage() {
return (
<SiemMigrationsTranslatedRulesUpsellPageCommon
title={i18n.SIEM_MIGRATION_UPSELLING_TITLE('Complete')}
upgradeMessage={i18n.SIEM_MIGRATION_RULES_PAGE_UPGRADE_LICENSE_MESSAGE}
/>
);
}
);

View file

@ -42,3 +42,11 @@ export const SIEM_MIGRATION_UPGRADE_MESSAGE = i18n.translate(
'To use this feature, you need to upgrade your Elastic Cloud Serverless feature tier. Update your subscription or contact your administrator for assistance.',
}
);
export const SIEM_MIGRATION_RULES_PAGE_UPGRADE_LICENSE_MESSAGE = i18n.translate(
'xpack.securitySolutionServerless.upselling.siemMigrations.rulesPageUpgradeLicenseMessage',
{
defaultMessage:
'To use this feature, you need to upgrade your Elastic Cloud Serverless feature tier. Update your subscription or contact your administrator for assistance. If you have created a migration previously, you will be able to access it after upgrade.',
}
);

View file

@ -34,6 +34,7 @@ import {
EntityAnalyticsUpsellingSectionLazy,
OsqueryResponseActionsUpsellingSectionLazy,
SiemMigrationsStartUpsellSectionLazy,
SiemMigrationsTranslatedRulesUpsellPageLazy,
ThreatIntelligencePaywallLazy,
} from './lazy_upselling';
import * as i18n from './translations';
@ -86,6 +87,11 @@ export const upsellingPages: UpsellingPages = [
pli: ProductFeatureKey.attackDiscovery,
component: () => <AttackDiscoveryUpsellingPageLazy />,
},
{
pageName: SecurityPageName.siemMigrationsRules,
pli: ProductFeatureKey.siemMigrations,
component: () => <SiemMigrationsTranslatedRulesUpsellPageLazy />,
},
];
const entityAnalyticsProductType = getProductTypeByPLI(ProductFeatureKey.advancedInsights) ?? '';

View file

@ -46,6 +46,6 @@
"@kbn/logging",
"@kbn/automatic-import-plugin",
"@kbn/cloud-security-posture-common",
"@kbn/dev-utils"
"@kbn/dev-utils",
]
}