Skip to content

Commit 21d7f82

Browse files
Merge branch 'main' into tests/unskip-cit-ccr-follower-indices
2 parents 415d11e + da96f61 commit 21d7f82

48 files changed

Lines changed: 928 additions & 364 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

x-pack/plugins/ml/public/application/app.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { Storage } from '../../../../../src/plugins/kibana_utils/public';
1616

1717
import {
1818
KibanaContextProvider,
19+
KibanaThemeProvider,
1920
RedirectAppLinks,
2021
} from '../../../../../src/plugins/kibana_react/public';
2122
import { setDependencyCache, clearCache } from './util/dependency_cache';
@@ -99,14 +100,16 @@ const App: FC<AppProps> = ({ coreStart, deps, appMountParams }) => {
99100
<RedirectAppLinks application={coreStart.application}>
100101
<ApplicationUsageTrackingProvider>
101102
<I18nContext>
102-
<KibanaContextProvider
103-
services={{
104-
...services,
105-
mlServices: getMlGlobalServices(coreStart.http, deps.usageCollection),
106-
}}
107-
>
108-
<MlRouter pageDeps={pageDeps} />
109-
</KibanaContextProvider>
103+
<KibanaThemeProvider theme$={appMountParams.theme$}>
104+
<KibanaContextProvider
105+
services={{
106+
...services,
107+
mlServices: getMlGlobalServices(coreStart.http, deps.usageCollection),
108+
}}
109+
>
110+
<MlRouter pageDeps={pageDeps} />
111+
</KibanaContextProvider>
112+
</KibanaThemeProvider>
110113
</I18nContext>
111114
</ApplicationUsageTrackingProvider>
112115
</RedirectAppLinks>
@@ -128,6 +131,7 @@ export const renderApp = (
128131
docLinks: coreStart.docLinks!,
129132
toastNotifications: coreStart.notifications.toasts,
130133
overlays: coreStart.overlays,
134+
theme: coreStart.theme,
131135
recentlyAccessed: coreStart.chrome!.recentlyAccessed,
132136
basePath: coreStart.http.basePath,
133137
savedObjectsClient: coreStart.savedObjects.client,

x-pack/plugins/ml/public/application/license/expired_warning.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import React from 'react';
99
import { i18n } from '@kbn/i18n';
1010
import { EuiCallOut } from '@elastic/eui';
11-
import { toMountPoint } from '../../../../../../src/plugins/kibana_react/public';
12-
import { getOverlays } from '../util/dependency_cache';
11+
import { toMountPoint, wrapWithTheme } from '../../../../../../src/plugins/kibana_react/public';
12+
import { getOverlays, getTheme } from '../util/dependency_cache';
1313

1414
let expiredLicenseBannerId: string;
1515

@@ -20,8 +20,15 @@ export function showExpiredLicenseWarning() {
2020
});
2121
// Only show the banner once with no way to dismiss it
2222
const overlays = getOverlays();
23+
const theme = getTheme();
24+
2325
expiredLicenseBannerId = overlays.banners.add(
24-
toMountPoint(<EuiCallOut iconType="iInCircle" color="warning" title={message} />)
26+
toMountPoint(
27+
wrapWithTheme(
28+
<EuiCallOut iconType="iInCircle" color="warning" title={message} />,
29+
theme.theme$
30+
)
31+
)
2532
);
2633
}
2734
}

x-pack/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/jobs_list_page.tsx

Lines changed: 65 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import type { ManagementAppMountParams } from '../../../../../../../../../src/pl
3030
import { checkGetManagementMlJobsResolver } from '../../../../capabilities/check_capabilities';
3131
import {
3232
KibanaContextProvider,
33+
KibanaThemeProvider,
3334
RedirectAppLinks,
3435
} from '../../../../../../../../../src/plugins/kibana_react/public';
3536

@@ -139,6 +140,7 @@ export const JobsListPage: FC<{
139140
const tabs = useTabs(isMlEnabledInSpace, spacesApi);
140141
const [currentTabId, setCurrentTabId] = useState<JobType>('anomaly-detector');
141142
const I18nContext = coreStart.i18n.Context;
143+
const theme$ = coreStart.theme.theme$;
142144

143145
const check = async () => {
144146
try {
@@ -219,69 +221,71 @@ export const JobsListPage: FC<{
219221
return (
220222
<RedirectAppLinks application={coreStart.application}>
221223
<I18nContext>
222-
<KibanaContextProvider
223-
services={{
224-
...coreStart,
225-
share,
226-
data,
227-
usageCollection,
228-
mlServices: getMlGlobalServices(coreStart.http, usageCollection),
229-
}}
230-
>
231-
<ContextWrapper feature={PLUGIN_ID}>
232-
<Router history={history}>
233-
<EuiPageHeader
234-
pageTitle={
235-
<FormattedMessage
236-
id="xpack.ml.management.jobsList.jobsListTitle"
237-
defaultMessage="Machine Learning Jobs"
238-
/>
239-
}
240-
description={
241-
<FormattedMessage
242-
id="xpack.ml.management.jobsList.jobsListTagline"
243-
defaultMessage="View, export, and import machine learning analytics and anomaly detection jobs."
244-
/>
245-
}
246-
rightSideItems={[docsLink]}
247-
bottomBorder
248-
/>
224+
<KibanaThemeProvider theme$={theme$}>
225+
<KibanaContextProvider
226+
services={{
227+
...coreStart,
228+
share,
229+
data,
230+
usageCollection,
231+
mlServices: getMlGlobalServices(coreStart.http, usageCollection),
232+
}}
233+
>
234+
<ContextWrapper feature={PLUGIN_ID}>
235+
<Router history={history}>
236+
<EuiPageHeader
237+
pageTitle={
238+
<FormattedMessage
239+
id="xpack.ml.management.jobsList.jobsListTitle"
240+
defaultMessage="Machine Learning Jobs"
241+
/>
242+
}
243+
description={
244+
<FormattedMessage
245+
id="xpack.ml.management.jobsList.jobsListTagline"
246+
defaultMessage="View, export, and import machine learning analytics and anomaly detection jobs."
247+
/>
248+
}
249+
rightSideItems={[docsLink]}
250+
bottomBorder
251+
/>
249252

250-
<EuiSpacer size="l" />
253+
<EuiSpacer size="l" />
251254

252-
<EuiPageContentBody
253-
id="kibanaManagementMLSection"
254-
data-test-subj="mlPageStackManagementJobsList"
255-
>
256-
<EuiFlexGroup>
257-
<EuiFlexItem grow={false}>
258-
{spacesEnabled && (
259-
<>
260-
<EuiButtonEmpty
261-
onClick={() => setShowSyncFlyout(true)}
262-
data-test-subj="mlStackMgmtSyncButton"
263-
>
264-
{i18n.translate('xpack.ml.management.jobsList.syncFlyoutButton', {
265-
defaultMessage: 'Synchronize saved objects',
266-
})}
267-
</EuiButtonEmpty>
268-
{showSyncFlyout && <JobSpacesSyncFlyout onClose={onCloseSyncFlyout} />}
269-
<EuiSpacer size="s" />
270-
</>
271-
)}
272-
</EuiFlexItem>
273-
<EuiFlexItem grow={false}>
274-
<ExportJobsFlyout isDisabled={false} currentTab={currentTabId} />
275-
</EuiFlexItem>
276-
<EuiFlexItem grow={false}>
277-
<ImportJobsFlyout isDisabled={false} />
278-
</EuiFlexItem>
279-
</EuiFlexGroup>
280-
{renderTabs()}
281-
</EuiPageContentBody>
282-
</Router>
283-
</ContextWrapper>
284-
</KibanaContextProvider>
255+
<EuiPageContentBody
256+
id="kibanaManagementMLSection"
257+
data-test-subj="mlPageStackManagementJobsList"
258+
>
259+
<EuiFlexGroup>
260+
<EuiFlexItem grow={false}>
261+
{spacesEnabled && (
262+
<>
263+
<EuiButtonEmpty
264+
onClick={() => setShowSyncFlyout(true)}
265+
data-test-subj="mlStackMgmtSyncButton"
266+
>
267+
{i18n.translate('xpack.ml.management.jobsList.syncFlyoutButton', {
268+
defaultMessage: 'Synchronize saved objects',
269+
})}
270+
</EuiButtonEmpty>
271+
{showSyncFlyout && <JobSpacesSyncFlyout onClose={onCloseSyncFlyout} />}
272+
<EuiSpacer size="s" />
273+
</>
274+
)}
275+
</EuiFlexItem>
276+
<EuiFlexItem grow={false}>
277+
<ExportJobsFlyout isDisabled={false} currentTab={currentTabId} />
278+
</EuiFlexItem>
279+
<EuiFlexItem grow={false}>
280+
<ImportJobsFlyout isDisabled={false} />
281+
</EuiFlexItem>
282+
</EuiFlexGroup>
283+
{renderTabs()}
284+
</EuiPageContentBody>
285+
</Router>
286+
</ContextWrapper>
287+
</KibanaContextProvider>
288+
</KibanaThemeProvider>
285289
</I18nContext>
286290
</RedirectAppLinks>
287291
);

x-pack/plugins/ml/public/application/trained_models/models_management/force_stop_dialog.tsx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import React, { FC } from 'react';
99
import { EuiConfirmModal } from '@elastic/eui';
1010
import { FormattedMessage } from '@kbn/i18n-react';
11-
import type { OverlayStart } from 'kibana/public';
11+
import type { OverlayStart, ThemeServiceStart } from 'kibana/public';
1212
import type { ModelItem } from './models_list';
13-
import { toMountPoint } from '../../../../../../../src/plugins/kibana_react/public';
13+
import { toMountPoint, wrapWithTheme } from '../../../../../../../src/plugins/kibana_react/public';
1414

1515
interface ForceStopModelConfirmDialogProps {
1616
model: ModelItem;
@@ -64,22 +64,25 @@ export const ForceStopModelConfirmDialog: FC<ForceStopModelConfirmDialogProps> =
6464
};
6565

6666
export const getUserConfirmationProvider =
67-
(overlays: OverlayStart) => async (forceStopModel: ModelItem) => {
67+
(overlays: OverlayStart, theme: ThemeServiceStart) => async (forceStopModel: ModelItem) => {
6868
return new Promise(async (resolve, reject) => {
6969
try {
7070
const modalSession = overlays.openModal(
7171
toMountPoint(
72-
<ForceStopModelConfirmDialog
73-
model={forceStopModel}
74-
onCancel={() => {
75-
modalSession.close();
76-
resolve(false);
77-
}}
78-
onConfirm={() => {
79-
modalSession.close();
80-
resolve(true);
81-
}}
82-
/>
72+
wrapWithTheme(
73+
<ForceStopModelConfirmDialog
74+
model={forceStopModel}
75+
onCancel={() => {
76+
modalSession.close();
77+
resolve(false);
78+
}}
79+
onConfirm={() => {
80+
modalSession.close();
81+
resolve(true);
82+
}}
83+
/>,
84+
theme.theme$
85+
)
8386
)
8487
);
8588
} catch (e) {

x-pack/plugins/ml/public/application/trained_models/models_management/models_list.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export const ModelsList: FC = () => {
8282
services: {
8383
application: { navigateToUrl, capabilities },
8484
overlays,
85+
theme,
8586
},
8687
} = useMlKibana();
8788
const urlLocator = useMlLocator()!;
@@ -112,7 +113,7 @@ export const ModelsList: FC = () => {
112113
{}
113114
);
114115

115-
const getUserConfirmation = useMemo(() => getUserConfirmationProvider(overlays), []);
116+
const getUserConfirmation = useMemo(() => getUserConfirmationProvider(overlays, theme), []);
116117

117118
const navigateToPath = useNavigateToPath();
118119

x-pack/plugins/ml/public/application/util/dependency_cache.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type {
1616
DocLinksStart,
1717
ToastsStart,
1818
OverlayStart,
19+
ThemeServiceStart,
1920
ChromeRecentlyAccessed,
2021
IBasePath,
2122
} from 'kibana/public';
@@ -34,6 +35,7 @@ export interface DependencyCache {
3435
docLinks: DocLinksStart | null;
3536
toastNotifications: ToastsStart | null;
3637
overlays: OverlayStart | null;
38+
theme: ThemeServiceStart | null;
3739
recentlyAccessed: ChromeRecentlyAccessed | null;
3840
fieldFormats: DataPublicPluginStart['fieldFormats'] | null;
3941
autocomplete: DataPublicPluginStart['autocomplete'] | null;
@@ -57,6 +59,7 @@ const cache: DependencyCache = {
5759
docLinks: null,
5860
toastNotifications: null,
5961
overlays: null,
62+
theme: null,
6063
recentlyAccessed: null,
6164
fieldFormats: null,
6265
autocomplete: null,
@@ -80,6 +83,7 @@ export function setDependencyCache(deps: Partial<DependencyCache>) {
8083
cache.docLinks = deps.docLinks || null;
8184
cache.toastNotifications = deps.toastNotifications || null;
8285
cache.overlays = deps.overlays || null;
86+
cache.theme = deps.theme || null;
8387
cache.recentlyAccessed = deps.recentlyAccessed || null;
8488
cache.fieldFormats = deps.fieldFormats || null;
8589
cache.autocomplete = deps.autocomplete || null;
@@ -128,6 +132,13 @@ export function getOverlays() {
128132
return cache.overlays;
129133
}
130134

135+
export function getTheme() {
136+
if (cache.theme === null) {
137+
throw new Error("theme hasn't been initialized");
138+
}
139+
return cache.theme;
140+
}
141+
131142
export function getUiSettings() {
132143
if (cache.config === null) {
133144
throw new Error("uiSettings hasn't been initialized");

x-pack/plugins/ml/public/embeddables/anomaly_charts/anomaly_charts_embeddable.tsx

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import ReactDOM from 'react-dom';
1010
import { CoreStart } from 'kibana/public';
1111
import { i18n } from '@kbn/i18n';
1212
import { Subject } from 'rxjs';
13-
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public';
13+
import {
14+
KibanaContextProvider,
15+
KibanaThemeProvider,
16+
} from '../../../../../../src/plugins/kibana_react/public';
1417
import { Embeddable, IContainer } from '../../../../../../src/plugins/embeddable/public';
1518
import { EmbeddableAnomalyChartsContainer } from './embeddable_anomaly_charts_container_lazy';
1619
import type { JobId } from '../../../common/types/anomaly_detection_jobs';
@@ -96,22 +99,25 @@ export class AnomalyChartsEmbeddable extends Embeddable<
9699
this.node = node;
97100

98101
const I18nContext = this.services[0].i18n.Context;
102+
const theme$ = this.services[0].theme.theme$;
99103

100104
ReactDOM.render(
101105
<I18nContext>
102-
<KibanaContextProvider services={{ ...this.services[0] }}>
103-
<Suspense fallback={<EmbeddableLoading />}>
104-
<EmbeddableAnomalyChartsContainer
105-
id={this.input.id}
106-
embeddableContext={this}
107-
embeddableInput={this.getInput$()}
108-
services={this.services}
109-
refresh={this.reload$.asObservable()}
110-
onInputChange={this.updateInput.bind(this)}
111-
onOutputChange={this.updateOutput.bind(this)}
112-
/>
113-
</Suspense>
114-
</KibanaContextProvider>
106+
<KibanaThemeProvider theme$={theme$}>
107+
<KibanaContextProvider services={{ ...this.services[0] }}>
108+
<Suspense fallback={<EmbeddableLoading />}>
109+
<EmbeddableAnomalyChartsContainer
110+
id={this.input.id}
111+
embeddableContext={this}
112+
embeddableInput={this.getInput$()}
113+
services={this.services}
114+
refresh={this.reload$.asObservable()}
115+
onInputChange={this.updateInput.bind(this)}
116+
onOutputChange={this.updateOutput.bind(this)}
117+
/>
118+
</Suspense>
119+
</KibanaContextProvider>
120+
</KibanaThemeProvider>
115121
</I18nContext>,
116122
node
117123
);

0 commit comments

Comments
 (0)