Skip to content

Commit d66f3fc

Browse files
Merge branch 'main' into fix/x-pack-test-serverless-types
2 parents 0acf688 + 7f79665 commit d66f3fc

7 files changed

Lines changed: 53 additions & 22 deletions

File tree

config/serverless.es.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ xpack.apm.enabled: false
55

66
xpack.cloudSecurityPosture.enabled: false
77
xpack.infra.enabled: false
8+
xpack.observabilityLogExplorer.enabled: false
89
xpack.observability.enabled: false
910
xpack.securitySolution.enabled: false
1011
xpack.serverless.observability.enabled: false

config/serverless.security.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
enterpriseSearch.enabled: false
55
xpack.apm.enabled: false
66
xpack.infra.enabled: false
7+
xpack.observabilityLogExplorer.enabled: false
78
xpack.observability.enabled: false
89
xpack.uptime.enabled: false
910
xpack.legacy_uptime.enabled: false

x-pack/plugins/ml/public/mocks.ts

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,33 @@ import { sharePluginMock } from '@kbn/share-plugin/public/mocks';
99
import { type ElasticModels } from './application/services/elastic_models_service';
1010
import type { MlPluginSetup, MlPluginStart } from './plugin';
1111

12+
const createElasticModelsMock = (): jest.Mocked<ElasticModels> => {
13+
return {
14+
getELSER: jest.fn().mockResolvedValue({
15+
version: 2,
16+
default: true,
17+
config: {
18+
input: {
19+
field_names: ['text_field'],
20+
},
21+
},
22+
description: 'Elastic Learned Sparse EncodeR v2 (Tech Preview)',
23+
name: '.elser_model_2',
24+
}),
25+
} as unknown as jest.Mocked<ElasticModels>;
26+
};
27+
1228
const createSetupContract = (): jest.Mocked<MlPluginSetup> => {
1329
return {
1430
locator: sharePluginMock.createLocator(),
31+
elasticModels: createElasticModelsMock(),
1532
};
1633
};
1734

1835
const createStartContract = (): jest.Mocked<MlPluginStart> => {
1936
return {
2037
locator: sharePluginMock.createLocator(),
21-
elasticModels: {
22-
getELSER: jest.fn(() =>
23-
Promise.resolve({
24-
version: 2,
25-
default: true,
26-
config: {
27-
input: {
28-
field_names: ['text_field'],
29-
},
30-
},
31-
description: 'Elastic Learned Sparse EncodeR v2 (Tech Preview)',
32-
name: '.elser_model_2',
33-
})
34-
),
35-
} as unknown as jest.Mocked<ElasticModels>,
38+
elasticModels: createElasticModelsMock(),
3639
};
3740
};
3841

x-pack/plugins/ml/public/plugin.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { take } from 'rxjs/operators';
1818

1919
import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public';
2020
import type { ManagementSetup } from '@kbn/management-plugin/public';
21-
import type { SharePluginSetup, SharePluginStart } from '@kbn/share-plugin/public';
21+
import type { LocatorPublic, SharePluginSetup, SharePluginStart } from '@kbn/share-plugin/public';
2222
import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
2323
import type { HomePublicPluginSetup } from '@kbn/home-plugin/public';
2424
import type { EmbeddableSetup, EmbeddableStart } from '@kbn/embeddable-plugin/public';
@@ -54,7 +54,7 @@ import {
5454
MlSharedServices,
5555
} from './application/services/get_shared_ml_services';
5656
import { registerManagementSection } from './application/management';
57-
import { MlLocatorDefinition, type MlLocator } from './locator';
57+
import { MlLocatorDefinition, MlLocatorParams, type MlLocator } from './locator';
5858
import { setDependencyCache } from './application/util/dependency_cache';
5959
import { registerHomeFeature } from './register_home_feature';
6060
import { isFullLicense, isMlEnabled } from '../common/license';
@@ -67,6 +67,7 @@ import {
6767
type ConfigSchema,
6868
} from '../common/constants/app';
6969
import type { MlCapabilities } from './shared';
70+
import { ElasticModels } from './application/services/elastic_models_service';
7071

7172
export interface MlStartDependencies {
7273
dataViewEditor: DataViewEditorStart;
@@ -131,7 +132,10 @@ export class MlPlugin implements Plugin<MlPluginSetup, MlPluginStart> {
131132
initEnabledFeatures(this.enabledFeatures, initializerContext.config.get());
132133
}
133134

134-
setup(core: MlCoreSetup, pluginsSetup: MlSetupDependencies) {
135+
setup(
136+
core: MlCoreSetup,
137+
pluginsSetup: MlSetupDependencies
138+
): { locator?: LocatorPublic<MlLocatorParams>; elasticModels?: ElasticModels } {
135139
this.sharedMlServices = getMlSharedServices(core.http);
136140

137141
core.application.register({
@@ -262,10 +266,14 @@ export class MlPlugin implements Plugin<MlPluginSetup, MlPluginStart> {
262266

263267
return {
264268
locator: this.locator,
269+
elasticModels: this.sharedMlServices.elasticModels,
265270
};
266271
}
267272

268-
start(core: CoreStart, deps: MlStartDependencies) {
273+
start(
274+
core: CoreStart,
275+
deps: MlStartDependencies
276+
): { locator?: LocatorPublic<MlLocatorParams>; elasticModels?: ElasticModels } {
269277
setDependencyCache({
270278
docLinks: core.docLinks!,
271279
basePath: core.http.basePath,

x-pack/plugins/observability_log_explorer/public/components/log_explorer_top_nav_menu.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* 2.0.
66
*/
77

8-
import React, { useEffect } from 'react';
8+
import React, { useEffect, useState } from 'react';
99
import deepEqual from 'fast-deep-equal';
1010
import useObservable from 'react-use/lib/useObservable';
11-
import { type BehaviorSubject, distinctUntilChanged } from 'rxjs';
11+
import { type BehaviorSubject, distinctUntilChanged, filter, take } from 'rxjs';
1212
import { HeaderMenuPortal } from '@kbn/observability-shared-plugin/public';
1313
import { AppMountParameters } from '@kbn/core-application-browser';
1414
import {
@@ -111,6 +111,16 @@ const StatefulTopNav = ({
111111
}: LogExplorerTopNavMenuProps) => {
112112
const { euiTheme } = useEuiTheme();
113113

114+
/**
115+
* Since the breadcrumbsAppendExtension might be set only during a plugin start (e.g. search session)
116+
* we retrieve the latest valid extension in order to restore it once we unmount the beta badge.
117+
*/
118+
const [previousAppendExtension$] = useState(() =>
119+
services.chrome.getBreadcrumbsAppendExtension$().pipe(filter(Boolean), take(1))
120+
);
121+
122+
const previousAppendExtension = useObservable(previousAppendExtension$);
123+
114124
useEffect(() => {
115125
const { chrome, i18n, theme } = services;
116126

@@ -137,7 +147,13 @@ const StatefulTopNav = ({
137147
),
138148
});
139149
}
140-
}, [euiTheme, services]);
150+
151+
return () => {
152+
if (chrome) {
153+
chrome.setBreadcrumbsAppendExtension(previousAppendExtension);
154+
}
155+
};
156+
}, [euiTheme, services, previousAppendExtension]);
141157

142158
return (
143159
<HeaderMenuPortal setHeaderActionMenu={setHeaderActionMenu} theme$={theme$}>

x-pack/plugins/observability_log_explorer/public/plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export class ObservabilityLogExplorerPlugin
5555
? AppNavLinkStatus.visible
5656
: AppNavLinkStatus.hidden,
5757
searchable: true,
58+
keywords: ['logs', 'log', 'explorer', 'logs explorer'],
5859
mount: async (appMountParams) => {
5960
const [coreStart, pluginsStart, ownPluginStart] = await core.getStartServices();
6061

x-pack/plugins/observability_log_explorer/server/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { PluginConfigDescriptor } from '@kbn/core/server';
1010
import { ObservabilityLogExplorerConfig } from '../common/plugin_config';
1111

1212
export const configSchema = schema.object({
13+
enabled: schema.boolean({ defaultValue: true }),
1314
navigation: schema.object({
1415
showAppLink: offeringBasedSchema({
1516
serverless: schema.boolean({

0 commit comments

Comments
 (0)