From 12e3c3514a6201c5f503f98c169c8d9abd59f94e Mon Sep 17 00:00:00 2001 From: Dave Snider Date: Wed, 13 May 2020 19:01:47 -0700 Subject: [PATCH 1/3] Warning and link to support matrix for IE11 --- src/core/public/chrome/chrome_service.tsx | 43 +++++++++++++++++++---- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index 3fc22caaefb04a..adfa7f5ed16746 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -18,11 +18,13 @@ */ import { Breadcrumb as EuiBreadcrumb, IconType } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; import React from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; import { BehaviorSubject, combineLatest, merge, Observable, of, ReplaySubject } from 'rxjs'; import { flatMap, map, takeUntil } from 'rxjs/operators'; import { parse } from 'url'; +import { EuiLink } from '@elastic/eui'; +import { mountReactNode } from '../utils/mount'; import { InternalApplicationStart } from '../application'; import { DocLinksStart } from '../doc_links'; import { HttpStart } from '../http'; @@ -165,12 +167,41 @@ export class ChromeService { // Can delete const getNavType$ = uiSettings.get$('pageNavigation').pipe(takeUntil(this.stop$)); + const isIE = () => { + const ua = window.navigator.userAgent; + const msie = ua.indexOf('MSIE '); // IE 10 or older + const trident = ua.indexOf('Trident/'); // IE 11 + + return msie > 0 || trident > 0; + }; + if (!this.params.browserSupportsCsp && injectedMetadata.getCspConfig().warnLegacyBrowsers) { - notifications.toasts.addWarning( - i18n.translate('core.chrome.legacyBrowserWarning', { - defaultMessage: 'Your browser does not meet the security requirements for Kibana.', - }) - ); + notifications.toasts.addWarning({ + title: mountReactNode( + + ), + }); + + if (isIE()) { + notifications.toasts.addWarning({ + title: mountReactNode( + + the support matrix on our website + + ), + }} + /> + ), + }); + } } return { From be83382754b8714ae5e1aa6b7252a838cf2a0481 Mon Sep 17 00:00:00 2001 From: Dave Snider Date: Thu, 14 May 2020 07:00:39 -0700 Subject: [PATCH 2/3] snaps --- src/core/public/chrome/chrome_service.test.ts | 214 +++++++++--------- 1 file changed, 108 insertions(+), 106 deletions(-) diff --git a/src/core/public/chrome/chrome_service.test.ts b/src/core/public/chrome/chrome_service.test.ts index 327be61cc63e39..b5cf900d9c39fb 100644 --- a/src/core/public/chrome/chrome_service.test.ts +++ b/src/core/public/chrome/chrome_service.test.ts @@ -97,7 +97,9 @@ describe('start', () => { expect(startDeps.notifications.toasts.addWarning.mock.calls).toMatchInlineSnapshot(` Array [ Array [ - "Your browser does not meet the security requirements for Kibana.", + Object { + "title": [Function], + }, ], ] `); @@ -146,18 +148,18 @@ describe('start', () => { service.stop(); await expect(promise).resolves.toMatchInlineSnapshot(` - Array [ - Object {}, - Object { - "logo": "big logo", - "smallLogo": "not so big logo", - }, - Object { - "logo": "big logo without small logo", - "smallLogo": undefined, - }, - ] - `); + Array [ + Object {}, + Object { + "logo": "big logo", + "smallLogo": "not so big logo", + }, + Object { + "logo": "big logo without small logo", + "smallLogo": undefined, + }, + ] + `); }); }); @@ -175,13 +177,13 @@ describe('start', () => { service.stop(); await expect(promise).resolves.toMatchInlineSnapshot(` - Array [ - false, - false, - false, - false, - ] - `); + Array [ + false, + false, + false, + false, + ] + `); }); it('emits false until manually overridden when in embed mode', async () => { @@ -203,13 +205,13 @@ describe('start', () => { service.stop(); await expect(promise).resolves.toMatchInlineSnapshot(` - Array [ - false, - false, - true, - false, - ] - `); + Array [ + false, + false, + true, + false, + ] + `); }); it('application-specified visibility on mount', async () => { @@ -230,13 +232,13 @@ describe('start', () => { service.stop(); await expect(promise).resolves.toMatchInlineSnapshot(` - Array [ - false, - true, - false, - true, - ] - `); + Array [ + false, + true, + false, + true, + ] + `); }); it('changing visibility has no effect on chrome-hiding application', async () => { @@ -253,12 +255,12 @@ describe('start', () => { service.stop(); await expect(promise).resolves.toMatchInlineSnapshot(` - Array [ - false, - false, - false, - ] - `); + Array [ + false, + false, + false, + ] + `); }); }); @@ -280,36 +282,36 @@ describe('start', () => { service.stop(); await expect(promise).resolves.toMatchInlineSnapshot(` - Array [ - Array [], - Array [ - "foo", - ], - Array [ - "foo", - ], - Array [ - "foo", - "bar", - ], - Array [ - "foo", - "bar", - ], - Array [ - "foo", - "bar", - "baz", - ], - Array [ - "foo", - "baz", - ], - Array [ - "baz", - ], - ] - `); + Array [ + Array [], + Array [ + "foo", + ], + Array [ + "foo", + ], + Array [ + "foo", + "bar", + ], + Array [ + "foo", + "bar", + ], + Array [ + "foo", + "bar", + "baz", + ], + Array [ + "foo", + "baz", + ], + Array [ + "baz", + ], + ] + `); }); }); @@ -327,19 +329,19 @@ describe('start', () => { service.stop(); await expect(promise).resolves.toMatchInlineSnapshot(` - Array [ - undefined, - Object { - "text": "foo", - "tooltip": "foo's tooltip", - }, - Object { - "text": "bar", - "tooltip": "bar's tooltip", - }, - undefined, - ] - `); + Array [ + undefined, + Object { + "text": "foo", + "tooltip": "foo's tooltip", + }, + Object { + "text": "bar", + "tooltip": "bar's tooltip", + }, + undefined, + ] + `); }); }); @@ -358,29 +360,29 @@ describe('start', () => { service.stop(); await expect(promise).resolves.toMatchInlineSnapshot(` - Array [ - Array [], - Array [ - Object { - "text": "foo", - }, - Object { - "text": "bar", - }, - ], - Array [ - Object { - "text": "foo", - }, - ], - Array [ - Object { - "text": "bar", - }, - ], - Array [], - ] - `); + Array [ + Array [], + Array [ + Object { + "text": "foo", + }, + Object { + "text": "bar", + }, + ], + Array [ + Object { + "text": "foo", + }, + ], + Array [ + Object { + "text": "bar", + }, + ], + Array [], + ] + `); }); }); From fcd168381d0422dc6e375d5c93f52007706da6a6 Mon Sep 17 00:00:00 2001 From: Dave Snider Date: Mon, 18 May 2020 11:36:23 -0700 Subject: [PATCH 3/3] i18n feedback --- src/core/public/chrome/chrome_service.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index 4b11a4d3a2572f..a921e514050b27 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -194,7 +194,10 @@ export class ChromeService { values={{ link: ( - the support matrix on our website + ), }}