mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[SharedUX] Replace KibanaRenderContextProvider usage (#220170)
## Summary Closes https://github.com/elastic/kibana/issues/220175 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
f5b6aa241f
commit
68174f8705
44 changed files with 181 additions and 238 deletions
|
@ -10,7 +10,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { Redirect } from 'react-router-dom';
|
import { Redirect } from 'react-router-dom';
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
import { Router, Routes, Route } from '@kbn/shared-ux-router';
|
import { Router, Routes, Route } from '@kbn/shared-ux-router';
|
||||||
import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app';
|
import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app';
|
||||||
import { EuiPageTemplate, EuiSideNav } from '@elastic/eui';
|
import { EuiPageTemplate, EuiSideNav } from '@elastic/eui';
|
||||||
|
@ -26,7 +25,7 @@ export const renderApp = (
|
||||||
{ element, history }: AppMountParameters
|
{ element, history }: AppMountParameters
|
||||||
) => {
|
) => {
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<KibanaRenderContextProvider {...core}>
|
core.rendering.addContext(
|
||||||
<Router history={history}>
|
<Router history={history}>
|
||||||
<RedirectAppLinks coreStart={core}>
|
<RedirectAppLinks coreStart={core}>
|
||||||
<EuiPageTemplate offset={0}>
|
<EuiPageTemplate offset={0}>
|
||||||
|
@ -86,7 +85,7 @@ export const renderApp = (
|
||||||
</EuiPageTemplate>
|
</EuiPageTemplate>
|
||||||
</RedirectAppLinks>
|
</RedirectAppLinks>
|
||||||
</Router>
|
</Router>
|
||||||
</KibanaRenderContextProvider>,
|
),
|
||||||
element
|
element
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,5 @@
|
||||||
"@kbn/shared-ux-router",
|
"@kbn/shared-ux-router",
|
||||||
"@kbn/saved-objects-finder-plugin",
|
"@kbn/saved-objects-finder-plugin",
|
||||||
"@kbn/content-management-table-list-view-common",
|
"@kbn/content-management-table-list-view-common",
|
||||||
"@kbn/react-kibana-context-render",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,31 +23,18 @@ import {
|
||||||
EuiLink,
|
EuiLink,
|
||||||
EuiButtonIcon,
|
EuiButtonIcon,
|
||||||
} from '@elastic/eui';
|
} from '@elastic/eui';
|
||||||
import {
|
import { AppMountParameters } from '@kbn/core/public';
|
||||||
AnalyticsServiceStart,
|
import { RenderingService } from '@kbn/core-rendering-browser';
|
||||||
AppMountParameters,
|
|
||||||
I18nStart,
|
|
||||||
ThemeServiceStart,
|
|
||||||
UserProfileService,
|
|
||||||
} from '@kbn/core/public';
|
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
import { ExampleDefinition } from './types';
|
import { ExampleDefinition } from './types';
|
||||||
|
|
||||||
interface StartServices {
|
|
||||||
analytics: Pick<AnalyticsServiceStart, 'reportEvent'>;
|
|
||||||
i18n: I18nStart;
|
|
||||||
theme: Pick<ThemeServiceStart, 'theme$'>;
|
|
||||||
userProfile: UserProfileService;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
startServices: StartServices;
|
rendering: RenderingService;
|
||||||
examples: ExampleDefinition[];
|
examples: ExampleDefinition[];
|
||||||
navigateToApp: (appId: string) => void;
|
navigateToApp: (appId: string) => void;
|
||||||
getUrlForApp: (appId: string) => string;
|
getUrlForApp: (appId: string) => string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DeveloperExamples({ startServices, examples, navigateToApp, getUrlForApp }: Props) {
|
function DeveloperExamples({ examples, navigateToApp, getUrlForApp, rendering }: Props) {
|
||||||
const [search, setSearch] = useState<string>('');
|
const [search, setSearch] = useState<string>('');
|
||||||
|
|
||||||
const lcSearch = search.toLowerCase();
|
const lcSearch = search.toLowerCase();
|
||||||
|
@ -59,69 +46,67 @@ function DeveloperExamples({ startServices, examples, navigateToApp, getUrlForAp
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return rendering.addContext(
|
||||||
<KibanaRenderContextProvider {...startServices}>
|
<EuiPageTemplate offset={0}>
|
||||||
<EuiPageTemplate offset={0}>
|
<EuiPageTemplate.Header>
|
||||||
<EuiPageTemplate.Header>
|
<EuiFlexGroup justifyContent={'spaceBetween'}>
|
||||||
<EuiFlexGroup justifyContent={'spaceBetween'}>
|
<EuiFlexItem>
|
||||||
<EuiFlexItem>
|
<EuiPageHeader pageTitle={'Developer examples'} />
|
||||||
<EuiPageHeader pageTitle={'Developer examples'} />
|
<EuiText>
|
||||||
<EuiText>
|
The following examples showcase services and APIs that are available to developers.
|
||||||
The following examples showcase services and APIs that are available to developers.
|
</EuiText>
|
||||||
</EuiText>
|
</EuiFlexItem>
|
||||||
</EuiFlexItem>
|
<EuiFlexItem>
|
||||||
<EuiFlexItem>
|
<EuiFieldSearch
|
||||||
<EuiFieldSearch
|
fullWidth
|
||||||
fullWidth
|
placeholder="Search"
|
||||||
placeholder="Search"
|
value={search}
|
||||||
value={search}
|
onChange={(e) => setSearch(e.target.value)}
|
||||||
onChange={(e) => setSearch(e.target.value)}
|
isClearable={true}
|
||||||
isClearable={true}
|
aria-label="Search developer examples"
|
||||||
aria-label="Search developer examples"
|
/>
|
||||||
|
</EuiFlexItem>
|
||||||
|
</EuiFlexGroup>
|
||||||
|
</EuiPageTemplate.Header>
|
||||||
|
<EuiPageTemplate.Section>
|
||||||
|
<EuiFlexGroup wrap>
|
||||||
|
{filteredExamples.map((def) => (
|
||||||
|
<EuiFlexItem style={{ minWidth: 300, maxWidth: 500 }} key={def.appId}>
|
||||||
|
<EuiCard
|
||||||
|
description={
|
||||||
|
<EuiHighlight search={search} highlightAll={true}>
|
||||||
|
{def.description}
|
||||||
|
</EuiHighlight>
|
||||||
|
}
|
||||||
|
title={
|
||||||
|
<React.Fragment>
|
||||||
|
<EuiLink
|
||||||
|
onClick={() => {
|
||||||
|
navigateToApp(def.appId);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<EuiHighlight search={search} highlightAll={true}>
|
||||||
|
{def.title}
|
||||||
|
</EuiHighlight>
|
||||||
|
</EuiLink>
|
||||||
|
<EuiButtonIcon
|
||||||
|
iconType="popout"
|
||||||
|
onClick={() =>
|
||||||
|
window.open(getUrlForApp(def.appId), '_blank', 'noopener, noreferrer')
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Open in new tab
|
||||||
|
</EuiButtonIcon>
|
||||||
|
</React.Fragment>
|
||||||
|
}
|
||||||
|
image={def.image}
|
||||||
|
footer={def.links ? <EuiListGroup size={'s'} listItems={def.links} /> : undefined}
|
||||||
/>
|
/>
|
||||||
</EuiFlexItem>
|
</EuiFlexItem>
|
||||||
</EuiFlexGroup>
|
))}
|
||||||
</EuiPageTemplate.Header>
|
</EuiFlexGroup>
|
||||||
<EuiPageTemplate.Section>
|
</EuiPageTemplate.Section>
|
||||||
<EuiFlexGroup wrap>
|
</EuiPageTemplate>
|
||||||
{filteredExamples.map((def) => (
|
|
||||||
<EuiFlexItem style={{ minWidth: 300, maxWidth: 500 }} key={def.appId}>
|
|
||||||
<EuiCard
|
|
||||||
description={
|
|
||||||
<EuiHighlight search={search} highlightAll={true}>
|
|
||||||
{def.description}
|
|
||||||
</EuiHighlight>
|
|
||||||
}
|
|
||||||
title={
|
|
||||||
<React.Fragment>
|
|
||||||
<EuiLink
|
|
||||||
onClick={() => {
|
|
||||||
navigateToApp(def.appId);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<EuiHighlight search={search} highlightAll={true}>
|
|
||||||
{def.title}
|
|
||||||
</EuiHighlight>
|
|
||||||
</EuiLink>
|
|
||||||
<EuiButtonIcon
|
|
||||||
iconType="popout"
|
|
||||||
onClick={() =>
|
|
||||||
window.open(getUrlForApp(def.appId), '_blank', 'noopener, noreferrer')
|
|
||||||
}
|
|
||||||
>
|
|
||||||
Open in new tab
|
|
||||||
</EuiButtonIcon>
|
|
||||||
</React.Fragment>
|
|
||||||
}
|
|
||||||
image={def.image}
|
|
||||||
footer={def.links ? <EuiListGroup size={'s'} listItems={def.links} /> : undefined}
|
|
||||||
/>
|
|
||||||
</EuiFlexItem>
|
|
||||||
))}
|
|
||||||
</EuiFlexGroup>
|
|
||||||
</EuiPageTemplate.Section>
|
|
||||||
</EuiPageTemplate>
|
|
||||||
</KibanaRenderContextProvider>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,13 @@ export class DeveloperExamplesPlugin implements Plugin<DeveloperExamplesSetup, v
|
||||||
async mount(params: AppMountParameters) {
|
async mount(params: AppMountParameters) {
|
||||||
const { renderApp } = await import('./app');
|
const { renderApp } = await import('./app');
|
||||||
const [coreStart] = await core.getStartServices();
|
const [coreStart] = await core.getStartServices();
|
||||||
const { analytics, i18n, theme, userProfile } = coreStart;
|
const { rendering } = coreStart;
|
||||||
return renderApp(
|
return renderApp(
|
||||||
{
|
{
|
||||||
startServices: { analytics, i18n, theme, userProfile },
|
|
||||||
examples,
|
examples,
|
||||||
navigateToApp: (appId: string) => coreStart.application.navigateToApp(appId),
|
navigateToApp: (appId: string) => coreStart.application.navigateToApp(appId),
|
||||||
getUrlForApp: (appId: string) => coreStart.application.getUrlForApp(appId),
|
getUrlForApp: (appId: string) => coreStart.application.getUrlForApp(appId),
|
||||||
|
rendering,
|
||||||
},
|
},
|
||||||
params.element
|
params.element
|
||||||
);
|
);
|
||||||
|
|
|
@ -15,6 +15,6 @@
|
||||||
],
|
],
|
||||||
"kbn_references": [
|
"kbn_references": [
|
||||||
"@kbn/core",
|
"@kbn/core",
|
||||||
"@kbn/react-kibana-context-render"
|
"@kbn/core-rendering-browser"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { AppMountParameters, CoreStart } from '@kbn/core/public';
|
import { AppMountParameters, CoreStart } from '@kbn/core/public';
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
import { AppPluginStartDependencies } from './types';
|
import { AppPluginStartDependencies } from './types';
|
||||||
import { GuidedOnboardingExampleApp } from './components/app';
|
import { GuidedOnboardingExampleApp } from './components/app';
|
||||||
|
|
||||||
|
@ -19,15 +18,15 @@ export const renderApp = (
|
||||||
{ guidedOnboarding }: AppPluginStartDependencies,
|
{ guidedOnboarding }: AppPluginStartDependencies,
|
||||||
{ element, history }: AppMountParameters
|
{ element, history }: AppMountParameters
|
||||||
) => {
|
) => {
|
||||||
const { notifications } = coreStart;
|
const { notifications, rendering } = coreStart;
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<KibanaRenderContextProvider {...coreStart}>
|
rendering.addContext(
|
||||||
<GuidedOnboardingExampleApp
|
<GuidedOnboardingExampleApp
|
||||||
notifications={notifications}
|
notifications={notifications}
|
||||||
guidedOnboarding={guidedOnboarding}
|
guidedOnboarding={guidedOnboarding}
|
||||||
history={history}
|
history={history}
|
||||||
/>
|
/>
|
||||||
</KibanaRenderContextProvider>,
|
),
|
||||||
element
|
element
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
"@kbn/i18n",
|
"@kbn/i18n",
|
||||||
"@kbn/guided-onboarding",
|
"@kbn/guided-onboarding",
|
||||||
"@kbn/shared-ux-router",
|
"@kbn/shared-ux-router",
|
||||||
"@kbn/react-kibana-context-render",
|
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"target/**/*",
|
"target/**/*",
|
||||||
|
|
|
@ -11,7 +11,6 @@ import ReactDOM from 'react-dom';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { AppMountParameters, CoreStart } from '@kbn/core/public';
|
import { AppMountParameters, CoreStart } from '@kbn/core/public';
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
import { createHashHistory } from 'history';
|
import { createHashHistory } from 'history';
|
||||||
import { TodoAppPage } from './todo';
|
import { TodoAppPage } from './todo';
|
||||||
import { StateContainersExamplesPage, ExampleLink } from '../common/example_page';
|
import { StateContainersExamplesPage, ExampleLink } from '../common/example_page';
|
||||||
|
@ -39,11 +38,11 @@ export const renderApp = (
|
||||||
) => {
|
) => {
|
||||||
const history = historyType === History.Browser ? platformHistory : createHashHistory();
|
const history = historyType === History.Browser ? platformHistory : createHashHistory();
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<KibanaRenderContextProvider {...core}>
|
core.rendering.addContext(
|
||||||
<StateContainersExamplesPage navigateToApp={navigateToApp} exampleLinks={exampleLinks}>
|
<StateContainersExamplesPage navigateToApp={navigateToApp} exampleLinks={exampleLinks}>
|
||||||
<TodoAppPage history={history} appTitle={appTitle} appBasePath={appBasePath} />
|
<TodoAppPage history={history} appTitle={appTitle} appBasePath={appBasePath} />
|
||||||
</StateContainersExamplesPage>
|
</StateContainersExamplesPage>
|
||||||
</KibanaRenderContextProvider>,
|
),
|
||||||
element
|
element
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,5 @@
|
||||||
"@kbn/developer-examples-plugin",
|
"@kbn/developer-examples-plugin",
|
||||||
"@kbn/es-query",
|
"@kbn/es-query",
|
||||||
"@kbn/shared-ux-router",
|
"@kbn/shared-ux-router",
|
||||||
"@kbn/react-kibana-context-render",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { toMountPoint } from '@kbn/react-kibana-mount';
|
||||||
|
|
||||||
export const ACTION_HELLO_WORLD = 'ACTION_HELLO_WORLD';
|
export const ACTION_HELLO_WORLD = 'ACTION_HELLO_WORLD';
|
||||||
|
|
||||||
type StartServices = Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme' | 'userProfile'>;
|
type StartServices = Pick<CoreStart, 'overlays' | 'rendering'>;
|
||||||
|
|
||||||
export const createHelloWorldActionDefinition = (
|
export const createHelloWorldActionDefinition = (
|
||||||
getStartServices: () => Promise<StartServices>
|
getStartServices: () => Promise<StartServices>
|
||||||
|
@ -23,7 +23,7 @@ export const createHelloWorldActionDefinition = (
|
||||||
type: ACTION_HELLO_WORLD,
|
type: ACTION_HELLO_WORLD,
|
||||||
getDisplayName: () => 'Hello World!',
|
getDisplayName: () => 'Hello World!',
|
||||||
execute: async () => {
|
execute: async () => {
|
||||||
const { overlays, ...startServices } = await getStartServices();
|
const { overlays, rendering } = await getStartServices();
|
||||||
const overlay = overlays.openModal(
|
const overlay = overlays.openModal(
|
||||||
toMountPoint(
|
toMountPoint(
|
||||||
<EuiModalBody>
|
<EuiModalBody>
|
||||||
|
@ -32,7 +32,7 @@ export const createHelloWorldActionDefinition = (
|
||||||
Close
|
Close
|
||||||
</EuiButton>
|
</EuiButton>
|
||||||
</EuiModalBody>,
|
</EuiModalBody>,
|
||||||
startServices
|
rendering
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -110,11 +110,11 @@ export const createEditUserAction = (getStartServices: () => Promise<CoreStart>)
|
||||||
getIconType: () => 'pencil',
|
getIconType: () => 'pencil',
|
||||||
getDisplayName: () => 'Edit user',
|
getDisplayName: () => 'Edit user',
|
||||||
execute: async ({ user, update }) => {
|
execute: async ({ user, update }) => {
|
||||||
const { overlays, ...startServices } = await getStartServices();
|
const { overlays, rendering } = await getStartServices();
|
||||||
const overlay = overlays.openModal(
|
const overlay = overlays.openModal(
|
||||||
toMountPoint(
|
toMountPoint(
|
||||||
<EditUserModal user={user} update={update} close={() => overlay.close()} />,
|
<EditUserModal user={user} update={update} close={() => overlay.close()} />,
|
||||||
startServices
|
rendering
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -19,7 +19,6 @@ import {
|
||||||
EuiPageHeader,
|
EuiPageHeader,
|
||||||
} from '@elastic/eui';
|
} from '@elastic/eui';
|
||||||
import { AppMountParameters, CoreStart } from '@kbn/core/public';
|
import { AppMountParameters, CoreStart } from '@kbn/core/public';
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
import { UiActionsStart } from '@kbn/ui-actions-plugin/public';
|
import { UiActionsStart } from '@kbn/ui-actions-plugin/public';
|
||||||
import { TriggerContextExample } from './trigger_context_example';
|
import { TriggerContextExample } from './trigger_context_example';
|
||||||
import { ContextMenuExamples } from './context_menu_examples';
|
import { ContextMenuExamples } from './context_menu_examples';
|
||||||
|
@ -32,36 +31,31 @@ interface Props {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ActionsExplorer = ({ uiActionsStartService, core }: Props) => {
|
const ActionsExplorer = ({ uiActionsStartService, core }: Props) => {
|
||||||
return (
|
return core.rendering.addContext(
|
||||||
<KibanaRenderContextProvider {...core}>
|
<EuiPage>
|
||||||
<EuiPage>
|
<EuiPageBody>
|
||||||
<EuiPageBody>
|
<EuiPageSection>
|
||||||
|
<EuiPageHeader pageTitle="Actions and Triggers" />
|
||||||
|
</EuiPageSection>
|
||||||
|
<EuiPageTemplate.Section>
|
||||||
<EuiPageSection>
|
<EuiPageSection>
|
||||||
<EuiPageHeader pageTitle="Actions and Triggers" />
|
<Overview />
|
||||||
|
|
||||||
|
<EuiSpacer />
|
||||||
|
|
||||||
|
<HelloWorldExample uiActionsStartService={uiActionsStartService} startServices={core} />
|
||||||
|
|
||||||
|
<EuiSpacer />
|
||||||
|
|
||||||
|
<TriggerContextExample uiActionsApi={uiActionsStartService} />
|
||||||
|
|
||||||
|
<EuiSpacer />
|
||||||
|
|
||||||
|
<ContextMenuExamples />
|
||||||
</EuiPageSection>
|
</EuiPageSection>
|
||||||
<EuiPageTemplate.Section>
|
</EuiPageTemplate.Section>
|
||||||
<EuiPageSection>
|
</EuiPageBody>
|
||||||
<Overview />
|
</EuiPage>
|
||||||
|
|
||||||
<EuiSpacer />
|
|
||||||
|
|
||||||
<HelloWorldExample
|
|
||||||
uiActionsStartService={uiActionsStartService}
|
|
||||||
startServices={core}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<EuiSpacer />
|
|
||||||
|
|
||||||
<TriggerContextExample uiActionsApi={uiActionsStartService} />
|
|
||||||
|
|
||||||
<EuiSpacer />
|
|
||||||
|
|
||||||
<ContextMenuExamples />
|
|
||||||
</EuiPageSection>
|
|
||||||
</EuiPageTemplate.Section>
|
|
||||||
</EuiPageBody>
|
|
||||||
</EuiPage>
|
|
||||||
</KibanaRenderContextProvider>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,13 @@ const DYNAMIC_ACTION_ID = `${ACTION_HELLO_WORLD}-Waldo`;
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
uiActionsStartService: UiActionsStart;
|
uiActionsStartService: UiActionsStart;
|
||||||
startServices: Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme' | 'userProfile'>;
|
startServices: Pick<CoreStart, 'overlays' | 'rendering'>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const HelloWorldExample = ({ uiActionsStartService, startServices }: Props) => {
|
export const HelloWorldExample = ({
|
||||||
|
uiActionsStartService,
|
||||||
|
startServices: { overlays, rendering },
|
||||||
|
}: Props) => {
|
||||||
const [isChecked, setIsChecked] = useState(false);
|
const [isChecked, setIsChecked] = useState(false);
|
||||||
|
|
||||||
const actionsMessage = isChecked ? '2 actions attached' : '1 action attached';
|
const actionsMessage = isChecked ? '2 actions attached' : '1 action attached';
|
||||||
|
@ -71,7 +74,7 @@ export const HelloWorldExample = ({ uiActionsStartService, startServices }: Prop
|
||||||
type: ACTION_HELLO_WORLD,
|
type: ACTION_HELLO_WORLD,
|
||||||
getDisplayName: () => 'Say hello to Waldo',
|
getDisplayName: () => 'Say hello to Waldo',
|
||||||
execute: async () => {
|
execute: async () => {
|
||||||
const overlay = startServices.overlays.openModal(
|
const overlay = overlays.openModal(
|
||||||
toMountPoint(
|
toMountPoint(
|
||||||
<EuiModalBody>
|
<EuiModalBody>
|
||||||
<EuiText data-test-subj="dynamicHelloWorldActionText">Hello Waldo</EuiText>{' '}
|
<EuiText data-test-subj="dynamicHelloWorldActionText">Hello Waldo</EuiText>{' '}
|
||||||
|
@ -79,7 +82,7 @@ export const HelloWorldExample = ({ uiActionsStartService, startServices }: Prop
|
||||||
Close
|
Close
|
||||||
</EuiButton>
|
</EuiButton>
|
||||||
</EuiModalBody>,
|
</EuiModalBody>,
|
||||||
startServices
|
rendering
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -18,6 +18,5 @@
|
||||||
"@kbn/ui-actions-examples-plugin",
|
"@kbn/ui-actions-examples-plugin",
|
||||||
"@kbn/developer-examples-plugin",
|
"@kbn/developer-examples-plugin",
|
||||||
"@kbn/react-kibana-mount",
|
"@kbn/react-kibana-mount",
|
||||||
"@kbn/react-kibana-context-render",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,9 @@ export interface ContentEditorKibanaDependencies {
|
||||||
addDanger: (notifyArgs: { title: MountPoint; text?: string }) => void;
|
addDanger: (notifyArgs: { title: MountPoint; text?: string }) => void;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
rendering: {
|
||||||
|
addContext: (element: React.ReactNode) => React.ReactElement;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* The public API from the savedObjectsTaggingOss plugin.
|
* The public API from the savedObjectsTaggingOss plugin.
|
||||||
|
@ -123,7 +126,7 @@ export const ContentEditorKibanaProvider: FC<
|
||||||
PropsWithChildren<ContentEditorKibanaDependencies>
|
PropsWithChildren<ContentEditorKibanaDependencies>
|
||||||
> = ({ children, ...services }) => {
|
> = ({ children, ...services }) => {
|
||||||
const { core, savedObjectsTagging } = services;
|
const { core, savedObjectsTagging } = services;
|
||||||
const { overlays, notifications, ...startServices } = core;
|
const { overlays, notifications, rendering } = core;
|
||||||
const { openFlyout: coreOpenFlyout } = overlays;
|
const { openFlyout: coreOpenFlyout } = overlays;
|
||||||
|
|
||||||
const TagList = useMemo(() => {
|
const TagList = useMemo(() => {
|
||||||
|
@ -148,19 +151,19 @@ export const ContentEditorKibanaProvider: FC<
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<UserProfilesProvider {...userProfilesServices}>{node}</UserProfilesProvider>
|
<UserProfilesProvider {...userProfilesServices}>{node}</UserProfilesProvider>
|
||||||
</QueryClientProvider>,
|
</QueryClientProvider>,
|
||||||
startServices
|
rendering
|
||||||
),
|
),
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
[coreOpenFlyout, startServices, userProfilesServices, queryClient]
|
[coreOpenFlyout, rendering, userProfilesServices, queryClient]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ContentEditorProvider
|
<ContentEditorProvider
|
||||||
openFlyout={openFlyout}
|
openFlyout={openFlyout}
|
||||||
notifyError={(title, text) => {
|
notifyError={(title, text) => {
|
||||||
notifications.toasts.addDanger({ title: toMountPoint(title, startServices), text });
|
notifications.toasts.addDanger({ title: toMountPoint(title, rendering), text });
|
||||||
}}
|
}}
|
||||||
TagList={TagList}
|
TagList={TagList}
|
||||||
TagSelector={savedObjectsTagging?.ui.components.SavedObjectSaveModalTagSelector}
|
TagSelector={savedObjectsTagging?.ui.components.SavedObjectSaveModalTagSelector}
|
||||||
|
|
|
@ -135,6 +135,9 @@ export interface TableListViewKibanaDependencies {
|
||||||
userProfile: {
|
userProfile: {
|
||||||
bulkGet: UserProfileServiceStart['bulkGet'];
|
bulkGet: UserProfileServiceStart['bulkGet'];
|
||||||
};
|
};
|
||||||
|
rendering: {
|
||||||
|
addContext: (element: React.ReactNode) => React.ReactElement;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* The public API from the savedObjectsTaggingOss plugin.
|
* The public API from the savedObjectsTaggingOss plugin.
|
||||||
|
@ -202,7 +205,7 @@ export const TableListViewKibanaProvider: FC<
|
||||||
PropsWithChildren<TableListViewKibanaDependencies>
|
PropsWithChildren<TableListViewKibanaDependencies>
|
||||||
> = ({ children, ...services }) => {
|
> = ({ children, ...services }) => {
|
||||||
const { core, savedObjectsTagging, FormattedRelative } = services;
|
const { core, savedObjectsTagging, FormattedRelative } = services;
|
||||||
const { application, http, notifications, ...startServices } = core;
|
const { application, http, notifications, rendering } = core;
|
||||||
|
|
||||||
const searchQueryParser = useMemo(() => {
|
const searchQueryParser = useMemo(() => {
|
||||||
if (savedObjectsTagging) {
|
if (savedObjectsTagging) {
|
||||||
|
@ -268,7 +271,7 @@ export const TableListViewKibanaProvider: FC<
|
||||||
favoritesClient={services.favorites}
|
favoritesClient={services.favorites}
|
||||||
notifyError={(title, text) => {
|
notifyError={(title, text) => {
|
||||||
notifications.toasts.addDanger({
|
notifications.toasts.addDanger({
|
||||||
title: toMountPoint(title, startServices),
|
title: toMountPoint(title, rendering),
|
||||||
text,
|
text,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
@ -276,7 +279,7 @@ export const TableListViewKibanaProvider: FC<
|
||||||
<TableListViewProvider
|
<TableListViewProvider
|
||||||
notifyError={(title, text) => {
|
notifyError={(title, text) => {
|
||||||
notifications.toasts.addDanger({
|
notifications.toasts.addDanger({
|
||||||
title: toMountPoint(title, startServices),
|
title: toMountPoint(title, rendering),
|
||||||
text,
|
text,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
@ -290,7 +293,7 @@ export const TableListViewKibanaProvider: FC<
|
||||||
TagList={TagList}
|
TagList={TagList}
|
||||||
itemHasTags={itemHasTags}
|
itemHasTags={itemHasTags}
|
||||||
getTagIdsFromReferences={getTagIdsFromReferences}
|
getTagIdsFromReferences={getTagIdsFromReferences}
|
||||||
getTagManagementUrl={() => core.http.basePath.prepend(TAG_MANAGEMENT_APP_URL)}
|
getTagManagementUrl={() => http.basePath.prepend(TAG_MANAGEMENT_APP_URL)}
|
||||||
isKibanaVersioningEnabled={services.isKibanaVersioningEnabled ?? false}
|
isKibanaVersioningEnabled={services.isKibanaVersioningEnabled ?? false}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import { i18n } from '@kbn/i18n';
|
||||||
import { CoreSetup, Plugin } from '@kbn/core/public';
|
import { CoreSetup, Plugin } from '@kbn/core/public';
|
||||||
import { SectionRegistry } from '@kbn/management-settings-section-registry';
|
import { SectionRegistry } from '@kbn/management-settings-section-registry';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { withSuspense } from '@kbn/shared-ux-utility';
|
import { withSuspense } from '@kbn/shared-ux-utility';
|
||||||
import {
|
import {
|
||||||
|
@ -60,7 +59,7 @@ export class AdvancedSettingsPlugin
|
||||||
setBreadcrumbs([{ text: title }]);
|
setBreadcrumbs([{ text: title }]);
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<KibanaRenderContextProvider {...coreStart}>
|
coreStart.rendering.addContext(
|
||||||
<KibanaSettingsApplication
|
<KibanaSettingsApplication
|
||||||
{...{
|
{...{
|
||||||
...coreStart,
|
...coreStart,
|
||||||
|
@ -69,7 +68,7 @@ export class AdvancedSettingsPlugin
|
||||||
sectionRegistry: sectionRegistryStart,
|
sectionRegistry: sectionRegistryStart,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</KibanaRenderContextProvider>,
|
),
|
||||||
element
|
element
|
||||||
);
|
);
|
||||||
return () => {
|
return () => {
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
"@kbn/config-schema",
|
"@kbn/config-schema",
|
||||||
"@kbn/core-plugins-server",
|
"@kbn/core-plugins-server",
|
||||||
"@kbn/management-settings-section-registry",
|
"@kbn/management-settings-section-registry",
|
||||||
"@kbn/react-kibana-context-render",
|
|
||||||
"@kbn/shared-ux-utility",
|
"@kbn/shared-ux-utility",
|
||||||
"@kbn/management-settings-application",
|
"@kbn/management-settings-application",
|
||||||
"@kbn/spaces-plugin",
|
"@kbn/spaces-plugin",
|
||||||
|
|
|
@ -11,7 +11,6 @@ import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { Router } from '@kbn/shared-ux-router';
|
import { Router } from '@kbn/shared-ux-router';
|
||||||
import { Route } from '@kbn/shared-ux-router';
|
import { Route } from '@kbn/shared-ux-router';
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
import { FormattedRelative } from '@kbn/i18n-react';
|
import { FormattedRelative } from '@kbn/i18n-react';
|
||||||
import type { CoreStart } from '@kbn/core/public';
|
import type { CoreStart } from '@kbn/core/public';
|
||||||
import type { ManagementAppMountParams } from '@kbn/management-plugin/public';
|
import type { ManagementAppMountParams } from '@kbn/management-plugin/public';
|
||||||
|
@ -33,14 +32,9 @@ export const mountManagementSection = (
|
||||||
} = startDeps;
|
} = startDeps;
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<KibanaRenderContextProvider {...coreStart}>
|
coreStart.rendering.addContext(
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<TableListViewKibanaProvider
|
<TableListViewKibanaProvider {...{ core: coreStart, FormattedRelative }}>
|
||||||
{...{
|
|
||||||
core: coreStart,
|
|
||||||
FormattedRelative,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<FilesManagementAppContextProvider
|
<FilesManagementAppContextProvider
|
||||||
filesClient={filesClientFactory.asUnscoped()}
|
filesClient={filesClientFactory.asUnscoped()}
|
||||||
getFileKindDefinition={getFileKindDefinition}
|
getFileKindDefinition={getFileKindDefinition}
|
||||||
|
@ -52,7 +46,7 @@ export const mountManagementSection = (
|
||||||
</FilesManagementAppContextProvider>
|
</FilesManagementAppContextProvider>
|
||||||
</TableListViewKibanaProvider>
|
</TableListViewKibanaProvider>
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
</KibanaRenderContextProvider>,
|
),
|
||||||
element
|
element
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
"@kbn/shared-ux-file-image",
|
"@kbn/shared-ux-file-image",
|
||||||
"@kbn/shared-ux-router",
|
"@kbn/shared-ux-router",
|
||||||
"@kbn/content-management-table-list-view-common",
|
"@kbn/content-management-table-list-view-common",
|
||||||
"@kbn/react-kibana-context-render",
|
|
||||||
"@kbn/charts-theme",
|
"@kbn/charts-theme",
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
|
|
@ -28,7 +28,7 @@ export const openImageEditor = async ({
|
||||||
}): Promise<ImageConfig> => {
|
}): Promise<ImageConfig> => {
|
||||||
const { ImageEditorFlyout } = await import('./image_editor_flyout');
|
const { ImageEditorFlyout } = await import('./image_editor_flyout');
|
||||||
|
|
||||||
const { overlays, http, security, ...startServices } = coreServices;
|
const { overlays, http, security, rendering } = coreServices;
|
||||||
const user = await security.authc.getCurrentUser();
|
const user = await security.authc.getCurrentUser();
|
||||||
const filesClient = filesService.filesClientFactory.asUnscoped<FileImageMetadata>();
|
const filesClient = filesService.filesClientFactory.asUnscoped<FileImageMetadata>();
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ export const openImageEditor = async ({
|
||||||
/>
|
/>
|
||||||
</ImageViewerContext.Provider>
|
</ImageViewerContext.Provider>
|
||||||
</FilesContext>,
|
</FilesContext>,
|
||||||
startServices
|
rendering
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
onClose: () => {
|
onClose: () => {
|
||||||
|
|
|
@ -11,7 +11,6 @@ import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
import { NewsfeedApiEndpoint } from '@kbn/newsfeed-plugin/public';
|
import { NewsfeedApiEndpoint } from '@kbn/newsfeed-plugin/public';
|
||||||
import { AppMountParameters, CoreStart } from '@kbn/core/public';
|
import { AppMountParameters, CoreStart } from '@kbn/core/public';
|
||||||
import { AppPluginStartDependencies } from './types';
|
import { AppPluginStartDependencies } from './types';
|
||||||
|
@ -42,14 +41,14 @@ export const renderApp = (
|
||||||
);
|
);
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<KibanaRenderContextProvider {...core}>
|
core.rendering.addContext(
|
||||||
<KibanaContextProvider services={{ ...core, ...deps }}>
|
<KibanaContextProvider services={{ ...core, ...deps }}>
|
||||||
<KibanaOverviewApp
|
<KibanaOverviewApp
|
||||||
basename={appBasePath}
|
basename={appBasePath}
|
||||||
{...{ notifications, http, navigation, newsfeed$, solutions, features$ }}
|
{...{ notifications, http, navigation, newsfeed$, solutions, features$ }}
|
||||||
/>
|
/>
|
||||||
</KibanaContextProvider>
|
</KibanaContextProvider>
|
||||||
</KibanaRenderContextProvider>,
|
),
|
||||||
element
|
element
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
"@kbn/shared-ux-router",
|
"@kbn/shared-ux-router",
|
||||||
"@kbn/shared-ux-avatar-solution",
|
"@kbn/shared-ux-avatar-solution",
|
||||||
"@kbn/shared-ux-utility",
|
"@kbn/shared-ux-utility",
|
||||||
"@kbn/react-kibana-context-render",
|
|
||||||
"@kbn/core-application-browser-mocks",
|
"@kbn/core-application-browser-mocks",
|
||||||
"@kbn/core-http-browser-mocks",
|
"@kbn/core-http-browser-mocks",
|
||||||
"@kbn/react-kibana-context-theme",
|
"@kbn/react-kibana-context-theme",
|
||||||
|
|
|
@ -16,7 +16,6 @@ import {
|
||||||
ApplicationStart,
|
ApplicationStart,
|
||||||
NotificationsStart,
|
NotificationsStart,
|
||||||
} from '@kbn/core/public';
|
} from '@kbn/core/public';
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
|
|
||||||
import { PLUGIN_FEATURE } from '../common/constants';
|
import { PLUGIN_FEATURE } from '../common/constants';
|
||||||
import type {
|
import type {
|
||||||
|
@ -80,16 +79,17 @@ export class GuidedOnboardingPlugin
|
||||||
application,
|
application,
|
||||||
notifications,
|
notifications,
|
||||||
}: {
|
}: {
|
||||||
startServices: Pick<CoreStart, 'analytics' | 'i18n' | 'theme' | 'userProfile'>;
|
startServices: Pick<CoreStart, 'rendering'>;
|
||||||
targetDomElement: HTMLElement;
|
targetDomElement: HTMLElement;
|
||||||
api: ApiService;
|
api: ApiService;
|
||||||
application: ApplicationStart;
|
application: ApplicationStart;
|
||||||
notifications: NotificationsStart;
|
notifications: NotificationsStart;
|
||||||
}) {
|
}) {
|
||||||
|
const { rendering } = startServices;
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<KibanaRenderContextProvider {...startServices}>
|
rendering.addContext(
|
||||||
<GuidePanel api={api} application={application} notifications={notifications} />
|
<GuidePanel api={api} application={application} notifications={notifications} />
|
||||||
</KibanaRenderContextProvider>,
|
),
|
||||||
targetDomElement
|
targetDomElement
|
||||||
);
|
);
|
||||||
return () => ReactDOM.unmountComponentAtNode(targetDomElement);
|
return () => ReactDOM.unmountComponentAtNode(targetDomElement);
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
"@kbn/core-http-browser-mocks",
|
"@kbn/core-http-browser-mocks",
|
||||||
"@kbn/config-schema",
|
"@kbn/config-schema",
|
||||||
"@kbn/features-plugin",
|
"@kbn/features-plugin",
|
||||||
"@kbn/react-kibana-context-render",
|
|
||||||
"@kbn/react-kibana-context-theme",
|
"@kbn/react-kibana-context-theme",
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
|
|
@ -11,7 +11,6 @@ import React from 'react';
|
||||||
import { render, unmountComponentAtNode } from 'react-dom';
|
import { render, unmountComponentAtNode } from 'react-dom';
|
||||||
import { ScopedHistory, CoreStart } from '@kbn/core/public';
|
import { ScopedHistory, CoreStart } from '@kbn/core/public';
|
||||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app';
|
import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app';
|
||||||
import { SampleDataTabKibanaProvider } from '@kbn/home-sample-data-tab';
|
import { SampleDataTabKibanaProvider } from '@kbn/home-sample-data-tab';
|
||||||
import { HomeApp } from './components/home_app';
|
import { HomeApp } from './components/home_app';
|
||||||
|
@ -38,7 +37,7 @@ export const renderApp = async (
|
||||||
);
|
);
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<KibanaRenderContextProvider {...coreStart}>
|
coreStart.rendering.addContext(
|
||||||
<RedirectAppLinks
|
<RedirectAppLinks
|
||||||
coreStart={{
|
coreStart={{
|
||||||
application: coreStart.application,
|
application: coreStart.application,
|
||||||
|
@ -50,7 +49,7 @@ export const renderApp = async (
|
||||||
</SampleDataTabKibanaProvider>
|
</SampleDataTabKibanaProvider>
|
||||||
</KibanaContextProvider>
|
</KibanaContextProvider>
|
||||||
</RedirectAppLinks>
|
</RedirectAppLinks>
|
||||||
</KibanaRenderContextProvider>,
|
),
|
||||||
element
|
element
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
"@kbn/shared-ux-router",
|
"@kbn/shared-ux-router",
|
||||||
"@kbn/core-http-common",
|
"@kbn/core-http-common",
|
||||||
"@kbn/shared-ux-link-redirect-app",
|
"@kbn/shared-ux-link-redirect-app",
|
||||||
"@kbn/react-kibana-context-render",
|
|
||||||
"@kbn/core-http-browser",
|
"@kbn/core-http-browser",
|
||||||
"@kbn/deeplinks-observability",
|
"@kbn/deeplinks-observability",
|
||||||
"@kbn/react-kibana-context-theme",
|
"@kbn/react-kibana-context-theme",
|
||||||
|
|
|
@ -14,7 +14,4 @@ export function setStartServices(core: CoreStart) {
|
||||||
coreStart = core;
|
coreStart = core;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getAnalytics = () => coreStart.analytics;
|
export const getRendering = () => coreStart.rendering;
|
||||||
export const getI18n = () => coreStart.i18n;
|
|
||||||
export const getTheme = () => coreStart.theme;
|
|
||||||
export const getUserProfile = () => coreStart.userProfile;
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
import React, { FC, PropsWithChildren } from 'react';
|
import React, { FC, PropsWithChildren } from 'react';
|
||||||
|
|
||||||
import { toMountPoint } from '@kbn/react-kibana-mount';
|
import { toMountPoint } from '@kbn/react-kibana-mount';
|
||||||
import { getAnalytics, getI18n, getTheme, getUserProfile } from '../kibana_services';
|
import { getRendering } from '../kibana_services';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the result of trying to persist the saved object.
|
* Represents the result of trying to persist the saved object.
|
||||||
|
@ -68,7 +68,7 @@ export function showSaveModal(
|
||||||
children: augmentedElement,
|
children: augmentedElement,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
{ analytics: getAnalytics(), theme: getTheme(), i18n: getI18n(), userProfile: getUserProfile() }
|
getRendering()
|
||||||
);
|
);
|
||||||
|
|
||||||
unmount = mount(document.createElement('div'));
|
unmount = mount(document.createElement('div'));
|
||||||
|
|
|
@ -11,22 +11,19 @@ import React from 'react';
|
||||||
import { EuiFlexGroup, EuiFlexItem, EuiBadge, EuiFlyoutBody } from '@elastic/eui';
|
import { EuiFlexGroup, EuiFlexItem, EuiBadge, EuiFlyoutBody } from '@elastic/eui';
|
||||||
import { CoreStart } from '@kbn/core/public';
|
import { CoreStart } from '@kbn/core/public';
|
||||||
import { toMountPoint } from '@kbn/react-kibana-mount';
|
import { toMountPoint } from '@kbn/react-kibana-mount';
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
import { ActionDefinition } from '../../actions';
|
import { ActionDefinition } from '../../actions';
|
||||||
|
|
||||||
type StartServices = Pick<CoreStart, 'analytics' | 'i18n' | 'theme' | 'userProfile'>;
|
type StartServices = Pick<CoreStart, 'overlays' | 'rendering'>;
|
||||||
|
|
||||||
const getMenuItem = (core: StartServices) => {
|
const getMenuItem = (core: StartServices) => {
|
||||||
return () => {
|
return () => {
|
||||||
return (
|
return core.rendering.addContext(
|
||||||
<KibanaRenderContextProvider {...core}>
|
<EuiFlexGroup alignItems="center">
|
||||||
<EuiFlexGroup alignItems="center">
|
<EuiFlexItem>Hello world!</EuiFlexItem>
|
||||||
<EuiFlexItem>Hello world!</EuiFlexItem>
|
<EuiFlexItem grow={false}>
|
||||||
<EuiFlexItem grow={false}>
|
<EuiBadge color={'danger'}>{'secret'}</EuiBadge>
|
||||||
<EuiBadge color={'danger'}>{'secret'}</EuiBadge>
|
</EuiFlexItem>
|
||||||
</EuiFlexItem>
|
</EuiFlexGroup>
|
||||||
</EuiFlexGroup>
|
|
||||||
</KibanaRenderContextProvider>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -36,17 +33,17 @@ export const ACTION_HELLO_WORLD = 'ACTION_HELLO_WORLD';
|
||||||
export function createHelloWorldAction(
|
export function createHelloWorldAction(
|
||||||
coreStart: StartServices & Pick<CoreStart, 'overlays'>
|
coreStart: StartServices & Pick<CoreStart, 'overlays'>
|
||||||
): ActionDefinition {
|
): ActionDefinition {
|
||||||
const { overlays, ...startServices } = coreStart;
|
const { overlays, rendering } = coreStart;
|
||||||
return {
|
return {
|
||||||
id: ACTION_HELLO_WORLD,
|
id: ACTION_HELLO_WORLD,
|
||||||
type: ACTION_HELLO_WORLD,
|
type: ACTION_HELLO_WORLD,
|
||||||
getIconType: () => 'lock',
|
getIconType: () => 'lock',
|
||||||
MenuItem: getMenuItem(startServices),
|
MenuItem: getMenuItem(coreStart),
|
||||||
execute: async () => {
|
execute: async () => {
|
||||||
overlays.openFlyout(
|
overlays.openFlyout(
|
||||||
toMountPoint(
|
toMountPoint(
|
||||||
<EuiFlyoutBody>Hello World, I am a hello world action!</EuiFlyoutBody>,
|
<EuiFlyoutBody>Hello World, I am a hello world action!</EuiFlyoutBody>,
|
||||||
startServices
|
rendering
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
'data-test-subj': 'helloWorldAction',
|
'data-test-subj': 'helloWorldAction',
|
||||||
|
|
|
@ -31,7 +31,7 @@ export function createSamplePanelAction(getStartServices: CoreSetup['getStartSer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const coreStart = (await getStartServices())[0];
|
const coreStart = (await getStartServices())[0];
|
||||||
const { overlays, ...startServices } = coreStart;
|
const { overlays, rendering } = coreStart;
|
||||||
const openFlyout = overlays.openFlyout;
|
const openFlyout = overlays.openFlyout;
|
||||||
openFlyout(
|
openFlyout(
|
||||||
toMountPoint(
|
toMountPoint(
|
||||||
|
@ -45,7 +45,7 @@ export function createSamplePanelAction(getStartServices: CoreSetup['getStartSer
|
||||||
<h3 data-test-subj="samplePanelActionBody">This is a sample action</h3>
|
<h3 data-test-subj="samplePanelActionBody">This is a sample action</h3>
|
||||||
</EuiFlyoutBody>
|
</EuiFlyoutBody>
|
||||||
</React.Fragment>,
|
</React.Fragment>,
|
||||||
startServices
|
rendering
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
'data-test-subj': 'samplePanelActionFlyout',
|
'data-test-subj': 'samplePanelActionFlyout',
|
||||||
|
|
|
@ -8,18 +8,15 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { EuiPage } from '@elastic/eui';
|
import { EuiPage } from '@elastic/eui';
|
||||||
import { CoreStart } from '@kbn/core/public';
|
import { CoreStart } from '@kbn/core/public';
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
import { Page } from '../../components/page';
|
import { Page } from '../../components/page';
|
||||||
import { DrilldownsManager } from '../drilldowns_manager';
|
import { DrilldownsManager } from '../drilldowns_manager';
|
||||||
|
|
||||||
export const App = ({ core }: { core: CoreStart }) => {
|
export const App = ({ core }: { core: CoreStart }) => {
|
||||||
return (
|
return core.rendering.addContext(
|
||||||
<KibanaRenderContextProvider i18n={core.i18n} theme={core.theme}>
|
<EuiPage>
|
||||||
<EuiPage>
|
<Page title={'UI Actions Enhanced'}>
|
||||||
<Page title={'UI Actions Enhanced'}>
|
<DrilldownsManager />
|
||||||
<DrilldownsManager />
|
</Page>
|
||||||
</Page>
|
</EuiPage>
|
||||||
</EuiPage>
|
|
||||||
</KibanaRenderContextProvider>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -96,7 +96,7 @@ export class UiActionsEnhancedExamplesPlugin
|
||||||
triggers: [SAMPLE_APP2_CLICK_TRIGGER],
|
triggers: [SAMPLE_APP2_CLICK_TRIGGER],
|
||||||
placeContext: {},
|
placeContext: {},
|
||||||
}),
|
}),
|
||||||
coreStart
|
coreStart.rendering
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
ownFocus: true,
|
ownFocus: true,
|
||||||
|
@ -122,7 +122,7 @@ export class UiActionsEnhancedExamplesPlugin
|
||||||
triggers: [SAMPLE_APP2_CLICK_TRIGGER],
|
triggers: [SAMPLE_APP2_CLICK_TRIGGER],
|
||||||
placeContext: { sampleApp2ClickContext },
|
placeContext: { sampleApp2ClickContext },
|
||||||
}),
|
}),
|
||||||
coreStart
|
coreStart.rendering
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
ownFocus: true,
|
ownFocus: true,
|
||||||
|
|
|
@ -29,6 +29,5 @@
|
||||||
"@kbn/utility-types",
|
"@kbn/utility-types",
|
||||||
"@kbn/presentation-publishing",
|
"@kbn/presentation-publishing",
|
||||||
"@kbn/react-kibana-mount",
|
"@kbn/react-kibana-mount",
|
||||||
"@kbn/react-kibana-context-render",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,16 +19,13 @@ export class BannersPlugin implements Plugin<{}, {}, {}, BannerPluginStartDepend
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
start(
|
start({ chrome, http, rendering }: CoreStart, { screenshotMode }: BannerPluginStartDependencies) {
|
||||||
{ chrome, http, ...startServices }: CoreStart,
|
|
||||||
{ screenshotMode }: BannerPluginStartDependencies
|
|
||||||
) {
|
|
||||||
if (!(screenshotMode?.isScreenshotMode() ?? false)) {
|
if (!(screenshotMode?.isScreenshotMode() ?? false)) {
|
||||||
getBannerInfo(http).then(
|
getBannerInfo(http).then(
|
||||||
({ allowed, banner }) => {
|
({ allowed, banner }) => {
|
||||||
if (allowed && banner.placement === 'top') {
|
if (allowed && banner.placement === 'top') {
|
||||||
chrome.setHeaderBanner({
|
chrome.setHeaderBanner({
|
||||||
content: toMountPoint(<Banner bannerConfig={banner} />, startServices),
|
content: toMountPoint(<Banner bannerConfig={banner} />, rendering),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,7 +13,6 @@ import {
|
||||||
PluginInitializerContext,
|
PluginInitializerContext,
|
||||||
} from '@kbn/core/public';
|
} from '@kbn/core/public';
|
||||||
import { GlobalSearchPluginStart } from '@kbn/global-search-plugin/public';
|
import { GlobalSearchPluginStart } from '@kbn/global-search-plugin/public';
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
import { SavedObjectTaggingPluginStart } from '@kbn/saved-objects-tagging-plugin/public';
|
import { SavedObjectTaggingPluginStart } from '@kbn/saved-objects-tagging-plugin/public';
|
||||||
import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
|
import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
@ -57,7 +56,7 @@ export class GlobalSearchBarPlugin implements Plugin<{}, {}, {}, GlobalSearchBar
|
||||||
order: 1000,
|
order: 1000,
|
||||||
mount: (container) => {
|
mount: (container) => {
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<KibanaRenderContextProvider {...core}>
|
core.rendering.addContext(
|
||||||
<SearchBar
|
<SearchBar
|
||||||
globalSearch={{ ...globalSearch, searchCharLimit: this.config.input_max_limit }}
|
globalSearch={{ ...globalSearch, searchCharLimit: this.config.input_max_limit }}
|
||||||
navigateToUrl={application.navigateToUrl}
|
navigateToUrl={application.navigateToUrl}
|
||||||
|
@ -66,7 +65,7 @@ export class GlobalSearchBarPlugin implements Plugin<{}, {}, {}, GlobalSearchBar
|
||||||
chromeStyle$={core.chrome.getChromeStyle$()}
|
chromeStyle$={core.chrome.getChromeStyle$()}
|
||||||
reportEvent={reportEvent}
|
reportEvent={reportEvent}
|
||||||
/>
|
/>
|
||||||
</KibanaRenderContextProvider>,
|
),
|
||||||
container
|
container
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
"@kbn/i18n",
|
"@kbn/i18n",
|
||||||
"@kbn/saved-objects-tagging-oss-plugin",
|
"@kbn/saved-objects-tagging-oss-plugin",
|
||||||
"@kbn/core-chrome-browser",
|
"@kbn/core-chrome-browser",
|
||||||
"@kbn/react-kibana-context-render",
|
|
||||||
"@kbn/config-schema",
|
"@kbn/config-schema",
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
|
|
@ -41,10 +41,10 @@ export const getAssignFlyoutOpener =
|
||||||
({
|
({
|
||||||
overlays,
|
overlays,
|
||||||
notifications,
|
notifications,
|
||||||
|
rendering,
|
||||||
tagCache,
|
tagCache,
|
||||||
assignmentService,
|
assignmentService,
|
||||||
assignableTypes,
|
assignableTypes,
|
||||||
...startServices
|
|
||||||
}: GetAssignFlyoutOpenerOptions): AssignFlyoutOpener =>
|
}: GetAssignFlyoutOpenerOptions): AssignFlyoutOpener =>
|
||||||
async ({ tagIds }) => {
|
async ({ tagIds }) => {
|
||||||
const flyout = overlays.openFlyout(
|
const flyout = overlays.openFlyout(
|
||||||
|
@ -59,7 +59,7 @@ export const getAssignFlyoutOpener =
|
||||||
onClose={() => flyout.close()}
|
onClose={() => flyout.close()}
|
||||||
/>
|
/>
|
||||||
</React.Suspense>,
|
</React.Suspense>,
|
||||||
startServices
|
rendering
|
||||||
),
|
),
|
||||||
{ size: 'm', maxWidth: 600 }
|
{ size: 'm', maxWidth: 600 }
|
||||||
);
|
);
|
||||||
|
|
|
@ -39,12 +39,7 @@ const LazyEditTagModal = React.lazy(() =>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getCreateModalOpener =
|
export const getCreateModalOpener =
|
||||||
({
|
({ overlays, tagClient, notifications, rendering }: GetModalOpenerOptions): CreateModalOpener =>
|
||||||
overlays,
|
|
||||||
tagClient,
|
|
||||||
notifications,
|
|
||||||
...startServices
|
|
||||||
}: GetModalOpenerOptions): CreateModalOpener =>
|
|
||||||
async ({ onCreate, defaultValues }: OpenCreateModalOptions) => {
|
async ({ onCreate, defaultValues }: OpenCreateModalOptions) => {
|
||||||
const modal = overlays.openModal(
|
const modal = overlays.openModal(
|
||||||
toMountPoint(
|
toMountPoint(
|
||||||
|
@ -62,7 +57,7 @@ export const getCreateModalOpener =
|
||||||
notifications={notifications}
|
notifications={notifications}
|
||||||
/>
|
/>
|
||||||
</React.Suspense>,
|
</React.Suspense>,
|
||||||
startServices
|
rendering
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return modal;
|
return modal;
|
||||||
|
@ -74,7 +69,7 @@ interface OpenEditModalOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getEditModalOpener =
|
export const getEditModalOpener =
|
||||||
({ overlays, tagClient, notifications, ...startServices }: GetModalOpenerOptions) =>
|
({ overlays, tagClient, notifications, rendering }: GetModalOpenerOptions) =>
|
||||||
async ({ tagId, onUpdate }: OpenEditModalOptions) => {
|
async ({ tagId, onUpdate }: OpenEditModalOptions) => {
|
||||||
const tag = await tagClient.get(tagId);
|
const tag = await tagClient.get(tagId);
|
||||||
|
|
||||||
|
@ -94,7 +89,7 @@ export const getEditModalOpener =
|
||||||
notifications={notifications}
|
notifications={notifications}
|
||||||
/>
|
/>
|
||||||
</React.Suspense>,
|
</React.Suspense>,
|
||||||
startServices
|
rendering
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
import React, { FC, PropsWithChildren } from 'react';
|
import React, { FC, PropsWithChildren } from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { CoreSetup, ApplicationStart } from '@kbn/core/public';
|
import { CoreSetup, ApplicationStart } from '@kbn/core/public';
|
||||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
|
||||||
import { ManagementAppMountParams } from '@kbn/management-plugin/public';
|
import { ManagementAppMountParams } from '@kbn/management-plugin/public';
|
||||||
import { getTagsCapabilities } from '../../common';
|
import { getTagsCapabilities } from '../../common';
|
||||||
import { SavedObjectTaggingPluginStart } from '../types';
|
import { SavedObjectTaggingPluginStart } from '../types';
|
||||||
|
@ -52,7 +51,7 @@ export const mountSection = async ({
|
||||||
coreStart.chrome.docTitle.change(title);
|
coreStart.chrome.docTitle.change(title);
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<KibanaRenderContextProvider {...coreStart}>
|
coreStart.rendering.addContext(
|
||||||
<RedirectToHomeIfUnauthorized applications={coreStart.application}>
|
<RedirectToHomeIfUnauthorized applications={coreStart.application}>
|
||||||
<TagManagementPage
|
<TagManagementPage
|
||||||
setBreadcrumbs={setBreadcrumbs}
|
setBreadcrumbs={setBreadcrumbs}
|
||||||
|
@ -64,7 +63,7 @@ export const mountSection = async ({
|
||||||
assignableTypes={assignableTypes}
|
assignableTypes={assignableTypes}
|
||||||
/>
|
/>
|
||||||
</RedirectToHomeIfUnauthorized>
|
</RedirectToHomeIfUnauthorized>
|
||||||
</KibanaRenderContextProvider>,
|
),
|
||||||
element
|
element
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,6 @@ export class SavedObjectTaggingPlugin
|
||||||
cache: this.tagCache,
|
cache: this.tagCache,
|
||||||
ui: getUiApi({
|
ui: getUiApi({
|
||||||
...startServices,
|
...startServices,
|
||||||
analytics,
|
|
||||||
cache: this.tagCache,
|
cache: this.tagCache,
|
||||||
client: this.tagClient,
|
client: this.tagClient,
|
||||||
capabilities: getTagsCapabilities(application.capabilities),
|
capabilities: getTagsCapabilities(application.capabilities),
|
||||||
|
|
|
@ -10,7 +10,4 @@ import type { SavedObjectsTaggingApi } from '@kbn/saved-objects-tagging-oss-plug
|
||||||
|
|
||||||
export type SavedObjectTaggingPluginStart = SavedObjectsTaggingApi;
|
export type SavedObjectTaggingPluginStart = SavedObjectsTaggingApi;
|
||||||
|
|
||||||
export type StartServices = Pick<
|
export type StartServices = Pick<CoreStart, 'overlays' | 'notifications' | 'rendering'>;
|
||||||
CoreStart,
|
|
||||||
'overlays' | 'notifications' | 'analytics' | 'i18n' | 'theme' | 'userProfile'
|
|
||||||
>;
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
"@kbn/config-schema",
|
"@kbn/config-schema",
|
||||||
"@kbn/ebt-tools",
|
"@kbn/ebt-tools",
|
||||||
"@kbn/core-notifications-browser",
|
"@kbn/core-notifications-browser",
|
||||||
"@kbn/react-kibana-context-render",
|
|
||||||
"@kbn/react-kibana-mount",
|
"@kbn/react-kibana-mount",
|
||||||
"@kbn/core-lifecycle-browser"
|
"@kbn/core-lifecycle-browser"
|
||||||
],
|
],
|
||||||
|
|
|
@ -45,12 +45,14 @@ export class ServerlessPlugin
|
||||||
core: CoreStart,
|
core: CoreStart,
|
||||||
dependencies: ServerlessPluginStartDependencies
|
dependencies: ServerlessPluginStartDependencies
|
||||||
): ServerlessPluginStart {
|
): ServerlessPluginStart {
|
||||||
core.chrome.setChromeStyle('project');
|
const { chrome, rendering } = core;
|
||||||
|
|
||||||
// Casting the "chrome.projects" service to an "internal" type: this is intentional to obscure the property from Typescript.
|
// Casting the "chrome.project" service to an "internal" type: this is intentional to obscure the property from Typescript.
|
||||||
const { project } = core.chrome as InternalChromeStart;
|
const { project } = chrome as InternalChromeStart;
|
||||||
const { cloud } = dependencies;
|
const { cloud } = dependencies;
|
||||||
|
|
||||||
|
chrome.setChromeStyle('project');
|
||||||
|
|
||||||
if (cloud.serverless.projectName) {
|
if (cloud.serverless.projectName) {
|
||||||
project.setProjectName(cloud.serverless.projectName);
|
project.setProjectName(cloud.serverless.projectName);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +61,7 @@ export class ServerlessPlugin
|
||||||
const activeNavigationNodes$ = project.getActiveNavigationNodes$();
|
const activeNavigationNodes$ = project.getActiveNavigationNodes$();
|
||||||
const navigationTreeUi$ = project.getNavigationTreeUi$();
|
const navigationTreeUi$ = project.getNavigationTreeUi$();
|
||||||
|
|
||||||
core.chrome.navControls.registerRight({
|
chrome.navControls.registerRight({
|
||||||
order: 1,
|
order: 1,
|
||||||
mount: toMountPoint(
|
mount: toMountPoint(
|
||||||
<EuiButton
|
<EuiButton
|
||||||
|
@ -74,7 +76,7 @@ export class ServerlessPlugin
|
||||||
defaultMessage: 'Give feedback',
|
defaultMessage: 'Give feedback',
|
||||||
})}
|
})}
|
||||||
</EuiButton>,
|
</EuiButton>,
|
||||||
core.rendering
|
rendering
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue