Skip to content

Commit 0d55b10

Browse files
committed
Merge remote-tracking branch 'upstream/main' into ad-hoc-management-screen-2
2 parents ea520f4 + d60acf8 commit 0d55b10

File tree

144 files changed

+2296
-1412
lines changed

Some content is hidden

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

144 files changed

+2296
-1412
lines changed

.buildkite/scripts/steps/storybooks/build_and_upload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const STORYBOOKS = [
1515
'apm',
1616
'canvas',
1717
'ci_composite',
18-
'cloud',
18+
'cloud_chat',
1919
'coloring',
2020
'chart_icons',
2121
'controls',

docs/developer/plugin-list.asciidoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,22 @@ The plugin exposes the static DefaultEditorController class to consume.
424424
|The cloud plugin adds Cloud-specific features to Kibana.
425425
426426
427+
|{kib-repo}blob/{branch}/x-pack/plugins/cloud_integrations/cloud_chat/README.md[cloudChat]
428+
|Integrates with DriftChat in order to provide live support to our Elastic Cloud users. This plugin should only run on Elastic Cloud.
429+
430+
427431
|{kib-repo}blob/{branch}/x-pack/plugins/cloud_integrations/cloud_experiments/README.mdx[cloudExperiments]
428432
|The Cloud Experiments Service provides the necessary APIs to implement A/B testing scenarios, fetching the variations in configuration and reporting back metrics to track conversion rates of the experiments.
429433
430434
435+
|{kib-repo}blob/{branch}/x-pack/plugins/cloud_integrations/cloud_full_story/README.md[cloudFullStory]
436+
|Integrates with FullStory in order to provide better product analytics, so we can understand how our users make use of Kibana. This plugin should only run on Elastic Cloud.
437+
438+
439+
|{kib-repo}blob/{branch}/x-pack/plugins/cloud_integrations/cloud_links/README.md[cloudLinks]
440+
|Adds all the links to the Elastic Cloud console.
441+
442+
431443
|{kib-repo}blob/{branch}/x-pack/plugins/cloud_security_posture/README.md[cloudSecurityPosture]
432444
|Cloud Posture automates the identification and remediation of risks across cloud infrastructures
433445

packages/kbn-optimizer/limits.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ pageLoadAssetSize:
1010
cases: 144442
1111
charts: 55000
1212
cloud: 21076
13+
cloudChat: 19894
1314
cloudExperiments: 59358
15+
cloudFullStory: 18493
16+
cloudLinks: 17629
1417
cloudSecurityPosture: 19109
1518
console: 46091
1619
controls: 40000

src/dev/storybook/aliases.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const storybookAliases = {
1111
apm: 'x-pack/plugins/apm/.storybook',
1212
canvas: 'x-pack/plugins/canvas/storybook',
1313
ci_composite: '.ci/.storybook',
14-
cloud: 'x-pack/plugins/cloud/.storybook',
14+
cloud_chat: 'x-pack/plugins/cloud_integrations/cloud_chat/.storybook',
1515
coloring: 'packages/kbn-coloring/.storybook',
1616
chart_icons: 'packages/kbn-chart-icons/.storybook',
1717
content_management: 'packages/content-management/.storybook',

src/plugins/home/kibana.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"server": true,
99
"ui": true,
1010
"requiredPlugins": ["dataViews", "share", "urlForwarding"],
11-
"optionalPlugins": ["usageCollection", "customIntegrations"],
11+
"optionalPlugins": ["usageCollection", "customIntegrations", "cloud"],
1212
"requiredBundles": ["kibanaReact"]
1313
}

src/plugins/home/public/plugin.test.ts

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { HomePublicPlugin } from './plugin';
1111
import { coreMock } from '@kbn/core/public/mocks';
1212
import { urlForwardingPluginMock } from '@kbn/url-forwarding-plugin/public/mocks';
1313
import { SharePluginSetup } from '@kbn/share-plugin/public';
14+
import { cloudMock } from '@kbn/cloud-plugin/public/mocks';
1415

1516
const mockInitializerContext = coreMock.createPluginInitializerContext();
1617
const mockShare = {} as SharePluginSetup;
@@ -24,14 +25,11 @@ describe('HomePublicPlugin', () => {
2425
});
2526

2627
describe('setup', () => {
27-
test('registers tutorial directory to feature catalogue', async () => {
28-
const setup = await new HomePublicPlugin(mockInitializerContext).setup(
29-
coreMock.createSetup() as any,
30-
{
31-
share: mockShare,
32-
urlForwarding: urlForwardingPluginMock.createSetupContract(),
33-
}
34-
);
28+
test('registers tutorial directory to feature catalogue', () => {
29+
const setup = new HomePublicPlugin(mockInitializerContext).setup(coreMock.createSetup(), {
30+
share: mockShare,
31+
urlForwarding: urlForwardingPluginMock.createSetupContract(),
32+
});
3533
expect(setup).toHaveProperty('featureCatalogue');
3634
expect(setup.featureCatalogue.register).toHaveBeenCalledTimes(1);
3735
expect(setup.featureCatalogue.register).toHaveBeenCalledWith(
@@ -44,53 +42,73 @@ describe('HomePublicPlugin', () => {
4442
);
4543
});
4644

47-
test('wires up and returns registry', async () => {
48-
const setup = await new HomePublicPlugin(mockInitializerContext).setup(
49-
coreMock.createSetup() as any,
50-
{
51-
share: mockShare,
52-
urlForwarding: urlForwardingPluginMock.createSetupContract(),
53-
}
54-
);
45+
test('wires up and returns registry', () => {
46+
const setup = new HomePublicPlugin(mockInitializerContext).setup(coreMock.createSetup(), {
47+
share: mockShare,
48+
urlForwarding: urlForwardingPluginMock.createSetupContract(),
49+
});
5550
expect(setup).toHaveProperty('featureCatalogue');
5651
expect(setup.featureCatalogue).toHaveProperty('register');
5752
});
5853

59-
test('wires up and returns environment service', async () => {
60-
const setup = await new HomePublicPlugin(mockInitializerContext).setup(
61-
coreMock.createSetup() as any,
62-
{
63-
share: {} as SharePluginSetup,
64-
urlForwarding: urlForwardingPluginMock.createSetupContract(),
65-
}
66-
);
54+
test('wires up and returns environment service', () => {
55+
const setup = new HomePublicPlugin(mockInitializerContext).setup(coreMock.createSetup(), {
56+
share: {} as SharePluginSetup,
57+
urlForwarding: urlForwardingPluginMock.createSetupContract(),
58+
});
6759
expect(setup).toHaveProperty('environment');
6860
expect(setup.environment).toHaveProperty('update');
6961
});
7062

71-
test('wires up and returns tutorial service', async () => {
72-
const setup = await new HomePublicPlugin(mockInitializerContext).setup(
73-
coreMock.createSetup() as any,
74-
{
75-
share: mockShare,
76-
urlForwarding: urlForwardingPluginMock.createSetupContract(),
77-
}
78-
);
63+
test('wires up and returns tutorial service', () => {
64+
const setup = new HomePublicPlugin(mockInitializerContext).setup(coreMock.createSetup(), {
65+
share: mockShare,
66+
urlForwarding: urlForwardingPluginMock.createSetupContract(),
67+
});
7968
expect(setup).toHaveProperty('tutorials');
8069
expect(setup.tutorials).toHaveProperty('setVariable');
8170
});
8271

83-
test('wires up and returns welcome service', async () => {
84-
const setup = await new HomePublicPlugin(mockInitializerContext).setup(
85-
coreMock.createSetup() as any,
86-
{
87-
share: mockShare,
88-
urlForwarding: urlForwardingPluginMock.createSetupContract(),
89-
}
90-
);
72+
test('wires up and returns welcome service', () => {
73+
const setup = new HomePublicPlugin(mockInitializerContext).setup(coreMock.createSetup(), {
74+
share: mockShare,
75+
urlForwarding: urlForwardingPluginMock.createSetupContract(),
76+
});
9177
expect(setup).toHaveProperty('welcomeScreen');
9278
expect(setup.welcomeScreen).toHaveProperty('registerOnRendered');
9379
expect(setup.welcomeScreen).toHaveProperty('registerTelemetryNoticeRenderer');
9480
});
81+
82+
test('sets the cloud environment variable when the cloud plugin is present but isCloudEnabled: false', () => {
83+
const cloud = { ...cloudMock.createSetup(), isCloudEnabled: false };
84+
const plugin = new HomePublicPlugin(mockInitializerContext);
85+
const setup = plugin.setup(coreMock.createSetup(), {
86+
cloud,
87+
share: mockShare,
88+
urlForwarding: urlForwardingPluginMock.createSetupContract(),
89+
});
90+
expect(setup.environment.update).toHaveBeenCalledTimes(1);
91+
expect(setup.environment.update).toHaveBeenCalledWith({ cloud: false });
92+
expect(setup.tutorials.setVariable).toHaveBeenCalledTimes(0);
93+
});
94+
95+
test('when cloud is enabled, it sets the cloud environment and the tutorials variable "cloud"', () => {
96+
const cloud = { ...cloudMock.createSetup(), isCloudEnabled: true };
97+
const plugin = new HomePublicPlugin(mockInitializerContext);
98+
const setup = plugin.setup(coreMock.createSetup(), {
99+
cloud,
100+
share: mockShare,
101+
urlForwarding: urlForwardingPluginMock.createSetupContract(),
102+
});
103+
expect(setup.environment.update).toHaveBeenCalledTimes(1);
104+
expect(setup.environment.update).toHaveBeenCalledWith({ cloud: true });
105+
expect(setup.tutorials.setVariable).toHaveBeenCalledTimes(1);
106+
expect(setup.tutorials.setVariable).toHaveBeenCalledWith('cloud', {
107+
id: 'mock-cloud-id',
108+
baseUrl: 'base-url',
109+
deploymentUrl: 'deployment-url',
110+
profileUrl: 'profile-url',
111+
});
112+
});
95113
});
96114
});

src/plugins/home/public/plugin.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
2020
import { UrlForwardingSetup, UrlForwardingStart } from '@kbn/url-forwarding-plugin/public';
2121
import { AppNavLinkStatus } from '@kbn/core/public';
2222
import { SharePluginSetup } from '@kbn/share-plugin/public';
23+
import type { CloudSetup } from '@kbn/cloud-plugin/public';
2324
import { PLUGIN_ID, HOME_APP_BASE_PATH } from '../common/constants';
2425
import { setServices } from './application/kibana_services';
2526
import { ConfigSchema } from '../config';
@@ -42,6 +43,7 @@ export interface HomePluginStartDependencies {
4243
}
4344

4445
export interface HomePluginSetupDependencies {
46+
cloud?: CloudSetup;
4547
share: SharePluginSetup;
4648
usageCollection?: UsageCollectionSetup;
4749
urlForwarding: UrlForwardingSetup;
@@ -66,7 +68,7 @@ export class HomePublicPlugin
6668

6769
public setup(
6870
core: CoreSetup<HomePluginStartDependencies>,
69-
{ share, urlForwarding, usageCollection }: HomePluginSetupDependencies
71+
{ cloud, share, urlForwarding, usageCollection }: HomePluginSetupDependencies
7072
): HomePublicPluginSetup {
7173
core.application.register({
7274
id: PLUGIN_ID,
@@ -127,10 +129,25 @@ export class HomePublicPlugin
127129
order: 500,
128130
});
129131

132+
const environment = { ...this.environmentService.setup() };
133+
const tutorials = { ...this.tutorialService.setup() };
134+
if (cloud) {
135+
environment.update({ cloud: cloud.isCloudEnabled });
136+
if (cloud.isCloudEnabled) {
137+
tutorials.setVariable('cloud', {
138+
id: cloud.cloudId,
139+
baseUrl: cloud.baseUrl,
140+
// Cloud's API already provides the full URLs
141+
profileUrl: cloud.profileUrl?.replace(cloud.baseUrl ?? '', ''),
142+
deploymentUrl: cloud.deploymentUrl?.replace(cloud.baseUrl ?? '', ''),
143+
});
144+
}
145+
}
146+
130147
return {
131148
featureCatalogue,
132-
environment: { ...this.environmentService.setup() },
133-
tutorials: { ...this.tutorialService.setup() },
149+
environment,
150+
tutorials,
134151
addData: { ...this.addDataService.setup() },
135152
welcomeScreen: { ...this.welcomeService.setup() },
136153
};

src/plugins/home/public/services/environment/environment.mock.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ const createSetupMock = (): jest.Mocked<EnvironmentServiceSetup> => {
1818

1919
const createMock = (): jest.Mocked<PublicMethodsOf<EnvironmentService>> => {
2020
const service = {
21-
setup: jest.fn(),
21+
setup: jest.fn(createSetupMock),
2222
getEnvironment: jest.fn(() => ({
2323
cloud: false,
2424
apmUi: false,
2525
ml: false,
2626
})),
2727
};
28-
service.setup.mockImplementation(createSetupMock);
2928
return service;
3029
};
3130

src/plugins/home/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
{ "path": "../kibana_react/tsconfig.json" },
1616
{ "path": "../share/tsconfig.json" },
1717
{ "path": "../url_forwarding/tsconfig.json" },
18-
{ "path": "../usage_collection/tsconfig.json" }
18+
{ "path": "../usage_collection/tsconfig.json" },
19+
{ "path": "../../../x-pack/plugins/cloud/tsconfig.json" }
1920
]
2021
}

test/plugin_functional/config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
6060
'--corePluginDeprecations.noLongerUsed=still_using',
6161
// for testing set buffer duration to 0 to immediately flush counters into saved objects.
6262
'--usageCollection.usageCounters.bufferDuration=0',
63+
// explicitly enable the cloud integration plugins to validate the rendered config keys
64+
'--xpack.cloud_integrations.chat.enabled=true',
65+
'--xpack.cloud_integrations.chat.chatURL=a_string',
66+
'--xpack.cloud_integrations.experiments.enabled=true',
67+
'--xpack.cloud_integrations.experiments.launch_darkly.sdk_key=a_string',
68+
'--xpack.cloud_integrations.experiments.launch_darkly.client_id=a_string',
69+
'--xpack.cloud_integrations.full_story.enabled=true',
70+
'--xpack.cloud_integrations.full_story.org_id=a_string',
6371
...plugins.map(
6472
(pluginDir) => `--plugin-path=${path.resolve(__dirname, 'plugins', pluginDir)}`
6573
),

0 commit comments

Comments
 (0)