From 2113878837be9822a7ee679ca3ba0bdabab7188e Mon Sep 17 00:00:00 2001
From: Vadim Kibana <82822460+vadimkibana@users.noreply.github.com>
Date: Thu, 10 Aug 2023 11:16:34 +0200
Subject: [PATCH] Rm canvas deprecations (#163467)
## Summary
Substitutes deprecated components from `kibana_react` plugin in Canvas
app by latest ones from packages.
Partially addresses https://github.com/elastic/kibana/issues/161422
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
---
.../canvas_plugin_src/renderers/embeddable/embeddable.tsx | 4 ++--
.../renderers/filters/advanced_filter/index.tsx | 4 ++--
.../renderers/filters/dropdown_filter/index.tsx | 4 ++--
.../renderers/filters/time_filter/index.tsx | 4 ++--
.../canvas/canvas_plugin_src/renderers/markdown/index.tsx | 4 ++--
.../plugins/canvas/canvas_plugin_src/renderers/table.tsx | 4 ++--
x-pack/plugins/canvas/canvas_plugin_src/renderers/text.tsx | 4 ++--
x-pack/plugins/canvas/public/application.tsx | 7 ++++---
.../canvas/public/components/home/home.component.tsx | 6 ++++--
x-pack/plugins/canvas/tsconfig.json | 2 ++
10 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx b/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx
index c99bfd21c9ad1..51c6cdc54131d 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx
+++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx
@@ -9,7 +9,7 @@ import React, { FC } from 'react';
import useObservable from 'react-use/lib/useObservable';
import ReactDOM from 'react-dom';
import { CoreStart } from '@kbn/core/public';
-import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
+import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
import {
IEmbeddable,
EmbeddableFactory,
@@ -62,7 +62,7 @@ const renderEmbeddableFactory = (core: CoreStart, plugins: StartDeps) => {
style={{ width: '100%', height: '100%', cursor: 'auto' }}
>
-
+
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/advanced_filter/index.tsx b/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/advanced_filter/index.tsx
index 12e1948260a96..2a875ff88f413 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/advanced_filter/index.tsx
+++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/advanced_filter/index.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
-import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
+import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
import { StartInitializer } from '../../../plugin';
import { RendererFactory } from '../../../../types';
import { AdvancedFilter } from './component';
@@ -24,7 +24,7 @@ export const advancedFilterFactory: StartInitializer> =
height: 50,
render(domNode, _, handlers) {
ReactDOM.render(
-
+
handlers.event({ name: 'applyFilterAction', data: filter })}
value={handlers.getFilter()}
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/dropdown_filter/index.tsx b/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/dropdown_filter/index.tsx
index 76323793ab698..50f534a658359 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/dropdown_filter/index.tsx
+++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/dropdown_filter/index.tsx
@@ -9,7 +9,7 @@ import { fromExpression, toExpression, Ast } from '@kbn/interpreter';
import { get } from 'lodash';
import React from 'react';
import ReactDOM from 'react-dom';
-import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
+import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
import { syncFilterExpression } from '../../../../public/lib/sync_filter_expression';
import { RendererFactory } from '../../../../types';
import { StartInitializer } from '../../../plugin';
@@ -97,7 +97,7 @@ export const dropdownFilterFactory: StartInitializer> =
);
ReactDOM.render(
- {filter},
+ {filter},
domNode,
() => handlers.done()
);
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/time_filter/index.tsx b/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/time_filter/index.tsx
index 9ae72a82c8870..52ae1e28f7904 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/time_filter/index.tsx
+++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/time_filter/index.tsx
@@ -9,7 +9,7 @@ import ReactDOM from 'react-dom';
import React from 'react';
import { toExpression } from '@kbn/interpreter';
import { UI_SETTINGS } from '@kbn/data-plugin/public';
-import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
+import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
import { syncFilterExpression } from '../../../../public/lib/sync_filter_expression';
import { RendererStrings } from '../../../../i18n';
import { TimeFilter } from './components';
@@ -60,7 +60,7 @@ export const timeFilterFactory: StartInitializer> = (
}
ReactDOM.render(
-
+
handlers.event({ name: 'applyFilterAction', data: filter })}
filter={filterExpression}
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx b/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx
index 7566db85427ac..fd1e2415d0589 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx
+++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/markdown/index.tsx
@@ -9,7 +9,7 @@ import React, { CSSProperties } from 'react';
import ReactDOM from 'react-dom';
import { CoreTheme } from '@kbn/core/public';
import { Observable } from 'rxjs';
-import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
+import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
import { defaultTheme$ } from '@kbn/presentation-util-plugin/common';
import { Markdown } from '@kbn/kibana-react-plugin/public';
import { StartInitializer } from '../../plugin';
@@ -30,7 +30,7 @@ export const getMarkdownRenderer =
const fontStyle = config.font ? config.font.spec : {};
ReactDOM.render(
-
+
+
+
{textString}
,
domNode,
diff --git a/x-pack/plugins/canvas/public/application.tsx b/x-pack/plugins/canvas/public/application.tsx
index cc365451b46f0..fa544095a8598 100644
--- a/x-pack/plugins/canvas/public/application.tsx
+++ b/x-pack/plugins/canvas/public/application.tsx
@@ -17,7 +17,8 @@ import { includes, remove } from 'lodash';
import { AppMountParameters, CoreStart, CoreSetup, AppUpdater } from '@kbn/core/public';
-import { KibanaContextProvider, KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
+import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
+import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { PluginServices } from '@kbn/presentation-util-plugin/public';
import { CanvasStartDeps, CanvasSetupDeps } from './plugin';
@@ -75,7 +76,7 @@ export const renderApp = ({
-
+
@@ -151,7 +152,7 @@ export const initializeCanvas = async (
],
content: (domNode, { hideHelpMenu }) => {
ReactDOM.render(
-
+
diff --git a/x-pack/plugins/canvas/public/components/home/home.component.tsx b/x-pack/plugins/canvas/public/components/home/home.component.tsx
index dbfbd8a920c7e..c29713da70d11 100644
--- a/x-pack/plugins/canvas/public/components/home/home.component.tsx
+++ b/x-pack/plugins/canvas/public/components/home/home.component.tsx
@@ -7,7 +7,7 @@
import React, { useState } from 'react';
import { i18n } from '@kbn/i18n';
-import { KibanaPageTemplate } from '@kbn/kibana-react-plugin/public';
+import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template';
import { withSuspense } from '@kbn/presentation-util-plugin/public';
import { WorkpadCreate } from './workpad_create';
@@ -48,7 +48,9 @@ export const Home = ({ activeTab = 'workpads' }: Props) => {
],
}}
>
- {tab === 'workpads' ? : }
+
+ {tab === 'workpads' ? : }
+
);
};
diff --git a/x-pack/plugins/canvas/tsconfig.json b/x-pack/plugins/canvas/tsconfig.json
index 04d1e78fc9555..45b22e422dc6e 100644
--- a/x-pack/plugins/canvas/tsconfig.json
+++ b/x-pack/plugins/canvas/tsconfig.json
@@ -82,6 +82,8 @@
"@kbn/core-saved-objects-server",
"@kbn/discover-utils",
"@kbn/content-management-plugin",
+ "@kbn/react-kibana-context-theme",
+ "@kbn/shared-ux-page-kibana-template",
],
"exclude": [
"target/**/*",