From 7669dac568b8a24f8576d82b4afe737a558e0af3 Mon Sep 17 00:00:00 2001 From: Tostti Date: Tue, 30 Jan 2024 08:25:58 -0300 Subject: [PATCH 1/9] Add icons --- .../core_app/assets/logos/google_groups.svg | 29 +++++++++++++++++++ .../core_app/assets/logos/icon_dark.svg | 17 +++++++++++ .../core_app/assets/logos/icon_light.svg | 13 +++++++++ 3 files changed, 59 insertions(+) create mode 100644 src/core/server/core_app/assets/logos/google_groups.svg create mode 100644 src/core/server/core_app/assets/logos/icon_dark.svg create mode 100644 src/core/server/core_app/assets/logos/icon_light.svg diff --git a/src/core/server/core_app/assets/logos/google_groups.svg b/src/core/server/core_app/assets/logos/google_groups.svg new file mode 100644 index 000000000000..934cf1d86d56 --- /dev/null +++ b/src/core/server/core_app/assets/logos/google_groups.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + diff --git a/src/core/server/core_app/assets/logos/icon_dark.svg b/src/core/server/core_app/assets/logos/icon_dark.svg new file mode 100644 index 000000000000..966e74def86c --- /dev/null +++ b/src/core/server/core_app/assets/logos/icon_dark.svg @@ -0,0 +1,17 @@ + + + + + + + + + diff --git a/src/core/server/core_app/assets/logos/icon_light.svg b/src/core/server/core_app/assets/logos/icon_light.svg new file mode 100644 index 000000000000..cc9df8577f88 --- /dev/null +++ b/src/core/server/core_app/assets/logos/icon_light.svg @@ -0,0 +1,13 @@ + + + + + + + + + From 5160e7db01069047b90a0b227fb15eac70276d61 Mon Sep 17 00:00:00 2001 From: Tostti Date: Tue, 30 Jan 2024 08:30:29 -0300 Subject: [PATCH 2/9] Modify help menu --- src/core/public/chrome/chrome_service.tsx | 1 + src/core/public/chrome/ui/header/header.tsx | 2 + .../chrome/ui/header/header_help_menu.tsx | 42 +++++++++++++------ 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index f6ca2aa28089..93b554c9d3f2 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -263,6 +263,7 @@ export class ChromeService { branding={injectedMetadata.getBranding()} logos={logos} survey={injectedMetadata.getSurvey()} + darkmode={uiSettings.get('theme:darkMode')} /> ), diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index acc7c6869145..0f903e015795 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -93,6 +93,7 @@ export interface HeaderProps { branding: ChromeBranding; logos: Logos; survey: string | undefined; + darkmode: boolean; } export function Header({ @@ -238,6 +239,7 @@ export function Header({ opensearchDashboardsDocLink={opensearchDashboardsDocLink} opensearchDashboardsVersion={opensearchDashboardsVersion} surveyLink={survey} + darkmode={observables.darkmode} /> diff --git a/src/core/public/chrome/ui/header/header_help_menu.tsx b/src/core/public/chrome/ui/header/header_help_menu.tsx index 33b858177118..10cbab9aaccb 100644 --- a/src/core/public/chrome/ui/header/header_help_menu.tsx +++ b/src/core/public/chrome/ui/header/header_help_menu.tsx @@ -50,7 +50,6 @@ import { ExclusiveUnion } from '@elastic/eui'; import { combineLatest } from 'rxjs'; import { HeaderExtension } from './header_extension'; import { ChromeHelpExtension } from '../../chrome_service'; -import { GITHUB_CREATE_ISSUE_LINK } from '../../constants'; /** @public */ export type ChromeHelpExtensionMenuGitHubLink = EuiButtonEmptyProps & { @@ -123,6 +122,7 @@ interface Props { useDefaultContent?: boolean; opensearchDashboardsDocLink: string; surveyLink?: string; + darkmode: boolean; } interface State { @@ -198,26 +198,38 @@ class HeaderHelpMenuUI extends Component { intl, opensearchDashboardsVersion, useDefaultContent, - opensearchDashboardsDocLink, surveyLink, + darkmode, } = this.props; - const { helpExtension, helpSupportUrl } = this.state; + const { helpExtension } = this.state; const defaultContent = useDefaultContent ? ( - + - + @@ -225,10 +237,16 @@ class HeaderHelpMenuUI extends Component { {surveyLink && (
- + @@ -238,15 +256,15 @@ class HeaderHelpMenuUI extends Component { From 18c3b79b80141ca16b0d8dec086db3c029b0a7d9 Mon Sep 17 00:00:00 2001 From: Tostti Date: Tue, 30 Jan 2024 08:30:38 -0300 Subject: [PATCH 3/9] Modify tests --- src/core/public/chrome/ui/header/header.test.tsx | 1 + src/core/public/chrome/ui/header/header_help_menu.test.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/src/core/public/chrome/ui/header/header.test.tsx b/src/core/public/chrome/ui/header/header.test.tsx index c829361ff5c1..071a0c7e3c83 100644 --- a/src/core/public/chrome/ui/header/header.test.tsx +++ b/src/core/public/chrome/ui/header/header.test.tsx @@ -72,6 +72,7 @@ function mockProps() { branding: {}, survey: '/', logos: chromeServiceMock.createStartContract().logos, + darkmode: false, }; } diff --git a/src/core/public/chrome/ui/header/header_help_menu.test.tsx b/src/core/public/chrome/ui/header/header_help_menu.test.tsx index fbcd47367120..2099b9a2a471 100644 --- a/src/core/public/chrome/ui/header/header_help_menu.test.tsx +++ b/src/core/public/chrome/ui/header/header_help_menu.test.tsx @@ -15,6 +15,7 @@ function mockProps() { opensearchDashboardsDocLink: '/doclink', opensearchDashboardsVersion: '1.0', useDefaultContent: true, + darkmode: false, }; } From 3a26d552c763119ddde0346a5a9aa77150666838 Mon Sep 17 00:00:00 2001 From: Tostti Date: Tue, 30 Jan 2024 08:57:39 -0300 Subject: [PATCH 4/9] Add version constant --- src/core/public/chrome/constants.ts | 2 ++ src/core/public/chrome/ui/header/header_help_menu.tsx | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/public/chrome/constants.ts b/src/core/public/chrome/constants.ts index 2fa80237566e..ec41dd0df1b9 100644 --- a/src/core/public/chrome/constants.ts +++ b/src/core/public/chrome/constants.ts @@ -28,6 +28,8 @@ * under the License. */ +export const WAZUH_VERSION = '4.9'; export const OPENSEARCH_DASHBOARDS_FEEDBACK_LINK = 'https://wazuh.com/community/join-us-on-slack'; export const OPENSEARCH_DASHBOARDS_ASK_OPENSEARCH_LINK = OPENSEARCH_DASHBOARDS_FEEDBACK_LINK; export const GITHUB_CREATE_ISSUE_LINK = 'https://github.com/wazuh/wazuh/issues/new/choose'; +export const WAZUH_DOCUMENTATION_URL = `https://documentation.wazuh.com/${WAZUH_VERSION}/`; diff --git a/src/core/public/chrome/ui/header/header_help_menu.tsx b/src/core/public/chrome/ui/header/header_help_menu.tsx index 10cbab9aaccb..44183dd64e56 100644 --- a/src/core/public/chrome/ui/header/header_help_menu.tsx +++ b/src/core/public/chrome/ui/header/header_help_menu.tsx @@ -50,6 +50,7 @@ import { ExclusiveUnion } from '@elastic/eui'; import { combineLatest } from 'rxjs'; import { HeaderExtension } from './header_extension'; import { ChromeHelpExtension } from '../../chrome_service'; +import { WAZUH_DOCUMENTATION_URL } from '../../constants'; /** @public */ export type ChromeHelpExtensionMenuGitHubLink = EuiButtonEmptyProps & { @@ -206,7 +207,7 @@ class HeaderHelpMenuUI extends Component { const defaultContent = useDefaultContent ? ( Date: Tue, 30 Jan 2024 09:16:42 -0300 Subject: [PATCH 5/9] Make wazuh version dynamic --- src/core/public/chrome/constants.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/public/chrome/constants.ts b/src/core/public/chrome/constants.ts index ec41dd0df1b9..bd26045a56ab 100644 --- a/src/core/public/chrome/constants.ts +++ b/src/core/public/chrome/constants.ts @@ -27,8 +27,9 @@ * specific language governing permissions and limitations * under the License. */ +import wazuh from '../../../../package.json'; -export const WAZUH_VERSION = '4.9'; +export const WAZUH_VERSION = wazuh.wazuh.version; export const OPENSEARCH_DASHBOARDS_FEEDBACK_LINK = 'https://wazuh.com/community/join-us-on-slack'; export const OPENSEARCH_DASHBOARDS_ASK_OPENSEARCH_LINK = OPENSEARCH_DASHBOARDS_FEEDBACK_LINK; export const GITHUB_CREATE_ISSUE_LINK = 'https://github.com/wazuh/wazuh/issues/new/choose'; From 0f81b4bef7dee3b522a450fd0b7d0a9d500ee80a Mon Sep 17 00:00:00 2001 From: Tostti Date: Tue, 30 Jan 2024 09:30:10 -0300 Subject: [PATCH 6/9] Fix documentation url --- src/core/public/chrome/constants.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/public/chrome/constants.ts b/src/core/public/chrome/constants.ts index bd26045a56ab..f2c6da852e9a 100644 --- a/src/core/public/chrome/constants.ts +++ b/src/core/public/chrome/constants.ts @@ -29,8 +29,10 @@ */ import wazuh from '../../../../package.json'; -export const WAZUH_VERSION = wazuh.wazuh.version; +export const WAZUH_MAJOR = wazuh.wazuh.version.split('.')[0]; +export const WAZUH_MINOR = wazuh.wazuh.version.split('.')[1]; + export const OPENSEARCH_DASHBOARDS_FEEDBACK_LINK = 'https://wazuh.com/community/join-us-on-slack'; export const OPENSEARCH_DASHBOARDS_ASK_OPENSEARCH_LINK = OPENSEARCH_DASHBOARDS_FEEDBACK_LINK; export const GITHUB_CREATE_ISSUE_LINK = 'https://github.com/wazuh/wazuh/issues/new/choose'; -export const WAZUH_DOCUMENTATION_URL = `https://documentation.wazuh.com/${WAZUH_VERSION}/`; +export const WAZUH_DOCUMENTATION_URL = `https://documentation.wazuh.com/${WAZUH_MAJOR}.${WAZUH_MINOR}/`; From 38766aa7b203afefadc3841d169609f0d7d963d0 Mon Sep 17 00:00:00 2001 From: Tostti Date: Wed, 31 Jan 2024 11:54:39 -0300 Subject: [PATCH 7/9] Change rootDir to allow reading package json --- src/core/tsconfig.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/tsconfig.json b/src/core/tsconfig.json index 3281d2f19cfe..fedd701d7e3c 100644 --- a/src/core/tsconfig.json +++ b/src/core/tsconfig.json @@ -5,7 +5,8 @@ "outDir": "./target/types", "emitDeclarationOnly": true, "declaration": true, - "declarationMap": true + "declarationMap": true, + "rootDir": "../../" }, "include": [ "public/**/*", @@ -15,9 +16,8 @@ "test_helpers/**/*", "utils/**/*", "index.ts", - "typings.ts" + "typings.ts", + "../../package.json" ], - "references": [ - { "path": "../test_utils/" } - ] + "references": [{ "path": "../test_utils/" }] } From 590fc127af68dc4da5db8839828fc7caad7f0bfb Mon Sep 17 00:00:00 2001 From: Tostti Date: Wed, 31 Jan 2024 14:02:43 -0300 Subject: [PATCH 8/9] Update snapshots --- .../src/integration_tests/build.test.ts | 20 +- .../header/__snapshots__/header.test.tsx.snap | 6 + .../header_help_menu.test.tsx.snap | 234 +++++++++++++----- 3 files changed, 192 insertions(+), 68 deletions(-) diff --git a/packages/osd-plugin-helpers/src/integration_tests/build.test.ts b/packages/osd-plugin-helpers/src/integration_tests/build.test.ts index 780682d27658..9a407db8ff8e 100644 --- a/packages/osd-plugin-helpers/src/integration_tests/build.test.ts +++ b/packages/osd-plugin-helpers/src/integration_tests/build.test.ts @@ -78,9 +78,7 @@ it('builds a generated plugin into a viable archive', async () => { expect(generateProc.all).toMatchInlineSnapshot(` " succ 🎉 - Your plugin has been created in ${standardize('plugins/foo_test_plugin', false, true)} - " - `); + Your plugin has been created in `); const buildProc = await execa( process.execPath, @@ -101,9 +99,15 @@ it('builds a generated plugin into a viable archive', async () => { info running @osd/optimizer │ info initialized, 0 bundles cached │ info starting worker [1 bundle] + │ warn worker stderr Browserslist: caniuse-lite is outdated. Please run: + │ warn worker stderr npx update-browserslist-db@latest + │ warn worker stderr Why you should do it regularly: https://github.com/browserslist/update-db#readme │ succ 1 bundles compiled successfully after