mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [Preparation for High Contrast Mode, Analytics Experience domains (#202608)](https://github.com/elastic/kibana/pull/202608) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Tim Sullivan","email":"tsullivan@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-12-12T19:16:07Z","message":"Preparation for High Contrast Mode, Analytics Experience domains (#202608)\n\n## Summary\r\n\r\n**Reviewers: Please test the code paths affected by this PR. See the\r\n\"Risks\" section below.**\r\n\r\nPart of work for enabling \"high contrast mode\" in Kibana. See\r\nhttps://github.com/elastic/kibana/issues/176219.\r\n\r\n**Background:**\r\nKibana will soon have a user profile setting to allow users to enable\r\n\"high contrast mode.\" This setting will activate a flag with\r\n`<EuiProvider>` that causes EUI components to render with higher\r\ncontrast visual elements. Consumer plugins and packages need to be\r\nupdated selected places where `<EuiProvider>` is wrapped, to pass the\r\n`UserProfileService` service dependency from the CoreStart contract.\r\n\r\n**NOTE:** **EUI currently does not yet support the high-contrast mode\r\nflag**, but support for that is expected to come in around 2 weeks.\r\nThese first PRs are simply preparing the code by wiring up the\r\n`UserProvideService`.\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [X] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [X] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n### Risks\r\n\r\nDoes this PR introduce any risks? For example, consider risks like hard\r\nto test bugs, performance regression, potential of data loss.\r\n\r\nDescribe the risk, its severity, and mitigation for each identified\r\nrisk. Invite stakeholders and evaluate how to proceed before merging.\r\n\r\n- [ ] [medium/high] The implementor of this change did not manually test\r\nthe affected code paths and relied on type-checking and functional tests\r\nto drive the changes. Code owners for this PR need to manually test the\r\naffected code paths.\r\n- [ ] [medium] The `UserProfileService` dependency comes from the\r\nCoreStart contract. If acquiring the service causes synchronous code to\r\nbecome asynchronous, check for race conditions or errors in rendering\r\nReact components. Code owners for this PR need to manually test the\r\naffected code paths.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"99aa884fa08beafd801588c0b38194ec03039008","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","Team:Visualizations","release_note:skip","v9.0.0","Team:DataDiscovery","backport:prev-minor","v8.18.0"],"title":"Preparation for High Contrast Mode, Analytics Experience domains","number":202608,"url":"https://github.com/elastic/kibana/pull/202608","mergeCommit":{"message":"Preparation for High Contrast Mode, Analytics Experience domains (#202608)\n\n## Summary\r\n\r\n**Reviewers: Please test the code paths affected by this PR. See the\r\n\"Risks\" section below.**\r\n\r\nPart of work for enabling \"high contrast mode\" in Kibana. See\r\nhttps://github.com/elastic/kibana/issues/176219.\r\n\r\n**Background:**\r\nKibana will soon have a user profile setting to allow users to enable\r\n\"high contrast mode.\" This setting will activate a flag with\r\n`<EuiProvider>` that causes EUI components to render with higher\r\ncontrast visual elements. Consumer plugins and packages need to be\r\nupdated selected places where `<EuiProvider>` is wrapped, to pass the\r\n`UserProfileService` service dependency from the CoreStart contract.\r\n\r\n**NOTE:** **EUI currently does not yet support the high-contrast mode\r\nflag**, but support for that is expected to come in around 2 weeks.\r\nThese first PRs are simply preparing the code by wiring up the\r\n`UserProvideService`.\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [X] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [X] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n### Risks\r\n\r\nDoes this PR introduce any risks? For example, consider risks like hard\r\nto test bugs, performance regression, potential of data loss.\r\n\r\nDescribe the risk, its severity, and mitigation for each identified\r\nrisk. Invite stakeholders and evaluate how to proceed before merging.\r\n\r\n- [ ] [medium/high] The implementor of this change did not manually test\r\nthe affected code paths and relied on type-checking and functional tests\r\nto drive the changes. Code owners for this PR need to manually test the\r\naffected code paths.\r\n- [ ] [medium] The `UserProfileService` dependency comes from the\r\nCoreStart contract. If acquiring the service causes synchronous code to\r\nbecome asynchronous, check for race conditions or errors in rendering\r\nReact components. Code owners for this PR need to manually test the\r\naffected code paths.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"99aa884fa08beafd801588c0b38194ec03039008"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202608","number":202608,"mergeCommit":{"message":"Preparation for High Contrast Mode, Analytics Experience domains (#202608)\n\n## Summary\r\n\r\n**Reviewers: Please test the code paths affected by this PR. See the\r\n\"Risks\" section below.**\r\n\r\nPart of work for enabling \"high contrast mode\" in Kibana. See\r\nhttps://github.com/elastic/kibana/issues/176219.\r\n\r\n**Background:**\r\nKibana will soon have a user profile setting to allow users to enable\r\n\"high contrast mode.\" This setting will activate a flag with\r\n`<EuiProvider>` that causes EUI components to render with higher\r\ncontrast visual elements. Consumer plugins and packages need to be\r\nupdated selected places where `<EuiProvider>` is wrapped, to pass the\r\n`UserProfileService` service dependency from the CoreStart contract.\r\n\r\n**NOTE:** **EUI currently does not yet support the high-contrast mode\r\nflag**, but support for that is expected to come in around 2 weeks.\r\nThese first PRs are simply preparing the code by wiring up the\r\n`UserProvideService`.\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [X] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [X] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n### Risks\r\n\r\nDoes this PR introduce any risks? For example, consider risks like hard\r\nto test bugs, performance regression, potential of data loss.\r\n\r\nDescribe the risk, its severity, and mitigation for each identified\r\nrisk. Invite stakeholders and evaluate how to proceed before merging.\r\n\r\n- [ ] [medium/high] The implementor of this change did not manually test\r\nthe affected code paths and relied on type-checking and functional tests\r\nto drive the changes. Code owners for this PR need to manually test the\r\naffected code paths.\r\n- [ ] [medium] The `UserProfileService` dependency comes from the\r\nCoreStart contract. If acquiring the service causes synchronous code to\r\nbecome asynchronous, check for race conditions or errors in rendering\r\nReact components. Code owners for this PR need to manually test the\r\naffected code paths.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"99aa884fa08beafd801588c0b38194ec03039008"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Tim Sullivan <tsullivan@users.noreply.github.com>
This commit is contained in:
parent
b9fce2f5fc
commit
6e12acb428
90 changed files with 221 additions and 267 deletions
|
@ -48,7 +48,7 @@ const App = ({
|
|||
}
|
||||
|
||||
return (
|
||||
<KibanaRenderContextProvider i18n={core.i18n} theme={core.theme}>
|
||||
<KibanaRenderContextProvider {...core}>
|
||||
<EuiPage>
|
||||
<EuiPageBody>
|
||||
<EuiPageSection>
|
||||
|
|
|
@ -315,10 +315,7 @@ export const ReactControlExample = ({
|
|||
<EuiCodeBlock language="json">
|
||||
{JSON.stringify(controlGroupApi?.serializeState(), null, 2)}
|
||||
</EuiCodeBlock>,
|
||||
{
|
||||
theme: core.theme,
|
||||
i18n: core.i18n,
|
||||
}
|
||||
core
|
||||
)
|
||||
);
|
||||
}}
|
||||
|
|
|
@ -52,11 +52,11 @@ export class DiscoverCustomizationExamplesPlugin implements Plugin {
|
|||
title: PLUGIN_NAME,
|
||||
visibleIn: [],
|
||||
mount: async (appMountParams) => {
|
||||
const [_, { discover, data }] = await core.getStartServices();
|
||||
const [coreStart, { discover, data }] = await core.getStartServices();
|
||||
|
||||
ReactDOM.render(
|
||||
<I18nProvider>
|
||||
<KibanaThemeProvider theme={core.theme}>
|
||||
<KibanaThemeProvider {...coreStart}>
|
||||
<Router history={appMountParams.history}>
|
||||
<Routes>
|
||||
<Route>
|
||||
|
|
|
@ -81,7 +81,7 @@ const App = ({
|
|||
}, [pages]);
|
||||
|
||||
return (
|
||||
<KibanaRenderContextProvider i18n={core.i18n} theme={core.theme}>
|
||||
<KibanaRenderContextProvider {...core}>
|
||||
<Router basename={mountParams.appBasePath}>
|
||||
<EuiPageTemplate restrictWidth={true} offset={0}>
|
||||
<EuiPageTemplate.Sidebar sticky={true}>
|
||||
|
|
|
@ -99,7 +99,7 @@ export const getDataTableFactory = (
|
|||
width: 100%;
|
||||
`}
|
||||
>
|
||||
<KibanaRenderContextProvider theme={core.theme} i18n={core.i18n}>
|
||||
<KibanaRenderContextProvider {...core}>
|
||||
<KibanaContextProvider services={allServices}>
|
||||
<CellActionsProvider
|
||||
getTriggerCompatibleActions={services.uiActions.getTriggerCompatibleActions}
|
||||
|
|
|
@ -69,10 +69,7 @@ export const openSavedBookEditor = (
|
|||
resolve({ addToLibrary });
|
||||
}}
|
||||
/>,
|
||||
{
|
||||
theme: core.theme,
|
||||
i18n: core.i18n,
|
||||
}
|
||||
core
|
||||
),
|
||||
{
|
||||
type: isCreate ? 'overlay' : 'push',
|
||||
|
|
|
@ -24,6 +24,7 @@ import {
|
|||
I18nStart,
|
||||
IUiSettingsClient,
|
||||
ThemeServiceStart,
|
||||
UserProfileService,
|
||||
} from '@kbn/core/public';
|
||||
import { ExpressionsStart } from '@kbn/expressions-plugin/public';
|
||||
import { Start as InspectorStart } from '@kbn/inspector-plugin/public';
|
||||
|
@ -41,6 +42,7 @@ interface Props {
|
|||
inspector: InspectorStart;
|
||||
actions: UiActionsStart;
|
||||
uiSettings: IUiSettingsClient;
|
||||
userProfile: UserProfileService;
|
||||
settings: SettingsStart;
|
||||
theme: ThemeServiceStart;
|
||||
i18n: I18nStart;
|
||||
|
@ -52,15 +54,13 @@ const ExpressionsExplorer = ({
|
|||
actions,
|
||||
uiSettings,
|
||||
settings,
|
||||
i18n,
|
||||
theme,
|
||||
...startServices
|
||||
}: Props) => {
|
||||
const { Provider: KibanaReactContextProvider } = createKibanaReactContext({
|
||||
uiSettings,
|
||||
settings,
|
||||
theme,
|
||||
theme: startServices.theme,
|
||||
});
|
||||
const startServices = { i18n, theme };
|
||||
return (
|
||||
<KibanaRenderContextProvider {...startServices}>
|
||||
<KibanaReactContextProvider>
|
||||
|
|
|
@ -58,6 +58,7 @@ export class ExpressionsExplorerPlugin implements Plugin<void, void, SetupDeps,
|
|||
inspector: depsStart.inspector,
|
||||
actions: depsStart.uiActions,
|
||||
uiSettings: core.uiSettings,
|
||||
userProfile: coreStart.userProfile,
|
||||
settings: core.settings,
|
||||
theme: coreStart.theme,
|
||||
i18n: coreStart.i18n,
|
||||
|
|
|
@ -98,10 +98,7 @@ export const getPanelId = async ({
|
|||
session.close();
|
||||
}}
|
||||
/>,
|
||||
{
|
||||
theme: coreStart.theme,
|
||||
i18n: coreStart.i18n,
|
||||
}
|
||||
coreStart
|
||||
)
|
||||
);
|
||||
});
|
||||
|
|
|
@ -56,7 +56,7 @@ const PortableDashboardsDemos = ({
|
|||
history: AppMountParameters['history'];
|
||||
}) => {
|
||||
return (
|
||||
<KibanaRenderContextProvider i18n={coreStart.i18n} theme={coreStart.theme}>
|
||||
<KibanaRenderContextProvider {...coreStart}>
|
||||
<Router history={history}>
|
||||
<Routes>
|
||||
<Route exact path="/">
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
|
||||
import type { AppMountParameters } from '@kbn/core/public';
|
||||
import type { AppMountParameters, CoreStart } from '@kbn/core/public';
|
||||
import { I18nProvider } from '@kbn/i18n-react';
|
||||
import React, { ReactNode, useState } from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
@ -98,10 +98,10 @@ const ResizableSection = ({
|
|||
);
|
||||
};
|
||||
|
||||
export const renderApp = ({ element, theme$ }: AppMountParameters) => {
|
||||
export const renderApp = (coreStart: CoreStart, { element }: AppMountParameters) => {
|
||||
ReactDOM.render(
|
||||
<I18nProvider>
|
||||
<KibanaThemeProvider theme={{ theme$ }}>
|
||||
<KibanaThemeProvider {...coreStart}>
|
||||
<div
|
||||
css={css`
|
||||
height: calc(100vh - var(--euiFixedHeadersOffset, 0));
|
||||
|
|
|
@ -25,10 +25,11 @@ export class ResizableLayoutExamplesPlugin implements Plugin {
|
|||
title: PLUGIN_NAME,
|
||||
visibleIn: [],
|
||||
mount: async (params: AppMountParameters) => {
|
||||
const [coreStart] = await core.getStartServices();
|
||||
// Load application bundle
|
||||
const { renderApp } = await import('./application');
|
||||
// Render the application
|
||||
return renderApp(params);
|
||||
return renderApp(coreStart, params);
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -43,7 +43,10 @@ import { PLUGIN_ID, PLUGIN_NAME, SERVER_SEARCH_ROUTE_PATH } from '../../common';
|
|||
import { IMyStrategyResponse } from '../../common/types';
|
||||
|
||||
interface SearchExamplesAppDeps
|
||||
extends Pick<CoreStart, 'notifications' | 'http' | 'analytics' | 'i18n' | 'theme'> {
|
||||
extends Pick<
|
||||
CoreStart,
|
||||
'notifications' | 'http' | 'analytics' | 'i18n' | 'theme' | 'userProfile'
|
||||
> {
|
||||
navigation: NavigationPublicPluginStart;
|
||||
data: DataPublicPluginStart;
|
||||
unifiedSearch: UnifiedSearchPublicPluginStart;
|
||||
|
@ -230,13 +233,8 @@ export const SearchExamplesApp = ({
|
|||
</EuiText>
|
||||
);
|
||||
notifications.toasts.addSuccess(
|
||||
{
|
||||
title: 'Query result',
|
||||
text: toMountPoint(message, startServices),
|
||||
},
|
||||
{
|
||||
toastLifeTimeMs: 300000,
|
||||
}
|
||||
{ title: 'Query result', text: toMountPoint(message, startServices) },
|
||||
{ toastLifeTimeMs: 300000 }
|
||||
);
|
||||
if (res.warning) {
|
||||
notifications.toasts.addWarning({
|
||||
|
|
|
@ -56,6 +56,7 @@ interface SearchSessionsExampleAppDeps {
|
|||
analytics: CoreStart['analytics'];
|
||||
i18n: CoreStart['i18n'];
|
||||
theme: CoreStart['theme'];
|
||||
userProfile: CoreStart['userProfile'];
|
||||
navigation: NavigationPublicPluginStart;
|
||||
data: DataPublicPluginStart;
|
||||
unifiedSearch: UnifiedSearchPublicPluginStart;
|
||||
|
@ -674,6 +675,7 @@ function doSearch(
|
|||
analytics: CoreStart['analytics'];
|
||||
i18n: CoreStart['i18n'];
|
||||
theme: CoreStart['theme'];
|
||||
userProfile: CoreStart['userProfile'];
|
||||
}
|
||||
): Promise<{ request: IEsSearchRequest; response: IEsSearchResponse; tookMs?: number }> {
|
||||
if (!dataView) return Promise.reject('Select a data view');
|
||||
|
|
|
@ -18,11 +18,11 @@ import { UnifiedFieldListExampleApp } from './example_app';
|
|||
export const renderApp = (
|
||||
core: CoreStart,
|
||||
deps: AppPluginStartDependencies,
|
||||
{ element, theme$ }: AppMountParameters
|
||||
{ element }: AppMountParameters
|
||||
) => {
|
||||
ReactDOM.render(
|
||||
<I18nProvider>
|
||||
<KibanaThemeProvider theme={{ theme$ }}>
|
||||
<KibanaThemeProvider {...core}>
|
||||
<UnifiedFieldListExampleApp
|
||||
services={{
|
||||
core,
|
||||
|
|
|
@ -14,6 +14,7 @@ import type {
|
|||
AnalyticsServiceStart,
|
||||
NotificationsStart,
|
||||
ThemeServiceStart,
|
||||
UserProfileService,
|
||||
} from '@kbn/core/public';
|
||||
import { toMountPoint } from '@kbn/react-kibana-mount';
|
||||
import type { I18nStart } from '@kbn/core-i18n-browser';
|
||||
|
@ -36,6 +37,7 @@ interface Services {
|
|||
inspector: InspectorStart;
|
||||
notifications: NotificationsStart;
|
||||
theme: ThemeServiceStart;
|
||||
userProfile: UserProfileService;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,7 +32,7 @@ export interface StartDeps {
|
|||
expression: ExpressionsServiceStart;
|
||||
}
|
||||
|
||||
export type StartServices = Pick<CoreStart, 'analytics' | 'i18n' | 'theme'>;
|
||||
export type StartServices = Pick<CoreStart, 'analytics' | 'i18n' | 'theme' | 'userProfile'>;
|
||||
|
||||
export type ExpressionXyPluginSetup = void;
|
||||
export type ExpressionXyPluginStart = void;
|
||||
|
|
|
@ -92,10 +92,7 @@ export const openEditControlGroupFlyout = (
|
|||
onDeleteAll={() => onDeleteAll(overlay)}
|
||||
onCancel={() => closeOverlay(overlay)}
|
||||
/>,
|
||||
{
|
||||
theme: coreServices.theme,
|
||||
i18n: coreServices.i18n,
|
||||
}
|
||||
coreServices
|
||||
),
|
||||
{
|
||||
'aria-label': i18n.translate('controls.controlGroup.manageControl', {
|
||||
|
|
|
@ -91,10 +91,7 @@ export const openDataControlEditor = <
|
|||
onSave({ type: selectedControlType, state });
|
||||
}}
|
||||
/>,
|
||||
{
|
||||
theme: coreServices.theme,
|
||||
i18n: coreServices.i18n,
|
||||
}
|
||||
coreServices
|
||||
),
|
||||
{
|
||||
size: 'm',
|
||||
|
|
|
@ -83,12 +83,11 @@ export class CopyToDashboardAction implements Action<EmbeddableApiContext> {
|
|||
public async execute({ embeddable }: EmbeddableApiContext) {
|
||||
if (!apiIsCompatible(embeddable)) throw new IncompatibleActionError();
|
||||
|
||||
const { theme, i18n } = coreServices;
|
||||
const session = coreServices.overlays.openModal(
|
||||
toMountPoint(<CopyToDashboardModal closeModal={() => session.close()} api={embeddable} />, {
|
||||
theme,
|
||||
i18n,
|
||||
}),
|
||||
toMountPoint(
|
||||
<CopyToDashboardModal closeModal={() => session.close()} api={embeddable} />,
|
||||
coreServices
|
||||
),
|
||||
{
|
||||
maxWidth: 400,
|
||||
'data-test-subj': 'copyToDashboardPanel',
|
||||
|
|
|
@ -49,7 +49,7 @@ export const DashboardNoMatch = ({ history }: { history: RouteComponentProps['hi
|
|||
/>
|
||||
</p>
|
||||
</EuiCallOut>,
|
||||
{ analytics: coreServices.analytics, i18n: coreServices.i18n, theme: coreServices.theme }
|
||||
coreServices
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ export const EditorMenu = ({ createNewVisType, isDisabled }: EditorMenuProps) =>
|
|||
/>
|
||||
);
|
||||
}),
|
||||
{ analytics: coreServices.analytics, theme: coreServices.theme, i18n: coreServices.i18n }
|
||||
coreServices
|
||||
);
|
||||
|
||||
dashboardApi.openOverlay(
|
||||
|
|
|
@ -27,7 +27,7 @@ export function openSettingsFlyout(dashboardApi: DashboardApi) {
|
|||
}}
|
||||
/>
|
||||
</DashboardContext.Provider>,
|
||||
{ analytics: coreServices.analytics, i18n: coreServices.i18n, theme: coreServices.theme }
|
||||
coreServices
|
||||
),
|
||||
{
|
||||
size: 's',
|
||||
|
|
|
@ -112,7 +112,7 @@ export const confirmCreateWithUnsaved = (
|
|||
</div>
|
||||
</EuiOutsideClickDetector>
|
||||
</EuiFocusTrap>,
|
||||
{ analytics: coreServices.analytics, i18n: coreServices.i18n, theme: coreServices.theme }
|
||||
coreServices
|
||||
),
|
||||
{
|
||||
'data-test-subj': 'dashboardCreateConfirmModal',
|
||||
|
|
|
@ -47,6 +47,7 @@ import type {
|
|||
IUiSettingsClient,
|
||||
ThemeServiceStart,
|
||||
ToastsSetup,
|
||||
UserProfileService,
|
||||
} from '@kbn/core/public';
|
||||
|
||||
import { BatchedFunc, BfetchPublicSetup, DISABLE_BFETCH } from '@kbn/bfetch-plugin/public';
|
||||
|
@ -127,6 +128,7 @@ export class SearchInterceptor {
|
|||
analytics: Pick<AnalyticsServiceStart, 'reportEvent'>;
|
||||
i18n: I18nStart;
|
||||
theme: Pick<ThemeServiceStart, 'theme$'>;
|
||||
userProfile: UserProfileService;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -136,10 +138,10 @@ export class SearchInterceptor {
|
|||
this.deps.http.addLoadingCountSource(this.pendingCount$);
|
||||
|
||||
this.deps.startServices.then(([coreStart, depsStart]) => {
|
||||
const { application, docLinks, analytics, i18n: i18nStart, theme } = coreStart;
|
||||
const { application, docLinks, ...startRenderServices } = coreStart;
|
||||
this.application = application;
|
||||
this.docLinks = docLinks;
|
||||
this.startRenderServices = { analytics, i18n: i18nStart, theme };
|
||||
this.startRenderServices = startRenderServices;
|
||||
this.inspector = (depsStart as SearchServiceStartDependencies).inspector;
|
||||
});
|
||||
|
||||
|
|
|
@ -226,16 +226,7 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> {
|
|||
}
|
||||
|
||||
public start(
|
||||
{
|
||||
analytics,
|
||||
http,
|
||||
theme,
|
||||
uiSettings,
|
||||
chrome,
|
||||
application,
|
||||
notifications,
|
||||
i18n: i18nStart,
|
||||
}: CoreStart,
|
||||
{ http, uiSettings, chrome, application, notifications, ...startServices }: CoreStart,
|
||||
{
|
||||
fieldFormats,
|
||||
indexPatterns,
|
||||
|
@ -254,11 +245,9 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> {
|
|||
const aggs = this.aggsService.start({ fieldFormats, indexPatterns });
|
||||
|
||||
const warningsServices = {
|
||||
analytics,
|
||||
i18n: i18nStart,
|
||||
inspector,
|
||||
notifications,
|
||||
theme,
|
||||
...startServices,
|
||||
};
|
||||
|
||||
const searchSourceDependencies: SearchSourceDependencies = {
|
||||
|
@ -314,7 +303,7 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> {
|
|||
tourDisabled: screenshotMode.isScreenshotMode(),
|
||||
})
|
||||
),
|
||||
{ analytics, i18n: i18nStart, theme }
|
||||
startServices
|
||||
),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import { SearchSessionsMgmtMain } from '../components/main';
|
|||
|
||||
export const renderApp = (
|
||||
elem: HTMLElement | null,
|
||||
{ i18n, uiSettings, ...homeDeps }: AppDependencies
|
||||
{ uiSettings, ...homeDeps }: AppDependencies
|
||||
) => {
|
||||
if (!elem) {
|
||||
return () => undefined;
|
||||
|
@ -28,7 +28,7 @@ export const renderApp = (
|
|||
});
|
||||
|
||||
render(
|
||||
<KibanaRenderContextProvider theme={homeDeps.core.theme} i18n={i18n}>
|
||||
<KibanaRenderContextProvider {...homeDeps.core}>
|
||||
<KibanaReactContextProvider>
|
||||
<SearchSessionsMgmtMain {...homeDeps} timezone={uiSettings.get('dateFormat:tz')} />
|
||||
</KibanaReactContextProvider>
|
||||
|
|
|
@ -33,7 +33,7 @@ import { SharePluginStart } from '@kbn/share-plugin/public';
|
|||
import type { IndexPatternManagementStart } from '.';
|
||||
import type { DataViewMgmtService } from './management_app/data_view_management_service';
|
||||
|
||||
export type StartServices = Pick<CoreStart, 'analytics' | 'i18n' | 'theme'>;
|
||||
export type StartServices = Pick<CoreStart, 'analytics' | 'i18n' | 'theme' | 'userProfile'>;
|
||||
|
||||
export interface IndexPatternManagmentContext extends StartServices {
|
||||
dataViewMgmtService: DataViewMgmtService;
|
||||
|
|
|
@ -206,7 +206,7 @@ export function DiscoverMainRoute({
|
|||
onBeforeRedirect() {
|
||||
services.urlTracker.setTrackedUrl('/');
|
||||
},
|
||||
theme: core.theme,
|
||||
...core,
|
||||
})(e);
|
||||
} else {
|
||||
setError(e);
|
||||
|
@ -222,8 +222,7 @@ export function DiscoverMainRoute({
|
|||
services,
|
||||
chrome.recentlyAccessed,
|
||||
history,
|
||||
core.application.navigateToApp,
|
||||
core.theme,
|
||||
core,
|
||||
basePath,
|
||||
toastNotifications,
|
||||
]
|
||||
|
|
|
@ -23,6 +23,8 @@ import type {
|
|||
AnalyticsServiceStart,
|
||||
AppMountParameters,
|
||||
ScopedHistory,
|
||||
ThemeServiceStart,
|
||||
UserProfileService,
|
||||
} from '@kbn/core/public';
|
||||
import type {
|
||||
FilterManager,
|
||||
|
@ -96,7 +98,8 @@ export interface DiscoverServices {
|
|||
history: History<HistoryLocationState>;
|
||||
getScopedHistory: <T>() => ScopedHistory<T | undefined> | undefined;
|
||||
setHeaderActionMenu: AppMountParameters['setHeaderActionMenu'];
|
||||
theme: CoreStart['theme'];
|
||||
theme: ThemeServiceStart;
|
||||
userProfile: UserProfileService;
|
||||
filterManager: FilterManager;
|
||||
fieldFormats: FieldFormatsStart;
|
||||
dataViews: DataViewsContract;
|
||||
|
@ -185,6 +188,7 @@ export const buildServices = memoize(
|
|||
embeddable: plugins.embeddable,
|
||||
i18n: core.i18n,
|
||||
theme: core.theme,
|
||||
userProfile: core.userProfile,
|
||||
fieldFormats: plugins.fieldFormats,
|
||||
filterManager: plugins.data.query.filterManager,
|
||||
history,
|
||||
|
|
|
@ -19,7 +19,5 @@ storiesOf('renderers/error', module).add('default', () => {
|
|||
error: thrownError,
|
||||
};
|
||||
|
||||
return (
|
||||
<Render renderer={getErrorRenderer(coreMock.createStart().theme.theme$)} config={config} />
|
||||
);
|
||||
return <Render renderer={getErrorRenderer(coreMock.createStart())} config={config} />;
|
||||
});
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
|
||||
import React from 'react';
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CoreSetup, CoreTheme } from '@kbn/core/public';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import { ExpressionRenderDefinition } from '@kbn/expressions-plugin/common';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { withSuspense } from '@kbn/presentation-util-plugin/public';
|
||||
|
@ -36,25 +35,24 @@ const strings = {
|
|||
}),
|
||||
};
|
||||
|
||||
export const getDebugRenderer =
|
||||
(theme$: Observable<CoreTheme>) => (): ExpressionRenderDefinition<any> => ({
|
||||
name: 'debug',
|
||||
displayName: strings.getDisplayName(),
|
||||
help: strings.getHelpDescription(),
|
||||
reuseDomNode: true,
|
||||
render(domNode, config, handlers) {
|
||||
handlers.onDestroy(() => unmountComponentAtNode(domNode));
|
||||
render(
|
||||
<KibanaErrorBoundaryProvider analytics={undefined}>
|
||||
<KibanaErrorBoundary>
|
||||
<KibanaThemeProvider theme={{ theme$ }}>
|
||||
<Debug parentNode={domNode} payload={config} onLoaded={handlers.done} />
|
||||
</KibanaThemeProvider>
|
||||
</KibanaErrorBoundary>
|
||||
</KibanaErrorBoundaryProvider>,
|
||||
domNode
|
||||
);
|
||||
},
|
||||
});
|
||||
export const getDebugRenderer = (core: CoreStart) => (): ExpressionRenderDefinition<any> => ({
|
||||
name: 'debug',
|
||||
displayName: strings.getDisplayName(),
|
||||
help: strings.getHelpDescription(),
|
||||
reuseDomNode: true,
|
||||
render(domNode, config, handlers) {
|
||||
handlers.onDestroy(() => unmountComponentAtNode(domNode));
|
||||
render(
|
||||
<KibanaErrorBoundaryProvider analytics={undefined}>
|
||||
<KibanaErrorBoundary>
|
||||
<KibanaThemeProvider {...core}>
|
||||
<Debug parentNode={domNode} payload={config} onLoaded={handlers.done} />
|
||||
</KibanaThemeProvider>
|
||||
</KibanaErrorBoundary>
|
||||
</KibanaErrorBoundaryProvider>,
|
||||
domNode
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
export const debugRendererFactory = (core: CoreSetup) => getDebugRenderer(core.theme.theme$);
|
||||
export const debugRendererFactory = (core: CoreStart) => getDebugRenderer(core);
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
|
||||
import React from 'react';
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CoreSetup, CoreTheme } from '@kbn/core/public';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import { I18nProvider } from '@kbn/i18n-react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import {
|
||||
|
@ -38,7 +37,7 @@ const errorStrings = {
|
|||
const ErrorComponent = withSuspense(LazyErrorRenderComponent);
|
||||
|
||||
export const getErrorRenderer =
|
||||
(theme$: Observable<CoreTheme>) => (): ExpressionRenderDefinition<ErrorRendererConfig> => ({
|
||||
(core: CoreStart) => (): ExpressionRenderDefinition<ErrorRendererConfig> => ({
|
||||
name: 'error',
|
||||
displayName: errorStrings.getDisplayName(),
|
||||
help: errorStrings.getHelpDescription(),
|
||||
|
@ -55,7 +54,7 @@ export const getErrorRenderer =
|
|||
render(
|
||||
<KibanaErrorBoundaryProvider analytics={undefined}>
|
||||
<KibanaErrorBoundary>
|
||||
<KibanaThemeProvider theme={{ theme$ }}>
|
||||
<KibanaThemeProvider {...core}>
|
||||
<I18nProvider>
|
||||
<ErrorComponent onLoaded={handlers.done} {...config} parentNode={domNode} />
|
||||
</I18nProvider>
|
||||
|
@ -67,4 +66,4 @@ export const getErrorRenderer =
|
|||
},
|
||||
});
|
||||
|
||||
export const errorRendererFactory = (core: CoreSetup) => getErrorRenderer(core.theme.theme$);
|
||||
export const errorRendererFactory = (core: CoreStart) => getErrorRenderer(core);
|
||||
|
|
|
@ -26,8 +26,10 @@ export class ExpressionErrorPlugin
|
|||
implements Plugin<ExpressionErrorPluginSetup, ExpressionErrorPluginStart, SetupDeps, StartDeps>
|
||||
{
|
||||
public setup(core: CoreSetup, { expressions }: SetupDeps): ExpressionErrorPluginSetup {
|
||||
expressions.registerRenderer(errorRendererFactory(core));
|
||||
expressions.registerRenderer(debugRendererFactory(core));
|
||||
core.getStartServices().then(([start]) => {
|
||||
expressions.registerRenderer(errorRendererFactory(start));
|
||||
expressions.registerRenderer(debugRendererFactory(start));
|
||||
});
|
||||
}
|
||||
|
||||
public start(core: CoreStart): ExpressionErrorPluginStart {}
|
||||
|
|
|
@ -23,7 +23,7 @@ const Renderer = ({ elasticLogo }: { elasticLogo: string }) => {
|
|||
|
||||
return (
|
||||
<Render
|
||||
renderer={getImageRenderer(coreMock.createStart().theme.theme$)}
|
||||
renderer={getImageRenderer(coreMock.createStart())}
|
||||
config={config}
|
||||
width="500px"
|
||||
height="500px"
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
|
||||
import React from 'react';
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CoreSetup, CoreTheme } from '@kbn/core/public';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import {
|
||||
ExpressionRenderDefinition,
|
||||
IInterpreterRenderHandlers,
|
||||
|
@ -34,7 +33,7 @@ const strings = {
|
|||
};
|
||||
|
||||
export const getImageRenderer =
|
||||
(theme$: Observable<CoreTheme>) => (): ExpressionRenderDefinition<ImageRendererConfig> => ({
|
||||
(core: CoreStart) => (): ExpressionRenderDefinition<ImageRendererConfig> => ({
|
||||
name: 'image',
|
||||
displayName: strings.getDisplayName(),
|
||||
help: strings.getHelpDescription(),
|
||||
|
@ -62,7 +61,7 @@ export const getImageRenderer =
|
|||
render(
|
||||
<KibanaErrorBoundaryProvider analytics={undefined}>
|
||||
<KibanaErrorBoundary>
|
||||
<KibanaThemeProvider theme={{ theme$ }}>
|
||||
<KibanaThemeProvider {...core}>
|
||||
<div style={style} />
|
||||
</KibanaThemeProvider>
|
||||
</KibanaErrorBoundary>
|
||||
|
@ -73,4 +72,4 @@ export const getImageRenderer =
|
|||
},
|
||||
});
|
||||
|
||||
export const imageRendererFactory = (core: CoreSetup) => getImageRenderer(core.theme.theme$);
|
||||
export const imageRendererFactory = (core: CoreStart) => getImageRenderer(core);
|
||||
|
|
|
@ -27,8 +27,10 @@ export class ExpressionImagePlugin
|
|||
implements Plugin<ExpressionImagePluginSetup, ExpressionImagePluginStart, SetupDeps, StartDeps>
|
||||
{
|
||||
public setup(core: CoreSetup, { expressions }: SetupDeps): ExpressionImagePluginSetup {
|
||||
expressions.registerFunction(imageFunction);
|
||||
expressions.registerRenderer(imageRendererFactory(core));
|
||||
core.getStartServices().then(([start]) => {
|
||||
expressions.registerFunction(imageFunction);
|
||||
expressions.registerRenderer(imageRendererFactory(start));
|
||||
});
|
||||
}
|
||||
|
||||
public start(core: CoreStart): ExpressionImagePluginStart {}
|
||||
|
|
|
@ -38,7 +38,7 @@ const metricFontSpec: CSSProperties = {
|
|||
color: '#b83c6f',
|
||||
};
|
||||
|
||||
const theme$ = coreMock.createStart().theme.theme$;
|
||||
const core = coreMock.createStart();
|
||||
|
||||
storiesOf('renderers/Metric', module)
|
||||
.add('with null metric', () => {
|
||||
|
@ -49,7 +49,7 @@ storiesOf('renderers/Metric', module)
|
|||
label: '',
|
||||
metricFormat: '',
|
||||
};
|
||||
return <Render renderer={getMetricRenderer(theme$)} config={config} />;
|
||||
return <Render renderer={getMetricRenderer(core)} config={config} />;
|
||||
})
|
||||
.add('with number metric', () => {
|
||||
const config: MetricRendererConfig = {
|
||||
|
@ -59,7 +59,7 @@ storiesOf('renderers/Metric', module)
|
|||
label: '',
|
||||
metricFormat: '',
|
||||
};
|
||||
return <Render renderer={getMetricRenderer(theme$)} config={config} />;
|
||||
return <Render renderer={getMetricRenderer(core)} config={config} />;
|
||||
})
|
||||
.add('with string metric', () => {
|
||||
const config: MetricRendererConfig = {
|
||||
|
@ -69,7 +69,7 @@ storiesOf('renderers/Metric', module)
|
|||
label: '',
|
||||
metricFormat: '',
|
||||
};
|
||||
return <Render renderer={getMetricRenderer(theme$)} config={config} />;
|
||||
return <Render renderer={getMetricRenderer(core)} config={config} />;
|
||||
})
|
||||
.add('with label', () => {
|
||||
const config: MetricRendererConfig = {
|
||||
|
@ -79,7 +79,7 @@ storiesOf('renderers/Metric', module)
|
|||
label: 'Average price',
|
||||
metricFormat: '',
|
||||
};
|
||||
return <Render renderer={getMetricRenderer(theme$)} config={config} />;
|
||||
return <Render renderer={getMetricRenderer(core)} config={config} />;
|
||||
})
|
||||
.add('with number metric and a specified format', () => {
|
||||
const config: MetricRendererConfig = {
|
||||
|
@ -89,7 +89,7 @@ storiesOf('renderers/Metric', module)
|
|||
label: 'Average price',
|
||||
metricFormat: '0.00%',
|
||||
};
|
||||
return <Render renderer={getMetricRenderer(theme$)} config={config} />;
|
||||
return <Render renderer={getMetricRenderer(core)} config={config} />;
|
||||
})
|
||||
.add('with formatted string metric and a specified format', () => {
|
||||
const config: MetricRendererConfig = {
|
||||
|
@ -99,7 +99,7 @@ storiesOf('renderers/Metric', module)
|
|||
label: 'Total Revenue',
|
||||
metricFormat: '$0a',
|
||||
};
|
||||
return <Render renderer={getMetricRenderer(theme$)} config={config} />;
|
||||
return <Render renderer={getMetricRenderer(core)} config={config} />;
|
||||
})
|
||||
.add('with invalid metricFont', () => {
|
||||
const config: MetricRendererConfig = {
|
||||
|
@ -109,5 +109,5 @@ storiesOf('renderers/Metric', module)
|
|||
label: 'Total Revenue',
|
||||
metricFormat: '$0a',
|
||||
};
|
||||
return <Render renderer={getMetricRenderer(theme$)} config={config} />;
|
||||
return <Render renderer={getMetricRenderer(core)} config={config} />;
|
||||
});
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
|
||||
import React, { CSSProperties } from 'react';
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CoreSetup, CoreTheme } from '@kbn/core/public';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import {
|
||||
ExpressionRenderDefinition,
|
||||
IInterpreterRenderHandlers,
|
||||
|
@ -33,7 +32,7 @@ const strings = {
|
|||
};
|
||||
|
||||
export const getMetricRenderer =
|
||||
(theme$: Observable<CoreTheme>) => (): ExpressionRenderDefinition<MetricRendererConfig> => ({
|
||||
(core: CoreStart) => (): ExpressionRenderDefinition<MetricRendererConfig> => ({
|
||||
name: 'metric',
|
||||
displayName: strings.getDisplayName(),
|
||||
help: strings.getHelpDescription(),
|
||||
|
@ -51,7 +50,7 @@ export const getMetricRenderer =
|
|||
render(
|
||||
<KibanaErrorBoundaryProvider analytics={undefined}>
|
||||
<KibanaErrorBoundary>
|
||||
<KibanaThemeProvider theme={{ theme$ }}>
|
||||
<KibanaThemeProvider {...core}>
|
||||
<MetricComponent
|
||||
label={config.label}
|
||||
labelFont={config.labelFont ? (config.labelFont.spec as CSSProperties) : {}}
|
||||
|
@ -68,4 +67,4 @@ export const getMetricRenderer =
|
|||
},
|
||||
});
|
||||
|
||||
export const metricRendererFactory = (core: CoreSetup) => getMetricRenderer(core.theme.theme$);
|
||||
export const metricRendererFactory = (core: CoreStart) => getMetricRenderer(core);
|
||||
|
|
|
@ -27,8 +27,10 @@ export class ExpressionMetricPlugin
|
|||
implements Plugin<ExpressionMetricPluginSetup, ExpressionMetricPluginStart, SetupDeps, StartDeps>
|
||||
{
|
||||
public setup(core: CoreSetup, { expressions }: SetupDeps): ExpressionMetricPluginSetup {
|
||||
expressions.registerFunction(metricFunction);
|
||||
expressions.registerRenderer(metricRendererFactory(core));
|
||||
core.getStartServices().then(([start]) => {
|
||||
expressions.registerFunction(metricFunction);
|
||||
expressions.registerRenderer(metricRendererFactory(start));
|
||||
});
|
||||
}
|
||||
|
||||
public start(core: CoreStart): ExpressionMetricPluginStart {}
|
||||
|
|
|
@ -32,7 +32,7 @@ const Renderer = ({
|
|||
|
||||
return (
|
||||
<Render
|
||||
renderer={getRepeatImageRenderer(coreMock.createStart().theme.theme$)}
|
||||
renderer={getRepeatImageRenderer(coreMock.createStart())}
|
||||
config={config}
|
||||
width="400px"
|
||||
/>
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
|
||||
import React from 'react';
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CoreSetup, CoreTheme } from '@kbn/core/public';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import {
|
||||
ExpressionRenderDefinition,
|
||||
IInterpreterRenderHandlers,
|
||||
|
@ -35,7 +34,7 @@ const strings = {
|
|||
};
|
||||
|
||||
export const getRepeatImageRenderer =
|
||||
(theme$: Observable<CoreTheme>) => (): ExpressionRenderDefinition<RepeatImageRendererConfig> => ({
|
||||
(core: CoreStart) => (): ExpressionRenderDefinition<RepeatImageRendererConfig> => ({
|
||||
name: 'repeatImage',
|
||||
displayName: strings.getDisplayName(),
|
||||
help: strings.getHelpDescription(),
|
||||
|
@ -60,7 +59,7 @@ export const getRepeatImageRenderer =
|
|||
render(
|
||||
<KibanaErrorBoundaryProvider analytics={undefined}>
|
||||
<KibanaErrorBoundary>
|
||||
<KibanaThemeProvider theme={{ theme$ }}>
|
||||
<KibanaThemeProvider {...core}>
|
||||
<I18nProvider>
|
||||
<RepeatImageComponent onLoaded={handlers.done} {...settings} parentNode={domNode} />
|
||||
</I18nProvider>
|
||||
|
@ -72,5 +71,4 @@ export const getRepeatImageRenderer =
|
|||
},
|
||||
});
|
||||
|
||||
export const repeatImageRendererFactory = (core: CoreSetup) =>
|
||||
getRepeatImageRenderer(core.theme.theme$);
|
||||
export const repeatImageRendererFactory = (core: CoreStart) => getRepeatImageRenderer(core);
|
||||
|
|
|
@ -33,8 +33,10 @@ export class ExpressionRepeatImagePlugin
|
|||
>
|
||||
{
|
||||
public setup(core: CoreSetup, { expressions }: SetupDeps): ExpressionRepeatImagePluginSetup {
|
||||
expressions.registerFunction(repeatImageFunction);
|
||||
expressions.registerRenderer(repeatImageRendererFactory(core));
|
||||
core.getStartServices().then(([start]) => {
|
||||
expressions.registerFunction(repeatImageFunction);
|
||||
expressions.registerRenderer(repeatImageRendererFactory(start));
|
||||
});
|
||||
}
|
||||
|
||||
public start(core: CoreStart): ExpressionRepeatImagePluginStart {}
|
||||
|
|
|
@ -29,12 +29,7 @@ const Renderer = ({
|
|||
percent: 0.45,
|
||||
};
|
||||
|
||||
return (
|
||||
<Render
|
||||
renderer={getRevealImageRenderer(coreMock.createStart().theme.theme$)}
|
||||
config={config}
|
||||
/>
|
||||
);
|
||||
return <Render renderer={getRevealImageRenderer(coreMock.createStart())} config={config} />;
|
||||
};
|
||||
|
||||
storiesOf('renderers/revealImage', module).add(
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
|
||||
import React from 'react';
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CoreSetup, CoreTheme } from '@kbn/core/public';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import {
|
||||
ExpressionRenderDefinition,
|
||||
IInterpreterRenderHandlers,
|
||||
|
@ -34,7 +33,7 @@ export const strings = {
|
|||
};
|
||||
|
||||
export const getRevealImageRenderer =
|
||||
(theme$: Observable<CoreTheme>) => (): ExpressionRenderDefinition<RevealImageRendererConfig> => ({
|
||||
(core: CoreStart) => (): ExpressionRenderDefinition<RevealImageRendererConfig> => ({
|
||||
name: 'revealImage',
|
||||
displayName: strings.getDisplayName(),
|
||||
help: strings.getHelpDescription(),
|
||||
|
@ -52,7 +51,7 @@ export const getRevealImageRenderer =
|
|||
render(
|
||||
<KibanaErrorBoundaryProvider analytics={undefined}>
|
||||
<KibanaErrorBoundary>
|
||||
<KibanaThemeProvider theme={{ theme$ }}>
|
||||
<KibanaThemeProvider {...core}>
|
||||
<I18nProvider>
|
||||
<RevealImageComponent onLoaded={handlers.done} {...config} parentNode={domNode} />
|
||||
</I18nProvider>
|
||||
|
@ -64,5 +63,4 @@ export const getRevealImageRenderer =
|
|||
},
|
||||
});
|
||||
|
||||
export const revealImageRendererFactory = (core: CoreSetup) =>
|
||||
getRevealImageRenderer(core.theme.theme$);
|
||||
export const revealImageRendererFactory = (core: CoreStart) => getRevealImageRenderer(core);
|
||||
|
|
|
@ -33,8 +33,10 @@ export class ExpressionRevealImagePlugin
|
|||
>
|
||||
{
|
||||
public setup(core: CoreSetup, { expressions }: SetupDeps): ExpressionRevealImagePluginSetup {
|
||||
expressions.registerFunction(revealImageFunction);
|
||||
expressions.registerRenderer(revealImageRendererFactory(core));
|
||||
core.getStartServices().then(([start]) => {
|
||||
expressions.registerFunction(revealImageFunction);
|
||||
expressions.registerRenderer(revealImageRendererFactory(start));
|
||||
});
|
||||
}
|
||||
|
||||
public start(core: CoreStart): ExpressionRevealImagePluginStart {}
|
||||
|
|
|
@ -31,7 +31,5 @@ storiesOf('renderers/progress', module).add('default', () => {
|
|||
valueWeight: 15,
|
||||
};
|
||||
|
||||
return (
|
||||
<Render renderer={getProgressRenderer(coreMock.createStart().theme.theme$)} config={config} />
|
||||
);
|
||||
return <Render renderer={getProgressRenderer(coreMock.createStart())} config={config} />;
|
||||
});
|
||||
|
|
|
@ -24,7 +24,5 @@ storiesOf('renderers/shape', module).add('default', () => {
|
|||
maintainAspect: true,
|
||||
};
|
||||
|
||||
return (
|
||||
<Render renderer={getShapeRenderer(coreMock.createStart().theme.theme$)} config={config} />
|
||||
);
|
||||
return <Render renderer={getShapeRenderer(coreMock.createStart())} config={config} />;
|
||||
});
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
|
||||
import React from 'react';
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CoreSetup, CoreTheme } from '@kbn/core/public';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import {
|
||||
ExpressionRenderDefinition,
|
||||
IInterpreterRenderHandlers,
|
||||
|
@ -34,7 +33,7 @@ const strings = {
|
|||
};
|
||||
|
||||
export const getProgressRenderer =
|
||||
(theme$: Observable<CoreTheme>) => (): ExpressionRenderDefinition<ProgressRendererConfig> => ({
|
||||
(core: CoreStart) => (): ExpressionRenderDefinition<ProgressRendererConfig> => ({
|
||||
name: 'progress',
|
||||
displayName: strings.getDisplayName(),
|
||||
help: strings.getHelpDescription(),
|
||||
|
@ -52,7 +51,7 @@ export const getProgressRenderer =
|
|||
render(
|
||||
<KibanaErrorBoundaryProvider analytics={undefined}>
|
||||
<KibanaErrorBoundary>
|
||||
<KibanaThemeProvider theme={{ theme$ }}>
|
||||
<KibanaThemeProvider {...core}>
|
||||
<I18nProvider>
|
||||
<ProgressComponent {...config} parentNode={domNode} onLoaded={handlers.done} />
|
||||
</I18nProvider>
|
||||
|
@ -64,4 +63,4 @@ export const getProgressRenderer =
|
|||
},
|
||||
});
|
||||
|
||||
export const progressRendererFactory = (core: CoreSetup) => getProgressRenderer(core.theme.theme$);
|
||||
export const progressRendererFactory = (core: CoreStart) => getProgressRenderer(core);
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
|
||||
import React from 'react';
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CoreSetup, CoreTheme } from '@kbn/core/public';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import {
|
||||
ExpressionRenderDefinition,
|
||||
IInterpreterRenderHandlers,
|
||||
|
@ -34,7 +33,7 @@ const strings = {
|
|||
};
|
||||
|
||||
export const getShapeRenderer =
|
||||
(theme$: Observable<CoreTheme>) => (): ExpressionRenderDefinition<ShapeRendererConfig> => ({
|
||||
(core: CoreStart) => (): ExpressionRenderDefinition<ShapeRendererConfig> => ({
|
||||
name: 'shape',
|
||||
displayName: strings.getDisplayName(),
|
||||
help: strings.getHelpDescription(),
|
||||
|
@ -52,7 +51,7 @@ export const getShapeRenderer =
|
|||
render(
|
||||
<KibanaErrorBoundaryProvider analytics={undefined}>
|
||||
<KibanaErrorBoundary>
|
||||
<KibanaThemeProvider theme={{ theme$ }}>
|
||||
<KibanaThemeProvider {...core}>
|
||||
<I18nProvider>
|
||||
<ShapeComponent onLoaded={handlers.done} {...config} parentNode={domNode} />
|
||||
</I18nProvider>
|
||||
|
@ -65,4 +64,4 @@ export const getShapeRenderer =
|
|||
},
|
||||
});
|
||||
|
||||
export const shapeRendererFactory = (core: CoreSetup) => getShapeRenderer(core.theme.theme$);
|
||||
export const shapeRendererFactory = (core: CoreStart) => getShapeRenderer(core);
|
||||
|
|
|
@ -27,10 +27,12 @@ export class ExpressionShapePlugin
|
|||
implements Plugin<ExpressionShapePluginSetup, ExpressionShapePluginStart, SetupDeps, StartDeps>
|
||||
{
|
||||
public setup(core: CoreSetup, { expressions }: SetupDeps): ExpressionShapePluginSetup {
|
||||
expressions.registerFunction(shapeFunction);
|
||||
expressions.registerFunction(progressFunction);
|
||||
expressions.registerRenderer(shapeRendererFactory(core));
|
||||
expressions.registerRenderer(progressRendererFactory(core));
|
||||
core.getStartServices().then(([start]) => {
|
||||
expressions.registerFunction(shapeFunction);
|
||||
expressions.registerFunction(progressFunction);
|
||||
expressions.registerRenderer(shapeRendererFactory(start));
|
||||
expressions.registerRenderer(progressRendererFactory(start));
|
||||
});
|
||||
}
|
||||
|
||||
public start(core: CoreStart): ExpressionShapePluginStart {}
|
||||
|
|
|
@ -28,7 +28,7 @@ export const openImageEditor = async ({
|
|||
}): Promise<ImageConfig> => {
|
||||
const { ImageEditorFlyout } = await import('./image_editor_flyout');
|
||||
|
||||
const { overlays, theme, i18n, http, security } = coreServices;
|
||||
const { overlays, http, security, ...startServices } = coreServices;
|
||||
const user = await security.authc.getCurrentUser();
|
||||
const filesClient = filesService.filesClientFactory.asUnscoped<FileImageMetadata>();
|
||||
|
||||
|
@ -73,7 +73,7 @@ export const openImageEditor = async ({
|
|||
/>
|
||||
</ImageViewerContext.Provider>
|
||||
</FilesContext>,
|
||||
{ theme, i18n }
|
||||
startServices
|
||||
),
|
||||
{
|
||||
onClose: () => {
|
||||
|
|
|
@ -133,7 +133,7 @@ export async function openEditorFlyout({
|
|||
parentDashboardId={parentDashboardId}
|
||||
isByReference={Boolean(initialState?.savedObjectId)}
|
||||
/>,
|
||||
{ theme: coreServices.theme, i18n: coreServices.i18n }
|
||||
coreServices
|
||||
),
|
||||
{
|
||||
id: flyoutId,
|
||||
|
|
|
@ -42,7 +42,7 @@ export const openCustomizePanelFlyout = ({
|
|||
}}
|
||||
/>
|
||||
</KibanaReactContextProvider>,
|
||||
{ theme: core.theme, i18n: core.i18n }
|
||||
core
|
||||
),
|
||||
{
|
||||
size: 's',
|
||||
|
|
|
@ -14,7 +14,7 @@ import { IncompatibleActionError, UiActionsActionDefinition } from '@kbn/ui-acti
|
|||
// for cleanup esFilters need to fix the issue https://github.com/elastic/kibana/issues/131292
|
||||
import { FilterManager, TimefilterContract } from '@kbn/data-plugin/public';
|
||||
import type { Filter, RangeFilter } from '@kbn/es-query';
|
||||
import { getOverlays, getIndexPatterns } from '../services';
|
||||
import { getIndexPatterns } from '../services';
|
||||
import { applyFiltersPopover } from '../apply_filters';
|
||||
|
||||
export const ACTION_GLOBAL_APPLY_FILTER = 'ACTION_GLOBAL_APPLY_FILTER';
|
||||
|
@ -74,7 +74,7 @@ export function createFilterAction(
|
|||
);
|
||||
|
||||
const filterSelectionPromise: Promise<Filter[]> = new Promise((resolve) => {
|
||||
const overlay = getOverlays().openModal(
|
||||
const overlay = coreStart.overlays.openModal(
|
||||
toMountPoint(
|
||||
applyFiltersPopover(
|
||||
filters,
|
||||
|
|
|
@ -14,7 +14,7 @@ import { APPLY_FILTER_TRIGGER } from '@kbn/data-plugin/public';
|
|||
import { createQueryStringInput } from './query_string_input/get_query_string_input';
|
||||
import { UPDATE_FILTER_REFERENCES_TRIGGER, updateFilterReferencesTrigger } from './triggers';
|
||||
import type { ConfigSchema } from '../server/config';
|
||||
import { setIndexPatterns, setTheme, setOverlays, setAnalytics, setI18n } from './services';
|
||||
import { setCoreStart, setIndexPatterns } from './services';
|
||||
import { AutocompleteService } from './autocomplete/autocomplete_service';
|
||||
import { createSearchBar } from './search_bar/create_search_bar';
|
||||
import { createIndexPatternSelect } from './index_pattern_select';
|
||||
|
@ -72,10 +72,7 @@ export class UnifiedSearchPublicPlugin
|
|||
core: CoreStart,
|
||||
{ data, dataViews, uiActions, screenshotMode }: UnifiedSearchStartDependencies
|
||||
): UnifiedSearchPublicPluginStart {
|
||||
setAnalytics(core.analytics);
|
||||
setI18n(core.i18n);
|
||||
setTheme(core.theme);
|
||||
setOverlays(core.overlays);
|
||||
setCoreStart(core);
|
||||
setIndexPatterns(dataViews);
|
||||
const autocompleteStart = this.autocomplete.start();
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ import { SuggestionsComponent } from '../typeahead';
|
|||
import { onRaf } from '../utils';
|
||||
import { FilterButtonGroup } from '../filter_bar/filter_button_group/filter_button_group';
|
||||
import { AutocompleteService, QuerySuggestion, QuerySuggestionTypes } from '../autocomplete';
|
||||
import { getAnalytics, getI18n, getTheme } from '../services';
|
||||
import { getCoreStart } from '../services';
|
||||
import './query_string_input.scss';
|
||||
|
||||
export const strings = {
|
||||
|
@ -568,7 +568,7 @@ export default class QueryStringInputUI extends PureComponent<QueryStringInputPr
|
|||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
</div>,
|
||||
{ analytics: getAnalytics(), i18n: getI18n(), theme: getTheme() }
|
||||
getCoreStart()
|
||||
),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -7,22 +7,11 @@
|
|||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import {
|
||||
ThemeServiceStart,
|
||||
OverlayStart,
|
||||
AnalyticsServiceStart,
|
||||
I18nStart,
|
||||
} from '@kbn/core/public';
|
||||
import { createGetterSetter } from '@kbn/kibana-utils-plugin/public';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import { DataViewsContract } from '@kbn/data-views-plugin/public';
|
||||
import { createGetterSetter } from '@kbn/kibana-utils-plugin/public';
|
||||
|
||||
export const [getCoreStart, setCoreStart] = createGetterSetter<CoreStart>('CoreStart');
|
||||
|
||||
export const [getIndexPatterns, setIndexPatterns] =
|
||||
createGetterSetter<DataViewsContract>('IndexPatterns');
|
||||
|
||||
export const [getAnalytics, setAnalytics] = createGetterSetter<AnalyticsServiceStart>('Analytics');
|
||||
|
||||
export const [getI18n, setI18n] = createGetterSetter<I18nStart>('I18n');
|
||||
|
||||
export const [getTheme, setTheme] = createGetterSetter<ThemeServiceStart>('Theme');
|
||||
|
||||
export const [getOverlays, setOverlays] = createGetterSetter<OverlayStart>('Overlays');
|
||||
|
|
|
@ -96,6 +96,7 @@ export interface IUnifiedSearchPluginServices extends Partial<CoreStart> {
|
|||
analytics: CoreStart['analytics'];
|
||||
i18n: CoreStart['i18n'];
|
||||
theme: CoreStart['theme'];
|
||||
userProfile: CoreStart['userProfile'];
|
||||
storage: IStorageWrapper;
|
||||
docLinks: DocLinksStart;
|
||||
data: DataPublicPluginStart;
|
||||
|
|
|
@ -15,7 +15,7 @@ import { EuiErrorBoundary, EuiLoadingChart } from '@elastic/eui';
|
|||
import { Vis, VisualizeEmbeddableContract } from '@kbn/visualizations-plugin/public';
|
||||
import { IEditorController, EditorRenderProps } from '@kbn/visualizations-plugin/public';
|
||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
||||
import { getAnalytics, getI18n, getTheme } from './services';
|
||||
import { getCoreStart } from './services';
|
||||
|
||||
// @ts-ignore
|
||||
const DefaultEditor = lazy(() => import('./default_editor'));
|
||||
|
@ -30,7 +30,7 @@ class DefaultEditorController implements IEditorController {
|
|||
|
||||
render(props: EditorRenderProps) {
|
||||
render(
|
||||
<KibanaRenderContextProvider analytics={getAnalytics()} i18n={getI18n()} theme={getTheme()}>
|
||||
<KibanaRenderContextProvider {...getCoreStart()}>
|
||||
<EuiErrorBoundary>
|
||||
<Suspense
|
||||
fallback={
|
||||
|
|
|
@ -11,7 +11,7 @@ import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
|||
|
||||
import type { VisualizationsSetup } from '@kbn/visualizations-plugin/public';
|
||||
import { DefaultEditorController } from './default_editor_controller';
|
||||
import { setAnalytics, setI18n, setTheme } from './services';
|
||||
import { setAnalytics, setCoreStart, setTheme } from './services';
|
||||
|
||||
export interface VisDefaultEditorSetupDependencies {
|
||||
visualizations: VisualizationsSetup;
|
||||
|
@ -29,7 +29,7 @@ export class VisDefaultEditorPlugin
|
|||
}
|
||||
|
||||
public start(core: CoreStart) {
|
||||
setI18n(core.i18n);
|
||||
setCoreStart(core);
|
||||
}
|
||||
|
||||
stop() {}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import { AnalyticsServiceStart, I18nStart, ThemeServiceStart } from '@kbn/core/public';
|
||||
import { AnalyticsServiceStart, CoreStart, ThemeServiceStart } from '@kbn/core/public';
|
||||
import { createGetterSetter } from '@kbn/kibana-utils-plugin/common';
|
||||
|
||||
export const [getAnalytics, setAnalytics] =
|
||||
createGetterSetter<AnalyticsServiceStart>('AnalyticsService');
|
||||
export const [getI18n, setI18n] = createGetterSetter<I18nStart>('I18nService');
|
||||
export const [getTheme, setTheme] = createGetterSetter<ThemeServiceStart>('ThemeService');
|
||||
export const [getCoreStart, setCoreStart] = createGetterSetter<CoreStart>('CoreStart');
|
||||
|
|
|
@ -18,11 +18,15 @@ import type { UsageCollectionStart } from '@kbn/usage-collection-plugin/public';
|
|||
import { LEGACY_HEATMAP_CHARTS_LIBRARY } from '@kbn/vis-type-heatmap-plugin/common';
|
||||
import { LEGACY_GAUGE_CHARTS_LIBRARY } from '@kbn/vis-type-gauge-plugin/common';
|
||||
import type { VislibPublicConfig } from '../server/config';
|
||||
import { setAnalytics, setI18n, setUsageCollectionStart } from './services';
|
||||
import {
|
||||
setFormatService,
|
||||
setDataActions,
|
||||
setCoreStart,
|
||||
setUsageCollectionStart,
|
||||
} from './services';
|
||||
import { heatmapVisTypeDefinition } from './heatmap';
|
||||
|
||||
import { createVisTypeVislibVisFn } from './vis_type_vislib_vis_fn';
|
||||
import { setFormatService, setDataActions, setTheme } from './services';
|
||||
import { getVislibVisRenderer } from './vis_renderer';
|
||||
import { gaugeVisTypeDefinition } from './gauge';
|
||||
import { goalVisTypeDefinition } from './goal';
|
||||
|
@ -87,11 +91,9 @@ export class VisTypeVislibPlugin
|
|||
core: CoreStart,
|
||||
{ data, usageCollection, fieldFormats }: VisTypeVislibPluginStartDependencies
|
||||
) {
|
||||
setCoreStart(core);
|
||||
setFormatService(fieldFormats);
|
||||
setDataActions(data.actions);
|
||||
setAnalytics(core.analytics);
|
||||
setI18n(core.i18n);
|
||||
setTheme(core.theme);
|
||||
if (usageCollection) {
|
||||
setUsageCollectionStart(usageCollection);
|
||||
}
|
||||
|
|
|
@ -7,22 +7,19 @@
|
|||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import { AnalyticsServiceStart, I18nStart, ThemeServiceStart } from '@kbn/core/public';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import { createGetterSetter } from '@kbn/kibana-utils-plugin/public';
|
||||
import { DataPublicPluginStart } from '@kbn/data-plugin/public';
|
||||
import { FieldFormatsStart } from '@kbn/field-formats-plugin/public';
|
||||
import { UsageCollectionStart } from '@kbn/usage-collection-plugin/public';
|
||||
|
||||
export const [getCoreStart, setCoreStart] = createGetterSetter<CoreStart>('CoreStart');
|
||||
|
||||
export const [getDataActions, setDataActions] =
|
||||
createGetterSetter<DataPublicPluginStart['actions']>('vislib data.actions');
|
||||
|
||||
export const [getFormatService, setFormatService] =
|
||||
createGetterSetter<FieldFormatsStart>('FieldFormats');
|
||||
|
||||
export const [getAnalytics, setAnalytics] =
|
||||
createGetterSetter<AnalyticsServiceStart>('vislib theme service');
|
||||
export const [getI18n, setI18n] = createGetterSetter<I18nStart>('vislib theme service');
|
||||
export const [getTheme, setTheme] = createGetterSetter<ThemeServiceStart>('vislib theme service');
|
||||
|
||||
export const [getUsageCollectionStart, setUsageCollectionStart] =
|
||||
createGetterSetter<UsageCollectionStart>('UsageCollection', false);
|
||||
|
|
|
@ -136,7 +136,7 @@ export const createVislibVisController = (
|
|||
}
|
||||
|
||||
mountLegend(
|
||||
startServices: Pick<CoreStart, 'analytics' | 'i18n' | 'theme'>,
|
||||
startServices: Pick<CoreStart, 'analytics' | 'i18n' | 'theme' | 'userProfile'>,
|
||||
visData: unknown,
|
||||
visParams: BasicVislibParams,
|
||||
fireEvent: IInterpreterRenderHandlers['event'],
|
||||
|
|
|
@ -11,7 +11,7 @@ import React from 'react';
|
|||
import ReactDOM from 'react-dom/server';
|
||||
import { EuiIcon } from '@elastic/eui';
|
||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
||||
import { getAnalytics, getI18n, getTheme } from '../../services';
|
||||
import { getCoreStart } from '../../services';
|
||||
|
||||
interface Props {
|
||||
wholeBucket: boolean;
|
||||
|
@ -19,7 +19,7 @@ interface Props {
|
|||
|
||||
export const touchdownTemplate = ({ wholeBucket }: Props) => {
|
||||
return ReactDOM.renderToStaticMarkup(
|
||||
<KibanaRenderContextProvider analytics={getAnalytics()} i18n={getI18n()} theme={getTheme()}>
|
||||
<KibanaRenderContextProvider {...getCoreStart()}>
|
||||
<p className="visTooltip__header">
|
||||
<EuiIcon type="iInCircle" className="visTooltip__headerIcon" />
|
||||
<span className="visTooltip__headerText">
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
import { Reference } from '../../common/content_management';
|
||||
import { PersistedState } from '../persisted_state';
|
||||
import { getAnalytics, getI18n, getOverlays, getTheme } from '../services';
|
||||
import { getAnalytics, getI18n, getOverlays, getTheme, getUserProfile } from '../services';
|
||||
import { saveVisualization } from '../utils/saved_visualize_utils';
|
||||
import { VisualizeOutputState } from './types';
|
||||
|
||||
|
@ -63,6 +63,7 @@ export const saveToLibrary = async ({
|
|||
i18n: getI18n(),
|
||||
overlays: getOverlays(),
|
||||
theme: getTheme(),
|
||||
userProfile: getUserProfile(),
|
||||
},
|
||||
references ?? []
|
||||
);
|
||||
|
|
|
@ -22,6 +22,7 @@ import {
|
|||
getSearch,
|
||||
getSpaces,
|
||||
getTheme,
|
||||
getUserProfile,
|
||||
} from '../services';
|
||||
import {
|
||||
deserializeReferences,
|
||||
|
@ -137,6 +138,7 @@ export const deserializeSavedObjectState = async ({
|
|||
overlays: getOverlays(),
|
||||
analytics: getAnalytics(),
|
||||
theme: getTheme(),
|
||||
userProfile: getUserProfile(),
|
||||
},
|
||||
savedObjectId
|
||||
);
|
||||
|
|
|
@ -105,6 +105,7 @@ import {
|
|||
setAnalytics,
|
||||
setI18n,
|
||||
setTheme,
|
||||
setUserProfile,
|
||||
setExecutionContext,
|
||||
setFieldFormats,
|
||||
setSavedObjectTagging,
|
||||
|
@ -465,6 +466,7 @@ export class VisualizationsPlugin
|
|||
const types = this.types.start();
|
||||
setTypes(types);
|
||||
setI18n(core.i18n);
|
||||
setUserProfile(core.userProfile);
|
||||
setEmbeddable(embeddable);
|
||||
setApplication(core.application);
|
||||
setCapabilities(core.application.capabilities);
|
||||
|
|
|
@ -22,6 +22,7 @@ import type {
|
|||
AnalyticsServiceStart,
|
||||
I18nStart,
|
||||
NotificationsStart,
|
||||
UserProfileService,
|
||||
} from '@kbn/core/public';
|
||||
import type { DataPublicPluginStart, TimefilterContract } from '@kbn/data-plugin/public';
|
||||
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
|
||||
|
@ -48,6 +49,9 @@ export const [getNotifications, setNotifications] =
|
|||
|
||||
export const [getCapabilities, setCapabilities] = createGetterSetter<Capabilities>('Capabilities');
|
||||
|
||||
export const [getUserProfile, setUserProfile] =
|
||||
createGetterSetter<UserProfileService>('UserProfile');
|
||||
|
||||
export const [getHttp, setHttp] = createGetterSetter<HttpStart>('Http');
|
||||
|
||||
export const [getFieldsFormats, setFieldFormats] =
|
||||
|
|
|
@ -34,6 +34,7 @@ export type StartServices = Pick<
|
|||
| 'analytics'
|
||||
| 'i18n'
|
||||
| 'theme'
|
||||
| 'userProfile'
|
||||
>;
|
||||
|
||||
export type { Vis, SerializedVis, VisParams };
|
||||
|
|
|
@ -70,9 +70,7 @@ export const redirectToSavedObjectPage = (
|
|||
savedVisualizationsId?: string
|
||||
) => {
|
||||
const {
|
||||
history,
|
||||
setActiveUrl,
|
||||
toastNotifications,
|
||||
http: { basePath },
|
||||
application: { navigateToApp },
|
||||
} = services;
|
||||
|
@ -81,9 +79,7 @@ export const redirectToSavedObjectPage = (
|
|||
path: `kibana/objects/savedVisualizations/${savedVisualizationsId}`,
|
||||
};
|
||||
redirectWhenMissing({
|
||||
history,
|
||||
navigateToApp,
|
||||
toastNotifications,
|
||||
basePath,
|
||||
mapping: {
|
||||
visualization: VisualizeConstants.LANDING_PAGE_PATH,
|
||||
|
@ -94,7 +90,7 @@ export const redirectToSavedObjectPage = (
|
|||
onBeforeRedirect() {
|
||||
setActiveUrl(VisualizeConstants.LANDING_PAGE_PATH);
|
||||
},
|
||||
theme: services.theme,
|
||||
...services,
|
||||
})(error);
|
||||
};
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import {
|
|||
getTheme,
|
||||
getContentManagement,
|
||||
getUISettings,
|
||||
getUserProfile,
|
||||
} from '../services';
|
||||
import type { BaseVisType } from '../vis_types';
|
||||
|
||||
|
@ -94,7 +95,7 @@ export function showNewVisModal({
|
|||
</Suspense>
|
||||
);
|
||||
}),
|
||||
{ analytics: getAnalytics(), i18n: getI18n(), theme: getTheme() }
|
||||
{ analytics: getAnalytics(), i18n: getI18n(), theme: getTheme(), userProfile: getUserProfile() }
|
||||
);
|
||||
|
||||
unmount = mount(container);
|
||||
|
|
|
@ -22,11 +22,8 @@ export const mount =
|
|||
const defaultDataView = await plugins.data.indexPatterns.getDefault();
|
||||
const { formula } = await plugins.lens.stateHelperApi();
|
||||
|
||||
const { analytics, i18n, theme } = core;
|
||||
const startServices = { analytics, i18n, theme };
|
||||
|
||||
const reactElement = (
|
||||
<KibanaRenderContextProvider {...startServices}>
|
||||
<KibanaRenderContextProvider {...core}>
|
||||
{defaultDataView && defaultDataView.isTimeBased() ? (
|
||||
<App core={core} plugins={plugins} defaultDataView={defaultDataView} formula={formula} />
|
||||
) : (
|
||||
|
|
|
@ -165,7 +165,7 @@ export const WorkspaceTopNavMenu = (props: WorkspaceTopNavMenuProps) => {
|
|||
<Provider store={store}>
|
||||
<Settings observable={settingsObservable} />
|
||||
</Provider>,
|
||||
{ theme: props.coreStart.theme, i18n: props.coreStart.i18n }
|
||||
props.coreStart
|
||||
),
|
||||
{
|
||||
size: 'm',
|
||||
|
|
|
@ -27,7 +27,7 @@ export async function checkForDuplicateTitle(
|
|||
onTitleDuplicate: (() => void) | undefined,
|
||||
services: {
|
||||
contentClient: ContentClient;
|
||||
} & Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme'>
|
||||
} & Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme' | 'userProfile'>
|
||||
): Promise<boolean> {
|
||||
const { contentClient, ...startServices } = services;
|
||||
// Don't check for duplicates if user has already confirmed save with duplicate title
|
||||
|
|
|
@ -15,7 +15,7 @@ export function confirmModalPromise(
|
|||
message = '',
|
||||
title = '',
|
||||
confirmBtnText = '',
|
||||
startServices: Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme'>
|
||||
startServices: Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme' | 'userProfile'>
|
||||
): Promise<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const cancelButtonText = i18n.translate('xpack.graph.confirmModal.cancelButtonLabel', {
|
||||
|
|
|
@ -13,7 +13,7 @@ import { confirmModalPromise } from './confirm_modal_promise';
|
|||
|
||||
export function displayDuplicateTitleConfirmModal(
|
||||
savedObject: Pick<GraphWorkspaceSavedObject, 'title'>,
|
||||
startServices: Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme'>
|
||||
startServices: Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme' | 'userProfile'>
|
||||
): Promise<boolean> {
|
||||
const confirmTitle = i18n.translate('xpack.graph.confirmModal.saveDuplicateConfirmationTitle', {
|
||||
defaultMessage: `This visualization already exists`,
|
||||
|
|
|
@ -34,7 +34,7 @@ export async function saveWithConfirmation(
|
|||
options: SavedObjectsCreateOptions,
|
||||
services: { contentClient: ContentClient } & Pick<
|
||||
CoreStart,
|
||||
'overlays' | 'analytics' | 'i18n' | 'theme'
|
||||
'overlays' | 'analytics' | 'i18n' | 'theme' | 'userProfile'
|
||||
>
|
||||
): Promise<{ item: GraphSavedObject }> {
|
||||
const { contentClient, ...startServices } = services;
|
||||
|
|
|
@ -167,7 +167,7 @@ export async function saveSavedWorkspace(
|
|||
}: SavedObjectSaveOpts = {},
|
||||
services: {
|
||||
contentClient: ContentClient;
|
||||
} & Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme'>
|
||||
} & Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme' | 'userProfile'>
|
||||
) {
|
||||
let attributes: SavedObjectAttributes = {};
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import { GraphWorkspaceSavedObject, GraphSavePolicy } from '../types';
|
|||
import { SaveModal, OnSaveGraphProps } from '../components/save_modal';
|
||||
|
||||
export interface SaveWorkspaceServices
|
||||
extends Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme'> {
|
||||
extends Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme' | 'userProfile'> {
|
||||
contentClient: ContentClient;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ export interface GraphState {
|
|||
}
|
||||
|
||||
export interface GraphStoreDependencies
|
||||
extends Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme'> {
|
||||
extends Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme' | 'userProfile'> {
|
||||
addBasePath: (url: string) => string;
|
||||
indexPatternProvider: IndexPatternProvider;
|
||||
createWorkspace: (index: string, advancedSettings: AdvancedSettings) => Workspace;
|
||||
|
|
|
@ -52,6 +52,7 @@ export type SaveModalContainerProps = {
|
|||
| 'analytics'
|
||||
| 'i18n'
|
||||
| 'theme'
|
||||
| 'userProfile'
|
||||
| 'stateTransfer'
|
||||
| 'savedObjectStore'
|
||||
>;
|
||||
|
@ -238,6 +239,7 @@ export type SaveVisualizationProps = Simplify<
|
|||
| 'analytics'
|
||||
| 'i18n'
|
||||
| 'theme'
|
||||
| 'userProfile'
|
||||
| 'notifications'
|
||||
| 'stateTransfer'
|
||||
| 'attributeService'
|
||||
|
|
|
@ -59,7 +59,7 @@ export const getSharedActions = ({
|
|||
isTextBasedLanguage?: boolean;
|
||||
hasLayerSettings: boolean;
|
||||
openLayerSettings: () => void;
|
||||
core: Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme'>;
|
||||
core: Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme' | 'userProfile'>;
|
||||
customRemoveModalText?: { title?: string; description?: string };
|
||||
}) => [
|
||||
getOpenLayerSettingsAction({
|
||||
|
|
|
@ -73,6 +73,7 @@ export type StartServices = Pick<
|
|||
| 'analytics'
|
||||
| 'i18n'
|
||||
| 'theme'
|
||||
| 'userProfile'
|
||||
>;
|
||||
|
||||
export interface IndexPatternRef {
|
||||
|
@ -662,6 +663,7 @@ export type DatasourceDimensionEditorProps<T = unknown> = DatasourceDimensionPro
|
|||
| 'analytics'
|
||||
| 'i18n'
|
||||
| 'theme'
|
||||
| 'userProfile'
|
||||
| 'docLinks'
|
||||
>;
|
||||
dateRange: DateRange;
|
||||
|
|
|
@ -36,7 +36,10 @@ export const getRevertChangesAction = ({
|
|||
state: XYState;
|
||||
layer: XYByReferenceAnnotationLayerConfig;
|
||||
setState: StateSetter<XYState, unknown>;
|
||||
core: Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme' | 'notifications'>;
|
||||
core: Pick<
|
||||
CoreStart,
|
||||
'overlays' | 'analytics' | 'i18n' | 'theme' | 'notifications' | 'userProfile'
|
||||
>;
|
||||
}): LayerAction => {
|
||||
return {
|
||||
displayName: i18n.translate('xpack.lens.xyChart.annotations.revertChanges', {
|
||||
|
|
|
@ -12,7 +12,7 @@ import { dynamic } from '@kbn/shared-ux-utility';
|
|||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
||||
import type { RegionMapVisRenderValue } from './region_map_fn';
|
||||
import { REGION_MAP_RENDER } from './types';
|
||||
import { getAnalytics, getCoreI18n, getTheme } from '../../kibana_services';
|
||||
import { getCore } from '../../kibana_services';
|
||||
|
||||
const Component = dynamic(async () => {
|
||||
const { RegionMapVisualization } = await import('./region_map_visualization');
|
||||
|
@ -40,11 +40,7 @@ export const regionMapRenderer = {
|
|||
};
|
||||
|
||||
render(
|
||||
<KibanaRenderContextProvider
|
||||
analytics={getAnalytics()}
|
||||
i18n={getCoreI18n()}
|
||||
theme={getTheme()}
|
||||
>
|
||||
<KibanaRenderContextProvider {...getCore()}>
|
||||
<Component {...props} />
|
||||
</KibanaRenderContextProvider>,
|
||||
domNode
|
||||
|
|
|
@ -12,7 +12,7 @@ import { dynamic } from '@kbn/shared-ux-utility';
|
|||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
||||
import type { TileMapVisRenderValue } from './tile_map_fn';
|
||||
import { TILE_MAP_RENDER } from './types';
|
||||
import { getAnalytics, getCoreI18n, getTheme } from '../../kibana_services';
|
||||
import { getCore } from '../../kibana_services';
|
||||
|
||||
const Component = dynamic(async () => {
|
||||
const { TileMapVisualization } = await import('./tile_map_visualization');
|
||||
|
@ -40,11 +40,7 @@ export const tileMapRenderer = {
|
|||
};
|
||||
|
||||
render(
|
||||
<KibanaRenderContextProvider
|
||||
analytics={getAnalytics()}
|
||||
i18n={getCoreI18n()}
|
||||
theme={getTheme()}
|
||||
>
|
||||
<KibanaRenderContextProvider {...getCore()}>
|
||||
<Component {...props} />
|
||||
</KibanaRenderContextProvider>,
|
||||
domNode
|
||||
|
|
|
@ -15,7 +15,7 @@ import type { KibanaExecutionContext } from '@kbn/core-execution-context-common'
|
|||
import { ChartSizeEvent } from '@kbn/chart-expressions-common';
|
||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
||||
import type { MapsPluginStartDependencies } from '../../plugin';
|
||||
import { getAnalytics, getCoreI18n, getTheme } from '../../kibana_services';
|
||||
import { getCore } from '../../kibana_services';
|
||||
import type { ChoroplethChartProps } from './types';
|
||||
|
||||
export const RENDERER_ID = 'lens_choropleth_chart_renderer';
|
||||
|
@ -99,11 +99,7 @@ export function getExpressionRenderer(coreSetup: CoreSetup<MapsPluginStartDepend
|
|||
handlers.event(chartSizeEvent);
|
||||
|
||||
ReactDOM.render(
|
||||
<KibanaRenderContextProvider
|
||||
analytics={getAnalytics()}
|
||||
i18n={getCoreI18n()}
|
||||
theme={getTheme()}
|
||||
>
|
||||
<KibanaRenderContextProvider {...getCore()}>
|
||||
<ChoroplethChart
|
||||
{...config}
|
||||
formatFactory={plugins.fieldFormats.deserialize}
|
||||
|
|
|
@ -18,9 +18,6 @@ import type { SavedObjectTaggingPluginStart } from '@kbn/saved-objects-tagging-p
|
|||
import { TableListViewKibanaProvider } from '@kbn/content-management-table-list-view-table';
|
||||
import {
|
||||
getCoreChrome,
|
||||
getAnalytics,
|
||||
getCoreI18n,
|
||||
getTheme,
|
||||
getMapsCapabilities,
|
||||
getEmbeddableService,
|
||||
getDocLinks,
|
||||
|
@ -110,7 +107,7 @@ export async function renderApp(
|
|||
}
|
||||
|
||||
render(
|
||||
<KibanaRenderContextProvider analytics={getAnalytics()} i18n={getCoreI18n()} theme={getTheme()}>
|
||||
<KibanaRenderContextProvider {...getCore()}>
|
||||
<AppUsageTracker>
|
||||
<TableListViewKibanaProvider
|
||||
{...{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue