From a298fb97c4a320d05d7142bbe9b1877f3f606fef Mon Sep 17 00:00:00 2001 From: Brianna Hall Date: Fri, 1 Oct 2021 10:25:42 -0400 Subject: [PATCH 01/13] Upgraded the version of EUI to 38.2.0 from 38.0.1 --- package.json | 2 +- src/dev/license_checker/config.ts | 2 +- yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 3da4475e2cd01d..af048c368dde55 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "@elastic/datemath": "link:bazel-bin/packages/elastic-datemath", "@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.21", "@elastic/ems-client": "7.15.0", - "@elastic/eui": "38.0.1", + "@elastic/eui": "38.2.0", "@elastic/filesaver": "1.1.2", "@elastic/good": "^9.0.1-kibana3", "@elastic/maki": "6.3.0", diff --git a/src/dev/license_checker/config.ts b/src/dev/license_checker/config.ts index 132d2bfa82aa23..3675afbecd9b0a 100644 --- a/src/dev/license_checker/config.ts +++ b/src/dev/license_checker/config.ts @@ -75,7 +75,7 @@ export const LICENSE_OVERRIDES = { 'jsts@1.6.2': ['Eclipse Distribution License - v 1.0'], // cf. https://github.com/bjornharrtell/jsts '@mapbox/jsonlint-lines-primitives@2.0.2': ['MIT'], // license in readme https://github.com/tmcw/jsonlint '@elastic/ems-client@7.15.0': ['Elastic License 2.0'], - '@elastic/eui@38.0.1': ['SSPL-1.0 OR Elastic License 2.0'], + '@elastic/eui@38.2.0': ['SSPL-1.0 OR Elastic License 2.0'], // TODO can be removed if the https://github.com/jindw/xmldom/issues/239 is released 'xmldom@0.1.27': ['MIT'], diff --git a/yarn.lock b/yarn.lock index 2813a39fa47a45..68986d309ca786 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1442,10 +1442,10 @@ resolved "https://registry.yarnpkg.com/@elastic/eslint-plugin-eui/-/eslint-plugin-eui-0.0.2.tgz#56b9ef03984a05cc213772ae3713ea8ef47b0314" integrity sha512-IoxURM5zraoQ7C8f+mJb9HYSENiZGgRVcG4tLQxE61yHNNRDXtGDWTZh8N1KIHcsqN1CEPETjuzBXkJYF/fDiQ== -"@elastic/eui@38.0.1": - version "38.0.1" - resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-38.0.1.tgz#de03c4436cd1b58327f54f57e4248183d681c0f8" - integrity sha512-yzV56rGVwhALnLVXsw2LGsFksh7c27BwIQOl2memDfm15VprzX5Fd+u6TpX8TkpFbTTgnYfyhI11W3eKVUYt1g== +"@elastic/eui@38.2.0": + version "38.2.0" + resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-38.2.0.tgz#8e65e301124bc16b8031dfab4b9c5a1c63d61939" + integrity sha512-itBQQoeWIw8C4fEnV0hiWfVhMGjj4UnvbcKUFE2etcMBQ6jjC+P+uKQOpR5Xs4q3j3X+hf7WKOAJvGICavqO7g== dependencies: "@types/chroma-js" "^2.0.0" "@types/lodash" "^4.14.160" From 69ee19c8d21856b16467effddfb9956dd3e41d16 Mon Sep 17 00:00:00 2001 From: Brianna Hall Date: Fri, 1 Oct 2021 10:52:13 -0400 Subject: [PATCH 02/13] Updated the i18n mappings required for EUI v.38.2.0 --- src/core/public/i18n/i18n_eui_mapping.tsx | 24 +++++++++++++++---- .../translations/translations/ja-JP.json | 2 -- .../translations/translations/zh-CN.json | 2 -- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/core/public/i18n/i18n_eui_mapping.tsx b/src/core/public/i18n/i18n_eui_mapping.tsx index 2fe9657bce8c9a..50753bc98260a7 100644 --- a/src/core/public/i18n/i18n_eui_mapping.tsx +++ b/src/core/public/i18n/i18n_eui_mapping.tsx @@ -634,19 +634,33 @@ export const getEuiContextMapping = (): EuiTokensObject => { defaultMessage: 'Syntax help', } ), - 'euiMarkdownEditorFooter.descriptionPrefix': i18n.translate( - 'core.euiMarkdownEditorFooter.descriptionPrefix', + 'euiMarkdownEditorFooter.mdSyntaxLink': i18n.translate( + 'core.euiMarkdownEditorFooter.mdSyntaxLink', { - defaultMessage: 'This editor uses', + defaultMessage: 'GitHub flavored markdown', } ), - 'euiMarkdownEditorFooter.descriptionSuffix': i18n.translate( - 'core.euiMarkdownEditorFooter.descriptionSuffix', + 'euiMarkdownEditorFooter.syntaxModalDescriptionPrefix': i18n.translate( + 'core.euiMarkdownEditorFooter.syntaxModalDescriptionPrefix', + { + defaultMessage: + 'This editor uses', + } + ), + 'euiMarkdownEditorFooter.syntaxModalDescriptionSuffix': i18n.translate( + 'core.euiMarkdownEditorFooter.syntaxModalDescriptionSuffix', { defaultMessage: 'You can also utilize these additional syntax plugins to add rich content to your text.', } ), + 'euiMarkdownEditorFooter.syntaxPopoverDescription': i18n.translate( + 'core.euiMarkdownEditorFooter.syntaxPopoverDescription', + { + defaultMessage: + 'This editor uses', + } + ), 'euiMarkdownEditorToolbar.editor': i18n.translate('core.euiMarkdownEditorToolbar.editor', { defaultMessage: 'Editor', }), diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 34e44d37bc4b85..5a4167710b64f6 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -1162,8 +1162,6 @@ "core.euiLink.external.ariaLabel": "外部リンク", "core.euiLink.newTarget.screenReaderOnlyText": "(新しいタブまたはウィンドウで開く)", "core.euiMarkdownEditorFooter.closeButton": "閉じる", - "core.euiMarkdownEditorFooter.descriptionPrefix": "このエディターは使用します", - "core.euiMarkdownEditorFooter.descriptionSuffix": "これらの追加の構文プラグインを利用して、リッチコンテンツをテキストに追加することもできます。", "core.euiMarkdownEditorFooter.errorsTitle": "エラー", "core.euiMarkdownEditorFooter.openUploadModal": "ファイルのアップロードモーダルを開く", "core.euiMarkdownEditorFooter.showMarkdownHelp": "マークダウンヘルプを表示", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 1ec387f8f0f30a..5e81b25840d49c 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -1180,8 +1180,6 @@ "core.euiLink.external.ariaLabel": "外部链接", "core.euiLink.newTarget.screenReaderOnlyText": "(在新选项卡或窗口中打开)", "core.euiMarkdownEditorFooter.closeButton": "关闭", - "core.euiMarkdownEditorFooter.descriptionPrefix": "此编辑器使用", - "core.euiMarkdownEditorFooter.descriptionSuffix": "还可以利用这些附加的语法插件向文本添加富文本内容。", "core.euiMarkdownEditorFooter.errorsTitle": "错误", "core.euiMarkdownEditorFooter.openUploadModal": "打开上传文件模式窗口", "core.euiMarkdownEditorFooter.showMarkdownHelp": "显示 Markdown 帮助", From d44b789f825f5401eefeef766c676a2326e1cbaf Mon Sep 17 00:00:00 2001 From: Brianna Hall Date: Mon, 4 Oct 2021 13:20:46 -0400 Subject: [PATCH 03/13] Update i18n snapshots and resolve linting error --- .../public/i18n/__snapshots__/i18n_service.test.tsx.snap | 6 ++++-- src/core/public/i18n/i18n_eui_mapping.tsx | 6 ++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap b/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap index 54e223cdc5d412..741575db872916 100644 --- a/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap +++ b/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap @@ -120,13 +120,15 @@ exports[`#start() returns \`Context\` component 1`] = ` "euiLink.external.ariaLabel": "External link", "euiLink.newTarget.screenReaderOnlyText": "(opens in a new tab or window)", "euiMarkdownEditorFooter.closeButton": "Close", - "euiMarkdownEditorFooter.descriptionPrefix": "This editor uses", - "euiMarkdownEditorFooter.descriptionSuffix": "You can also utilize these additional syntax plugins to add rich content to your text.", "euiMarkdownEditorFooter.errorsTitle": "Errors", + "euiMarkdownEditorFooter.mdSyntaxLink": "GitHub flavored markdown", "euiMarkdownEditorFooter.openUploadModal": "Open upload files modal", "euiMarkdownEditorFooter.showMarkdownHelp": "Show markdown help", "euiMarkdownEditorFooter.showSyntaxErrors": "Show errors", "euiMarkdownEditorFooter.supportedFileTypes": [Function], + "euiMarkdownEditorFooter.syntaxModalDescriptionPrefix": "This editor uses", + "euiMarkdownEditorFooter.syntaxModalDescriptionSuffix": "You can also utilize these additional syntax plugins to add rich content to your text.", + "euiMarkdownEditorFooter.syntaxPopoverDescription": "This editor uses", "euiMarkdownEditorFooter.syntaxTitle": "Syntax help", "euiMarkdownEditorFooter.unsupportedFileType": "File type not supported", "euiMarkdownEditorFooter.uploadingFiles": "Click to upload files", diff --git a/src/core/public/i18n/i18n_eui_mapping.tsx b/src/core/public/i18n/i18n_eui_mapping.tsx index 50753bc98260a7..b7bacb3679058c 100644 --- a/src/core/public/i18n/i18n_eui_mapping.tsx +++ b/src/core/public/i18n/i18n_eui_mapping.tsx @@ -643,15 +643,13 @@ export const getEuiContextMapping = (): EuiTokensObject => { 'euiMarkdownEditorFooter.syntaxModalDescriptionPrefix': i18n.translate( 'core.euiMarkdownEditorFooter.syntaxModalDescriptionPrefix', { - defaultMessage: - 'This editor uses', + defaultMessage: 'This editor uses', } ), 'euiMarkdownEditorFooter.syntaxModalDescriptionSuffix': i18n.translate( 'core.euiMarkdownEditorFooter.syntaxModalDescriptionSuffix', { - defaultMessage: - 'You can also utilize these additional syntax plugins to add rich content to your text.', + defaultMessage: 'You can also utilize these additional syntax plugins to add rich content to your text.', } ), 'euiMarkdownEditorFooter.syntaxPopoverDescription': i18n.translate( From 8a29a960692dfdb63d8cf26db8d6f4096602f4ff Mon Sep 17 00:00:00 2001 From: Brianna Hall Date: Mon, 4 Oct 2021 13:24:58 -0400 Subject: [PATCH 04/13] Removed html_id_generator mocks. Current mock was failing due to missing useGeneratedHtmlId export. This is safe to remove because EUI contains a .testenv that contains an mock for html_id_generator. More info at https://github.com/elastic/eui/blob/master/src/services/accessibility/html_id_generator.testenv.ts --- .../public/components/cron_editor/cron_editor.test.tsx | 6 ------ .../__jest__/client_integration/helpers/jest.mocks.tsx | 6 ------ .../field_format_editor/editors/url/url.test.tsx | 6 ------ .../app/error_group_overview/List/List.test.tsx | 6 ------ .../components/shared/Stacktrace/Stackframe.test.tsx | 6 ------ .../__snapshots__/asset_manager.stories.storyshot | 8 ++++---- .../__snapshots__/expression_input.stories.storyshot | 2 +- .../__snapshots__/file_upload.stories.storyshot | 4 ++-- .../__snapshots__/workpad_table.stories.storyshot | 8 ++++---- .../components/footer/settings/settings.test.tsx | 6 +----- x-pack/plugins/canvas/storybook/storyshots.test.tsx | 7 ------- .../license_management/__jest__/add_license.test.js | 5 ----- .../__jest__/request_trial_extension.test.js | 5 ----- .../license_management/__jest__/revert_to_basic.test.js | 5 ----- .../license_management/__jest__/start_trial.test.js | 6 ------ .../reporting/public/management/report_listing.test.tsx | 6 ------ .../availability_reporting.test.tsx | 6 ------ .../availability_reporting/location_status_tags.test.tsx | 6 ------ .../overview/monitor_list/monitor_list.test.tsx | 6 ------ 19 files changed, 12 insertions(+), 98 deletions(-) diff --git a/src/plugins/es_ui_shared/public/components/cron_editor/cron_editor.test.tsx b/src/plugins/es_ui_shared/public/components/cron_editor/cron_editor.test.tsx index 26ef7483bbbbd9..0ae82872124a43 100644 --- a/src/plugins/es_ui_shared/public/components/cron_editor/cron_editor.test.tsx +++ b/src/plugins/es_ui_shared/public/components/cron_editor/cron_editor.test.tsx @@ -14,12 +14,6 @@ import { mountWithI18nProvider } from '@kbn/test/jest'; import { Frequency } from './types'; import { CronEditor } from './cron_editor'; -jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => { - return { - htmlIdGenerator: () => () => `generated-id`, - }; -}); - describe('CronEditor', () => { ['MINUTE', 'HOUR', 'DAY', 'WEEK', 'MONTH', 'YEAR'].forEach((unit) => { test(`is rendered with a ${unit} frequency`, () => { diff --git a/src/plugins/index_pattern_field_editor/__jest__/client_integration/helpers/jest.mocks.tsx b/src/plugins/index_pattern_field_editor/__jest__/client_integration/helpers/jest.mocks.tsx index e291ec7b4ca083..d33a0d2a87fb5d 100644 --- a/src/plugins/index_pattern_field_editor/__jest__/client_integration/helpers/jest.mocks.tsx +++ b/src/plugins/index_pattern_field_editor/__jest__/client_integration/helpers/jest.mocks.tsx @@ -9,12 +9,6 @@ import React from 'react'; const EDITOR_ID = 'testEditor'; -jest.mock('@elastic/eui/lib/services/accessibility', () => { - return { - htmlIdGenerator: () => () => `generated-id`, - }; -}); - jest.mock('@elastic/eui', () => { const original = jest.requireActual('@elastic/eui'); diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/url/url.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/url/url.test.tsx index 48d3a5dfea7c65..6394d42b691f1f 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/url/url.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/url/url.test.tsx @@ -15,12 +15,6 @@ import { createKibanaReactContext } from '../../../../../../kibana_react/public' import { render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -jest.mock('@elastic/eui/lib/services/accessibility', () => { - return { - htmlIdGenerator: () => () => `generated-id`, - }; -}); - const fieldType = 'string'; const format = { getConverterFor: jest diff --git a/x-pack/plugins/apm/public/components/app/error_group_overview/List/List.test.tsx b/x-pack/plugins/apm/public/components/app/error_group_overview/List/List.test.tsx index a2a92b7e16f8ea..12fa1c955ccc8f 100644 --- a/x-pack/plugins/apm/public/components/app/error_group_overview/List/List.test.tsx +++ b/x-pack/plugins/apm/public/components/app/error_group_overview/List/List.test.tsx @@ -15,12 +15,6 @@ import props from './__fixtures__/props.json'; import { MemoryRouter } from 'react-router-dom'; import { EuiThemeProvider } from '../../../../../../../../src/plugins/kibana_react/common'; -jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => { - return { - htmlIdGenerator: () => () => `generated-id`, - }; -}); - describe('ErrorGroupOverview -> List', () => { beforeAll(() => { mockMoment(); diff --git a/x-pack/plugins/apm/public/components/shared/Stacktrace/Stackframe.test.tsx b/x-pack/plugins/apm/public/components/shared/Stacktrace/Stackframe.test.tsx index c73d312e0cf189..6bab77dbe49701 100644 --- a/x-pack/plugins/apm/public/components/shared/Stacktrace/Stackframe.test.tsx +++ b/x-pack/plugins/apm/public/components/shared/Stacktrace/Stackframe.test.tsx @@ -12,12 +12,6 @@ import { mountWithTheme } from '../../../utils/testHelpers'; import { Stackframe as StackframeComponent } from './Stackframe'; import stacktracesMock from './__fixtures__/stacktraces.json'; -jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => { - return { - htmlIdGenerator: () => () => `generated-id`, - }; -}); - describe('Stackframe', () => { describe('when stackframe has source lines', () => { let wrapper: ReactWrapper; diff --git a/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset_manager.stories.storyshot b/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset_manager.stories.storyshot index 6ef6d19e446dbc..45b9d896db5f27 100644 --- a/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset_manager.stories.storyshot +++ b/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset_manager.stories.storyshot @@ -54,7 +54,7 @@ exports[`Storyshots components/Assets/AssetManager no assets 1`] = ` >