Skip to content

Commit

Permalink
[Security Solution][Admin][AVC Banner] AVC banner logic moved into a …
Browse files Browse the repository at this point in the history
…kbn package (elastic#188359)

- [x] This is an improvement pr to move all the avc banner logic into a
reusable kibana package (security solution and fleet integrations)
- [x] Compresses the svg used in the banner's  background
- [x] Fixes a bug where the blog link didn't previously open in a new
tab

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 14498a0)
  • Loading branch information
parkiino committed Jul 23, 2024
1 parent c3a585d commit 84cee3f
Show file tree
Hide file tree
Showing 21 changed files with 1,851 additions and 727 deletions.
1,756 changes: 1,756 additions & 0 deletions .github/CODEOWNERS

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"alertingTypes": "packages/kbn-alerting-types",
"apmOss": "src/plugins/apm_oss",
"autocomplete": "packages/kbn-securitysolution-autocomplete/src",
"avcBanner": "packages/kbn-avc-banner/src",
"bfetch": "src/plugins/bfetch",
"bfetchError": "packages/kbn-bfetch-error",
"cases": ["packages/kbn-cases-components"],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
"@kbn/application-usage-test-plugin": "link:x-pack/test/usage_collection/plugins/application_usage_test",
"@kbn/assets-data-access-plugin": "link:x-pack/plugins/observability_solution/assets_data_access",
"@kbn/audit-log-plugin": "link:x-pack/test/security_api_integration/plugins/audit_log",
"@kbn/avc-banner": "link:packages/kbn-avc-banner",
"@kbn/banners-plugin": "link:x-pack/plugins/banners",
"@kbn/bfetch-error": "link:packages/kbn-bfetch-error",
"@kbn/bfetch-explorer-plugin": "link:examples/bfetch_explorer",
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-avc-banner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @kbn/avc-banner

`@kbn/avc-banner` is the callout component to showcase the AVC 2024 results Elastic Security recently received for our native Endpoint and encourage users to install Elastic Defend/Endpoint. This package should be delted at EOY 2024.
9 changes: 9 additions & 0 deletions packages/kbn-avc-banner/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export * from './src';
13 changes: 13 additions & 0 deletions packages/kbn-avc-banner/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-avc-banner'],
};
5 changes: 5 additions & 0 deletions packages/kbn-avc-banner/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "shared-browser",
"id": "@kbn/avc-banner",
"owner": "@elastic/security-defend-workflows"
}
6 changes: 6 additions & 0 deletions packages/kbn-avc-banner/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@kbn/avc-banner",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}
1 change: 1 addition & 0 deletions packages/kbn-avc-banner/src/avc_banner_background.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions packages/kbn-avc-banner/src/custom.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

declare module '*.svg' {
const content: string;
// eslint-disable-next-line import/no-default-export
export default content;
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
/*
* 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.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React from 'react';
import { css } from '@emotion/css';
import { i18n } from '@kbn/i18n';
import { EuiButton, EuiCallOut, EuiSpacer, useEuiTheme } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { useKibana } from '../../lib/kibana';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import avcBannerBackground from './avc_banner_background.svg';

export const AVCResultsBanner2024: React.FC<{ onDismiss: () => void }> = ({ onDismiss }) => {
const { docLinks } = useKibana().services;
const { euiTheme } = useEuiTheme();
const bannerTitle = i18n.translate('xpack.securitySolution.common.avcResultsBanner.title', {
const bannerTitle = i18n.translate('avcBanner.title', {
defaultMessage: '100% protection with zero false positives.',
});

Expand All @@ -38,20 +39,18 @@ export const AVCResultsBanner2024: React.FC<{ onDismiss: () => void }> = ({ onDi
data-test-subj="avcResultsBanner"
>
<FormattedMessage
id="xpack.securitySolution.common.avcResultsBanner.body"
id="avcBanner.body"
defaultMessage="Elastic Security shines in Malware Protection Test by AV-Comparatives"
/>
<EuiSpacer size="s" />
<EuiButton
size="s"
color="success"
href={docLinks.links.securitySolution.avcResults}
href={docLinks?.links.securitySolution.avcResults}
target="_blank"
data-test-subj="avcReadTheBlog"
>
<FormattedMessage
id="xpack.securitySolution.common.avcResults.readTheBlog.link"
defaultMessage="Read the blog"
/>
<FormattedMessage id="avcBanner.readTheBlog.link" defaultMessage="Read the blog" />
</EuiButton>
</EuiCallOut>
);
Expand Down
23 changes: 23 additions & 0 deletions packages/kbn-avc-banner/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node",
"react"
]
},
"include": [
"**/*.ts",
"**/*.tsx",
],
"exclude": [
"target/**/*"
],
"kbn_references": [
"@kbn/i18n",
"@kbn/i18n-react",
"@kbn/kibana-react-plugin",
]
}
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
"@kbn/assets-data-access-plugin/*": ["x-pack/plugins/observability_solution/assets_data_access/*"],
"@kbn/audit-log-plugin": ["x-pack/test/security_api_integration/plugins/audit_log"],
"@kbn/audit-log-plugin/*": ["x-pack/test/security_api_integration/plugins/audit_log/*"],
"@kbn/avc-banner": ["packages/kbn-avc-banner"],
"@kbn/avc-banner/*": ["packages/kbn-avc-banner/*"],
"@kbn/axe-config": ["packages/kbn-axe-config"],
"@kbn/axe-config/*": ["packages/kbn-axe-config/*"],
"@kbn/babel-preset": ["packages/kbn-babel-preset"],
Expand Down
Loading

0 comments on commit 84cee3f

Please sign in to comment.