From 8b3afcd758937ec96278df3bf9dce6db17e9f6a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20David=20Guti=C3=A9rrez?= Date: Tue, 7 Dec 2021 13:08:08 +0100 Subject: [PATCH 1/4] fix(telemetry): Hide the telemetry banner - Hide the telemetry banner from UI and set a flag in the saved object that controls if the banner was seen and dismissed - Changed the `wazuh` `public` `start` method to sync intead of `async` function --- kibana.json | 3 ++- public/plugin.ts | 9 +++++++-- public/types.ts | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/kibana.json b/kibana.json index e2ed164e58..ac1218a65b 100644 --- a/kibana.json +++ b/kibana.json @@ -17,7 +17,8 @@ "savedObjects", "kibanaReact", "kibanaUtils", - "securityOss" + "securityOss", + "telemetry" ], "optionalPlugins": [ "security", diff --git a/public/plugin.ts b/public/plugin.ts index faa69b1e44..9ffb7ea4ed 100644 --- a/public/plugin.ts +++ b/public/plugin.ts @@ -92,11 +92,16 @@ export class WazuhPlugin implements Plugin { + public start(core: CoreStart, plugins: AppPluginStartDependencies): WazuhStart { // hide security alert if(plugins.securityOss) { plugins.securityOss.insecureCluster.hideAlert(true); - } + }; + + // hide the telemetry banner. Remove the banner from the UI and set the flag in the telemetry saved object as the notice was seen and dismissed + if(plugins?.telemetry?.telemetryNotifications?.setOptedInNoticeSeen) { + plugins.telemetry.telemetryNotifications.setOptedInNoticeSeen() + }; // we need to register the application service at setup, but to render it // there are some start dependencies necessary, for this reason diff --git a/public/types.ts b/public/types.ts index 0d3a246213..acf47b50c8 100644 --- a/public/types.ts +++ b/public/types.ts @@ -7,6 +7,7 @@ import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/pub import { UiActionsSetup } from '../../../src/plugins/ui_actions/public'; import { SecurityOssPluginStart } from '../../../src/plugins/security_oss/public/'; import { SavedObjectsStart } from '../../../src/plugins/saved_objects/public'; +import { TelemetryPluginStart } from '../../../src/plugins/telemetry/public'; export interface AppPluginStartDependencies { navigation: NavigationPublicPluginStart; @@ -15,7 +16,8 @@ export interface AppPluginStartDependencies { discover: DiscoverStart; charts: ChartsPluginStart securityOss: SecurityOssPluginStart, - savedObjects: SavedObjectsStart + savedObjects: SavedObjectsStart, + telemetry: TelemetryPluginStart } export interface AppDependencies { core: CoreStart; From 6bbbe3747e38412ad3b5c061fddb2f6879b3e937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20David=20Guti=C3=A9rrez?= Date: Tue, 7 Dec 2021 13:36:49 +0100 Subject: [PATCH 2/4] changelog: Add PR to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cd321c477..989237a67a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Support for Kibana 7.13.4 - Support for Kibana 7.14.2 +- Hide the `telemetry` banner [#3709](https://github.com/wazuh/wazuh-kibana-app/pull/3709) ### Fixed From ecc5b8a437ca73231497208cc04278fb6b4088fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20David=20Guti=C3=A9rrez?= Date: Tue, 7 Dec 2021 13:41:57 +0100 Subject: [PATCH 3/4] fix: Add semicolon --- public/plugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/plugin.ts b/public/plugin.ts index 9ffb7ea4ed..340b887387 100644 --- a/public/plugin.ts +++ b/public/plugin.ts @@ -100,7 +100,7 @@ export class WazuhPlugin implements Plugin Date: Fri, 10 Dec 2021 11:19:37 +0100 Subject: [PATCH 4/4] fix(telemetry): Hide the telemetry banner when the app frontend is to be mounted. Note the requirement to access to the app to hide and dissmiss the telemetry notice. This means the banner is visible while the user doesn't open the Wazuh app if the notice wasn't dismissed. --- public/plugin.ts | 11 ++++++++--- public/types.ts | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/public/plugin.ts b/public/plugin.ts index 340b887387..15d96acb0c 100644 --- a/public/plugin.ts +++ b/public/plugin.ts @@ -33,6 +33,7 @@ export class WazuhPlugin implements Plugin void; private innerAngularInitialized: boolean = false; private stateUpdater = new BehaviorSubject(() => ({})); + private hideTelemetryBanner?: () => void; public setup(core: CoreSetup, plugins: WazuhSetupPlugins): WazuhSetup { core.application.register({ @@ -43,6 +44,11 @@ export class WazuhPlugin implements Plugin plugins.telemetry.telemetryNotifications.setOptedInNoticeSeen(); }; - // we need to register the application service at setup, but to render it // there are some start dependencies necessary, for this reason // initializeInnerAngular + initializeServices are assigned at start and used diff --git a/public/types.ts b/public/types.ts index acf47b50c8..c8a5c4306e 100644 --- a/public/types.ts +++ b/public/types.ts @@ -7,7 +7,7 @@ import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/pub import { UiActionsSetup } from '../../../src/plugins/ui_actions/public'; import { SecurityOssPluginStart } from '../../../src/plugins/security_oss/public/'; import { SavedObjectsStart } from '../../../src/plugins/saved_objects/public'; -import { TelemetryPluginStart } from '../../../src/plugins/telemetry/public'; +import { TelemetryPluginStart, TelemetryPluginSetup } from '../../../src/plugins/telemetry/public'; export interface AppPluginStartDependencies { navigation: NavigationPublicPluginStart; @@ -30,6 +30,7 @@ export type WazuhSetupPlugins = { visualizations: VisualizationsSetup; data: DataPublicPluginSetup; navigation: NavigationPublicPluginStart; + telemetry: TelemetryPluginSetup; } export type WazuhStartPlugins = AppPluginStartDependencies;