Skip to content

Commit

Permalink
Merge branch 'main' of github.com:elastic/kibana into upgrade-rxjs-to-7
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo committed Apr 12, 2022
2 parents 5f203d4 + 6366f37 commit d12ca24
Show file tree
Hide file tree
Showing 82 changed files with 1,364 additions and 674 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0
5.1.1
3 changes: 0 additions & 3 deletions .buildkite/scripts/steps/functional/performance_playwright.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ sleep 120

cd "$XPACK_DIR"

jobId=$(npx uuid)
export TEST_JOB_ID="$jobId"

journeys=("ecommerce_dashboard" "flight_dashboard" "web_logs_dashboard" "promotion_tracking_dashboard")

for i in "${journeys[@]}"; do
Expand Down
3 changes: 2 additions & 1 deletion docs/api/cases.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ these APIs:
* <<cases-api-get-status>>
* <<cases-api-get-comments>>
* {security-guide}/cases-get-connector.html[Get current connector]
* {security-guide}/cases-api-get-reporters.html[Get reporters]
* <<cases-api-get-reporters>>
* <<cases-api-get-tag>>
* {security-guide}/cases-api-push.html[Push case]
* {security-guide}/assign-connector.html[Set default Elastic Security UI connector]
Expand All @@ -40,6 +40,7 @@ include::cases/cases-api-get-case-activity.asciidoc[leveloffset=+1]
include::cases/cases-api-get-case.asciidoc[leveloffset=+1]
include::cases/cases-api-get-status.asciidoc[leveloffset=+1]
include::cases/cases-api-get-comments.asciidoc[leveloffset=+1]
include::cases/cases-api-get-reporters.asciidoc[leveloffset=+1]
include::cases/cases-api-get-tags.asciidoc[leveloffset=+1]
//UPDATE
include::cases/cases-api-update.asciidoc[leveloffset=+1]
Expand Down
60 changes: 60 additions & 0 deletions docs/api/cases/cases-api-get-reporters.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[[cases-api-get-reporters]]
== Get reporters API
++++
<titleabbrev>Get reporters</titleabbrev>
++++

Returns information about the users who opened cases.

=== Request

`GET <kibana host>:<port>/api/cases/reporters`

`GET <kibana host>:<port>/s/api/cases/reporters`

=== Prerequisite

You must have `read` privileges for the *Cases* feature in the *Management*,
*{observability}*, or *Security* section of the
<<kibana-feature-privileges,{kib} feature privileges>>, depending on the
`owner` of the cases you're seeking.

=== Query parameters

`owner`::
(Optional, string or array of strings) A filter to limit the retrieved reporters
to a specific set of applications. If this parameter is omitted, the response
will contain all reporters from cases that the user has access to read.

==== Response code

`200`::
Indicates a successful call.

==== Example

Returns all case reporters:

[source,sh]
--------------------------------------------------
GET api/cases/reporters
--------------------------------------------------
// KIBANA

The API returns a JSON object with the retrieved reporters. For example:

[source,json]
--------------------------------------------------
[
{
"full_name": "Alan Hunley",
"email": "ahunley@imf.usa.gov",
"username": "ahunley"
},
{
"full_name": "Rat Hustler",
"email": "jrhustler@aol.com",
"username": "rhustler"
}
]
--------------------------------------------------
9 changes: 5 additions & 4 deletions docs/api/cases/cases-api-get-tags.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ default space is used.
=== Query parameters

`owner`::
(Optional, string) Specifies the set of applications to limit the retrieved
tags. If not specified, the response contains all tags that the user has access
to read.
(Optional, string or array of strings) Specifies the set of applications to
limit the retrieved tags. If not specified, the response contains all tags from
cases that the user has access to read.

==== Response code

Expand All @@ -51,7 +51,8 @@ GET api/cases/tags
--------------------------------------------------
// KIBANA

The API returns a JSON object with all tags for all cases. For example:
The API returns a JSON object with the names and email addresses of users who
opened cases. For example:

[source,json]
--------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ When `includeElasticMapsService` is turned off, only tile layer configured by <<
| Specifies the URL of a self hosted <<elastic-maps-server,{hosted-ems}>>

| [[tilemap-settings]] `map.tilemap.options.attribution:` {ess-icon}
| The map attribution string. Provide attributions in markdown and use '|' to delimit attributions, for example: `"[attribution 1](https://www.attribution1)|[attribution 2](https://www.attribution2)"`.
| The map attribution string. Provide attributions in markdown and use `\|` to delimit attributions, for example: `"[attribution 1](https://www.attribution1)\|[attribution 2](https://www.attribution2)"`.
*Default: `"© [Elastic Maps Service](https://www.elastic.co/elastic-maps-service)"`*

| [[tilemap-max-zoom]] `map.tilemap.options.maxZoom:` {ess-icon}
Expand Down
21 changes: 20 additions & 1 deletion packages/kbn-optimizer/src/common/bundle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import { Bundle, BundleSpec, parseBundles } from './bundle';
import { Hashes } from './hashes';
import { parseDllManifest } from './dll_manifest';

jest.mock('fs');

Expand All @@ -31,13 +32,31 @@ it('creates cache keys', () => {
].sort(() => (Math.random() > 0.5 ? 1 : -1));

const hashes = new Hashes(new Map(hashEntries));
const dllManifest = parseDllManifest({
name: 'manifest-name',
content: {
'./some-foo.ts': {
id: 1,
buildMeta: {
a: 'b',
},
unknownField: 'hi',
},
},
});
const dllRefKeys = ['./some-foo.ts'];

expect(bundle.createCacheKey(['/foo/bar/a', '/foo/bar/c'], hashes)).toMatchInlineSnapshot(`
expect(bundle.createCacheKey(['/foo/bar/a', '/foo/bar/c'], hashes, dllManifest, dllRefKeys))
.toMatchInlineSnapshot(`
Object {
"checksums": Object {
"/foo/bar/a": "123",
"/foo/bar/c": "789",
},
"dllName": "manifest-name",
"dllRefs": Object {
"./some-foo.ts": "1:ku/53aRMuAA+4TmQeCWA/w:GtuPW9agF2yecW0xAIHtUQ",
},
"spec": Object {
"banner": undefined,
"contextDir": "/foo/bar",
Expand Down
12 changes: 10 additions & 2 deletions packages/kbn-optimizer/src/common/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { UnknownVals } from './ts_helpers';
import { omit } from './obj_helpers';
import { includes } from './array_helpers';
import type { Hashes } from './hashes';
import { ParsedDllManifest } from './dll_manifest';

const VALID_BUNDLE_TYPES = ['plugin' as const, 'entry' as const];

Expand Down Expand Up @@ -88,12 +89,19 @@ export class Bundle {

/**
* Calculate the cache key for this bundle based from current
* mtime values.
* state determined by looking at files on disk.
*/
createCacheKey(paths: string[], hashes: Hashes): unknown {
createCacheKey(
paths: string[],
hashes: Hashes,
dllManifest: ParsedDllManifest,
dllRefKeys: string[]
): unknown {
return {
spec: omit(this.toSpec(), ['pageLoadAssetSizeLimit']),
checksums: Object.fromEntries(paths.map((p) => [p, hashes.getCached(p)] as const)),
dllName: dllManifest.name,
dllRefs: Object.fromEntries(dllRefKeys.map((k) => [k, dllManifest.content[k]] as const)),
};
}

Expand Down
5 changes: 5 additions & 0 deletions packages/kbn-optimizer/src/common/bundle_cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface State {
workUnits?: number;
referencedPaths?: string[];
bundleRefExportIds?: string[];
dllRefKeys?: string[];
}

const DEFAULT_STATE: State = {};
Expand Down Expand Up @@ -90,6 +91,10 @@ export class BundleCache {
return this.get().bundleRefExportIds;
}

public getDllRefKeys() {
return this.get().dllRefKeys;
}

public getCacheKey() {
return this.get().cacheKey;
}
Expand Down
45 changes: 45 additions & 0 deletions packages/kbn-optimizer/src/common/dll_manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import Crypto from 'crypto';

export interface DllManifest {
name: string;
content: Record<string, any>;
}

export interface ParsedDllManifest {
name: string;
content: Record<string, any>;
}

const hash = (s: string) => {
return Crypto.createHash('md5').update(s).digest('base64').replace(/=+$/, '');
};

export function parseDllManifest(manifest: DllManifest): ParsedDllManifest {
return {
name: manifest.name,
content: Object.fromEntries(
Object.entries(manifest.content).map(([k, v]) => {
const { id, buildMeta, ...other } = v;
const metaJson = JSON.stringify(buildMeta) || '{}';
const otherJson = JSON.stringify(other) || '{}';

return [
k,
[
v.id,
...(metaJson !== '{}' ? [hash(metaJson)] : []),
...(otherJson !== '{}' ? [hash(otherJson)] : []),
].join(':'),
];
})
),
};
}
1 change: 1 addition & 0 deletions packages/kbn-optimizer/src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ export * from './parse_path';
export * from './theme_tags';
export * from './obj_helpers';
export * from './hashes';
export * from './dll_manifest';
Loading

0 comments on commit d12ca24

Please sign in to comment.