mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
(cherry picked from commit 7d767ede9c
)
Co-authored-by: Pierre Gayvallet <pierre.gayvallet@elastic.co>
This commit is contained in:
parent
41fb58dbb9
commit
ef7bc024a4
5 changed files with 19 additions and 4 deletions
|
@ -10,6 +10,7 @@ import {
|
|||
overlayServiceMock,
|
||||
httpServiceMock,
|
||||
notificationServiceMock,
|
||||
themeServiceMock,
|
||||
} from '@kbn/core/public/mocks';
|
||||
import { TelemetryService } from './services/telemetry_service';
|
||||
import { TelemetryNotifications } from './services/telemetry_notifications/telemetry_notifications';
|
||||
|
@ -75,6 +76,7 @@ export function mockTelemetryNotifications({
|
|||
return new TelemetryNotifications({
|
||||
http: httpServiceMock.createSetupContract(),
|
||||
overlays: overlayServiceMock.createStartContract(),
|
||||
theme: themeServiceMock.createStartContract(),
|
||||
telemetryService,
|
||||
telemetryConstants: mockTelemetryConstants(),
|
||||
});
|
||||
|
|
|
@ -198,6 +198,7 @@ export class TelemetryPlugin implements Plugin<TelemetryPluginSetup, TelemetryPl
|
|||
analytics,
|
||||
http,
|
||||
overlays,
|
||||
theme,
|
||||
application,
|
||||
savedObjects,
|
||||
docLinks,
|
||||
|
@ -213,6 +214,7 @@ export class TelemetryPlugin implements Plugin<TelemetryPluginSetup, TelemetryPl
|
|||
const telemetryNotifications = new TelemetryNotifications({
|
||||
http,
|
||||
overlays,
|
||||
theme,
|
||||
telemetryService: this.telemetryService,
|
||||
telemetryConstants,
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import { renderOptedInNoticeBanner } from './render_opted_in_notice_banner';
|
||||
import { overlayServiceMock, httpServiceMock } from '@kbn/core/public/mocks';
|
||||
import { overlayServiceMock, httpServiceMock, themeServiceMock } from '@kbn/core/public/mocks';
|
||||
import { mockTelemetryConstants } from '../../mocks';
|
||||
|
||||
describe('renderOptedInNoticeBanner', () => {
|
||||
|
@ -15,6 +15,7 @@ describe('renderOptedInNoticeBanner', () => {
|
|||
const bannerID = 'brucer-wayne';
|
||||
const overlays = overlayServiceMock.createStartContract();
|
||||
const mockHttp = httpServiceMock.createStartContract();
|
||||
const theme = themeServiceMock.createStartContract();
|
||||
const telemetryConstants = mockTelemetryConstants();
|
||||
overlays.banners.add.mockReturnValue(bannerID);
|
||||
|
||||
|
@ -22,6 +23,7 @@ describe('renderOptedInNoticeBanner', () => {
|
|||
http: mockHttp,
|
||||
onSeen: jest.fn(),
|
||||
overlays,
|
||||
theme,
|
||||
telemetryConstants,
|
||||
});
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import type { HttpStart, OverlayStart } from '@kbn/core/public';
|
||||
import type { HttpStart, OverlayStart, ThemeServiceStart } from '@kbn/core/public';
|
||||
import { toMountPoint } from '@kbn/kibana-react-plugin/public';
|
||||
import { withSuspense } from '@kbn/shared-ux-utility';
|
||||
import type { TelemetryConstants } from '../..';
|
||||
|
@ -15,13 +15,16 @@ import type { TelemetryConstants } from '../..';
|
|||
interface RenderBannerConfig {
|
||||
http: HttpStart;
|
||||
overlays: OverlayStart;
|
||||
theme: ThemeServiceStart;
|
||||
onSeen: () => void;
|
||||
telemetryConstants: TelemetryConstants;
|
||||
}
|
||||
|
||||
export function renderOptedInNoticeBanner({
|
||||
onSeen,
|
||||
overlays,
|
||||
http,
|
||||
theme,
|
||||
telemetryConstants,
|
||||
}: RenderBannerConfig) {
|
||||
const OptedInNoticeBannerLazy = withSuspense(
|
||||
|
@ -36,7 +39,8 @@ export function renderOptedInNoticeBanner({
|
|||
onSeenBanner={onSeen}
|
||||
http={http}
|
||||
telemetryConstants={telemetryConstants}
|
||||
/>
|
||||
/>,
|
||||
{ theme$: theme.theme$ }
|
||||
);
|
||||
const bannerId = overlays.banners.add(mount, 10000);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { HttpStart, OverlayStart } from '@kbn/core/public';
|
||||
import { HttpStart, OverlayStart, ThemeServiceStart } from '@kbn/core/public';
|
||||
import { renderOptedInNoticeBanner } from './render_opted_in_notice_banner';
|
||||
import { renderOptInBanner } from './render_opt_in_banner';
|
||||
import { TelemetryService } from '../telemetry_service';
|
||||
|
@ -15,6 +15,7 @@ import { TelemetryConstants } from '../..';
|
|||
interface TelemetryNotificationsConstructor {
|
||||
http: HttpStart;
|
||||
overlays: OverlayStart;
|
||||
theme: ThemeServiceStart;
|
||||
telemetryService: TelemetryService;
|
||||
telemetryConstants: TelemetryConstants;
|
||||
}
|
||||
|
@ -25,6 +26,7 @@ interface TelemetryNotificationsConstructor {
|
|||
export class TelemetryNotifications {
|
||||
private readonly http: HttpStart;
|
||||
private readonly overlays: OverlayStart;
|
||||
private readonly theme: ThemeServiceStart;
|
||||
private readonly telemetryConstants: TelemetryConstants;
|
||||
private readonly telemetryService: TelemetryService;
|
||||
private optedInNoticeBannerId?: string;
|
||||
|
@ -33,12 +35,14 @@ export class TelemetryNotifications {
|
|||
constructor({
|
||||
http,
|
||||
overlays,
|
||||
theme,
|
||||
telemetryService,
|
||||
telemetryConstants,
|
||||
}: TelemetryNotificationsConstructor) {
|
||||
this.telemetryService = telemetryService;
|
||||
this.http = http;
|
||||
this.overlays = overlays;
|
||||
this.theme = theme;
|
||||
this.telemetryConstants = telemetryConstants;
|
||||
}
|
||||
|
||||
|
@ -59,6 +63,7 @@ export class TelemetryNotifications {
|
|||
http: this.http,
|
||||
onSeen: this.setOptedInNoticeSeen,
|
||||
overlays: this.overlays,
|
||||
theme: this.theme,
|
||||
telemetryConstants: this.telemetryConstants,
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue