Skip to content

Commit 21a0631

Browse files
committed
Merge remote-tracking branch 'upstream/master' into alerts-create-form-ui-flyout
# Conflicts: # x-pack/legacy/plugins/triggers_actions_ui/np_ready/public/application/sections/action_connector_form/action_connector_form.test.tsx # x-pack/legacy/plugins/triggers_actions_ui/np_ready/public/application/sections/action_connector_form/connector_add_flyout.test.tsx # x-pack/legacy/plugins/triggers_actions_ui/np_ready/public/application/sections/alerts_list/components/alerts_list.tsx # x-pack/legacy/plugins/triggers_actions_ui/np_ready/public/types.ts
2 parents 87d6a9b + 4f4d3d7 commit 21a0631

File tree

264 files changed

+5823
-1871
lines changed

Some content is hidden

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

264 files changed

+5823
-1871
lines changed

.github/CODEOWNERS

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,7 @@
2828
/src/plugins/dev_tools/ @elastic/kibana-app
2929

3030
# App Architecture
31-
/src/plugins/data/ @elastic/kibana-app-arch
32-
/src/plugins/embeddable/ @elastic/kibana-app-arch
33-
/src/plugins/expressions/ @elastic/kibana-app-arch
34-
/src/plugins/kibana_react/ @elastic/kibana-app-arch
35-
/src/plugins/kibana_utils/ @elastic/kibana-app-arch
36-
/src/plugins/navigation/ @elastic/kibana-app-arch
37-
/src/plugins/ui_actions/ @elastic/kibana-app-arch
38-
/src/plugins/visualizations/ @elastic/kibana-app-arch
39-
/x-pack/plugins/advanced_ui_actions/ @elastic/kibana-app-arch
31+
/packages/kbn-interpreter/ @elastic/kibana-app-arch
4032
/src/legacy/core_plugins/data/ @elastic/kibana-app-arch
4133
/src/legacy/core_plugins/elasticsearch/lib/create_proxy.js @elastic/kibana-app-arch
4234
/src/legacy/core_plugins/embeddable_api/ @elastic/kibana-app-arch
@@ -48,6 +40,19 @@
4840
/src/legacy/core_plugins/kibana/server/routes/api/suggestions/ @elastic/kibana-app-arch
4941
/src/legacy/core_plugins/visualizations/ @elastic/kibana-app-arch
5042
/src/legacy/server/index_patterns/ @elastic/kibana-app-arch
43+
/src/plugins/bfetch/ @elastic/kibana-app-arch
44+
/src/plugins/dashboard_embeddable_container/ @elastic/kibana-app-arch
45+
/src/plugins/data/ @elastic/kibana-app-arch
46+
/src/plugins/embeddable/ @elastic/kibana-app-arch
47+
/src/plugins/expressions/ @elastic/kibana-app-arch
48+
/src/plugins/inspector/ @elastic/kibana-app-arch
49+
/src/plugins/kibana_react/ @elastic/kibana-app-arch
50+
/src/plugins/kibana_utils/ @elastic/kibana-app-arch
51+
/src/plugins/management/ @elastic/kibana-app-arch
52+
/src/plugins/navigation/ @elastic/kibana-app-arch
53+
/src/plugins/ui_actions/ @elastic/kibana-app-arch
54+
/src/plugins/visualizations/ @elastic/kibana-app-arch
55+
/x-pack/plugins/advanced_ui_actions/ @elastic/kibana-app-arch
5156

5257
# APM
5358
/x-pack/legacy/plugins/apm/ @elastic/apm-ui

packages/kbn-test/src/functional_test_runner/lib/config/read_config_file.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async function getSettingsFromFile(log: ToolingLog, path: string, settingOverrid
5656
return transformDeprecations(settingsWithDefaults, logDeprecation);
5757
}
5858

59-
export async function readConfigFile(log: ToolingLog, path: string, settingOverrides: any) {
59+
export async function readConfigFile(log: ToolingLog, path: string, settingOverrides: any = {}) {
6060
return new Config({
6161
settings: await getSettingsFromFile(log, path, settingOverrides),
6262
primary: true,
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import React from 'react';
21+
import { mount } from 'enzyme';
22+
23+
import { AppContainer } from './app_container';
24+
import { Mounter, AppMountParameters, AppStatus } from '../types';
25+
26+
describe('AppContainer', () => {
27+
const appId = 'someApp';
28+
const setAppLeaveHandler = jest.fn();
29+
30+
const flushPromises = async () => {
31+
await new Promise(async resolve => {
32+
setImmediate(() => resolve());
33+
});
34+
};
35+
36+
const createResolver = (): [Promise<void>, () => void] => {
37+
let resolve: () => void | undefined;
38+
const promise = new Promise<void>(r => {
39+
resolve = r;
40+
});
41+
return [promise, resolve!];
42+
};
43+
44+
const createMounter = (promise: Promise<void>): Mounter => ({
45+
appBasePath: '/base-path',
46+
appRoute: '/some-route',
47+
unmountBeforeMounting: false,
48+
mount: async ({ element }: AppMountParameters) => {
49+
await promise;
50+
const container = document.createElement('div');
51+
container.innerHTML = 'some-content';
52+
element.appendChild(container);
53+
return () => container.remove();
54+
},
55+
});
56+
57+
it('should hide the "not found" page before mounting the route', async () => {
58+
const [waitPromise, resolvePromise] = createResolver();
59+
const mounter = createMounter(waitPromise);
60+
61+
const wrapper = mount(
62+
<AppContainer
63+
appId={appId}
64+
appStatus={AppStatus.inaccessible}
65+
mounter={mounter}
66+
setAppLeaveHandler={setAppLeaveHandler}
67+
/>
68+
);
69+
70+
expect(wrapper.text()).toContain('Application Not Found');
71+
72+
wrapper.setProps({
73+
appId,
74+
setAppLeaveHandler,
75+
mounter,
76+
appStatus: AppStatus.accessible,
77+
});
78+
wrapper.update();
79+
80+
expect(wrapper.text()).toEqual('');
81+
82+
resolvePromise();
83+
await flushPromises();
84+
wrapper.update();
85+
86+
expect(wrapper.text()).toContain('some-content');
87+
});
88+
});

src/core/public/application/ui/app_container.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,27 @@ export const AppContainer: FunctionComponent<Props> = ({
5353
unmountRef.current = null;
5454
}
5555
};
56-
const mount = async () => {
57-
if (!mounter || appStatus !== AppStatus.accessible) {
58-
return setAppNotFound(true);
59-
}
6056

61-
if (mounter.unmountBeforeMounting) {
62-
unmount();
63-
}
57+
if (!mounter || appStatus !== AppStatus.accessible) {
58+
return setAppNotFound(true);
59+
}
60+
setAppNotFound(false);
6461

62+
if (mounter.unmountBeforeMounting) {
63+
unmount();
64+
}
65+
66+
const mount = async () => {
6567
unmountRef.current =
6668
(await mounter.mount({
6769
appBasePath: mounter.appBasePath,
6870
element: elementRef.current!,
6971
onAppLeave: handler => setAppLeaveHandler(appId, handler),
7072
})) || null;
71-
setAppNotFound(false);
7273
};
7374

7475
mount();
76+
7577
return unmount;
7678
}, [appId, appStatus, mounter, setAppLeaveHandler]);
7779

src/core/server/http/integration_tests/lifecycle.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ describe('Auth', () => {
721721
res.ok({
722722
headers: {
723723
'www-authenticate': 'from handler',
724+
'another-header': 'yet another header',
724725
},
725726
})
726727
);

src/core/server/http/lifecycle/on_pre_response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ export function adoptToHapiOnPreResponseFormat(fn: OnPreResponseHandler, log: Lo
120120
...(result.headers as any), // hapi types don't specify string[] as valid value
121121
};
122122
} else {
123+
findHeadersIntersection(response.headers, result.headers, log);
123124
for (const [headerName, headerValue] of Object.entries(result.headers)) {
124-
findHeadersIntersection(response.headers, result.headers, log);
125125
response.header(headerName, headerValue as any); // hapi types don't specify string[] as valid value
126126
}
127127
}

src/dev/ci_setup/setup_env.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,23 @@ export KIBANA_PKG_BRANCH="$kbnBranch"
5656
###
5757
### download node
5858
###
59+
nodeVersion="$(cat "$dir/.node-version")"
60+
nodeDir="$cacheDir/node/$nodeVersion"
61+
nodeBin="$nodeDir/bin"
62+
classifier="x64.tar.gz"
63+
5964
UNAME=$(uname)
6065
OS="linux"
6166
if [[ "$UNAME" = *"MINGW64_NT"* ]]; then
6267
OS="win"
68+
nodeBin="$HOME/node"
69+
classifier="x64.zip"
70+
elif [[ "$UNAME" == "Darwin" ]]; then
71+
OS="darwin"
6372
fi
6473
echo " -- Running on OS: $OS"
6574

66-
nodeVersion="$(cat "$dir/.node-version")"
67-
nodeDir="$cacheDir/node/$nodeVersion"
68-
69-
if [[ "$OS" == "win" ]]; then
70-
nodeBin="$HOME/node"
71-
nodeUrl="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v$nodeVersion/node-v$nodeVersion-win-x64.zip"
72-
else
73-
nodeBin="$nodeDir/bin"
74-
nodeUrl="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v$nodeVersion/node-v$nodeVersion-linux-x64.tar.gz"
75-
fi
75+
nodeUrl="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v$nodeVersion/node-v$nodeVersion-${OS}-${classifier}"
7676

7777
if [[ "$installNode" == "true" ]]; then
7878
echo " -- node: version=v${nodeVersion} dir=$nodeDir"

src/es_archiver/actions/edit.js renamed to src/es_archiver/actions/edit.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,23 @@ import Fs from 'fs';
2222
import { createGunzip, createGzip, Z_BEST_COMPRESSION } from 'zlib';
2323
import { promisify } from 'util';
2424
import globby from 'globby';
25+
import { ToolingLog } from '@kbn/dev-utils';
2526

2627
import { createPromiseFromStreams } from '../../legacy/utils';
2728

2829
const unlinkAsync = promisify(Fs.unlink);
2930

30-
export async function editAction({ prefix, dataDir, log, handler }) {
31+
export async function editAction({
32+
prefix,
33+
dataDir,
34+
log,
35+
handler,
36+
}: {
37+
prefix: string;
38+
dataDir: string;
39+
log: ToolingLog;
40+
handler: () => Promise<any>;
41+
}) {
3142
const archives = (
3243
await globby('**/*.gz', {
3344
cwd: prefix ? resolve(dataDir, prefix) : dataDir,

src/es_archiver/actions/empty_kibana_index.js renamed to src/es_archiver/actions/empty_kibana_index.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,25 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19+
20+
import { Client } from 'elasticsearch';
21+
import { ToolingLog, KbnClient } from '@kbn/dev-utils';
22+
1923
import { migrateKibanaIndex, deleteKibanaIndices, createStats } from '../lib';
2024

21-
export async function emptyKibanaIndexAction({ client, log, kbnClient }) {
25+
export async function emptyKibanaIndexAction({
26+
client,
27+
log,
28+
kbnClient,
29+
}: {
30+
client: Client;
31+
log: ToolingLog;
32+
kbnClient: KbnClient;
33+
}) {
2234
const stats = createStats('emptyKibanaIndex', log);
2335
const kibanaPluginIds = await kbnClient.plugins.getEnabledIds();
2436

25-
await deleteKibanaIndices({ client, stats });
26-
await migrateKibanaIndex({ client, log, stats, kibanaPluginIds });
37+
await deleteKibanaIndices({ client, stats, log });
38+
await migrateKibanaIndex({ client, log, kibanaPluginIds });
2739
return stats;
2840
}
File renamed without changes.

0 commit comments

Comments
 (0)