Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
Maja Grubic committed Apr 4, 2022
2 parents 8232289 + 9e1fd5e commit e10a126
Show file tree
Hide file tree
Showing 352 changed files with 11,456 additions and 5,700 deletions.
18 changes: 17 additions & 1 deletion .buildkite/scripts/steps/es_snapshots/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ echo "--- Build Elasticsearch"
:distribution:archives:darwin-aarch64-tar:assemble \
:distribution:archives:darwin-tar:assemble \
:distribution:docker:docker-export:assemble \
:distribution:docker:cloud-docker-export:assemble \
:distribution:archives:linux-aarch64-tar:assemble \
:distribution:archives:linux-tar:assemble \
:distribution:archives:windows-zip:assemble \
Expand All @@ -79,11 +80,26 @@ find distribution -type f \( -name 'elasticsearch-*-*-*-*.tar.gz' -o -name 'elas

ls -alh "$destination"

echo "--- Create docker image archives"
echo "--- Create docker default image archives"
docker images "docker.elastic.co/elasticsearch/elasticsearch"
docker images "docker.elastic.co/elasticsearch/elasticsearch" --format "{{.Tag}}" | xargs -n1 echo 'docker save docker.elastic.co/elasticsearch/elasticsearch:${0} | gzip > ../es-build/elasticsearch-${0}-docker-image.tar.gz'
docker images "docker.elastic.co/elasticsearch/elasticsearch" --format "{{.Tag}}" | xargs -n1 bash -c 'docker save docker.elastic.co/elasticsearch/elasticsearch:${0} | gzip > ../es-build/elasticsearch-${0}-docker-image.tar.gz'

echo "--- Create kibana-ci docker cloud image archives"
ES_CLOUD_ID=$(docker images "docker.elastic.co/elasticsearch-ci/elasticsearch-cloud" --format "{{.ID}}")
ES_CLOUD_VERSION=$(docker images "docker.elastic.co/elasticsearch-ci/elasticsearch-cloud" --format "{{.Tag}}")
KIBANA_ES_CLOUD_VERSION="$ES_CLOUD_VERSION-$ELASTICSEARCH_GIT_COMMIT"
KIBANA_ES_CLOUD_IMAGE="docker.elastic.co/kibana-ci/elasticsearch-cloud:$KIBANA_ES_CLOUD_VERSION"

docker tag "$ES_CLOUD_ID" "$KIBANA_ES_CLOUD_IMAGE"

echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co
trap 'docker logout docker.elastic.co' EXIT
docker image push "$KIBANA_ES_CLOUD_IMAGE"

export ELASTICSEARCH_CLOUD_IMAGE="$KIBANA_ES_CLOUD_IMAGE"
export ELASTICSEARCH_CLOUD_IMAGE_CHECKSUM="$(docker images "$KIBANA_ES_CLOUD_IMAGE" --format "{{.Digest}}")"

echo "--- Create checksums for snapshot files"
cd "$destination"
find ./* -exec bash -c "shasum -a 512 {} > {}.sha512" \;
Expand Down
13 changes: 13 additions & 0 deletions .buildkite/scripts/steps/es_snapshots/create_manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const { BASE_BUCKET_DAILY } = require('./bucket_config.js');
const destination = process.argv[2] || __dirname + '/test';

const ES_BRANCH = process.env.ELASTICSEARCH_BRANCH;
const ES_CLOUD_IMAGE = process.env.ELASTICSEARCH_CLOUD_IMAGE;
const ES_CLOUD_IMAGE_CHECKSUM = process.env.ELASTICSEARCH_CLOUD_IMAGE_CHECKSUM;
const GIT_COMMIT = process.env.ELASTICSEARCH_GIT_COMMIT;
const GIT_COMMIT_SHORT = process.env.ELASTICSEARCH_GIT_COMMIT_SHORT;

Expand Down Expand Up @@ -59,6 +61,17 @@ const { BASE_BUCKET_DAILY } = require('./bucket_config.js');
};
});

if (ES_CLOUD_IMAGE && ES_CLOUD_IMAGE_CHECKSUM) {
manifestEntries.push({
checksum: ES_CLOUD_IMAGE_CHECKSUM,
url: ES_CLOUD_IMAGE,
version: VERSION,
platform: 'docker',
architecture: 'image',
license: 'default',
});
}

const manifest = {
id: SNAPSHOT_ID,
bucket: `${BASE_BUCKET_DAILY}/${DESTINATION}`.toString(),
Expand Down
7 changes: 1 addition & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,7 @@ module.exports = {
* Licence headers
*/
{
files: [
'**/*.{js,mjs,ts,tsx}',
'!plugins/**/*',
'!packages/elastic-datemath/**/*',
'!packages/elastic-eslint-config-kibana/**/*',
],
files: ['**/*.{js,mjs,ts,tsx}'],
rules: {
'@kbn/eslint/require-license-header': [
'error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ export interface ApplicationStart
| --- | --- |
| [getUrlForApp(appId, options)](./kibana-plugin-core-public.applicationstart.geturlforapp.md) | Returns the absolute path (or URL) to a given app, including the global base path.<!-- -->By default, it returns the absolute path of the application (e.g <code>/basePath/app/my-app</code>). Use the <code>absolute</code> option to generate an absolute url instead (e.g <code>http://host:port/basePath/app/my-app</code>)<!-- -->Note that when generating absolute urls, the origin (protocol, host and port) are determined from the browser's current location. |
| [navigateToApp(appId, options)](./kibana-plugin-core-public.applicationstart.navigatetoapp.md) | Navigate to a given app |
| [navigateToUrl(url)](./kibana-plugin-core-public.applicationstart.navigatetourl.md) | Navigate to given URL in a SPA friendly way when possible (when the URL will redirect to a valid application within the current basePath).<!-- -->The method resolves pathnames the same way browsers do when resolving a <code>&lt;a href&gt;</code> value. The provided <code>url</code> can be: - an absolute URL - an absolute path - a path relative to the current URL (window.location.href)<!-- -->If all these criteria are true for the given URL: - (only for absolute URLs) The origin of the URL matches the origin of the browser's current location - The resolved pathname of the provided URL/path starts with the current basePath (eg. /mybasepath/s/my-space) - The pathname segment after the basePath matches any known application route (eg. /app/<id>/ or any application's <code>appRoute</code> configuration)<!-- -->Then a SPA navigation will be performed using <code>navigateToApp</code> using the corresponding application and path. Otherwise, fallback to a full page reload to navigate to the url using <code>window.location.assign</code> |
| [navigateToUrl(url, options)](./kibana-plugin-core-public.applicationstart.navigatetourl.md) | Navigate to given URL in a SPA friendly way when possible (when the URL will redirect to a valid application within the current basePath).<!-- -->The method resolves pathnames the same way browsers do when resolving a <code>&lt;a href&gt;</code> value. The provided <code>url</code> can be: - an absolute URL - an absolute path - a path relative to the current URL (window.location.href)<!-- -->If all these criteria are true for the given URL: - (only for absolute URLs) The origin of the URL matches the origin of the browser's current location - The resolved pathname of the provided URL/path starts with the current basePath (eg. /mybasepath/s/my-space) - The pathname segment after the basePath matches any known application route (eg. /app/<id>/ or any application's <code>appRoute</code> configuration)<!-- -->Then a SPA navigation will be performed using <code>navigateToApp</code> using the corresponding application and path. Otherwise, fallback to a full page reload to navigate to the url using <code>window.location.assign</code> |

Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ Then a SPA navigation will be performed using `navigateToApp` using the correspo
<b>Signature:</b>

```typescript
navigateToUrl(url: string): Promise<void>;
navigateToUrl(url: string, options?: NavigateToUrlOptions): Promise<void>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| url | string | an absolute URL, an absolute path or a relative path, to navigate to. |
| options | NavigateToUrlOptions | |

<b>Returns:</b>

Expand Down
1 change: 1 addition & 0 deletions docs/development/core/public/kibana-plugin-core-public.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [IHttpResponseInterceptorOverrides](./kibana-plugin-core-public.ihttpresponseinterceptoroverrides.md) | Properties that can be returned by HttpInterceptor.request to override the response. |
| [IUiSettingsClient](./kibana-plugin-core-public.iuisettingsclient.md) | Client-side client that provides access to the advanced settings stored in elasticsearch. The settings provide control over the behavior of the Kibana application. For example, a user can specify how to display numeric or date fields. Users can adjust the settings via Management UI. [IUiSettingsClient](./kibana-plugin-core-public.iuisettingsclient.md) |
| [NavigateToAppOptions](./kibana-plugin-core-public.navigatetoappoptions.md) | Options for the [navigateToApp API](./kibana-plugin-core-public.applicationstart.navigatetoapp.md) |
| [NavigateToUrlOptions](./kibana-plugin-core-public.navigatetourloptions.md) | Options for the [navigateToUrl API](./kibana-plugin-core-public.applicationstart.navigatetourl.md) |
| [NotificationsSetup](./kibana-plugin-core-public.notificationssetup.md) | |
| [NotificationsStart](./kibana-plugin-core-public.notificationsstart.md) | |
| [OverlayBannersStart](./kibana-plugin-core-public.overlaybannersstart.md) | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ export interface NavigateToAppOptions
| [openInNewTab?](./kibana-plugin-core-public.navigatetoappoptions.openinnewtab.md) | boolean | <i>(Optional)</i> if true, will open the app in new tab, will share session information via window.open if base |
| [path?](./kibana-plugin-core-public.navigatetoappoptions.path.md) | string | <i>(Optional)</i> optional path inside application to deep link to. If undefined, will use [the app's default path](./kibana-plugin-core-public.app.defaultpath.md) as default. |
| [replace?](./kibana-plugin-core-public.navigatetoappoptions.replace.md) | boolean | <i>(Optional)</i> if true, will not create a new history entry when navigating (using <code>replace</code> instead of <code>push</code>) |
| [skipAppLeave?](./kibana-plugin-core-public.navigatetoappoptions.skipappleave.md) | boolean | <i>(Optional)</i> if true, will bypass the default onAppLeave behavior |
| [state?](./kibana-plugin-core-public.navigatetoappoptions.state.md) | unknown | <i>(Optional)</i> optional state to forward to the application |

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [NavigateToAppOptions](./kibana-plugin-core-public.navigatetoappoptions.md) &gt; [skipAppLeave](./kibana-plugin-core-public.navigatetoappoptions.skipappleave.md)

## NavigateToAppOptions.skipAppLeave property

if true, will bypass the default onAppLeave behavior

<b>Signature:</b>

```typescript
skipAppLeave?: boolean;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [NavigateToUrlOptions](./kibana-plugin-core-public.navigatetourloptions.md) &gt; [forceRedirect](./kibana-plugin-core-public.navigatetourloptions.forceredirect.md)

## NavigateToUrlOptions.forceRedirect property

if true, will redirect directly to the url

<b>Signature:</b>

```typescript
forceRedirect?: boolean;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [NavigateToUrlOptions](./kibana-plugin-core-public.navigatetourloptions.md)

## NavigateToUrlOptions interface

Options for the [navigateToUrl API](./kibana-plugin-core-public.applicationstart.navigatetourl.md)

<b>Signature:</b>

```typescript
export interface NavigateToUrlOptions
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [forceRedirect?](./kibana-plugin-core-public.navigatetourloptions.forceredirect.md) | boolean | <i>(Optional)</i> if true, will redirect directly to the url |
| [skipAppLeave?](./kibana-plugin-core-public.navigatetourloptions.skipappleave.md) | boolean | <i>(Optional)</i> if true, will bypass the default onAppLeave behavior |

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [NavigateToUrlOptions](./kibana-plugin-core-public.navigatetourloptions.md) &gt; [skipAppLeave](./kibana-plugin-core-public.navigatetourloptions.skipappleave.md)

## NavigateToUrlOptions.skipAppLeave property

if true, will bypass the default onAppLeave behavior

<b>Signature:</b>

```typescript
skipAppLeave?: boolean;
```
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ Please refer to [elasticsearch documentation](https://www.elastic.co/guide/en/el
```typescript
export declare type SavedObjectsFieldMapping = estypes.MappingProperty & {
dynamic?: false | 'strict';
properties?: Record<estypes.PropertyName, estypes.MappingProperty>;
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<titleabbrev>ServiceNow SecOps</titleabbrev>
++++

The {sn} SecOps connector uses the https://docs.servicenow.com/bundle/orlando-application-development/page/integrate/inbound-rest/concept/c_TableAPI.html[V2 Table API] to create {sn} security incidents.
The {sn} SecOps connector uses the https://developer.servicenow.com/dev.do#!/reference/api/sandiego/rest/c_ImportSetAPI[Import Set API] to create {sn} security incidents.

[float]
[[servicenow-sir-connector-prerequisites]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<titleabbrev>ServiceNow ITSM</titleabbrev>
++++

The {sn} ITSM connector uses the https://docs.servicenow.com/bundle/orlando-application-development/page/integrate/inbound-rest/concept/c_TableAPI.html[V2 Table API] to create {sn} incidents.
The {sn} ITSM connector uses the https://developer.servicenow.com/dev.do#!/reference/api/sandiego/rest/c_ImportSetAPI[Import Set API] to create {sn} incidents.

[float]
[[servicenow-itsm-connector-prerequisites]]
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"@elastic/apm-synthtrace": "link:bazel-bin/packages/elastic-apm-synthtrace",
"@elastic/charts": "45.1.1",
"@elastic/datemath": "link:bazel-bin/packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/[email protected].1",
"@elastic/elasticsearch": "npm:@elastic/[email protected].2",
"@elastic/ems-client": "8.2.0",
"@elastic/eui": "53.0.1",
"@elastic/filesaver": "1.1.2",
Expand Down Expand Up @@ -753,7 +753,7 @@
"callsites": "^3.1.0",
"chai": "3.5.0",
"chance": "1.0.18",
"chromedriver": "^99.0.0",
"chromedriver": "^100.0.0",
"clean-webpack-plugin": "^3.0.0",
"cmd-shim": "^2.1.0",
"compression-webpack-plugin": "^4.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
asyncSearch: `${ELASTICSEARCH_DOCS}async-search-intro.html`,
dataStreams: `${ELASTICSEARCH_DOCS}data-streams.html`,
deprecationLogging: `${ELASTICSEARCH_DOCS}logging.html#deprecation-logging`,
createIndex: `${ELASTICSEARCH_DOCS}indices-create-index.html`,
frozenIndices: `${ELASTICSEARCH_DOCS}frozen-indices.html`,
gettingStarted: `${ELASTICSEARCH_DOCS}getting-started.html`,
hiddenIndices: `${ELASTICSEARCH_DOCS}multi-index.html#hidden`,
Expand Down
68 changes: 66 additions & 2 deletions src/core/public/application/application_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -898,17 +898,24 @@ describe('#start()', () => {

it('should call private function shouldNavigate with overlays and the nextAppId', async () => {
service.setup(setupDeps);
const shouldNavigateSpy = jest.spyOn(service as any, 'shouldNavigate');

const shouldNavigateSpy = jest.spyOn(service as any, 'shouldNavigate');
const { navigateToApp } = await service.start(startDeps);

await navigateToApp('myTestApp');
expect(shouldNavigateSpy).toHaveBeenCalledWith(startDeps.overlays, 'myTestApp');

await navigateToApp('myOtherApp');
expect(shouldNavigateSpy).toHaveBeenCalledWith(startDeps.overlays, 'myOtherApp');
});

it('should call private function shouldNavigate with overlays, nextAppId and skipAppLeave', async () => {
service.setup(setupDeps);
const shouldNavigateSpy = jest.spyOn(service as any, 'shouldNavigate');
const { navigateToApp } = await service.start(startDeps);
await navigateToApp('myTestApp', { skipAppLeave: true });
expect(shouldNavigateSpy).not.toHaveBeenCalledWith(startDeps.overlays, 'myTestApp');
});

describe('when `replace` option is true', () => {
it('use `history.replace` instead of `history.push`', async () => {
service.setup(setupDeps);
Expand Down Expand Up @@ -1117,6 +1124,63 @@ describe('#start()', () => {
expect(MockHistory.push).toHaveBeenCalledWith('/app/foo/some-path', undefined);
expect(setupDeps.redirectTo).not.toHaveBeenCalled();
});

describe('navigateToUrl with options', () => {
let addListenerSpy: jest.SpyInstance;
let removeListenerSpy: jest.SpyInstance;
beforeEach(() => {
addListenerSpy = jest.spyOn(window, 'addEventListener');
removeListenerSpy = jest.spyOn(window, 'removeEventListener');
});
afterEach(() => {
jest.restoreAllMocks();
});

it('calls `navigateToApp` with `skipAppLeave` option', async () => {
parseAppUrlMock.mockReturnValue({ app: 'foo', path: '/some-path' });
service.setup(setupDeps);
const { navigateToUrl } = await service.start(startDeps);

await navigateToUrl('/an-app-path', { skipAppLeave: true });

expect(MockHistory.push).toHaveBeenCalledWith('/app/foo/some-path', undefined);
expect(setupDeps.redirectTo).not.toHaveBeenCalled();
});

it('calls `redirectTo` when `forceRedirect` option is true', async () => {
parseAppUrlMock.mockReturnValue({ app: 'foo', path: '/some-path' });
service.setup(setupDeps);

const { navigateToUrl } = await service.start(startDeps);

await navigateToUrl('/an-app-path', { forceRedirect: true });

expect(addListenerSpy).toHaveBeenCalledTimes(1);
expect(addListenerSpy).toHaveBeenCalledWith('beforeunload', expect.any(Function));

expect(setupDeps.redirectTo).toHaveBeenCalledWith('/an-app-path');
expect(MockHistory.push).not.toHaveBeenCalled();
});

it('removes the beforeunload listener and calls `redirectTo` when `forceRedirect` and `skipAppLeave` option are both true', async () => {
parseAppUrlMock.mockReturnValue({ app: 'foo', path: '/some-path' });
service.setup(setupDeps);

const { navigateToUrl } = await service.start(startDeps);

await navigateToUrl('/an-app-path', { skipAppLeave: true, forceRedirect: true });

expect(addListenerSpy).toHaveBeenCalledTimes(1);
expect(addListenerSpy).toHaveBeenCalledWith('beforeunload', expect.any(Function));
const handler = addListenerSpy.mock.calls[0][1];

expect(MockHistory.push).toHaveBeenCalledTimes(0);
expect(setupDeps.redirectTo).toHaveBeenCalledWith('/an-app-path');

expect(removeListenerSpy).toHaveBeenCalledTimes(1);
expect(removeListenerSpy).toHaveBeenCalledWith('beforeunload', handler);
});
});
});
});

Expand Down
Loading

0 comments on commit e10a126

Please sign in to comment.