From 8812be233fa481de2b881822a3abcd692047eded Mon Sep 17 00:00:00 2001 From: parkiino Date: Tue, 9 Jul 2024 15:28:55 -0400 Subject: [PATCH 1/8] compact svg and date wip --- .../epm/screens/detail/index.test.tsx | 4 + .../avc_banner/avc_banner_background.svg | 330 +----------------- .../avc_banner/avc_banner_background.svg | 330 +----------------- .../landing_page/onboarding/onboarding.tsx | 11 +- 4 files changed, 16 insertions(+), 659 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx index 4617cc9bd8b1f..0102297ed32dc 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx @@ -345,6 +345,10 @@ describe('when on integration detail', () => { ); }); }); + describe('and package is endpoint', () => { + const pkgkey = 'endpoint'; + const detailPageUrlPath = pagePathGetters.integration_details_overview({ pkgkey })[1]; + }); }); interface MockedApi< diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/avc_banner/avc_banner_background.svg b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/avc_banner/avc_banner_background.svg index cd37f26c95f7b..57b0f91a419e9 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/avc_banner/avc_banner_background.svg +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/avc_banner/avc_banner_background.svg @@ -1,329 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/x-pack/plugins/security_solution/public/common/components/avc_banner/avc_banner_background.svg b/x-pack/plugins/security_solution/public/common/components/avc_banner/avc_banner_background.svg index cd37f26c95f7b..57b0f91a419e9 100644 --- a/x-pack/plugins/security_solution/public/common/components/avc_banner/avc_banner_background.svg +++ b/x-pack/plugins/security_solution/public/common/components/avc_banner/avc_banner_background.svg @@ -1,329 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.tsx b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.tsx index c19f03f63461d..21eb1ae6618ee 100644 --- a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.tsx +++ b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.tsx @@ -66,6 +66,15 @@ export const OnboardingComponent: React.FC = ({ [telemetry] ); + const year2025 = new Date('January, 1, 2025 00:00:00'); + console.log('year2025', year2025); + // const today = new Date().getTime(); + // const today = new Date('December, 30, 2024 00:00:00'); + const today = new Date('January, 1, 2025 00:00:00'); + console.log('today', today); + + const isStillYear2024 = today < year2025; + const [showAVCBanner, setShowAVCBanner] = useState( storage.get('securitySolution.showAvcBanner') ?? true ); @@ -78,7 +87,7 @@ export const OnboardingComponent: React.FC = ({ return (
- {showAVCBanner && ( + {showAVCBanner && isStillYear2024 && ( From f542f7d2c97b6962f105dfecebd8f40c6579e774 Mon Sep 17 00:00:00 2001 From: Candace Park Date: Wed, 10 Jul 2024 16:33:10 -0400 Subject: [PATCH 2/8] wip date v2 --- .../landing_page/onboarding/onboarding.test.tsx | 15 +++++++++++++-- .../landing_page/onboarding/onboarding.tsx | 10 +++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.test.tsx b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.test.tsx index fb7b6b4c9ec6b..603512a69ef34 100644 --- a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.test.tsx @@ -72,7 +72,10 @@ describe('OnboardingComponent', () => { expect(welcomeHeader).toBeInTheDocument(); expect(togglePanel).toBeInTheDocument(); }); - describe('AVC 2024 Results banner', () => { + describe.only('AVC 2024 Results banner', () => { + afterEach(() => { + jest.clearAllMocks(); + }); it('should render on the page', () => { render(); expect(renderResult.getByTestId('avcResultsBanner')).toBeTruthy(); @@ -95,10 +98,18 @@ describe('OnboardingComponent', () => { false ); }); + it('should stay dismissed if it has been closed once', () => { - (useKibana().services.storage.get as jest.Mock).mockReturnValue(false); + (useKibana().services.storage.get as jest.Mock).mockReturnValueOnce(false); render(); expect(renderResult.queryByTestId('avcResultsBanner')).toBeNull(); }); + + it('should not be shown if the current date is January 1, 2025', () => { + jest.useFakeTimers().setSystemTime(new Date('2025-01-01')); + (useKibana().services.storage.get as jest.Mock).mockReturnValue(true); + render(); + expect(renderResult.queryByTestId('avcResultsBanner')).toBeTruthy(); + }); }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.tsx b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.tsx index 21eb1ae6618ee..db668eb09cbdd 100644 --- a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.tsx +++ b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.tsx @@ -66,13 +66,9 @@ export const OnboardingComponent: React.FC = ({ [telemetry] ); - const year2025 = new Date('January, 1, 2025 00:00:00'); - console.log('year2025', year2025); - // const today = new Date().getTime(); - // const today = new Date('December, 30, 2024 00:00:00'); - const today = new Date('January, 1, 2025 00:00:00'); - console.log('today', today); - + // Logic to hide banner at EOY 2024 + const year2025 = new Date('January 01, 2025 00:00:00'); + const today = new Date(Date.now()); const isStillYear2024 = today < year2025; const [showAVCBanner, setShowAVCBanner] = useState( From 858b23cf21ccd0f355ee001720575538473f9172 Mon Sep 17 00:00:00 2001 From: parkiino Date: Thu, 11 Jul 2024 21:48:39 -0400 Subject: [PATCH 3/8] working timer tests --- .../landing_page/onboarding/onboarding.test.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.test.tsx b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.test.tsx index 603512a69ef34..a0d1e7f6c81c6 100644 --- a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.test.tsx @@ -72,9 +72,13 @@ describe('OnboardingComponent', () => { expect(welcomeHeader).toBeInTheDocument(); expect(togglePanel).toBeInTheDocument(); }); - describe.only('AVC 2024 Results banner', () => { + describe('AVC 2024 Results banner', () => { + beforeEach(() => { + (useKibana().services.storage.get as jest.Mock).mockReturnValue(true); + }); afterEach(() => { jest.clearAllMocks(); + jest.useRealTimers(); }); it('should render on the page', () => { render(); @@ -106,8 +110,13 @@ describe('OnboardingComponent', () => { }); it('should not be shown if the current date is January 1, 2025', () => { - jest.useFakeTimers().setSystemTime(new Date('2025-01-01')); - (useKibana().services.storage.get as jest.Mock).mockReturnValue(true); + jest.useFakeTimers().setSystemTime(new Date('2025-01-01T05:00:00.000Z')); + render(); + expect(renderResult.queryByTestId('avcResultsBanner')).toBeNull(); + jest.useRealTimers(); + }); + it('should be shown if the current date is before January 1, 2025', () => { + jest.useFakeTimers().setSystemTime(new Date('2024-12-31T05:00:00.000Z')); render(); expect(renderResult.queryByTestId('avcResultsBanner')).toBeTruthy(); }); From 0cf616abf00b3b50a18b407bb362db6b48f97025 Mon Sep 17 00:00:00 2001 From: parkiino Date: Fri, 12 Jul 2024 16:01:25 -0400 Subject: [PATCH 4/8] put everything in kbn package, add eoy logic to integrations --- package.json | 1 + packages/kbn-avc-banner/README.md | 3 + packages/kbn-avc-banner/index.ts | 9 +++ packages/kbn-avc-banner/jest.config.js | 13 +++++ packages/kbn-avc-banner/kibana.jsonc | 5 ++ packages/kbn-avc-banner/package.json | 6 ++ .../src}/avc_banner_background.svg | 0 .../kbn-avc-banner/src/index.tsx | 14 ++++- packages/kbn-avc-banner/tsconfig.json | 19 +++++++ tsconfig.base.json | 2 + .../avc_banner/avc_results_banner_2024.tsx | 56 ------------------- .../epm/screens/detail/overview/overview.tsx | 6 +- .../avc_banner/avc_banner_background.svg | 1 - .../landing_page/onboarding/onboarding.tsx | 9 +-- yarn.lock | 4 ++ 15 files changed, 78 insertions(+), 70 deletions(-) create mode 100644 packages/kbn-avc-banner/README.md create mode 100644 packages/kbn-avc-banner/index.ts create mode 100644 packages/kbn-avc-banner/jest.config.js create mode 100644 packages/kbn-avc-banner/kibana.jsonc create mode 100644 packages/kbn-avc-banner/package.json rename {x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/avc_banner => packages/kbn-avc-banner/src}/avc_banner_background.svg (100%) rename x-pack/plugins/security_solution/public/common/components/avc_banner/avc_results_banner_2024.tsx => packages/kbn-avc-banner/src/index.tsx (80%) create mode 100644 packages/kbn-avc-banner/tsconfig.json delete mode 100644 x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/avc_banner/avc_results_banner_2024.tsx delete mode 100644 x-pack/plugins/security_solution/public/common/components/avc_banner/avc_banner_background.svg diff --git a/package.json b/package.json index 624c0820ce4e6..919fa0c365687 100644 --- a/package.json +++ b/package.json @@ -179,6 +179,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", diff --git a/packages/kbn-avc-banner/README.md b/packages/kbn-avc-banner/README.md new file mode 100644 index 0000000000000..b015a08025420 --- /dev/null +++ b/packages/kbn-avc-banner/README.md @@ -0,0 +1,3 @@ +# @kbn/avc-banner + +Empty package generated by @kbn/generate diff --git a/packages/kbn-avc-banner/index.ts b/packages/kbn-avc-banner/index.ts new file mode 100644 index 0000000000000..de0577ee3ed83 --- /dev/null +++ b/packages/kbn-avc-banner/index.ts @@ -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'; diff --git a/packages/kbn-avc-banner/jest.config.js b/packages/kbn-avc-banner/jest.config.js new file mode 100644 index 0000000000000..8886c66ec80e7 --- /dev/null +++ b/packages/kbn-avc-banner/jest.config.js @@ -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: ['/packages/kbn-avc-banner'], +}; diff --git a/packages/kbn-avc-banner/kibana.jsonc b/packages/kbn-avc-banner/kibana.jsonc new file mode 100644 index 0000000000000..57da07769d84b --- /dev/null +++ b/packages/kbn-avc-banner/kibana.jsonc @@ -0,0 +1,5 @@ +{ + "type": "shared-common", + "id": "@kbn/avc-banner", + "owner": "@elastic/security-defend-workflows" +} diff --git a/packages/kbn-avc-banner/package.json b/packages/kbn-avc-banner/package.json new file mode 100644 index 0000000000000..f01617945592d --- /dev/null +++ b/packages/kbn-avc-banner/package.json @@ -0,0 +1,6 @@ +{ + "name": "@kbn/avc-banner", + "private": true, + "version": "1.0.0", + "license": "SSPL-1.0 OR Elastic License 2.0" +} \ No newline at end of file diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/avc_banner/avc_banner_background.svg b/packages/kbn-avc-banner/src/avc_banner_background.svg similarity index 100% rename from x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/avc_banner/avc_banner_background.svg rename to packages/kbn-avc-banner/src/avc_banner_background.svg diff --git a/x-pack/plugins/security_solution/public/common/components/avc_banner/avc_results_banner_2024.tsx b/packages/kbn-avc-banner/src/index.tsx similarity index 80% rename from x-pack/plugins/security_solution/public/common/components/avc_banner/avc_results_banner_2024.tsx rename to packages/kbn-avc-banner/src/index.tsx index 0c73af1ef4861..92a1ef351b919 100644 --- a/x-pack/plugins/security_solution/public/common/components/avc_banner/avc_results_banner_2024.tsx +++ b/packages/kbn-avc-banner/src/index.tsx @@ -1,8 +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; 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'; @@ -10,9 +11,16 @@ 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'; +// Logic to hide banner at EOY 2024 +export const useIsStillYear2024 = () => { + const year2025 = new Date('January 01, 2025 00:00:00'); + const today = new Date(Date.now()); + return today < year2025; +}; + export const AVCResultsBanner2024: React.FC<{ onDismiss: () => void }> = ({ onDismiss }) => { const { docLinks } = useKibana().services; const { euiTheme } = useEuiTheme(); diff --git a/packages/kbn-avc-banner/tsconfig.json b/packages/kbn-avc-banner/tsconfig.json new file mode 100644 index 0000000000000..dad708677fd87 --- /dev/null +++ b/packages/kbn-avc-banner/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + "types": [ + "jest", + "node", + "react" + ] + }, + "include": [ + "**/*.ts", + "**/*.tsx", + ], + "exclude": [ + "target/**/*" + ], + "kbn_references": [] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index 6d4637281115e..f119c2605faa1 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -94,6 +94,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"], diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/avc_banner/avc_results_banner_2024.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/avc_banner/avc_results_banner_2024.tsx deleted file mode 100644 index 63a3f68254c6c..0000000000000 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/avc_banner/avc_results_banner_2024.tsx +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 { 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 '@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.fleet.integrations.epm.elasticDefend.avcResultsBanner.title', - { - defaultMessage: '100% protection with zero false positives.', - } - ); - - const calloutStyles = css({ - paddingLeft: `${euiTheme.size.xl}`, - backgroundImage: `url(${avcBannerBackground})`, - backgroundRepeat: 'no-repeat', - backgroundPositionX: 'right', - backgroundPositionY: 'bottom', - }); - - return ( - - - - - - - - ); -}; diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/overview.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/overview.tsx index f9c2d80d3336e..c8bc2e773f290 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/overview.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/overview.tsx @@ -22,6 +22,8 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { useKibana } from '@kbn/kibana-react-plugin/public'; +import { AVCResultsBanner2024, useIsStillYear2024 } from '@kbn/avc-banner'; + import { isIntegrationPolicyTemplate, isPackagePrerelease, @@ -40,8 +42,6 @@ import { SideBarColumn } from '../../../components/side_bar_column'; import type { FleetStartServices } from '../../../../../../../plugin'; -import { AVCResultsBanner2024 } from './avc_banner/avc_results_banner_2024'; - import { Screenshots } from './screenshots'; import { Readme } from './readme'; import { Details } from './details'; @@ -313,7 +313,7 @@ export const OverviewPage: React.FC = memo( {isUnverified && } - {isElasticDefend && showAVCBanner && ( + {useIsStillYear2024 && isElasticDefend && showAVCBanner && ( <> diff --git a/x-pack/plugins/security_solution/public/common/components/avc_banner/avc_banner_background.svg b/x-pack/plugins/security_solution/public/common/components/avc_banner/avc_banner_background.svg deleted file mode 100644 index 57b0f91a419e9..0000000000000 --- a/x-pack/plugins/security_solution/public/common/components/avc_banner/avc_banner_background.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.tsx b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.tsx index db668eb09cbdd..0944226355b7d 100644 --- a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.tsx +++ b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.tsx @@ -6,6 +6,7 @@ */ import React, { useCallback, useMemo, useState } from 'react'; +import { AVCResultsBanner2024, useIsStillYear2024 } from '@kbn/avc-banner'; import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template'; import { TogglePanel } from './toggle_panel'; @@ -24,7 +25,6 @@ import type { StepId } from './types'; import { useOnboardingStyles } from './styles/onboarding.styles'; import { useKibana } from '../../../lib/kibana'; import type { OnboardingHubStepLinkClickedParams } from '../../../lib/telemetry/events/onboarding/types'; -import { AVCResultsBanner2024 } from '../../avc_banner/avc_results_banner_2024'; interface OnboardingProps { indicesExist?: boolean; @@ -66,11 +66,6 @@ export const OnboardingComponent: React.FC = ({ [telemetry] ); - // Logic to hide banner at EOY 2024 - const year2025 = new Date('January 01, 2025 00:00:00'); - const today = new Date(Date.now()); - const isStillYear2024 = today < year2025; - const [showAVCBanner, setShowAVCBanner] = useState( storage.get('securitySolution.showAvcBanner') ?? true ); @@ -83,7 +78,7 @@ export const OnboardingComponent: React.FC = ({ return (
- {showAVCBanner && isStillYear2024 && ( + {useIsStillYear2024() && showAVCBanner && ( diff --git a/yarn.lock b/yarn.lock index f922a093b906d..1a653af7131c0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3400,6 +3400,10 @@ version "0.0.0" uid "" +"@kbn/avc-banner@link:packages/kbn-avc-banner": + version "0.0.0" + uid "" + "@kbn/axe-config@link:packages/kbn-axe-config": version "0.0.0" uid "" From c270e58da1351c4163d96f7739f09d6fdc346c81 Mon Sep 17 00:00:00 2001 From: parkiino Date: Wed, 24 Jul 2024 19:38:44 -0400 Subject: [PATCH 5/8] remove old test stub --- .../integrations/sections/epm/screens/detail/index.test.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx index 0102297ed32dc..4617cc9bd8b1f 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx @@ -345,10 +345,6 @@ describe('when on integration detail', () => { ); }); }); - describe('and package is endpoint', () => { - const pkgkey = 'endpoint'; - const detailPageUrlPath = pagePathGetters.integration_details_overview({ pkgkey })[1]; - }); }); interface MockedApi< From 41f1359bb2583c8893e334650e4ff06eed5f8df1 Mon Sep 17 00:00:00 2001 From: parkiino Date: Fri, 26 Jul 2024 16:28:18 -0400 Subject: [PATCH 6/8] add return type --- packages/kbn-avc-banner/src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-avc-banner/src/index.tsx b/packages/kbn-avc-banner/src/index.tsx index c2f510cc47ae2..c4b23fd589567 100644 --- a/packages/kbn-avc-banner/src/index.tsx +++ b/packages/kbn-avc-banner/src/index.tsx @@ -15,7 +15,7 @@ import { useKibana } from '@kbn/kibana-react-plugin/public'; import avcBannerBackground from './avc_banner_background.svg'; // Logic to hide banner at EOY 2024 -export const useIsStillYear2024 = () => { +export const useIsStillYear2024: boolean = () => { const year2025 = new Date('January 01, 2025 00:00:00'); const today = new Date(Date.now()); return today < year2025; From e542797434d081d2ca07f957e9810e34080fadd7 Mon Sep 17 00:00:00 2001 From: parkiino Date: Wed, 31 Jul 2024 11:51:02 -0400 Subject: [PATCH 7/8] simplify date logic, update blog url --- packages/kbn-avc-banner/src/index.tsx | 8 ++++---- packages/kbn-doc-links/src/get_doc_links.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/kbn-avc-banner/src/index.tsx b/packages/kbn-avc-banner/src/index.tsx index c4b23fd589567..50a7c21957ac1 100644 --- a/packages/kbn-avc-banner/src/index.tsx +++ b/packages/kbn-avc-banner/src/index.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import React from 'react'; +import React, { useMemo } from 'react'; import { css } from '@emotion/css'; import { i18n } from '@kbn/i18n'; import { EuiButton, EuiCallOut, EuiSpacer, useEuiTheme } from '@elastic/eui'; @@ -16,9 +16,9 @@ import avcBannerBackground from './avc_banner_background.svg'; // Logic to hide banner at EOY 2024 export const useIsStillYear2024: boolean = () => { - const year2025 = new Date('January 01, 2025 00:00:00'); - const today = new Date(Date.now()); - return today < year2025; + useMemo(() => { + new Date().getFullYear() === 2024; + }, []); }; export const AVCResultsBanner2024: React.FC<{ onDismiss: () => void }> = ({ onDismiss }) => { diff --git a/packages/kbn-doc-links/src/get_doc_links.ts b/packages/kbn-doc-links/src/get_doc_links.ts index fef52545f8d2f..25c91238a7b6d 100644 --- a/packages/kbn-doc-links/src/get_doc_links.ts +++ b/packages/kbn-doc-links/src/get_doc_links.ts @@ -466,7 +466,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D }, securitySolution: { artifactControl: `${SECURITY_SOLUTION_DOCS}artifact-control.html`, - avcResults: `${ELASTIC_WEBSITE_URL}blog/elastic-security-malware-protection-test-av-comparatives`, + avcResults: `${ELASTIC_WEBSITE_URL}blog/elastic-av-comparatives-business-security-test`, trustedApps: `${SECURITY_SOLUTION_DOCS}trusted-apps-ov.html`, eventFilters: `${SECURITY_SOLUTION_DOCS}event-filters.html`, blocklist: `${SECURITY_SOLUTION_DOCS}blocklist.html`, From 0c9a825343f67317beac3a7b8212ae3210c535f5 Mon Sep 17 00:00:00 2001 From: parkiino Date: Wed, 31 Jul 2024 16:42:35 -0400 Subject: [PATCH 8/8] fix type and test --- packages/kbn-avc-banner/src/index.tsx | 6 +++--- .../components/landing_page/onboarding/onboarding.test.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/kbn-avc-banner/src/index.tsx b/packages/kbn-avc-banner/src/index.tsx index 50a7c21957ac1..2f71b5ddd9679 100644 --- a/packages/kbn-avc-banner/src/index.tsx +++ b/packages/kbn-avc-banner/src/index.tsx @@ -15,9 +15,9 @@ import { useKibana } from '@kbn/kibana-react-plugin/public'; import avcBannerBackground from './avc_banner_background.svg'; // Logic to hide banner at EOY 2024 -export const useIsStillYear2024: boolean = () => { - useMemo(() => { - new Date().getFullYear() === 2024; +export const useIsStillYear2024: () => boolean = () => { + return useMemo(() => { + return new Date().getFullYear() === 2024; }, []); }; diff --git a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.test.tsx b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.test.tsx index a0d1e7f6c81c6..319a8082f5274 100644 --- a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/onboarding.test.tsx @@ -89,7 +89,7 @@ describe('OnboardingComponent', () => { render(); expect(renderResult.getByTestId('avcReadTheBlog')).toHaveAttribute( 'href', - 'https://www.elastic.co/blog/elastic-security-malware-protection-test-av-comparatives' + 'https://www.elastic.co/blog/elastic-av-comparatives-business-security-test' ); });