diff --git a/.ci/pipeline-library/src/test/KibanaBasePipelineTest.groovy b/.ci/pipeline-library/src/test/KibanaBasePipelineTest.groovy index 086484f2385b0..4112cb3c0e14b 100644 --- a/.ci/pipeline-library/src/test/KibanaBasePipelineTest.groovy +++ b/.ci/pipeline-library/src/test/KibanaBasePipelineTest.groovy @@ -78,6 +78,10 @@ class KibanaBasePipelineTest extends BasePipelineTest { return helper.callStack.find { it.methodName == name } } + def fnMocks(String name) { + helper.callStack.findAll { it.methodName == name } + } + void mockFailureBuild() { props([ buildUtils: [ diff --git a/.ci/pipeline-library/src/test/slackNotifications.groovy b/.ci/pipeline-library/src/test/slackNotifications.groovy index 467e4a0e5f520..f7e39f5fad903 100644 --- a/.ci/pipeline-library/src/test/slackNotifications.groovy +++ b/.ci/pipeline-library/src/test/slackNotifications.groovy @@ -59,4 +59,67 @@ class SlackNotificationsTest extends KibanaBasePipelineTest { args.blocks[2].text.text.toString() ) } + + @Test + void 'sendFailedBuild() should call slackSend() with a backup message when first attempt fails'() { + mockFailureBuild() + def counter = 0 + helper.registerAllowedMethod('slackSend', [Map.class], { ++counter > 1 }) + slackNotifications.sendFailedBuild() + + def args = fnMocks('slackSend')[1].args[0] + + def expected = [ + channel: '#kibana-operations-alerts', + username: 'Kibana Operations', + iconEmoji: ':jenkins:', + color: 'danger', + message: ':broken_heart: elastic / kibana # master #1', + ] + + expected.each { + assertEquals(it.value.toString(), args[it.key].toString()) + } + + assertEquals( + ":broken_heart: **" + + "\n\nFirst attempt at sending this notification failed. Please check the build.", + args.blocks[0].text.text.toString() + ) + } + + @Test + void 'getTestFailures() should truncate list of failures to 10'() { + prop('testUtils', [ + getFailures: { + return (1..12).collect { + return [ + url: Mocks.TEST_FAILURE_URL, + fullDisplayName: "Failure #${it}", + ] + } + }, + ]) + + def message = (String) slackNotifications.getTestFailures() + + assertTrue("Message ends with truncated indicator", message.endsWith("...and 2 more")) + assertTrue("Message contains Failure #10", message.contains("Failure #10")) + assertTrue("Message does not contain Failure #11", !message.contains("Failure #11")) + } + + @Test + void 'shortenMessage() should truncate a long message, but leave parts that fit'() { + assertEquals('Hello\nHello\n[...truncated...]', slackNotifications.shortenMessage('Hello\nHello\nthis is a long string', 29)) + } + + @Test + void 'shortenMessage() should not modify a short message'() { + assertEquals('Hello world', slackNotifications.shortenMessage('Hello world', 11)) + } + + @Test + void 'shortenMessage() should truncate an entire message with only one part'() { + assertEquals('[...truncated...]', slackNotifications.shortenMessage('Hello world this is a really long message', 40)) + } } diff --git a/docs/apm/error-reports-watcher.asciidoc b/docs/apm/error-reports-watcher.asciidoc deleted file mode 100644 index f41597932b751..0000000000000 --- a/docs/apm/error-reports-watcher.asciidoc +++ /dev/null @@ -1,18 +0,0 @@ -[role="xpack"] -[[errors-alerts-with-watcher]] -=== Error reports with Watcher - -++++ -Enable error reports -++++ - -You can use the power of the alerting features with Watcher to get reports on error occurrences. -The Watcher assistant, which is available on the errors overview, can help you set up a watch per service. - -Configure the watch with an occurrences threshold, time interval, and the desired actions, such as email or Slack notifications. -With Watcher, your team can set up reports within minutes. - -Watches are managed separately in the dedicated Watcher UI available in Advanced Settings. - -[role="screenshot"] -image::apm/images/apm-errors-watcher-assistant.png[Example view of the Watcher assistant for errors in APM app in Kibana] diff --git a/docs/apm/how-to-guides.asciidoc b/docs/apm/how-to-guides.asciidoc index 9b0efb4f7a359..9a415375f17fd 100644 --- a/docs/apm/how-to-guides.asciidoc +++ b/docs/apm/how-to-guides.asciidoc @@ -8,7 +8,6 @@ Learn how to perform common APM app tasks. * <> * <> * <> -* <> * <> * <> * <> @@ -21,8 +20,6 @@ include::apm-alerts.asciidoc[] include::custom-links.asciidoc[] -include::error-reports-watcher.asciidoc[] - include::filters.asciidoc[] include::machine-learning.asciidoc[] diff --git a/docs/development/core/server/kibana-plugin-core-server.countresponse._shards.md b/docs/development/core/server/kibana-plugin-core-server.countresponse._shards.md new file mode 100644 index 0000000000000..0f31a554e2208 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.countresponse._shards.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [CountResponse](./kibana-plugin-core-server.countresponse.md) > [\_shards](./kibana-plugin-core-server.countresponse._shards.md) + +## CountResponse.\_shards property + +Signature: + +```typescript +_shards: ShardsInfo; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.countresponse.count.md b/docs/development/core/server/kibana-plugin-core-server.countresponse.count.md new file mode 100644 index 0000000000000..3cd1a6aaf6644 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.countresponse.count.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [CountResponse](./kibana-plugin-core-server.countresponse.md) > [count](./kibana-plugin-core-server.countresponse.count.md) + +## CountResponse.count property + +Signature: + +```typescript +count: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.countresponse.md b/docs/development/core/server/kibana-plugin-core-server.countresponse.md new file mode 100644 index 0000000000000..f8664f4878f46 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.countresponse.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [CountResponse](./kibana-plugin-core-server.countresponse.md) + +## CountResponse interface + + +Signature: + +```typescript +export interface CountResponse +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [\_shards](./kibana-plugin-core-server.countresponse._shards.md) | ShardsInfo | | +| [count](./kibana-plugin-core-server.countresponse.count.md) | number | | + diff --git a/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._id.md b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._id.md new file mode 100644 index 0000000000000..ccc6a76361f26 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._id.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeleteDocumentResponse](./kibana-plugin-core-server.deletedocumentresponse.md) > [\_id](./kibana-plugin-core-server.deletedocumentresponse._id.md) + +## DeleteDocumentResponse.\_id property + +Signature: + +```typescript +_id: string; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._index.md b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._index.md new file mode 100644 index 0000000000000..a9a04bb2b2ed7 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._index.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeleteDocumentResponse](./kibana-plugin-core-server.deletedocumentresponse.md) > [\_index](./kibana-plugin-core-server.deletedocumentresponse._index.md) + +## DeleteDocumentResponse.\_index property + +Signature: + +```typescript +_index: string; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._shards.md b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._shards.md new file mode 100644 index 0000000000000..e3d5e9208db0a --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._shards.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeleteDocumentResponse](./kibana-plugin-core-server.deletedocumentresponse.md) > [\_shards](./kibana-plugin-core-server.deletedocumentresponse._shards.md) + +## DeleteDocumentResponse.\_shards property + +Signature: + +```typescript +_shards: ShardsResponse; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._type.md b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._type.md new file mode 100644 index 0000000000000..690852e20a76e --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeleteDocumentResponse](./kibana-plugin-core-server.deletedocumentresponse.md) > [\_type](./kibana-plugin-core-server.deletedocumentresponse._type.md) + +## DeleteDocumentResponse.\_type property + +Signature: + +```typescript +_type: string; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._version.md b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._version.md new file mode 100644 index 0000000000000..acfe8ef55ae71 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse._version.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeleteDocumentResponse](./kibana-plugin-core-server.deletedocumentresponse.md) > [\_version](./kibana-plugin-core-server.deletedocumentresponse._version.md) + +## DeleteDocumentResponse.\_version property + +Signature: + +```typescript +_version: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.error.md b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.error.md new file mode 100644 index 0000000000000..aafe850188998 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.error.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeleteDocumentResponse](./kibana-plugin-core-server.deletedocumentresponse.md) > [error](./kibana-plugin-core-server.deletedocumentresponse.error.md) + +## DeleteDocumentResponse.error property + +Signature: + +```typescript +error?: { + type: string; + }; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.found.md b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.found.md new file mode 100644 index 0000000000000..00bc89bda66ed --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.found.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeleteDocumentResponse](./kibana-plugin-core-server.deletedocumentresponse.md) > [found](./kibana-plugin-core-server.deletedocumentresponse.found.md) + +## DeleteDocumentResponse.found property + +Signature: + +```typescript +found: boolean; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.md b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.md new file mode 100644 index 0000000000000..e8ac7d2fd8ec1 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeleteDocumentResponse](./kibana-plugin-core-server.deletedocumentresponse.md) + +## DeleteDocumentResponse interface + + +Signature: + +```typescript +export interface DeleteDocumentResponse +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [\_id](./kibana-plugin-core-server.deletedocumentresponse._id.md) | string | | +| [\_index](./kibana-plugin-core-server.deletedocumentresponse._index.md) | string | | +| [\_shards](./kibana-plugin-core-server.deletedocumentresponse._shards.md) | ShardsResponse | | +| [\_type](./kibana-plugin-core-server.deletedocumentresponse._type.md) | string | | +| [\_version](./kibana-plugin-core-server.deletedocumentresponse._version.md) | number | | +| [error](./kibana-plugin-core-server.deletedocumentresponse.error.md) | {
type: string;
} | | +| [found](./kibana-plugin-core-server.deletedocumentresponse.found.md) | boolean | | +| [result](./kibana-plugin-core-server.deletedocumentresponse.result.md) | string | | + diff --git a/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.result.md b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.result.md new file mode 100644 index 0000000000000..88f7568d3d9bc --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.result.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeleteDocumentResponse](./kibana-plugin-core-server.deletedocumentresponse.md) > [result](./kibana-plugin-core-server.deletedocumentresponse.result.md) + +## DeleteDocumentResponse.result property + +Signature: + +```typescript +result: string; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.elasticsearchclient.md b/docs/development/core/server/kibana-plugin-core-server.elasticsearchclient.md new file mode 100644 index 0000000000000..279262aa6a5ec --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.elasticsearchclient.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ElasticsearchClient](./kibana-plugin-core-server.elasticsearchclient.md) + +## ElasticsearchClient type + +Client used to query the elasticsearch cluster. + +Signature: + +```typescript +export declare type ElasticsearchClient = Omit & { + transport: { + request(params: TransportRequestParams, options?: TransportRequestOptions): TransportRequestPromise; + }; +}; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.explanation.description.md b/docs/development/core/server/kibana-plugin-core-server.explanation.description.md new file mode 100644 index 0000000000000..37fc90f5ac5d8 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.explanation.description.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Explanation](./kibana-plugin-core-server.explanation.md) > [description](./kibana-plugin-core-server.explanation.description.md) + +## Explanation.description property + +Signature: + +```typescript +description: string; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.explanation.details.md b/docs/development/core/server/kibana-plugin-core-server.explanation.details.md new file mode 100644 index 0000000000000..afba9175d86cf --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.explanation.details.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Explanation](./kibana-plugin-core-server.explanation.md) > [details](./kibana-plugin-core-server.explanation.details.md) + +## Explanation.details property + +Signature: + +```typescript +details: Explanation[]; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.explanation.md b/docs/development/core/server/kibana-plugin-core-server.explanation.md new file mode 100644 index 0000000000000..eb18910c4795b --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.explanation.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Explanation](./kibana-plugin-core-server.explanation.md) + +## Explanation interface + + +Signature: + +```typescript +export interface Explanation +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [description](./kibana-plugin-core-server.explanation.description.md) | string | | +| [details](./kibana-plugin-core-server.explanation.details.md) | Explanation[] | | +| [value](./kibana-plugin-core-server.explanation.value.md) | number | | + diff --git a/docs/development/core/server/kibana-plugin-core-server.explanation.value.md b/docs/development/core/server/kibana-plugin-core-server.explanation.value.md new file mode 100644 index 0000000000000..b10f60176b0c8 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.explanation.value.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Explanation](./kibana-plugin-core-server.explanation.md) > [value](./kibana-plugin-core-server.explanation.value.md) + +## Explanation.value property + +Signature: + +```typescript +value: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.getresponse._id.md b/docs/development/core/server/kibana-plugin-core-server.getresponse._id.md new file mode 100644 index 0000000000000..d31b61f3962c8 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.getresponse._id.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [GetResponse](./kibana-plugin-core-server.getresponse.md) > [\_id](./kibana-plugin-core-server.getresponse._id.md) + +## GetResponse.\_id property + +Signature: + +```typescript +_id: string; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.getresponse._index.md b/docs/development/core/server/kibana-plugin-core-server.getresponse._index.md new file mode 100644 index 0000000000000..0353ec1a17b2c --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.getresponse._index.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [GetResponse](./kibana-plugin-core-server.getresponse.md) > [\_index](./kibana-plugin-core-server.getresponse._index.md) + +## GetResponse.\_index property + +Signature: + +```typescript +_index: string; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.getresponse._primary_term.md b/docs/development/core/server/kibana-plugin-core-server.getresponse._primary_term.md new file mode 100644 index 0000000000000..8412302ab727d --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.getresponse._primary_term.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [GetResponse](./kibana-plugin-core-server.getresponse.md) > [\_primary\_term](./kibana-plugin-core-server.getresponse._primary_term.md) + +## GetResponse.\_primary\_term property + +Signature: + +```typescript +_primary_term: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.getresponse._routing.md b/docs/development/core/server/kibana-plugin-core-server.getresponse._routing.md new file mode 100644 index 0000000000000..1af3ed31ee112 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.getresponse._routing.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [GetResponse](./kibana-plugin-core-server.getresponse.md) > [\_routing](./kibana-plugin-core-server.getresponse._routing.md) + +## GetResponse.\_routing property + +Signature: + +```typescript +_routing?: string; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.getresponse._seq_no.md b/docs/development/core/server/kibana-plugin-core-server.getresponse._seq_no.md new file mode 100644 index 0000000000000..e8d72563f8149 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.getresponse._seq_no.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [GetResponse](./kibana-plugin-core-server.getresponse.md) > [\_seq\_no](./kibana-plugin-core-server.getresponse._seq_no.md) + +## GetResponse.\_seq\_no property + +Signature: + +```typescript +_seq_no: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.getresponse._source.md b/docs/development/core/server/kibana-plugin-core-server.getresponse._source.md new file mode 100644 index 0000000000000..97aacb42992a3 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.getresponse._source.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [GetResponse](./kibana-plugin-core-server.getresponse.md) > [\_source](./kibana-plugin-core-server.getresponse._source.md) + +## GetResponse.\_source property + +Signature: + +```typescript +_source: T; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.getresponse._type.md b/docs/development/core/server/kibana-plugin-core-server.getresponse._type.md new file mode 100644 index 0000000000000..b3205e2fe91d7 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.getresponse._type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [GetResponse](./kibana-plugin-core-server.getresponse.md) > [\_type](./kibana-plugin-core-server.getresponse._type.md) + +## GetResponse.\_type property + +Signature: + +```typescript +_type: string; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.getresponse._version.md b/docs/development/core/server/kibana-plugin-core-server.getresponse._version.md new file mode 100644 index 0000000000000..23d3a8c91f4a2 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.getresponse._version.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [GetResponse](./kibana-plugin-core-server.getresponse.md) > [\_version](./kibana-plugin-core-server.getresponse._version.md) + +## GetResponse.\_version property + +Signature: + +```typescript +_version: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.getresponse.found.md b/docs/development/core/server/kibana-plugin-core-server.getresponse.found.md new file mode 100644 index 0000000000000..8d34a3e743cca --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.getresponse.found.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [GetResponse](./kibana-plugin-core-server.getresponse.md) > [found](./kibana-plugin-core-server.getresponse.found.md) + +## GetResponse.found property + +Signature: + +```typescript +found: boolean; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.getresponse.md b/docs/development/core/server/kibana-plugin-core-server.getresponse.md new file mode 100644 index 0000000000000..bab3092c6b1fa --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.getresponse.md @@ -0,0 +1,27 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [GetResponse](./kibana-plugin-core-server.getresponse.md) + +## GetResponse interface + + +Signature: + +```typescript +export interface GetResponse +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [\_id](./kibana-plugin-core-server.getresponse._id.md) | string | | +| [\_index](./kibana-plugin-core-server.getresponse._index.md) | string | | +| [\_primary\_term](./kibana-plugin-core-server.getresponse._primary_term.md) | number | | +| [\_routing](./kibana-plugin-core-server.getresponse._routing.md) | string | | +| [\_seq\_no](./kibana-plugin-core-server.getresponse._seq_no.md) | number | | +| [\_source](./kibana-plugin-core-server.getresponse._source.md) | T | | +| [\_type](./kibana-plugin-core-server.getresponse._type.md) | string | | +| [\_version](./kibana-plugin-core-server.getresponse._version.md) | number | | +| [found](./kibana-plugin-core-server.getresponse.found.md) | boolean | | + diff --git a/docs/development/core/server/kibana-plugin-core-server.md b/docs/development/core/server/kibana-plugin-core-server.md index 61ffc532f0de5..95b7627398b45 100644 --- a/docs/development/core/server/kibana-plugin-core-server.md +++ b/docs/development/core/server/kibana-plugin-core-server.md @@ -74,7 +74,9 @@ The plugin integrates with the core system via lifecycle events: `setup` | [CoreSetup](./kibana-plugin-core-server.coresetup.md) | Context passed to the plugins setup method. | | [CoreStart](./kibana-plugin-core-server.corestart.md) | Context passed to the plugins start method. | | [CoreStatus](./kibana-plugin-core-server.corestatus.md) | Status of core services. | +| [CountResponse](./kibana-plugin-core-server.countresponse.md) | | | [CustomHttpResponseOptions](./kibana-plugin-core-server.customhttpresponseoptions.md) | HTTP response parameters for a response with adjustable status code. | +| [DeleteDocumentResponse](./kibana-plugin-core-server.deletedocumentresponse.md) | | | [DeprecationAPIClientParams](./kibana-plugin-core-server.deprecationapiclientparams.md) | | | [DeprecationAPIResponse](./kibana-plugin-core-server.deprecationapiresponse.md) | | | [DeprecationInfo](./kibana-plugin-core-server.deprecationinfo.md) | | @@ -85,7 +87,9 @@ The plugin integrates with the core system via lifecycle events: `setup` | [ElasticsearchStatusMeta](./kibana-plugin-core-server.elasticsearchstatusmeta.md) | | | [EnvironmentMode](./kibana-plugin-core-server.environmentmode.md) | | | [ErrorHttpResponseOptions](./kibana-plugin-core-server.errorhttpresponseoptions.md) | HTTP response parameters | +| [Explanation](./kibana-plugin-core-server.explanation.md) | | | [FakeRequest](./kibana-plugin-core-server.fakerequest.md) | Fake request object created manually by Kibana plugins. | +| [GetResponse](./kibana-plugin-core-server.getresponse.md) | | | [HttpAuth](./kibana-plugin-core-server.httpauth.md) | | | [HttpResources](./kibana-plugin-core-server.httpresources.md) | HttpResources service is responsible for serving static & dynamic assets for Kibana application via HTTP. Provides API allowing plug-ins to respond with: - a pre-configured HTML page bootstrapping Kibana client app - custom HTML page - custom JS script file. | | [HttpResourcesRenderOptions](./kibana-plugin-core-server.httpresourcesrenderoptions.md) | Allows to configure HTTP response parameters | @@ -189,11 +193,14 @@ The plugin integrates with the core system via lifecycle events: `setup` | [SavedObjectsTypeMappingDefinition](./kibana-plugin-core-server.savedobjectstypemappingdefinition.md) | Describe a saved object type mapping. | | [SavedObjectsUpdateOptions](./kibana-plugin-core-server.savedobjectsupdateoptions.md) | | | [SavedObjectsUpdateResponse](./kibana-plugin-core-server.savedobjectsupdateresponse.md) | | +| [SearchResponse](./kibana-plugin-core-server.searchresponse.md) | | | [ServiceStatus](./kibana-plugin-core-server.servicestatus.md) | The current status of a service at a point in time. | | [SessionCookieValidationResult](./kibana-plugin-core-server.sessioncookievalidationresult.md) | Return type from a function to validate cookie contents. | | [SessionStorage](./kibana-plugin-core-server.sessionstorage.md) | Provides an interface to store and retrieve data across requests. | | [SessionStorageCookieOptions](./kibana-plugin-core-server.sessionstoragecookieoptions.md) | Configuration used to create HTTP session storage based on top of cookie mechanism. | | [SessionStorageFactory](./kibana-plugin-core-server.sessionstoragefactory.md) | SessionStorage factory to bind one to an incoming request | +| [ShardsInfo](./kibana-plugin-core-server.shardsinfo.md) | | +| [ShardsResponse](./kibana-plugin-core-server.shardsresponse.md) | | | [StatusServiceSetup](./kibana-plugin-core-server.statusservicesetup.md) | API for accessing status of Core and this plugin's dependencies as well as for customizing this plugin's status. | | [StringValidationRegex](./kibana-plugin-core-server.stringvalidationregex.md) | StringValidation with regex object | | [StringValidationRegexString](./kibana-plugin-core-server.stringvalidationregexstring.md) | StringValidation as regex string | @@ -228,6 +235,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [ConfigDeprecationProvider](./kibana-plugin-core-server.configdeprecationprovider.md) | A provider that should returns a list of [ConfigDeprecation](./kibana-plugin-core-server.configdeprecation.md).See [ConfigDeprecationFactory](./kibana-plugin-core-server.configdeprecationfactory.md) for more usage examples. | | [ConfigPath](./kibana-plugin-core-server.configpath.md) | | | [DestructiveRouteMethod](./kibana-plugin-core-server.destructiveroutemethod.md) | Set of HTTP methods changing the state of the server. | +| [ElasticsearchClient](./kibana-plugin-core-server.elasticsearchclient.md) | Client used to query the elasticsearch cluster. | | [Freezable](./kibana-plugin-core-server.freezable.md) | | | [GetAuthHeaders](./kibana-plugin-core-server.getauthheaders.md) | Get headers to authenticate a user against Elasticsearch. | | [GetAuthState](./kibana-plugin-core-server.getauthstate.md) | Gets authentication state for a request. Returned by auth interceptor. | diff --git a/docs/development/core/server/kibana-plugin-core-server.routeconfigoptions.md b/docs/development/core/server/kibana-plugin-core-server.routeconfigoptions.md index 5a6103dfc57d4..fee6124f8d866 100644 --- a/docs/development/core/server/kibana-plugin-core-server.routeconfigoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.routeconfigoptions.md @@ -19,5 +19,6 @@ export interface RouteConfigOptions | [authRequired](./kibana-plugin-core-server.routeconfigoptions.authrequired.md) | boolean | 'optional' | Defines authentication mode for a route: - true. A user has to have valid credentials to access a resource - false. A user can access a resource without any credentials. - 'optional'. A user can access a resource if has valid credentials or no credentials at all. Can be useful when we grant access to a resource but want to identify a user if possible.Defaults to true if an auth mechanism is registered. | | [body](./kibana-plugin-core-server.routeconfigoptions.body.md) | Method extends 'get' | 'options' ? undefined : RouteConfigOptionsBody | Additional body options [RouteConfigOptionsBody](./kibana-plugin-core-server.routeconfigoptionsbody.md). | | [tags](./kibana-plugin-core-server.routeconfigoptions.tags.md) | readonly string[] | Additional metadata tag strings to attach to the route. | +| [timeout](./kibana-plugin-core-server.routeconfigoptions.timeout.md) | number | Timeouts for processing durations. Response timeout is in milliseconds. Default value: 2 minutes | | [xsrfRequired](./kibana-plugin-core-server.routeconfigoptions.xsrfrequired.md) | Method extends 'get' ? never : boolean | Defines xsrf protection requirements for a route: - true. Requires an incoming POST/PUT/DELETE request to contain kbn-xsrf header. - false. Disables xsrf protection.Set to true by default | diff --git a/docs/development/core/server/kibana-plugin-core-server.routeconfigoptions.timeout.md b/docs/development/core/server/kibana-plugin-core-server.routeconfigoptions.timeout.md new file mode 100644 index 0000000000000..479fcf883ec4d --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.routeconfigoptions.timeout.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [RouteConfigOptions](./kibana-plugin-core-server.routeconfigoptions.md) > [timeout](./kibana-plugin-core-server.routeconfigoptions.timeout.md) + +## RouteConfigOptions.timeout property + +Timeouts for processing durations. Response timeout is in milliseconds. Default value: 2 minutes + +Signature: + +```typescript +timeout?: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.md index 3fac0d889c6ce..ba81a3e8c32d0 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.md @@ -15,5 +15,5 @@ export interface SavedObjectsDeleteByNamespaceOptions extends SavedObjectsBaseOp | Property | Type | Description | | --- | --- | --- | -| [refresh](./kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.refresh.md) | MutatingOperationRefreshSetting | The Elasticsearch Refresh setting for this operation | +| [refresh](./kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.refresh.md) | boolean | The Elasticsearch supports only boolean flag for this operation | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.refresh.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.refresh.md index c67866a5553a0..52b562e8e22b7 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.refresh.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.refresh.md @@ -4,10 +4,10 @@ ## SavedObjectsDeleteByNamespaceOptions.refresh property -The Elasticsearch Refresh setting for this operation +The Elasticsearch supports only boolean flag for this operation Signature: ```typescript -refresh?: MutatingOperationRefreshSetting; +refresh?: boolean; ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.searchresponse._scroll_id.md b/docs/development/core/server/kibana-plugin-core-server.searchresponse._scroll_id.md new file mode 100644 index 0000000000000..a9dd0e76475fd --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.searchresponse._scroll_id.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SearchResponse](./kibana-plugin-core-server.searchresponse.md) > [\_scroll\_id](./kibana-plugin-core-server.searchresponse._scroll_id.md) + +## SearchResponse.\_scroll\_id property + +Signature: + +```typescript +_scroll_id?: string; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.searchresponse._shards.md b/docs/development/core/server/kibana-plugin-core-server.searchresponse._shards.md new file mode 100644 index 0000000000000..e090ad20e8bc8 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.searchresponse._shards.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SearchResponse](./kibana-plugin-core-server.searchresponse.md) > [\_shards](./kibana-plugin-core-server.searchresponse._shards.md) + +## SearchResponse.\_shards property + +Signature: + +```typescript +_shards: ShardsResponse; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.searchresponse.aggregations.md b/docs/development/core/server/kibana-plugin-core-server.searchresponse.aggregations.md new file mode 100644 index 0000000000000..686e6f2aa05e9 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.searchresponse.aggregations.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SearchResponse](./kibana-plugin-core-server.searchresponse.md) > [aggregations](./kibana-plugin-core-server.searchresponse.aggregations.md) + +## SearchResponse.aggregations property + +Signature: + +```typescript +aggregations?: any; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.searchresponse.hits.md b/docs/development/core/server/kibana-plugin-core-server.searchresponse.hits.md new file mode 100644 index 0000000000000..1629e77425525 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.searchresponse.hits.md @@ -0,0 +1,28 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SearchResponse](./kibana-plugin-core-server.searchresponse.md) > [hits](./kibana-plugin-core-server.searchresponse.hits.md) + +## SearchResponse.hits property + +Signature: + +```typescript +hits: { + total: number; + max_score: number; + hits: Array<{ + _index: string; + _type: string; + _id: string; + _score: number; + _source: T; + _version?: number; + _explanation?: Explanation; + fields?: any; + highlight?: any; + inner_hits?: any; + matched_queries?: string[]; + sort?: string[]; + }>; + }; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.searchresponse.md b/docs/development/core/server/kibana-plugin-core-server.searchresponse.md new file mode 100644 index 0000000000000..b53cbf0d87f24 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.searchresponse.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SearchResponse](./kibana-plugin-core-server.searchresponse.md) + +## SearchResponse interface + + +Signature: + +```typescript +export interface SearchResponse +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [\_scroll\_id](./kibana-plugin-core-server.searchresponse._scroll_id.md) | string | | +| [\_shards](./kibana-plugin-core-server.searchresponse._shards.md) | ShardsResponse | | +| [aggregations](./kibana-plugin-core-server.searchresponse.aggregations.md) | any | | +| [hits](./kibana-plugin-core-server.searchresponse.hits.md) | {
total: number;
max_score: number;
hits: Array<{
_index: string;
_type: string;
_id: string;
_score: number;
_source: T;
_version?: number;
_explanation?: Explanation;
fields?: any;
highlight?: any;
inner_hits?: any;
matched_queries?: string[];
sort?: string[];
}>;
} | | +| [timed\_out](./kibana-plugin-core-server.searchresponse.timed_out.md) | boolean | | +| [took](./kibana-plugin-core-server.searchresponse.took.md) | number | | + diff --git a/docs/development/core/server/kibana-plugin-core-server.searchresponse.timed_out.md b/docs/development/core/server/kibana-plugin-core-server.searchresponse.timed_out.md new file mode 100644 index 0000000000000..a3488117cd874 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.searchresponse.timed_out.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SearchResponse](./kibana-plugin-core-server.searchresponse.md) > [timed\_out](./kibana-plugin-core-server.searchresponse.timed_out.md) + +## SearchResponse.timed\_out property + +Signature: + +```typescript +timed_out: boolean; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.searchresponse.took.md b/docs/development/core/server/kibana-plugin-core-server.searchresponse.took.md new file mode 100644 index 0000000000000..8c9c0b0f7c420 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.searchresponse.took.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SearchResponse](./kibana-plugin-core-server.searchresponse.md) > [took](./kibana-plugin-core-server.searchresponse.took.md) + +## SearchResponse.took property + +Signature: + +```typescript +took: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.shardsinfo.failed.md b/docs/development/core/server/kibana-plugin-core-server.shardsinfo.failed.md new file mode 100644 index 0000000000000..a47fc1263be41 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.shardsinfo.failed.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ShardsInfo](./kibana-plugin-core-server.shardsinfo.md) > [failed](./kibana-plugin-core-server.shardsinfo.failed.md) + +## ShardsInfo.failed property + +Signature: + +```typescript +failed: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.shardsinfo.md b/docs/development/core/server/kibana-plugin-core-server.shardsinfo.md new file mode 100644 index 0000000000000..9eafe3792c14a --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.shardsinfo.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ShardsInfo](./kibana-plugin-core-server.shardsinfo.md) + +## ShardsInfo interface + + +Signature: + +```typescript +export interface ShardsInfo +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [failed](./kibana-plugin-core-server.shardsinfo.failed.md) | number | | +| [skipped](./kibana-plugin-core-server.shardsinfo.skipped.md) | number | | +| [successful](./kibana-plugin-core-server.shardsinfo.successful.md) | number | | +| [total](./kibana-plugin-core-server.shardsinfo.total.md) | number | | + diff --git a/docs/development/core/server/kibana-plugin-core-server.shardsinfo.skipped.md b/docs/development/core/server/kibana-plugin-core-server.shardsinfo.skipped.md new file mode 100644 index 0000000000000..0c87831edd6ca --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.shardsinfo.skipped.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ShardsInfo](./kibana-plugin-core-server.shardsinfo.md) > [skipped](./kibana-plugin-core-server.shardsinfo.skipped.md) + +## ShardsInfo.skipped property + +Signature: + +```typescript +skipped: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.shardsinfo.successful.md b/docs/development/core/server/kibana-plugin-core-server.shardsinfo.successful.md new file mode 100644 index 0000000000000..c927adb39932a --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.shardsinfo.successful.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ShardsInfo](./kibana-plugin-core-server.shardsinfo.md) > [successful](./kibana-plugin-core-server.shardsinfo.successful.md) + +## ShardsInfo.successful property + +Signature: + +```typescript +successful: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.shardsinfo.total.md b/docs/development/core/server/kibana-plugin-core-server.shardsinfo.total.md new file mode 100644 index 0000000000000..820c8a70fd222 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.shardsinfo.total.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ShardsInfo](./kibana-plugin-core-server.shardsinfo.md) > [total](./kibana-plugin-core-server.shardsinfo.total.md) + +## ShardsInfo.total property + +Signature: + +```typescript +total: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.shardsresponse.failed.md b/docs/development/core/server/kibana-plugin-core-server.shardsresponse.failed.md new file mode 100644 index 0000000000000..7f7a173af2e58 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.shardsresponse.failed.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ShardsResponse](./kibana-plugin-core-server.shardsresponse.md) > [failed](./kibana-plugin-core-server.shardsresponse.failed.md) + +## ShardsResponse.failed property + +Signature: + +```typescript +failed: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.shardsresponse.md b/docs/development/core/server/kibana-plugin-core-server.shardsresponse.md new file mode 100644 index 0000000000000..722ffd8efdb57 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.shardsresponse.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ShardsResponse](./kibana-plugin-core-server.shardsresponse.md) + +## ShardsResponse interface + + +Signature: + +```typescript +export interface ShardsResponse +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [failed](./kibana-plugin-core-server.shardsresponse.failed.md) | number | | +| [skipped](./kibana-plugin-core-server.shardsresponse.skipped.md) | number | | +| [successful](./kibana-plugin-core-server.shardsresponse.successful.md) | number | | +| [total](./kibana-plugin-core-server.shardsresponse.total.md) | number | | + diff --git a/docs/development/core/server/kibana-plugin-core-server.shardsresponse.skipped.md b/docs/development/core/server/kibana-plugin-core-server.shardsresponse.skipped.md new file mode 100644 index 0000000000000..b01c3501fe022 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.shardsresponse.skipped.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ShardsResponse](./kibana-plugin-core-server.shardsresponse.md) > [skipped](./kibana-plugin-core-server.shardsresponse.skipped.md) + +## ShardsResponse.skipped property + +Signature: + +```typescript +skipped: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.shardsresponse.successful.md b/docs/development/core/server/kibana-plugin-core-server.shardsresponse.successful.md new file mode 100644 index 0000000000000..23c6ff0519ed7 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.shardsresponse.successful.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ShardsResponse](./kibana-plugin-core-server.shardsresponse.md) > [successful](./kibana-plugin-core-server.shardsresponse.successful.md) + +## ShardsResponse.successful property + +Signature: + +```typescript +successful: number; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.shardsresponse.total.md b/docs/development/core/server/kibana-plugin-core-server.shardsresponse.total.md new file mode 100644 index 0000000000000..e669f6216a10f --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.shardsresponse.total.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ShardsResponse](./kibana-plugin-core-server.shardsresponse.md) > [total](./kibana-plugin-core-server.shardsresponse.total.md) + +## ShardsResponse.total property + +Signature: + +```typescript +total: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.connecttoquerystate.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.connecttoquerystate.md index a6731e5ef8de1..7c937b39cda87 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.connecttoquerystate.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.connecttoquerystate.md @@ -9,9 +9,10 @@ Helper to setup two-way syncing of global data and a state container Signature: ```typescript -connectToQueryState: ({ timefilter: { timefilter }, filterManager, state$, }: Pick, stateContainer: BaseStateContainer, syncConfig: { +connectToQueryState: ({ timefilter: { timefilter }, filterManager, queryString, state$, }: Pick, stateContainer: BaseStateContainer, syncConfig: { time?: boolean; refreshInterval?: boolean; filters?: FilterStateStore | boolean; + query?: boolean; }) => () => void ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.md index cc489a0cb0367..021d808afecb5 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.md @@ -17,6 +17,7 @@ export interface QueryState | Property | Type | Description | | --- | --- | --- | | [filters](./kibana-plugin-plugins-data-public.querystate.filters.md) | Filter[] | | +| [query](./kibana-plugin-plugins-data-public.querystate.query.md) | Query | | | [refreshInterval](./kibana-plugin-plugins-data-public.querystate.refreshinterval.md) | RefreshInterval | | | [time](./kibana-plugin-plugins-data-public.querystate.time.md) | TimeRange | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.query.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.query.md new file mode 100644 index 0000000000000..b0ac376a358dc --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.query.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QueryState](./kibana-plugin-plugins-data-public.querystate.md) > [query](./kibana-plugin-plugins-data-public.querystate.query.md) + +## QueryState.query property + +Signature: + +```typescript +query?: Query; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.syncquerystatewithurl.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.syncquerystatewithurl.md index f6f8bed8cb914..1aafa022f9690 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.syncquerystatewithurl.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.syncquerystatewithurl.md @@ -9,7 +9,7 @@ Helper to setup syncing of global data with the URL Signature: ```typescript -syncQueryStateWithUrl: (query: Pick, kbnUrlStateStorage: IKbnUrlStateStorage) => { +syncQueryStateWithUrl: (query: Pick, kbnUrlStateStorage: IKbnUrlStateStorage) => { stop: () => void; hasInheritedQueryFromUrl: boolean; } diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.md index 3afba80064f08..d9749bc44f45a 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.md @@ -14,6 +14,6 @@ export interface ISearchSetup | Property | Type | Description | | --- | --- | --- | -| [registerSearchStrategy](./kibana-plugin-plugins-data-server.isearchsetup.registersearchstrategy.md) | TRegisterSearchStrategy | Extension point exposed for other plugins to register their own search strategies. | +| [registerSearchStrategy](./kibana-plugin-plugins-data-server.isearchsetup.registersearchstrategy.md) | (name: string, strategy: ISearchStrategy) => void | Extension point exposed for other plugins to register their own search strategies. | | [usage](./kibana-plugin-plugins-data-server.isearchsetup.usage.md) | SearchUsage | Used internally for telemetry | diff --git a/docs/redirects.asciidoc b/docs/redirects.asciidoc index c94c8e5c55f85..58687d99627b6 100644 --- a/docs/redirects.asciidoc +++ b/docs/redirects.asciidoc @@ -80,3 +80,13 @@ This page was deleted. See <>. == Developing Visualizations This page was deleted. See <>. + +[role="exclude",id="errors-alerts-with-watcher"] +== Error reports with Watcher + +deprecated::[7.9.0] + +Watcher error reports have been removed and replaced with Kibana's <> feature. +To create error alerts with new tool, select **Alerts** - **Create threshold alert** - **Error rate**. + +More information on this new feature is available in <>. diff --git a/docs/settings/reporting-settings.asciidoc b/docs/settings/reporting-settings.asciidoc index c83cd068eff5b..b31ae76d28052 100644 --- a/docs/settings/reporting-settings.asciidoc +++ b/docs/settings/reporting-settings.asciidoc @@ -21,7 +21,7 @@ You can configure `xpack.reporting` settings in your `kibana.yml` to: | Set to `false` to disable the {report-features}. | `xpack.reporting.encryptionKey` - | Set to any text string. By default, {kib} will generate a random key when it + | Set to an alphanumeric, at least 32 characters long text string. By default, {kib} will generate a random key when it starts, which will cause pending reports to fail after restart. Configure this setting to preserve the same key across multiple restarts and multiple instances of {kib}. diff --git a/docs/setup/production.asciidoc b/docs/setup/production.asciidoc index afb4b37df6a28..23dbb3346b7ef 100644 --- a/docs/setup/production.asciidoc +++ b/docs/setup/production.asciidoc @@ -167,7 +167,7 @@ These can be used to automatically update the list of hosts as a cluster is resi Kibana has a default maximum memory limit of 1.4 GB, and in most cases, we recommend leaving this unconfigured. In some scenarios, such as large reporting jobs, it may make sense to tweak limits to meet more specific requirements. -You can modify this limit by setting `--max-old-space-size` in the `node.options` config file that can be found inside `kibana/config` folder or any other configured with the environment variable `KIBANA_PATH_CONF` (for example in debian based system would be `/etc/kibana`). +You can modify this limit by setting `--max-old-space-size` in the `node.options` config file that can be found inside `kibana/config` folder or any other configured with the environment variable `KBN_PATH_CONF` (for example in debian based system would be `/etc/kibana`). The option accepts a limit in MB: -------- diff --git a/docs/user/reporting/configuring-reporting.asciidoc b/docs/user/reporting/configuring-reporting.asciidoc index ca2d79bb2dec0..6a0c44cf4c2a4 100644 --- a/docs/user/reporting/configuring-reporting.asciidoc +++ b/docs/user/reporting/configuring-reporting.asciidoc @@ -23,7 +23,7 @@ reporting job metadata. To set a static encryption key for reporting, set the `xpack.reporting.encryptionKey` property in the `kibana.yml` -configuration file. You can use any text string as the encryption key. +configuration file. You can use any alphanumeric, at least 32 characters long text string as the encryption key. [source,yaml] -------------------------------------------------------------------------------- diff --git a/docs/visualize/images/lens_aggregation_labels.png b/docs/visualize/images/lens_aggregation_labels.png new file mode 100644 index 0000000000000..9dcf1d226a197 Binary files /dev/null and b/docs/visualize/images/lens_aggregation_labels.png differ diff --git a/docs/visualize/images/lens_data_info.png b/docs/visualize/images/lens_data_info.png index 3ceb7e5e990f7..5ea6fc64a217d 100644 Binary files a/docs/visualize/images/lens_data_info.png and b/docs/visualize/images/lens_data_info.png differ diff --git a/docs/visualize/images/lens_drag_drop.gif b/docs/visualize/images/lens_drag_drop.gif index 2a759abf03020..ca62115e7ea3a 100644 Binary files a/docs/visualize/images/lens_drag_drop.gif and b/docs/visualize/images/lens_drag_drop.gif differ diff --git a/docs/visualize/images/lens_index_pattern.png b/docs/visualize/images/lens_index_pattern.png new file mode 100644 index 0000000000000..90a34b7a5d225 Binary files /dev/null and b/docs/visualize/images/lens_index_pattern.png differ diff --git a/docs/visualize/images/lens_layers.png b/docs/visualize/images/lens_layers.png new file mode 100644 index 0000000000000..7410425a6977e Binary files /dev/null and b/docs/visualize/images/lens_layers.png differ diff --git a/docs/visualize/images/lens_suggestions.gif b/docs/visualize/images/lens_suggestions.gif index ad93a9d87d548..3258e924cb205 100644 Binary files a/docs/visualize/images/lens_suggestions.gif and b/docs/visualize/images/lens_suggestions.gif differ diff --git a/docs/visualize/images/lens_tutorial_1.png b/docs/visualize/images/lens_tutorial_1.png index 7992276c833e7..77c1532e0ddac 100644 Binary files a/docs/visualize/images/lens_tutorial_1.png and b/docs/visualize/images/lens_tutorial_1.png differ diff --git a/docs/visualize/images/lens_tutorial_2.png b/docs/visualize/images/lens_tutorial_2.png index b47e7feff3b9f..e7b8a7b515f52 100644 Binary files a/docs/visualize/images/lens_tutorial_2.png and b/docs/visualize/images/lens_tutorial_2.png differ diff --git a/docs/visualize/images/lens_tutorial_3.1.png b/docs/visualize/images/lens_tutorial_3.1.png new file mode 100644 index 0000000000000..e9ed365e64aec Binary files /dev/null and b/docs/visualize/images/lens_tutorial_3.1.png differ diff --git a/docs/visualize/images/lens_tutorial_3.2.png b/docs/visualize/images/lens_tutorial_3.2.png new file mode 100644 index 0000000000000..c19bcb05dcb00 Binary files /dev/null and b/docs/visualize/images/lens_tutorial_3.2.png differ diff --git a/docs/visualize/images/lens_tutorial_3.png b/docs/visualize/images/lens_tutorial_3.png index ea40b458202b7..35fb10d4985e1 100644 Binary files a/docs/visualize/images/lens_tutorial_3.png and b/docs/visualize/images/lens_tutorial_3.png differ diff --git a/docs/visualize/images/lens_viz_types.png b/docs/visualize/images/lens_viz_types.png index fb3961ad8bb28..2ecfa6bd0e0e3 100644 Binary files a/docs/visualize/images/lens_viz_types.png and b/docs/visualize/images/lens_viz_types.png differ diff --git a/docs/visualize/lens.asciidoc b/docs/visualize/lens.asciidoc index 09b55af9be2db..6e51433bca3f6 100644 --- a/docs/visualize/lens.asciidoc +++ b/docs/visualize/lens.asciidoc @@ -4,24 +4,22 @@ beta[] -*Lens* is a simple and fast way to create visualizations of your {es} data. With *Lens*, +*Lens* is a simple and fast way to create visualizations of your {es} data. To create visualizations, you drag and drop your data fields onto the visualization builder pane, and *Lens* automatically generates a visualization that best displays your data. With Lens, you can: -* Explore your data in just a few clicks. +* Use the automatically generated visualization suggestions to change the visualization type. * Create visualizations with multiple layers and indices. -* Use the automatically generated visualization suggestions to change the visualization type. - * Add your visualizations to dashboards and Canvas workpads. -To get started with *Lens*, click a field in the data panel, then drag and drop the field on a highlighted area. +To get started with *Lens*, select a field in the data panel, then drag and drop the field on a highlighted area. [role="screenshot"] -image::images/lens_drag_drop.gif[] +image::images/lens_drag_drop.gif[Drag and drop] You can incorporate many fields into your visualization, and Lens uses heuristics to decide how to apply each one to the visualization. @@ -30,9 +28,9 @@ you can still configure the customization options for your visualization. [float] [[apply-lens-filters]] -==== Filter the data panel fields +==== Change the data panel fields -The fields in the data panel based on your selected <>, and the <>. +The fields in the data panel are based on the selected <> and <>. To change the index pattern, click it, then select a new one. The fields in the data panel automatically update. @@ -46,12 +44,12 @@ To filter the fields in the data panel: [[view-data-summaries]] ==== Data summaries -To help you decide exactly the data you want to display, get a quick summary of each field. The summary shows the distribution of values in the time range. +To help you decide exactly the data you want to display, get a quick summary of each field. The summary shows the distribution of values within the selected time range. To view the field summary information, navigate to the field, then click *i*. [role="screenshot"] -image::images/lens_data_info.png[] +image::images/lens_data_info.png[Data summary window] [float] [[change-the-visualization-type]] @@ -62,7 +60,7 @@ image::images/lens_data_info.png[] *Suggestions* are shortcuts to alternate visualizations that *Lens* generates for you. [role="screenshot"] -image::images/lens_suggestions.gif[] +image::images/lens_suggestions.gif[Visualization suggestions] If you'd like to use a visualization type that is not suggested, click the visualization type, then select a new one. @@ -78,19 +76,30 @@ still allows you to make the change. [[customize-operation]] ==== Change the aggregation and labels -Lens allows some customizations of the data for each visualization. +For each visualization, Lens allows some customizations of the data. . Click *Drop a field here* or the field name in the column. -. Change the options that appear depending on the type of field. +. Change the options that appear. Options vary depending on the type of field. ++ +[role="screenshot"] +image::images/lens_aggregation_labels.png[Quick function options] [float] [[layers]] ==== Add layers and indices -Bar, line, and area charts allow you to visualize multiple data layers and indices so that you can compare and analyze data from multiple sources. +Area, line, and bar charts allow you to visualize multiple data layers and indices so that you can compare and analyze data from multiple sources. + +To add a layer, click *+*, then drag and drop the fields for the new layer. + +[role="screenshot"] +image::images/lens_layers.png[Add layers] + +To view a different index, click it, then select a new one. -To add a layer, click *+*, then drag and drop the fields for the new layer. To view a different index, click it, then select a new one. +[role="screenshot"] +image::images/lens_index_pattern.png[Add index pattern] [float] [[lens-tutorial]] @@ -110,8 +119,6 @@ To start, you'll need to add the <>. Drag and drop your data onto the visualization builder pane. -. Open *Lens*. - . Select the *kibana_sample_data_ecommerce* index pattern. . Click image:images/time-filter-calendar.png[], then click *Last 7 days*. @@ -138,16 +145,19 @@ image::images/lens_tutorial_2.png[Lens tutorial] Make your visualization look exactly how you want with the customization options. -. Click *Average of taxful_total_price*. - -.. Change the *Label* to `Sales`. - -. Click *Top values of category.keyword*. +. Click *Average of taxful_total_price*, then change the *Label* to `Sales`. ++ +[role="screenshot"] +image::images/lens_tutorial_3.1.png[Lens tutorial] -.. Change *Number of values* to `10`. The visualization updates to show there are only -six available categories. +. Click *Top values of category.keyword*, then change *Number of values* to `10`. ++ +[role="screenshot"] +image::images/lens_tutorial_3.2.png[Lens tutorial] ++ +The visualization updates to show there are only six available categories. + -Look at the *Suggestions*. An area chart is not an option, but for sales data, a stacked area chart might be the best option. +Look at the *Suggestions*. An area chart is not an option, but for the sales data, a stacked area chart might be the best option. . To switch the chart type, click *Stacked bar chart* in the column, then click *Stacked area* from the *Select a visualizations* window. + diff --git a/examples/alerting_example/server/plugin.ts b/examples/alerting_example/server/plugin.ts index 49352cc285693..e74cad28f77f4 100644 --- a/examples/alerting_example/server/plugin.ts +++ b/examples/alerting_example/server/plugin.ts @@ -44,6 +44,9 @@ export class AlertingExamplePlugin implements Plugin { - appStateContainer.set({ ...appState, query }); - }, - [appStateContainer, appState] - ); - const indexPattern = useIndexPattern(data); if (!indexPattern) - return
No index pattern found. Please create an intex patter before loading...
; + return
No index pattern found. Please create an index patter before loading...
; // Render the application DOM. // Note that `navigation.ui.TopNavMenu` is a stateful component exported on the `navigation` plugin's start contract. @@ -107,8 +100,6 @@ const App = ({ navigation, data, history, kbnUrlStateStorage }: StateDemoAppDeps showSearchBar={true} indexPatterns={[indexPattern]} useDefaultBehaviors={true} - onQuerySubmit={onQuerySubmit} - query={appState.query} showSaveQuery={true} /> @@ -200,7 +191,7 @@ function useAppStateSyncing( const stopSyncingQueryAppStateWithStateContainer = connectToQueryState( query, appStateContainer, - { filters: esFilters.FilterStateStore.APP_STATE } + { filters: esFilters.FilterStateStore.APP_STATE, query: true } ); // sets up syncing app state container with url diff --git a/package.json b/package.json index 0c49ec26be194..51a41cbbab9ff 100644 --- a/package.json +++ b/package.json @@ -460,7 +460,7 @@ "jest-cli": "^25.5.4", "jest-environment-jsdom-thirteen": "^1.0.1", "jest-raw-loader": "^1.0.1", - "jimp": "^0.9.6", + "jimp": "^0.14.0", "json5": "^1.0.1", "license-checker": "^16.0.0", "listr": "^0.14.1", diff --git a/packages/kbn-dev-utils/src/ci_stats_reporter/ci_stats_reporter.ts b/packages/kbn-dev-utils/src/ci_stats_reporter/ci_stats_reporter.ts index b38a27fdc1b48..b0378ab6c5cd5 100644 --- a/packages/kbn-dev-utils/src/ci_stats_reporter/ci_stats_reporter.ts +++ b/packages/kbn-dev-utils/src/ci_stats_reporter/ci_stats_reporter.ts @@ -29,6 +29,8 @@ interface Config { buildId: string; } +export type CiStatsMetrics = Array<{ group: string; id: string; value: number }>; + function parseConfig(log: ToolingLog) { const configJson = process.env.KIBANA_CI_STATS_CONFIG; if (!configJson) { @@ -84,7 +86,7 @@ export class CiStatsReporter { return !!this.config; } - async metrics(metrics: Array<{ group: string; id: string; value: number }>) { + async metrics(metrics: CiStatsMetrics) { if (!this.config) { return; } diff --git a/packages/kbn-optimizer/src/cli.ts b/packages/kbn-optimizer/src/cli.ts index 9d3f4b88a258f..542dc7255f22f 100644 --- a/packages/kbn-optimizer/src/cli.ts +++ b/packages/kbn-optimizer/src/cli.ts @@ -116,7 +116,7 @@ run( log.warning('Unable to initialize CiStatsReporter from env'); } - update$ = update$.pipe(reportOptimizerStats(reporter, config)); + update$ = update$.pipe(reportOptimizerStats(reporter, config, log)); } await update$.pipe(logOptimizerState(log, config)).toPromise(); diff --git a/packages/kbn-optimizer/src/log_optimizer_state.ts b/packages/kbn-optimizer/src/log_optimizer_state.ts index 20d98f74dbe86..e8bc6debf971e 100644 --- a/packages/kbn-optimizer/src/log_optimizer_state.ts +++ b/packages/kbn-optimizer/src/log_optimizer_state.ts @@ -104,7 +104,7 @@ export function logOptimizerState(log: ToolingLog, config: OptimizerConfig) { } if (state.phase === 'running' || state.phase === 'initializing') { - return true; + return; } if (state.phase === 'issue') { @@ -119,7 +119,7 @@ export function logOptimizerState(log: ToolingLog, config: OptimizerConfig) { } } log.indent(-4); - return true; + return; } if (state.phase === 'success') { @@ -135,7 +135,7 @@ export function logOptimizerState(log: ToolingLog, config: OptimizerConfig) { ); } - return true; + return; } throw new Error(`unhandled optimizer message: ${inspect(update)}`); diff --git a/packages/kbn-optimizer/src/report_optimizer_stats.ts b/packages/kbn-optimizer/src/report_optimizer_stats.ts index 5057c717efcc3..eff2bce0b827e 100644 --- a/packages/kbn-optimizer/src/report_optimizer_stats.ts +++ b/packages/kbn-optimizer/src/report_optimizer_stats.ts @@ -21,7 +21,7 @@ import Fs from 'fs'; import Path from 'path'; import { materialize, mergeMap, dematerialize } from 'rxjs/operators'; -import { CiStatsReporter } from '@kbn/dev-utils'; +import { CiStatsReporter, CiStatsMetrics, ToolingLog } from '@kbn/dev-utils'; import { OptimizerUpdate$ } from './run_optimizer'; import { OptimizerState, OptimizerConfig } from './optimizer'; @@ -67,7 +67,11 @@ const getFiles = (dir: string, parent?: string) => return true; }); -export function reportOptimizerStats(reporter: CiStatsReporter, config: OptimizerConfig) { +export function reportOptimizerStats( + reporter: CiStatsReporter, + config: OptimizerConfig, + log: ToolingLog +) { return pipeClosure((update$: OptimizerUpdate$) => { let lastState: OptimizerState | undefined; return update$.pipe( @@ -98,10 +102,18 @@ export function reportOptimizerStats(reporter: CiStatsReporter, config: Optimize const miscFiles = outputFiles.filter( (f) => f !== entry && !asyncChunks.includes(f) ); + + if (asyncChunks.length) { + log.verbose(bundle.id, 'async chunks', asyncChunks); + } + if (miscFiles.length) { + log.verbose(bundle.id, 'misc files', asyncChunks); + } + const sumSize = (files: Entry[]) => files.reduce((acc: number, f) => acc + f.stats!.size, 0); - return [ + const metrics: CiStatsMetrics = [ { group: `@kbn/optimizer bundle module count`, id: bundle.id, @@ -123,6 +135,10 @@ export function reportOptimizerStats(reporter: CiStatsReporter, config: Optimize value: sumSize(miscFiles), }, ]; + + log.info(bundle.id, 'metrics', metrics); + + return metrics; }) ) ); diff --git a/packages/kbn-storybook/package.json b/packages/kbn-storybook/package.json index 4f035c3334b86..53ad84da93988 100644 --- a/packages/kbn-storybook/package.json +++ b/packages/kbn-storybook/package.json @@ -6,14 +6,14 @@ "dependencies": { "@kbn/babel-preset": "1.0.0", "@kbn/dev-utils": "1.0.0", - "@storybook/addon-actions": "^5.2.8", + "@storybook/addon-actions": "^5.3.19", "@storybook/addon-console": "^1.2.1", - "@storybook/addon-info": "^5.2.8", - "@storybook/addon-knobs": "^5.2.8", - "@storybook/addon-options": "^5.2.8", - "@storybook/addon-storyshots": "^5.2.8", - "@storybook/react": "^5.2.8", - "@storybook/theming": "^5.2.8", + "@storybook/addon-info": "^5.3.19", + "@storybook/addon-knobs": "^5.3.19", + "@storybook/addon-options": "^5.3.19", + "@storybook/addon-storyshots": "^5.3.19", + "@storybook/react": "^5.3.19", + "@storybook/theming": "^5.3.19", "copy-webpack-plugin": "^6.0.2", "fast-glob": "2.2.7", "glob-watcher": "5.0.3", diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts index 70b25cb78787a..eb54983d0be13 100644 --- a/src/core/public/doc_links/doc_links_service.ts +++ b/src/core/public/doc_links/doc_links_service.ts @@ -112,7 +112,7 @@ export class DocLinksService { kibana: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/index.html`, siem: { guide: `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/index.html`, - gettingStarted: `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/install-siem.html`, + gettingStarted: `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/index.html`, }, query: { luceneQuerySyntax: `${ELASTICSEARCH_DOCS}query-dsl-query-string-query.html#query-string-syntax`, diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index c811209dfa80f..9b421e0172df0 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -5,147 +5,35 @@ ```ts import { Action } from 'history'; +import { ApiResponse } from '@elastic/elasticsearch/lib/Transport'; import Boom from 'boom'; -import { BulkIndexDocumentsParams } from 'elasticsearch'; -import { CatAliasesParams } from 'elasticsearch'; -import { CatAllocationParams } from 'elasticsearch'; -import { CatCommonParams } from 'elasticsearch'; -import { CatFielddataParams } from 'elasticsearch'; -import { CatHealthParams } from 'elasticsearch'; -import { CatHelpParams } from 'elasticsearch'; -import { CatIndicesParams } from 'elasticsearch'; -import { CatRecoveryParams } from 'elasticsearch'; -import { CatSegmentsParams } from 'elasticsearch'; -import { CatShardsParams } from 'elasticsearch'; -import { CatSnapshotsParams } from 'elasticsearch'; -import { CatTasksParams } from 'elasticsearch'; -import { CatThreadPoolParams } from 'elasticsearch'; -import { ClearScrollParams } from 'elasticsearch'; -import { Client } from 'elasticsearch'; -import { ClusterAllocationExplainParams } from 'elasticsearch'; -import { ClusterGetSettingsParams } from 'elasticsearch'; -import { ClusterHealthParams } from 'elasticsearch'; -import { ClusterPendingTasksParams } from 'elasticsearch'; -import { ClusterPutSettingsParams } from 'elasticsearch'; -import { ClusterRerouteParams } from 'elasticsearch'; -import { ClusterStateParams } from 'elasticsearch'; -import { ClusterStatsParams } from 'elasticsearch'; -import { CountParams } from 'elasticsearch'; -import { CreateDocumentParams } from 'elasticsearch'; -import { DeleteDocumentByQueryParams } from 'elasticsearch'; -import { DeleteDocumentParams } from 'elasticsearch'; -import { DeleteScriptParams } from 'elasticsearch'; -import { DeleteTemplateParams } from 'elasticsearch'; import { EuiBreadcrumb } from '@elastic/eui'; import { EuiButtonEmptyProps } from '@elastic/eui'; import { EuiConfirmModalProps } from '@elastic/eui'; import { EuiGlobalToastListToast } from '@elastic/eui'; import { ExclusiveUnion } from '@elastic/eui'; -import { ExistsParams } from 'elasticsearch'; -import { ExplainParams } from 'elasticsearch'; -import { FieldStatsParams } from 'elasticsearch'; -import { GenericParams } from 'elasticsearch'; -import { GetParams } from 'elasticsearch'; -import { GetResponse } from 'elasticsearch'; -import { GetScriptParams } from 'elasticsearch'; -import { GetSourceParams } from 'elasticsearch'; -import { GetTemplateParams } from 'elasticsearch'; import { History } from 'history'; import { Href } from 'history'; import { IconType } from '@elastic/eui'; -import { IndexDocumentParams } from 'elasticsearch'; -import { IndicesAnalyzeParams } from 'elasticsearch'; -import { IndicesClearCacheParams } from 'elasticsearch'; -import { IndicesCloseParams } from 'elasticsearch'; -import { IndicesCreateParams } from 'elasticsearch'; -import { IndicesDeleteAliasParams } from 'elasticsearch'; -import { IndicesDeleteParams } from 'elasticsearch'; -import { IndicesDeleteTemplateParams } from 'elasticsearch'; -import { IndicesExistsAliasParams } from 'elasticsearch'; -import { IndicesExistsParams } from 'elasticsearch'; -import { IndicesExistsTemplateParams } from 'elasticsearch'; -import { IndicesExistsTypeParams } from 'elasticsearch'; -import { IndicesFlushParams } from 'elasticsearch'; -import { IndicesFlushSyncedParams } from 'elasticsearch'; -import { IndicesForcemergeParams } from 'elasticsearch'; -import { IndicesGetAliasParams } from 'elasticsearch'; -import { IndicesGetFieldMappingParams } from 'elasticsearch'; -import { IndicesGetMappingParams } from 'elasticsearch'; -import { IndicesGetParams } from 'elasticsearch'; -import { IndicesGetSettingsParams } from 'elasticsearch'; -import { IndicesGetTemplateParams } from 'elasticsearch'; -import { IndicesGetUpgradeParams } from 'elasticsearch'; -import { IndicesOpenParams } from 'elasticsearch'; -import { IndicesPutAliasParams } from 'elasticsearch'; -import { IndicesPutMappingParams } from 'elasticsearch'; -import { IndicesPutSettingsParams } from 'elasticsearch'; -import { IndicesPutTemplateParams } from 'elasticsearch'; -import { IndicesRecoveryParams } from 'elasticsearch'; -import { IndicesRefreshParams } from 'elasticsearch'; -import { IndicesRolloverParams } from 'elasticsearch'; -import { IndicesSegmentsParams } from 'elasticsearch'; -import { IndicesShardStoresParams } from 'elasticsearch'; -import { IndicesShrinkParams } from 'elasticsearch'; -import { IndicesStatsParams } from 'elasticsearch'; -import { IndicesUpdateAliasesParams } from 'elasticsearch'; -import { IndicesUpgradeParams } from 'elasticsearch'; -import { IndicesValidateQueryParams } from 'elasticsearch'; -import { InfoParams } from 'elasticsearch'; -import { IngestDeletePipelineParams } from 'elasticsearch'; -import { IngestGetPipelineParams } from 'elasticsearch'; -import { IngestPutPipelineParams } from 'elasticsearch'; -import { IngestSimulateParams } from 'elasticsearch'; +import { KibanaClient } from '@elastic/elasticsearch/api/kibana'; import { KibanaConfigType } from 'src/core/server/kibana_config'; import { Location } from 'history'; import { LocationDescriptorObject } from 'history'; import { MaybePromise } from '@kbn/utility-types'; -import { MGetParams } from 'elasticsearch'; -import { MGetResponse } from 'elasticsearch'; -import { MSearchParams } from 'elasticsearch'; -import { MSearchResponse } from 'elasticsearch'; -import { MSearchTemplateParams } from 'elasticsearch'; -import { MTermVectorsParams } from 'elasticsearch'; -import { NodesHotThreadsParams } from 'elasticsearch'; -import { NodesInfoParams } from 'elasticsearch'; -import { NodesStatsParams } from 'elasticsearch'; import { Observable } from 'rxjs'; import { ParsedQuery } from 'query-string'; import { Path } from 'history'; -import { PingParams } from 'elasticsearch'; import { PublicUiSettingsParams as PublicUiSettingsParams_2 } from 'src/core/server/types'; -import { PutScriptParams } from 'elasticsearch'; -import { PutTemplateParams } from 'elasticsearch'; import React from 'react'; import { RecursiveReadonly } from '@kbn/utility-types'; -import { ReindexParams } from 'elasticsearch'; -import { ReindexRethrottleParams } from 'elasticsearch'; -import { RenderSearchTemplateParams } from 'elasticsearch'; import * as Rx from 'rxjs'; -import { ScrollParams } from 'elasticsearch'; -import { SearchParams } from 'elasticsearch'; -import { SearchResponse } from 'elasticsearch'; -import { SearchShardsParams } from 'elasticsearch'; -import { SearchTemplateParams } from 'elasticsearch'; import { ShallowPromise } from '@kbn/utility-types'; -import { SnapshotCreateParams } from 'elasticsearch'; -import { SnapshotCreateRepositoryParams } from 'elasticsearch'; -import { SnapshotDeleteParams } from 'elasticsearch'; -import { SnapshotDeleteRepositoryParams } from 'elasticsearch'; -import { SnapshotGetParams } from 'elasticsearch'; -import { SnapshotGetRepositoryParams } from 'elasticsearch'; -import { SnapshotRestoreParams } from 'elasticsearch'; -import { SnapshotStatusParams } from 'elasticsearch'; -import { SnapshotVerifyRepositoryParams } from 'elasticsearch'; -import { SuggestParams } from 'elasticsearch'; -import { TasksCancelParams } from 'elasticsearch'; -import { TasksGetParams } from 'elasticsearch'; -import { TasksListParams } from 'elasticsearch'; -import { TermvectorsParams } from 'elasticsearch'; +import { TransportRequestOptions } from '@elastic/elasticsearch/lib/Transport'; +import { TransportRequestParams } from '@elastic/elasticsearch/lib/Transport'; +import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; import { Type } from '@kbn/config-schema'; import { TypeOf } from '@kbn/config-schema'; import { UnregisterCallback } from 'history'; -import { UpdateDocumentByQueryParams } from 'elasticsearch'; -import { UpdateDocumentParams } from 'elasticsearch'; import { UserProvidedValues as UserProvidedValues_2 } from 'src/core/server/types'; // @internal (undocumented) diff --git a/src/core/server/config/deprecation/core_deprecations.test.ts b/src/core/server/config/deprecation/core_deprecations.test.ts index ebdb6f1c88b16..adf0f52339366 100644 --- a/src/core/server/config/deprecation/core_deprecations.test.ts +++ b/src/core/server/config/deprecation/core_deprecations.test.ts @@ -51,7 +51,7 @@ describe('core deprecations', () => { const { messages } = applyCoreDeprecations(); expect(messages).toMatchInlineSnapshot(` Array [ - "Environment variable CONFIG_PATH is deprecated. It has been replaced with KIBANA_PATH_CONF pointing to a config folder", + "Environment variable CONFIG_PATH is deprecated. It has been replaced with KBN_PATH_CONF pointing to a config folder", ] `); }); diff --git a/src/core/server/config/deprecation/core_deprecations.ts b/src/core/server/config/deprecation/core_deprecations.ts index 715f5b883139f..6cc0e5ef138d5 100644 --- a/src/core/server/config/deprecation/core_deprecations.ts +++ b/src/core/server/config/deprecation/core_deprecations.ts @@ -23,7 +23,7 @@ import { ConfigDeprecationProvider, ConfigDeprecation } from './types'; const configPathDeprecation: ConfigDeprecation = (settings, fromPath, log) => { if (has(process.env, 'CONFIG_PATH')) { log( - `Environment variable CONFIG_PATH is deprecated. It has been replaced with KIBANA_PATH_CONF pointing to a config folder` + `Environment variable CONFIG_PATH is deprecated. It has been replaced with KBN_PATH_CONF pointing to a config folder` ); } return settings; diff --git a/src/core/server/elasticsearch/client/types.ts b/src/core/server/elasticsearch/client/types.ts index 285f52e89a591..827b185672c7c 100644 --- a/src/core/server/elasticsearch/client/types.ts +++ b/src/core/server/elasticsearch/client/types.ts @@ -42,34 +42,50 @@ export type ElasticsearchClient = Omit< }; }; -interface ShardsResponse { +/** + * All response typings are maintained until elasticsearch-js provides them out of the box + * https://github.com/elastic/elasticsearch-js/pull/970 + */ + +/** + * @public + */ +export interface ShardsResponse { total: number; successful: number; failed: number; skipped: number; } -interface Explanation { +/** + * @public + */ +export interface Explanation { value: number; description: string; details: Explanation[]; } -interface ShardsInfo { +/** + * @public + */ +export interface ShardsInfo { total: number; successful: number; skipped: number; failed: number; } +/** + * @public + */ export interface CountResponse { _shards: ShardsInfo; count: number; } /** - * Maintained until elasticsearch provides response typings out of the box - * https://github.com/elastic/elasticsearch-js/pull/970 + * @public */ export interface SearchResponse { took: number; @@ -97,6 +113,9 @@ export interface SearchResponse { aggregations?: any; } +/** + * @public + */ export interface GetResponse { _index: string; _type: string; @@ -109,6 +128,9 @@ export interface GetResponse { _primary_term: number; } +/** + * @public + */ export interface DeleteDocumentResponse { _shards: ShardsResponse; found: boolean; diff --git a/src/core/server/elasticsearch/index.ts b/src/core/server/elasticsearch/index.ts index 32be6e6bf34dd..9359b88434396 100644 --- a/src/core/server/elasticsearch/index.ts +++ b/src/core/server/elasticsearch/index.ts @@ -36,8 +36,12 @@ export { ElasticsearchClientConfig, ElasticsearchClient, IScopedClusterClient, + // responses SearchResponse, + CountResponse, + ShardsInfo, + ShardsResponse, + Explanation, GetResponse, DeleteDocumentResponse, - CountResponse, } from './client'; diff --git a/src/core/server/http/http_server.test.ts b/src/core/server/http/http_server.test.ts index 601eba835a54e..007d75a69b955 100644 --- a/src/core/server/http/http_server.test.ts +++ b/src/core/server/http/http_server.test.ts @@ -992,6 +992,133 @@ describe('body options', () => { }); }); +describe('timeout options', () => { + test('should accept a socket "timeout" which is 3 minutes in milliseconds, "300000" for a POST', async () => { + const { registerRouter, server: innerServer } = await server.setup(config); + + const router = new Router('', logger, enhanceWithContext); + router.post( + { + path: '/', + validate: false, + options: { timeout: 300000 }, + }, + (context, req, res) => { + try { + return res.ok({ body: { timeout: req.route.options.timeout } }); + } catch (err) { + return res.internalError({ body: err.message }); + } + } + ); + registerRouter(router); + await server.start(); + await supertest(innerServer.listener).post('/').send({ test: 1 }).expect(200, { + timeout: 300000, + }); + }); + + test('should accept a socket "timeout" which is 3 minutes in milliseconds, "300000" for a GET', async () => { + const { registerRouter, server: innerServer } = await server.setup(config); + + const router = new Router('', logger, enhanceWithContext); + router.get( + { + path: '/', + validate: false, + options: { timeout: 300000 }, + }, + (context, req, res) => { + try { + return res.ok({ body: { timeout: req.route.options.timeout } }); + } catch (err) { + return res.internalError({ body: err.message }); + } + } + ); + registerRouter(router); + await server.start(); + await supertest(innerServer.listener).get('/').expect(200, { + timeout: 300000, + }); + }); + + test('should accept a socket "timeout" which is 3 minutes in milliseconds, "300000" for a DELETE', async () => { + const { registerRouter, server: innerServer } = await server.setup(config); + + const router = new Router('', logger, enhanceWithContext); + router.delete( + { + path: '/', + validate: false, + options: { timeout: 300000 }, + }, + (context, req, res) => { + try { + return res.ok({ body: { timeout: req.route.options.timeout } }); + } catch (err) { + return res.internalError({ body: err.message }); + } + } + ); + registerRouter(router); + await server.start(); + await supertest(innerServer.listener).delete('/').expect(200, { + timeout: 300000, + }); + }); + + test('should accept a socket "timeout" which is 3 minutes in milliseconds, "300000" for a PUT', async () => { + const { registerRouter, server: innerServer } = await server.setup(config); + + const router = new Router('', logger, enhanceWithContext); + router.put( + { + path: '/', + validate: false, + options: { timeout: 300000 }, + }, + (context, req, res) => { + try { + return res.ok({ body: { timeout: req.route.options.timeout } }); + } catch (err) { + return res.internalError({ body: err.message }); + } + } + ); + registerRouter(router); + await server.start(); + await supertest(innerServer.listener).put('/').expect(200, { + timeout: 300000, + }); + }); + + test('should accept a socket "timeout" which is 3 minutes in milliseconds, "300000" for a PATCH', async () => { + const { registerRouter, server: innerServer } = await server.setup(config); + + const router = new Router('', logger, enhanceWithContext); + router.patch( + { + path: '/', + validate: false, + options: { timeout: 300000 }, + }, + (context, req, res) => { + try { + return res.ok({ body: { timeout: req.route.options.timeout } }); + } catch (err) { + return res.internalError({ body: err.message }); + } + } + ); + registerRouter(router); + await server.start(); + await supertest(innerServer.listener).patch('/').expect(200, { + timeout: 300000, + }); + }); +}); + test('should return a stream in the body', async () => { const { registerRouter, server: innerServer } = await server.setup(config); diff --git a/src/core/server/http/http_server.ts b/src/core/server/http/http_server.ts index 9c16162d69334..4b70f58deba99 100644 --- a/src/core/server/http/http_server.ts +++ b/src/core/server/http/http_server.ts @@ -161,8 +161,10 @@ export class HttpServer { this.log.debug(`registering route handler for [${route.path}]`); // Hapi does not allow payload validation to be specified for 'head' or 'get' requests const validate = isSafeMethod(route.method) ? undefined : { payload: true }; - const { authRequired, tags, body = {} } = route.options; + const { authRequired, tags, body = {}, timeout } = route.options; const { accepts: allow, maxBytes, output, parse } = body; + // Hapi does not allow timeouts on payloads to be specified for 'head' or 'get' requests + const payloadTimeout = isSafeMethod(route.method) || timeout == null ? undefined : timeout; const kibanaRouteState: KibanaRouteState = { xsrfRequired: route.options.xsrfRequired ?? !isSafeMethod(route.method), @@ -181,9 +183,23 @@ export class HttpServer { // validation applied in ./http_tools#getServerOptions // (All NP routes are already required to specify their own validation in order to access the payload) validate, - payload: [allow, maxBytes, output, parse].some((v) => typeof v !== 'undefined') - ? { allow, maxBytes, output, parse } + payload: [allow, maxBytes, output, parse, payloadTimeout].some( + (v) => typeof v !== 'undefined' + ) + ? { + allow, + maxBytes, + output, + parse, + timeout: payloadTimeout, + } : undefined, + timeout: + timeout != null + ? { + socket: timeout + 1, // Hapi server requires the socket to be greater than payload settings so we add 1 millisecond + } + : undefined, }, }); } diff --git a/src/core/server/http/integration_tests/router.test.ts b/src/core/server/http/integration_tests/router.test.ts index bb36fefa96611..434e22e3cf6f5 100644 --- a/src/core/server/http/integration_tests/router.test.ts +++ b/src/core/server/http/integration_tests/router.test.ts @@ -302,6 +302,130 @@ describe('Options', () => { }); }); }); + + describe('timeout', () => { + it('should timeout if configured with a small timeout value for a POST', async () => { + const { server: innerServer, createRouter } = await server.setup(setupDeps); + const router = createRouter('/'); + + router.post( + { path: '/a', validate: false, options: { timeout: 1000 } }, + async (context, req, res) => { + await new Promise((resolve) => setTimeout(resolve, 2000)); + return res.ok({}); + } + ); + router.post({ path: '/b', validate: false }, (context, req, res) => res.ok({})); + await server.start(); + expect(supertest(innerServer.listener).post('/a')).rejects.toThrow('socket hang up'); + await supertest(innerServer.listener).post('/b').expect(200, {}); + }); + + it('should timeout if configured with a small timeout value for a PUT', async () => { + const { server: innerServer, createRouter } = await server.setup(setupDeps); + const router = createRouter('/'); + + router.put( + { path: '/a', validate: false, options: { timeout: 1000 } }, + async (context, req, res) => { + await new Promise((resolve) => setTimeout(resolve, 2000)); + return res.ok({}); + } + ); + router.put({ path: '/b', validate: false }, (context, req, res) => res.ok({})); + await server.start(); + + expect(supertest(innerServer.listener).put('/a')).rejects.toThrow('socket hang up'); + await supertest(innerServer.listener).put('/b').expect(200, {}); + }); + + it('should timeout if configured with a small timeout value for a DELETE', async () => { + const { server: innerServer, createRouter } = await server.setup(setupDeps); + const router = createRouter('/'); + + router.delete( + { path: '/a', validate: false, options: { timeout: 1000 } }, + async (context, req, res) => { + await new Promise((resolve) => setTimeout(resolve, 2000)); + return res.ok({}); + } + ); + router.delete({ path: '/b', validate: false }, (context, req, res) => res.ok({})); + await server.start(); + expect(supertest(innerServer.listener).delete('/a')).rejects.toThrow('socket hang up'); + await supertest(innerServer.listener).delete('/b').expect(200, {}); + }); + + it('should timeout if configured with a small timeout value for a GET', async () => { + const { server: innerServer, createRouter } = await server.setup(setupDeps); + const router = createRouter('/'); + + router.get( + // Note: There is a bug within Hapi Server where it cannot set the payload timeout for a GET call but it also cannot configure a timeout less than the payload body + // so the least amount of possible time to configure the timeout is 10 seconds. + { path: '/a', validate: false, options: { timeout: 100000 } }, + async (context, req, res) => { + // Cause a wait of 20 seconds to cause the socket hangup + await new Promise((resolve) => setTimeout(resolve, 200000)); + return res.ok({}); + } + ); + router.get({ path: '/b', validate: false }, (context, req, res) => res.ok({})); + await server.start(); + + expect(supertest(innerServer.listener).get('/a')).rejects.toThrow('socket hang up'); + await supertest(innerServer.listener).get('/b').expect(200, {}); + }); + + it('should not timeout if configured with a 5 minute timeout value for a POST', async () => { + const { server: innerServer, createRouter } = await server.setup(setupDeps); + const router = createRouter('/'); + + router.post( + { path: '/a', validate: false, options: { timeout: 300000 } }, + async (context, req, res) => res.ok({}) + ); + await server.start(); + await supertest(innerServer.listener).post('/a').expect(200, {}); + }); + + it('should not timeout if configured with a 5 minute timeout value for a PUT', async () => { + const { server: innerServer, createRouter } = await server.setup(setupDeps); + const router = createRouter('/'); + + router.put( + { path: '/a', validate: false, options: { timeout: 300000 } }, + async (context, req, res) => res.ok({}) + ); + await server.start(); + + await supertest(innerServer.listener).put('/a').expect(200, {}); + }); + + it('should not timeout if configured with a 5 minute timeout value for a DELETE', async () => { + const { server: innerServer, createRouter } = await server.setup(setupDeps); + const router = createRouter('/'); + + router.delete( + { path: '/a', validate: false, options: { timeout: 300000 } }, + async (context, req, res) => res.ok({}) + ); + await server.start(); + await supertest(innerServer.listener).delete('/a').expect(200, {}); + }); + + it('should not timeout if configured with a 5 minute timeout value for a GET', async () => { + const { server: innerServer, createRouter } = await server.setup(setupDeps); + const router = createRouter('/'); + + router.get( + { path: '/a', validate: false, options: { timeout: 300000 } }, + async (context, req, res) => res.ok({}) + ); + await server.start(); + await supertest(innerServer.listener).get('/a').expect(200, {}); + }); + }); }); describe('Cache-Control', () => { diff --git a/src/core/server/http/router/request.ts b/src/core/server/http/router/request.ts index fefd75ad9710e..0e73431fe7c6d 100644 --- a/src/core/server/http/router/request.ts +++ b/src/core/server/http/router/request.ts @@ -197,12 +197,14 @@ export class KibanaRequest< private getRouteInfo(request: Request): KibanaRequestRoute { const method = request.method as Method; const { parse, maxBytes, allow, output } = request.route.settings.payload || {}; + const timeout = request.route.settings.timeout?.socket; const options = ({ authRequired: this.getAuthRequired(request), // some places in LP call KibanaRequest.from(request) manually. remove fallback to true before v8 xsrfRequired: (request.route.settings.app as KibanaRouteState)?.xsrfRequired ?? true, tags: request.route.settings.tags || [], + timeout: typeof timeout === 'number' ? timeout - 1 : undefined, // We are forced to have the timeout be 1 millisecond greater than the server and payload so we subtract one here to give the user consist settings body: isSafeMethod(method) ? undefined : { diff --git a/src/core/server/http/router/route.ts b/src/core/server/http/router/route.ts index 9789d266587af..676c494bec522 100644 --- a/src/core/server/http/router/route.ts +++ b/src/core/server/http/router/route.ts @@ -144,6 +144,12 @@ export interface RouteConfigOptions { * Additional body options {@link RouteConfigOptionsBody}. */ body?: Method extends 'get' | 'options' ? undefined : RouteConfigOptionsBody; + + /** + * Timeouts for processing durations. Response timeout is in milliseconds. + * Default value: 2 minutes + */ + timeout?: number; } /** diff --git a/src/core/server/index.ts b/src/core/server/index.ts index c846e81573acb..f46b41d6b8793 100644 --- a/src/core/server/index.ts +++ b/src/core/server/index.ts @@ -110,6 +110,13 @@ export { FakeRequest, ScopeableRequest, ElasticsearchClient, + SearchResponse, + CountResponse, + ShardsInfo, + ShardsResponse, + Explanation, + GetResponse, + DeleteDocumentResponse, } from './elasticsearch'; export * from './elasticsearch/legacy/api_types'; export { diff --git a/src/core/server/path/index.ts b/src/core/server/path/index.ts index 1bb650518c47a..7c1a81643fbc8 100644 --- a/src/core/server/path/index.ts +++ b/src/core/server/path/index.ts @@ -25,14 +25,18 @@ import { fromRoot } from '../utils'; const isString = (v: any): v is string => typeof v === 'string'; const CONFIG_PATHS = [ + process.env.KBN_PATH_CONF && join(process.env.KBN_PATH_CONF, 'kibana.yml'), process.env.KIBANA_PATH_CONF && join(process.env.KIBANA_PATH_CONF, 'kibana.yml'), process.env.CONFIG_PATH, // deprecated fromRoot('config/kibana.yml'), ].filter(isString); -const CONFIG_DIRECTORIES = [process.env.KIBANA_PATH_CONF, fromRoot('config'), '/etc/kibana'].filter( - isString -); +const CONFIG_DIRECTORIES = [ + process.env.KBN_PATH_CONF, + process.env.KIBANA_PATH_CONF, + fromRoot('config'), + '/etc/kibana', +].filter(isString); const DATA_PATHS = [ process.env.DATA_PATH, // deprecated diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index 4b6bcbc8ad7a0..c94151f8cee17 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -45,7 +45,7 @@ import { ExplainParams } from 'elasticsearch'; import { FieldStatsParams } from 'elasticsearch'; import { GenericParams } from 'elasticsearch'; import { GetParams } from 'elasticsearch'; -import { GetResponse } from 'elasticsearch'; +import { GetResponse as GetResponse_2 } from 'elasticsearch'; import { GetScriptParams } from 'elasticsearch'; import { GetSourceParams } from 'elasticsearch'; import { GetTemplateParams } from 'elasticsearch'; @@ -121,7 +121,7 @@ import { ResponseToolkit } from 'hapi'; import { SchemaTypeError } from '@kbn/config-schema'; import { ScrollParams } from 'elasticsearch'; import { SearchParams } from 'elasticsearch'; -import { SearchResponse } from 'elasticsearch'; +import { SearchResponse as SearchResponse_2 } from 'elasticsearch'; import { SearchShardsParams } from 'elasticsearch'; import { SearchTemplateParams } from 'elasticsearch'; import { Server } from 'hapi'; @@ -532,6 +532,14 @@ export interface CoreStatus { savedObjects: ServiceStatus; } +// @public (undocumented) +export interface CountResponse { + // (undocumented) + count: number; + // (undocumented) + _shards: ShardsInfo; +} + // @public export class CspConfig implements ICspConfig { // @internal @@ -592,6 +600,28 @@ export const DEFAULT_APP_CATEGORIES: Readonly<{ }; }>; +// @public (undocumented) +export interface DeleteDocumentResponse { + // (undocumented) + error?: { + type: string; + }; + // (undocumented) + found: boolean; + // (undocumented) + _id: string; + // (undocumented) + _index: string; + // (undocumented) + result: string; + // (undocumented) + _shards: ShardsResponse; + // (undocumented) + _type: string; + // (undocumented) + _version: number; +} + // @public (undocumented) export interface DeprecationAPIClientParams extends GenericParams { // (undocumented) @@ -642,6 +672,13 @@ export interface DiscoveredPlugin { readonly requiredPlugins: readonly PluginName[]; } +// @public +export type ElasticsearchClient = Omit & { + transport: { + request(params: TransportRequestParams, options?: TransportRequestOptions): TransportRequestPromise; + }; +}; + // @public export class ElasticsearchConfig { constructor(rawConfig: ElasticsearchConfigType); @@ -709,6 +746,16 @@ export interface ErrorHttpResponseOptions { headers?: ResponseHeaders; } +// @public (undocumented) +export interface Explanation { + // (undocumented) + description: string; + // (undocumented) + details: Explanation[]; + // (undocumented) + value: number; +} + // @public export function exportSavedObjectsToStream({ types, objects, search, savedObjectsClient, exportSizeLimit, includeReferencesDeep, excludeExportDetails, namespace, }: SavedObjectsExportOptions): Promise; @@ -736,6 +783,28 @@ export function getFlattenedObject(rootValue: Record): { [key: string]: any; }; +// @public (undocumented) +export interface GetResponse { + // (undocumented) + found: boolean; + // (undocumented) + _id: string; + // (undocumented) + _index: string; + // (undocumented) + _primary_term: number; + // (undocumented) + _routing?: string; + // (undocumented) + _seq_no: number; + // (undocumented) + _source: T; + // (undocumented) + _type: string; + // (undocumented) + _version: number; +} + // @public export type HandlerContextType> = T extends HandlerFunction ? U : never; @@ -1042,7 +1111,7 @@ export interface LegacyAPICaller { // (undocumented) (endpoint: 'fieldStats', params: FieldStatsParams, options?: LegacyCallAPIOptions): ReturnType; // (undocumented) - (endpoint: 'get', params: GetParams, options?: LegacyCallAPIOptions): Promise>; + (endpoint: 'get', params: GetParams, options?: LegacyCallAPIOptions): Promise>; // (undocumented) (endpoint: 'getScript', params: GetScriptParams, options?: LegacyCallAPIOptions): ReturnType; // (undocumented) @@ -1074,9 +1143,9 @@ export interface LegacyAPICaller { // (undocumented) (endpoint: 'renderSearchTemplate', params: RenderSearchTemplateParams, options?: LegacyCallAPIOptions): ReturnType; // (undocumented) - (endpoint: 'scroll', params: ScrollParams, options?: LegacyCallAPIOptions): Promise>; + (endpoint: 'scroll', params: ScrollParams, options?: LegacyCallAPIOptions): Promise>; // (undocumented) - (endpoint: 'search', params: SearchParams, options?: LegacyCallAPIOptions): Promise>; + (endpoint: 'search', params: SearchParams, options?: LegacyCallAPIOptions): Promise>; // (undocumented) (endpoint: 'searchShards', params: SearchShardsParams, options?: LegacyCallAPIOptions): ReturnType; // (undocumented) @@ -1790,6 +1859,7 @@ export interface RouteConfigOptions { authRequired?: boolean | 'optional'; body?: Method extends 'get' | 'options' ? undefined : RouteConfigOptionsBody; tags?: readonly string[]; + timeout?: number; xsrfRequired?: Method extends 'get' ? never : boolean; } @@ -2082,7 +2152,7 @@ export interface SavedObjectsCreateOptions extends SavedObjectsBaseOptions { // @public (undocumented) export interface SavedObjectsDeleteByNamespaceOptions extends SavedObjectsBaseOptions { - refresh?: MutatingOperationRefreshSetting; + refresh?: boolean; } // @public (undocumented) @@ -2396,7 +2466,7 @@ export class SavedObjectsRepository { // Warning: (ae-forgotten-export) The symbol "KibanaMigrator" needs to be exported by the entry point index.d.ts // // @internal - static createRepository(migrator: KibanaMigrator, typeRegistry: SavedObjectTypeRegistry, indexName: string, callCluster: LegacyAPICaller, includedHiddenTypes?: string[], injectedConstructor?: any): ISavedObjectsRepository; + static createRepository(migrator: KibanaMigrator, typeRegistry: SavedObjectTypeRegistry, indexName: string, client: ElasticsearchClient, includedHiddenTypes?: string[], injectedConstructor?: any): ISavedObjectsRepository; delete(type: string, id: string, options?: SavedObjectsDeleteOptions): Promise<{}>; deleteByNamespace(namespace: string, options?: SavedObjectsDeleteByNamespaceOptions): Promise; deleteFromNamespaces(type: string, id: string, namespaces: string[], options?: SavedObjectsDeleteFromNamespacesOptions): Promise<{}>; @@ -2412,7 +2482,7 @@ export class SavedObjectsRepository { attributes: any; }>; update(type: string, id: string, attributes: Partial, options?: SavedObjectsUpdateOptions): Promise>; - } +} // @public export interface SavedObjectsRepositoryFactory { @@ -2552,6 +2622,39 @@ export type SavedObjectUnsanitizedDoc = SavedObjectDoc & Partial // @public export type ScopeableRequest = KibanaRequest | LegacyRequest | FakeRequest; +// @public (undocumented) +export interface SearchResponse { + // (undocumented) + aggregations?: any; + // (undocumented) + hits: { + total: number; + max_score: number; + hits: Array<{ + _index: string; + _type: string; + _id: string; + _score: number; + _source: T; + _version?: number; + _explanation?: Explanation; + fields?: any; + highlight?: any; + inner_hits?: any; + matched_queries?: string[]; + sort?: string[]; + }>; + }; + // (undocumented) + _scroll_id?: string; + // (undocumented) + _shards: ShardsResponse; + // (undocumented) + timed_out: boolean; + // (undocumented) + took: number; +} + // @public export interface ServiceStatus | unknown = unknown> { detail?: string; @@ -2612,6 +2715,30 @@ export interface SessionStorageFactory { asScoped: (request: KibanaRequest) => SessionStorage; } +// @public (undocumented) +export interface ShardsInfo { + // (undocumented) + failed: number; + // (undocumented) + skipped: number; + // (undocumented) + successful: number; + // (undocumented) + total: number; +} + +// @public (undocumented) +export interface ShardsResponse { + // (undocumented) + failed: number; + // (undocumented) + skipped: number; + // (undocumented) + successful: number; + // (undocumented) + total: number; +} + // @public (undocumented) export type SharedGlobalConfig = RecursiveReadonly<{ kibana: Pick; diff --git a/src/dev/build/tasks/bin/scripts/kibana-keystore b/src/dev/build/tasks/bin/scripts/kibana-keystore index f83df118d24e8..d811e70095548 100755 --- a/src/dev/build/tasks/bin/scripts/kibana-keystore +++ b/src/dev/build/tasks/bin/scripts/kibana-keystore @@ -14,7 +14,7 @@ while [ -h "$SCRIPT" ] ; do done DIR="$(dirname "${SCRIPT}")/.." -CONFIG_DIR=${KIBANA_PATH_CONF:-"$DIR/config"} +CONFIG_DIR=${KBN_PATH_CONF:-"$DIR/config"} NODE="${DIR}/node/bin/node" test -x "$NODE" if [ ! -x "$NODE" ]; then diff --git a/src/dev/build/tasks/bin/scripts/kibana-keystore.bat b/src/dev/build/tasks/bin/scripts/kibana-keystore.bat index 389eb5bf488e4..7e227141c8ba3 100755 --- a/src/dev/build/tasks/bin/scripts/kibana-keystore.bat +++ b/src/dev/build/tasks/bin/scripts/kibana-keystore.bat @@ -12,8 +12,8 @@ If Not Exist "%NODE%" ( Exit /B 1 ) -set CONFIG_DIR=%KIBANA_PATH_CONF% -If [%KIBANA_PATH_CONF%] == [] ( +set CONFIG_DIR=%KBN_PATH_CONF% +If [%KBN_PATH_CONF%] == [] ( set CONFIG_DIR=%DIR%\config ) diff --git a/src/dev/build/tasks/bin/scripts/kibana-plugin b/src/dev/build/tasks/bin/scripts/kibana-plugin index f1102e1ef5a32..f4486e9cf85fb 100755 --- a/src/dev/build/tasks/bin/scripts/kibana-plugin +++ b/src/dev/build/tasks/bin/scripts/kibana-plugin @@ -14,7 +14,7 @@ while [ -h "$SCRIPT" ] ; do done DIR="$(dirname "${SCRIPT}")/.." -CONFIG_DIR=${KIBANA_PATH_CONF:-"$DIR/config"} +CONFIG_DIR=${KBN_PATH_CONF:-"$DIR/config"} NODE="${DIR}/node/bin/node" test -x "$NODE" if [ ! -x "$NODE" ]; then diff --git a/src/dev/build/tasks/bin/scripts/kibana-plugin.bat b/src/dev/build/tasks/bin/scripts/kibana-plugin.bat index 6815b1b9eab8c..4fb30977fda06 100755 --- a/src/dev/build/tasks/bin/scripts/kibana-plugin.bat +++ b/src/dev/build/tasks/bin/scripts/kibana-plugin.bat @@ -13,8 +13,8 @@ If Not Exist "%NODE%" ( Exit /B 1 ) -set CONFIG_DIR=%KIBANA_PATH_CONF% -If [%KIBANA_PATH_CONF%] == [] ( +set CONFIG_DIR=%KBN_PATH_CONF% +If [%KBN_PATH_CONF%] == [] ( set CONFIG_DIR=%DIR%\config ) diff --git a/src/dev/build/tasks/bin/scripts/kibana.bat b/src/dev/build/tasks/bin/scripts/kibana.bat index d3edc92f110a5..98dd9ec05a48c 100755 --- a/src/dev/build/tasks/bin/scripts/kibana.bat +++ b/src/dev/build/tasks/bin/scripts/kibana.bat @@ -14,8 +14,8 @@ If Not Exist "%NODE%" ( Exit /B 1 ) -set CONFIG_DIR=%KIBANA_PATH_CONF% -If [%KIBANA_PATH_CONF%] == [] ( +set CONFIG_DIR=%KBN_PATH_CONF% +If [%KBN_PATH_CONF%] == [] ( set CONFIG_DIR=%DIR%\config ) diff --git a/src/dev/build/tasks/build_kibana_platform_plugins.ts b/src/dev/build/tasks/build_kibana_platform_plugins.ts index 08637677fcfbe..beb5ad40229df 100644 --- a/src/dev/build/tasks/build_kibana_platform_plugins.ts +++ b/src/dev/build/tasks/build_kibana_platform_plugins.ts @@ -44,7 +44,7 @@ export const BuildKibanaPlatformPlugins: Task = { await runOptimizer(optimizerConfig) .pipe( - reportOptimizerStats(reporter, optimizerConfig), + reportOptimizerStats(reporter, optimizerConfig, log), logOptimizerState(log, optimizerConfig) ) .toPromise(); diff --git a/src/dev/build/tasks/os_packages/package_scripts/post_install.sh b/src/dev/build/tasks/os_packages/package_scripts/post_install.sh index c49b291d1a0c9..1c679bdb40b59 100644 --- a/src/dev/build/tasks/os_packages/package_scripts/post_install.sh +++ b/src/dev/build/tasks/os_packages/package_scripts/post_install.sh @@ -31,6 +31,10 @@ case $1 in --ingroup "<%= group %>" --shell /bin/false "<%= user %>" fi + if [ -n "$2" ]; then + IS_UPGRADE=true + fi + set_access ;; abort-deconfigure|abort-upgrade|abort-remove) @@ -47,6 +51,10 @@ case $1 in -c "kibana service user" "<%= user %>" fi + if [ "$1" = "2" ]; then + IS_UPGRADE=true + fi + set_access ;; @@ -55,3 +63,9 @@ case $1 in exit 1 ;; esac + +if [ "$IS_UPGRADE" = "true" ]; then + if command -v systemctl >/dev/null; then + systemctl daemon-reload + fi +fi diff --git a/src/dev/build/tasks/os_packages/service_templates/sysv/etc/default/kibana b/src/dev/build/tasks/os_packages/service_templates/sysv/etc/default/kibana index 092dc6482fa1d..ee019d348ed97 100644 --- a/src/dev/build/tasks/os_packages/service_templates/sysv/etc/default/kibana +++ b/src/dev/build/tasks/os_packages/service_templates/sysv/etc/default/kibana @@ -12,4 +12,4 @@ KILL_ON_STOP_TIMEOUT=0 BABEL_CACHE_PATH="/var/lib/kibana/optimize/.babel_register_cache.json" -KIBANA_PATH_CONF="/etc/kibana" +KBN_PATH_CONF="/etc/kibana" diff --git a/src/dev/run_check_published_api_changes.ts b/src/dev/run_check_published_api_changes.ts index 0aa450c8b002a..28e8570812915 100644 --- a/src/dev/run_check_published_api_changes.ts +++ b/src/dev/run_check_published_api_changes.ts @@ -17,8 +17,6 @@ * under the License. */ -/* eslint-disable no-console */ - import { ToolingLog } from '@kbn/dev-utils'; import { Extractor, @@ -35,6 +33,11 @@ import fs from 'fs'; import path from 'path'; import getopts from 'getopts'; +const log = new ToolingLog({ + level: 'info', + writeTo: process.stdout, +}); + /* * Step 1: execute build:types * This users tsconfig.types.json to generate types in `target/types` @@ -92,13 +95,13 @@ const apiExtractorConfig = (folder: string): ExtractorConfig => { }, }, }; - const con = ExtractorConfig.prepare({ + const cfg = ExtractorConfig.prepare({ configObject: config, configObjectFullPath: undefined, packageJsonFullPath: path.resolve('package.json'), }); - return con; + return cfg; }; const runBuildTypes = async () => { @@ -108,7 +111,7 @@ const runBuildTypes = async () => { const runApiDocumenter = async (folder: string) => { const sourceFolder = `./build/${folder}`; const targetFolder = `./docs/development/${folder}`; - console.log(`Generating docs from ${sourceFolder} into ${targetFolder}...`); + log.info(`Generating docs from ${sourceFolder} into ${targetFolder}...`); await execa('api-documenter', ['generate', '-i', sourceFolder, '-o', targetFolder], { preferLocal: true, }); @@ -117,7 +120,7 @@ const runApiDocumenter = async (folder: string) => { const renameExtractedApiPackageName = async (folder: string) => { const fname = getReportFileName(folder); const jsonApiFile = `build/${folder}/${fname}.api.json`; - console.log(`Updating ${jsonApiFile}...`); + log.info(`Updating ${jsonApiFile}...`); const json = JSON.parse(fs.readFileSync(jsonApiFile).toString()); json.name = json.canonicalReference = `kibana-plugin-${folder.replace(/\//g, '-')}`; fs.writeFileSync(jsonApiFile, JSON.stringify(json, null, 2)); @@ -127,11 +130,7 @@ const renameExtractedApiPackageName = async (folder: string) => { * Runs api-extractor with a custom logger in order to extract results from the process * */ -const runApiExtractor = ( - log: ToolingLog, - folder: string, - acceptChanges: boolean = false -): ExtractorResult => { +const runApiExtractor = (folder: string, acceptChanges: boolean = false): ExtractorResult => { const config = apiExtractorConfig(folder); const options = { // Indicates that API Extractor is running as part of a local build, @@ -177,13 +176,10 @@ interface Options { filter: string; } -async function run( - folder: string, - { log, opts }: { log: ToolingLog; opts: Options } -): Promise { +async function run(folder: string, { opts }: { opts: Options }): Promise { log.info(`${folder} API: checking for changes in API signature...`); - const { apiReportChanged, succeeded } = runApiExtractor(log, folder, opts.accept); + const { apiReportChanged, succeeded } = runApiExtractor(folder, opts.accept); // If we're not accepting changes and there's a failure, exit. if (!opts.accept && !succeeded) { @@ -209,11 +205,6 @@ async function run( } (async () => { - const log = new ToolingLog({ - level: 'info', - writeTo: process.stdout, - }); - const extraFlags: string[] = []; const opts = (getopts(process.argv.slice(2), { boolean: ['accept', 'docs', 'help'], @@ -276,26 +267,22 @@ async function run( return !(extraFlags.length > 0); } - try { - log.info(`Building types for api extractor...`); - await runBuildTypes(); - } catch (e) { - log.error(e); - return false; - } + log.info('Building types for api extractor...'); + await runBuildTypes(); + log.info('Types for api extractor has been built'); const filteredFolders = folders.filter((folder) => opts.filter.length ? folder.match(opts.filter) : true ); const results = []; for (const folder of filteredFolders) { - results.push(await run(folder, { log, opts })); + results.push(await run(folder, { opts })); } if (results.includes(false)) { process.exitCode = 1; } })().catch((e) => { - console.log(e); + log.error(e); process.exitCode = 1; }); diff --git a/src/dev/run_i18n_integrate.ts b/src/dev/run_i18n_integrate.ts index 23d66fae9f26e..ac1e957adfc99 100644 --- a/src/dev/run_i18n_integrate.ts +++ b/src/dev/run_i18n_integrate.ts @@ -108,6 +108,7 @@ run( const reporter = new ErrorReporter(); const messages: Map = new Map(); await list.run({ messages, reporter }); + process.exitCode = 0; } catch (error) { process.exitCode = 1; if (error instanceof ErrorReporter) { @@ -117,6 +118,7 @@ run( log.error(error); } } + process.exit(); }, { flags: { diff --git a/src/plugins/dashboard/public/application/dashboard_app.tsx b/src/plugins/dashboard/public/application/dashboard_app.tsx index f101935b9288d..6690ae318fc8f 100644 --- a/src/plugins/dashboard/public/application/dashboard_app.tsx +++ b/src/plugins/dashboard/public/application/dashboard_app.tsx @@ -52,7 +52,10 @@ export interface DashboardAppScope extends ng.IScope { expandedPanel?: string; getShouldShowEditHelp: () => boolean; getShouldShowViewHelp: () => boolean; - updateQueryAndFetch: ({ query, dateRange }: { query: Query; dateRange?: TimeRange }) => void; + handleRefresh: ( + { query, dateRange }: { query?: Query; dateRange: TimeRange }, + isUpdate?: boolean + ) => void; topNavMenu: any; showAddPanel: any; showSaveQuery: boolean; diff --git a/src/plugins/dashboard/public/application/dashboard_app_controller.tsx b/src/plugins/dashboard/public/application/dashboard_app_controller.tsx index 2a0e2889575f3..3a4e49968626f 100644 --- a/src/plugins/dashboard/public/application/dashboard_app_controller.tsx +++ b/src/plugins/dashboard/public/application/dashboard_app_controller.tsx @@ -25,12 +25,11 @@ import React, { useState, ReactElement } from 'react'; import ReactDOM from 'react-dom'; import angular from 'angular'; -import { Observable, pipe, Subscription } from 'rxjs'; -import { filter, map, mapTo, startWith, switchMap } from 'rxjs/operators'; +import { Observable, pipe, Subscription, merge } from 'rxjs'; +import { filter, map, debounceTime, mapTo, startWith, switchMap } from 'rxjs/operators'; import { History } from 'history'; import { SavedObjectSaveOpts } from 'src/plugins/saved_objects/public'; import { NavigationPublicPluginStart as NavigationStart } from 'src/plugins/navigation/public'; -import { TimeRange } from 'src/plugins/data/public'; import { DashboardEmptyScreen, DashboardEmptyScreenProps } from './dashboard_empty_screen'; import { @@ -38,11 +37,9 @@ import { esFilters, IndexPattern, IndexPatternsContract, - Query, QueryState, SavedQuery, syncQueryStateWithUrl, - UI_SETTINGS, } from '../../../data/public'; import { getSavedObjectFinder, SaveResult, showSaveModal } from '../../../saved_objects/public'; @@ -81,8 +78,8 @@ import { addFatalError, AngularHttpError, KibanaLegacyStart, - migrateLegacyQuery, subscribeWithScope, + migrateLegacyQuery, } from '../../../kibana_legacy/public'; export interface DashboardAppControllerDependencies extends RenderDeps { @@ -127,7 +124,6 @@ export class DashboardAppController { $route, $routeParams, dashboardConfig, - localStorage, indexPatterns, savedQueryService, embeddable, @@ -153,8 +149,8 @@ export class DashboardAppController { navigation, }: DashboardAppControllerDependencies) { const filterManager = queryService.filterManager; - const queryFilter = filterManager; const timefilter = queryService.timefilter.timefilter; + const queryStringManager = queryService.queryString; const isEmbeddedExternally = Boolean($routeParams.embed); // url param rules should only apply when embedded (e.g. url?embed=true) @@ -172,6 +168,10 @@ export class DashboardAppController { chrome.docTitle.change(dash.title); } + const incomingEmbeddable = embeddable + .getStateTransfer(scopedHistory()) + .getIncomingEmbeddablePackage(); + const dashboardStateManager = new DashboardStateManager({ savedDashboard: dash, hideWriteControls: dashboardConfig.getHideWriteControls(), @@ -184,20 +184,30 @@ export class DashboardAppController { // sync initial app filters from state to filterManager // if there is an existing similar global filter, then leave it as global filterManager.setAppFilters(_.cloneDeep(dashboardStateManager.appState.filters)); + queryStringManager.setQuery(migrateLegacyQuery(dashboardStateManager.appState.query)); + // setup syncing of app filters between appState and filterManager const stopSyncingAppFilters = connectToQueryState( queryService, { - set: ({ filters }) => dashboardStateManager.setFilters(filters || []), - get: () => ({ filters: dashboardStateManager.appState.filters }), + set: ({ filters, query }) => { + dashboardStateManager.setFilters(filters || []); + dashboardStateManager.setQuery(query || queryStringManager.getDefaultQuery()); + }, + get: () => ({ + filters: dashboardStateManager.appState.filters, + query: dashboardStateManager.getQuery(), + }), state$: dashboardStateManager.appState$.pipe( map((state) => ({ filters: state.filters, + query: queryStringManager.formatQuery(state.query), })) ), }, { filters: esFilters.FilterStateStore.APP_STATE, + query: true, } ); @@ -327,7 +337,7 @@ export class DashboardAppController { const isEmptyInReadonlyMode = shouldShowUnauthorizedEmptyState(); return { id: dashboardStateManager.savedDashboard.id || '', - filters: queryFilter.getFilters(), + filters: filterManager.getFilters(), hidePanelTitles: dashboardStateManager.getHidePanelTitles(), query: $scope.model.query, timeRange: { @@ -352,7 +362,7 @@ export class DashboardAppController { // https://github.com/angular/angular.js/wiki/Understanding-Scopes $scope.model = { query: dashboardStateManager.getQuery(), - filters: queryFilter.getFilters(), + filters: filterManager.getFilters(), timeRestore: dashboardStateManager.getTimeRestore(), title: dashboardStateManager.getTitle(), description: dashboardStateManager.getDescription(), @@ -416,12 +426,12 @@ export class DashboardAppController { if ( !esFilters.compareFilters( container.getInput().filters, - queryFilter.getFilters(), + filterManager.getFilters(), esFilters.COMPARE_ALL_OPTIONS ) ) { // Add filters modifies the object passed to it, hence the clone deep. - queryFilter.addFilters(_.cloneDeep(container.getInput().filters)); + filterManager.addFilters(_.cloneDeep(container.getInput().filters)); dashboardStateManager.applyFilters( $scope.model.query, @@ -444,21 +454,24 @@ export class DashboardAppController { refreshDashboardContainer(); }); - const incomingState = embeddable - .getStateTransfer(scopedHistory()) - .getIncomingEmbeddablePackage(); - if (incomingState) { - if ('id' in incomingState) { - container.addOrUpdateEmbeddable(incomingState.type, { - savedObjectId: incomingState.id, - }); - } else if ('input' in incomingState) { - const input = incomingState.input; + if (incomingEmbeddable) { + if ('id' in incomingEmbeddable) { + container.addOrUpdateEmbeddable( + incomingEmbeddable.type, + { + savedObjectId: incomingEmbeddable.id, + } + ); + } else if ('input' in incomingEmbeddable) { + const input = incomingEmbeddable.input; delete input.id; const explicitInput = { savedVis: input, }; - container.addOrUpdateEmbeddable(incomingState.type, explicitInput); + container.addOrUpdateEmbeddable( + incomingEmbeddable.type, + explicitInput + ); } } } @@ -480,13 +493,8 @@ export class DashboardAppController { }); dashboardStateManager.applyFilters( - dashboardStateManager.getQuery() || { - query: '', - language: - localStorage.get('kibana.userQueryLanguage') || - uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), - }, - queryFilter.getFilters() + dashboardStateManager.getQuery() || queryStringManager.getDefaultQuery(), + filterManager.getFilters() ); timefilter.disableTimeRangeSelector(); @@ -560,21 +568,13 @@ export class DashboardAppController { } }; - $scope.updateQueryAndFetch = function ({ query, dateRange }) { - if (dateRange) { - timefilter.setTime(dateRange); - } - - const oldQuery = $scope.model.query; - if (_.isEqual(oldQuery, query)) { + $scope.handleRefresh = function (_payload, isUpdate) { + if (isUpdate === false) { // The user can still request a reload in the query bar, even if the // query is the same, and in that case, we have to explicitly ask for // a reload, since no state changes will cause it. lastReloadRequestTime = new Date().getTime(); refreshDashboardContainer(); - } else { - $scope.model.query = query; - dashboardStateManager.applyFilters($scope.model.query, $scope.model.filters); } }; @@ -593,7 +593,7 @@ export class DashboardAppController { // Making this method sync broke the updates. // Temporary fix, until we fix the complex state in this file. setTimeout(() => { - queryFilter.setFilters(allFilters); + filterManager.setFilters(allFilters); }, 0); }; @@ -626,11 +626,6 @@ export class DashboardAppController { $scope.indexPatterns = []; - $scope.$watch('model.query', (newQuery: Query) => { - const query = migrateLegacyQuery(newQuery) as Query; - $scope.updateQueryAndFetch({ query }); - }); - $scope.$watch( () => dashboardCapabilities.saveQuery, (newCapability) => { @@ -671,18 +666,11 @@ export class DashboardAppController { showFilterBar, indexPatterns: $scope.indexPatterns, showSaveQuery: $scope.showSaveQuery, - query: $scope.model.query, savedQuery: $scope.savedQuery, onSavedQueryIdChange, savedQueryId: dashboardStateManager.getSavedQueryId(), useDefaultBehaviors: true, - onQuerySubmit: (payload: { dateRange: TimeRange; query?: Query }): void => { - if (!payload.query) { - $scope.updateQueryAndFetch({ query: $scope.model.query, dateRange: payload.dateRange }); - } else { - $scope.updateQueryAndFetch({ query: payload.query, dateRange: payload.dateRange }); - } - }, + onQuerySubmit: $scope.handleRefresh, }; }; const dashboardNavBar = document.getElementById('dashboardChrome'); @@ -697,25 +685,11 @@ export class DashboardAppController { }; $scope.timefilterSubscriptions$ = new Subscription(); - + const timeChanges$ = merge(timefilter.getRefreshIntervalUpdate$(), timefilter.getTimeUpdate$()); $scope.timefilterSubscriptions$.add( subscribeWithScope( $scope, - timefilter.getRefreshIntervalUpdate$(), - { - next: () => { - updateState(); - refreshDashboardContainer(); - }, - }, - (error: AngularHttpError | Error | string) => addFatalError(fatalErrors, error) - ) - ); - - $scope.timefilterSubscriptions$.add( - subscribeWithScope( - $scope, - timefilter.getTimeUpdate$(), + timeChanges$, { next: () => { updateState(); @@ -1088,13 +1062,21 @@ export class DashboardAppController { updateViewMode(dashboardStateManager.getViewMode()); + const filterChanges = merge(filterManager.getUpdates$(), queryStringManager.getUpdates$()).pipe( + debounceTime(100) + ); + // update root source when filters update - const updateSubscription = queryFilter.getUpdates$().subscribe({ + const updateSubscription = filterChanges.subscribe({ next: () => { - $scope.model.filters = queryFilter.getFilters(); + $scope.model.filters = filterManager.getFilters(); + $scope.model.query = queryStringManager.getQuery(); dashboardStateManager.applyFilters($scope.model.query, $scope.model.filters); if (dashboardContainer) { - dashboardContainer.updateInput({ filters: $scope.model.filters }); + dashboardContainer.updateInput({ + filters: $scope.model.filters, + query: $scope.model.query, + }); } }, }); diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index 65670bc1cf83e..d6812a4aa4524 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -7,44 +7,15 @@ import { $Values } from '@kbn/utility-types'; import _ from 'lodash'; import { Action } from 'history'; +import { ApiResponse } from '@elastic/elasticsearch/lib/Transport'; import { ApplicationStart } from 'kibana/public'; import { Assign } from '@kbn/utility-types'; import { BehaviorSubject } from 'rxjs'; import Boom from 'boom'; -import { BulkIndexDocumentsParams } from 'elasticsearch'; -import { CatAliasesParams } from 'elasticsearch'; -import { CatAllocationParams } from 'elasticsearch'; -import { CatCommonParams } from 'elasticsearch'; -import { CatFielddataParams } from 'elasticsearch'; -import { CatHealthParams } from 'elasticsearch'; -import { CatHelpParams } from 'elasticsearch'; -import { CatIndicesParams } from 'elasticsearch'; -import { CatRecoveryParams } from 'elasticsearch'; -import { CatSegmentsParams } from 'elasticsearch'; -import { CatShardsParams } from 'elasticsearch'; -import { CatSnapshotsParams } from 'elasticsearch'; -import { CatTasksParams } from 'elasticsearch'; -import { CatThreadPoolParams } from 'elasticsearch'; -import { ClearScrollParams } from 'elasticsearch'; -import { Client } from 'elasticsearch'; -import { ClusterAllocationExplainParams } from 'elasticsearch'; -import { ClusterGetSettingsParams } from 'elasticsearch'; -import { ClusterHealthParams } from 'elasticsearch'; -import { ClusterPendingTasksParams } from 'elasticsearch'; -import { ClusterPutSettingsParams } from 'elasticsearch'; -import { ClusterRerouteParams } from 'elasticsearch'; -import { ClusterStateParams } from 'elasticsearch'; -import { ClusterStatsParams } from 'elasticsearch'; import { Component } from 'react'; import { CoreSetup } from 'src/core/public'; import { CoreStart } from 'kibana/public'; import { CoreStart as CoreStart_2 } from 'src/core/public'; -import { CountParams } from 'elasticsearch'; -import { CreateDocumentParams } from 'elasticsearch'; -import { DeleteDocumentByQueryParams } from 'elasticsearch'; -import { DeleteDocumentParams } from 'elasticsearch'; -import { DeleteScriptParams } from 'elasticsearch'; -import { DeleteTemplateParams } from 'elasticsearch'; import { Ensure } from '@kbn/utility-types'; import { ErrorToastOptions } from 'src/core/public/notifications'; import { EuiBreadcrumb } from '@elastic/eui'; @@ -53,98 +24,33 @@ import { EuiComboBoxProps } from '@elastic/eui'; import { EuiConfirmModalProps } from '@elastic/eui'; import { EuiGlobalToastListToast } from '@elastic/eui'; import { ExclusiveUnion } from '@elastic/eui'; -import { ExistsParams } from 'elasticsearch'; -import { ExplainParams } from 'elasticsearch'; import { ExpressionAstFunction } from 'src/plugins/expressions/common'; import { ExpressionsSetup } from 'src/plugins/expressions/public'; -import { FieldStatsParams } from 'elasticsearch'; -import { GenericParams } from 'elasticsearch'; -import { GetParams } from 'elasticsearch'; -import { GetResponse } from 'elasticsearch'; -import { GetScriptParams } from 'elasticsearch'; -import { GetSourceParams } from 'elasticsearch'; -import { GetTemplateParams } from 'elasticsearch'; import { History } from 'history'; import { Href } from 'history'; import { IconType } from '@elastic/eui'; -import { IndexDocumentParams } from 'elasticsearch'; -import { IndicesAnalyzeParams } from 'elasticsearch'; -import { IndicesClearCacheParams } from 'elasticsearch'; -import { IndicesCloseParams } from 'elasticsearch'; -import { IndicesCreateParams } from 'elasticsearch'; -import { IndicesDeleteAliasParams } from 'elasticsearch'; -import { IndicesDeleteParams } from 'elasticsearch'; -import { IndicesDeleteTemplateParams } from 'elasticsearch'; -import { IndicesExistsAliasParams } from 'elasticsearch'; -import { IndicesExistsParams } from 'elasticsearch'; -import { IndicesExistsTemplateParams } from 'elasticsearch'; -import { IndicesExistsTypeParams } from 'elasticsearch'; -import { IndicesFlushParams } from 'elasticsearch'; -import { IndicesFlushSyncedParams } from 'elasticsearch'; -import { IndicesForcemergeParams } from 'elasticsearch'; -import { IndicesGetAliasParams } from 'elasticsearch'; -import { IndicesGetFieldMappingParams } from 'elasticsearch'; -import { IndicesGetMappingParams } from 'elasticsearch'; -import { IndicesGetParams } from 'elasticsearch'; -import { IndicesGetSettingsParams } from 'elasticsearch'; -import { IndicesGetTemplateParams } from 'elasticsearch'; -import { IndicesGetUpgradeParams } from 'elasticsearch'; -import { IndicesOpenParams } from 'elasticsearch'; -import { IndicesPutAliasParams } from 'elasticsearch'; -import { IndicesPutMappingParams } from 'elasticsearch'; -import { IndicesPutSettingsParams } from 'elasticsearch'; -import { IndicesPutTemplateParams } from 'elasticsearch'; -import { IndicesRecoveryParams } from 'elasticsearch'; -import { IndicesRefreshParams } from 'elasticsearch'; -import { IndicesRolloverParams } from 'elasticsearch'; -import { IndicesSegmentsParams } from 'elasticsearch'; -import { IndicesShardStoresParams } from 'elasticsearch'; -import { IndicesShrinkParams } from 'elasticsearch'; -import { IndicesStatsParams } from 'elasticsearch'; -import { IndicesUpdateAliasesParams } from 'elasticsearch'; -import { IndicesUpgradeParams } from 'elasticsearch'; -import { IndicesValidateQueryParams } from 'elasticsearch'; -import { InfoParams } from 'elasticsearch'; -import { IngestDeletePipelineParams } from 'elasticsearch'; -import { IngestGetPipelineParams } from 'elasticsearch'; -import { IngestPutPipelineParams } from 'elasticsearch'; -import { IngestSimulateParams } from 'elasticsearch'; import { InjectedIntl } from '@kbn/i18n/react'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; import { IUiSettingsClient } from 'src/core/public'; import { IUiSettingsClient as IUiSettingsClient_3 } from 'kibana/public'; +import { KibanaClient } from '@elastic/elasticsearch/api/kibana'; import { KibanaConfigType } from 'src/core/server/kibana_config'; import { Location } from 'history'; import { LocationDescriptorObject } from 'history'; import { MaybePromise } from '@kbn/utility-types'; import { METRIC_TYPE } from '@kbn/analytics'; -import { MGetParams } from 'elasticsearch'; -import { MGetResponse } from 'elasticsearch'; import { Moment } from 'moment'; import moment from 'moment'; -import { MSearchParams } from 'elasticsearch'; -import { MSearchResponse } from 'elasticsearch'; -import { MSearchTemplateParams } from 'elasticsearch'; -import { MTermVectorsParams } from 'elasticsearch'; import { NameList } from 'elasticsearch'; -import { NodesHotThreadsParams } from 'elasticsearch'; -import { NodesInfoParams } from 'elasticsearch'; -import { NodesStatsParams } from 'elasticsearch'; import { Observable } from 'rxjs'; import { Path } from 'history'; -import { PingParams } from 'elasticsearch'; import { Plugin as Plugin_2 } from 'src/core/public'; import { PluginInitializerContext as PluginInitializerContext_2 } from 'src/core/public'; import { PopoverAnchorPosition } from '@elastic/eui'; import { PublicUiSettingsParams } from 'src/core/server/types'; -import { PutScriptParams } from 'elasticsearch'; -import { PutTemplateParams } from 'elasticsearch'; import React from 'react'; import * as React_2 from 'react'; import { RecursiveReadonly } from '@kbn/utility-types'; -import { ReindexParams } from 'elasticsearch'; -import { ReindexRethrottleParams } from 'elasticsearch'; -import { RenderSearchTemplateParams } from 'elasticsearch'; import { Reporter } from '@kbn/analytics'; import { RequestAdapter } from 'src/plugins/inspector/common'; import { RequestStatistics } from 'src/plugins/inspector/common'; @@ -153,38 +59,22 @@ import * as Rx from 'rxjs'; import { SavedObject } from 'src/core/server'; import { SavedObject as SavedObject_3 } from 'src/core/public'; import { SavedObjectsClientContract } from 'src/core/public'; -import { ScrollParams } from 'elasticsearch'; import { SearchParams } from 'elasticsearch'; import { SearchResponse as SearchResponse_2 } from 'elasticsearch'; -import { SearchShardsParams } from 'elasticsearch'; -import { SearchTemplateParams } from 'elasticsearch'; import { SerializedFieldFormat as SerializedFieldFormat_2 } from 'src/plugins/expressions/common'; -import { SnapshotCreateParams } from 'elasticsearch'; -import { SnapshotCreateRepositoryParams } from 'elasticsearch'; -import { SnapshotDeleteParams } from 'elasticsearch'; -import { SnapshotDeleteRepositoryParams } from 'elasticsearch'; -import { SnapshotGetParams } from 'elasticsearch'; -import { SnapshotGetRepositoryParams } from 'elasticsearch'; -import { SnapshotRestoreParams } from 'elasticsearch'; -import { SnapshotStatusParams } from 'elasticsearch'; -import { SnapshotVerifyRepositoryParams } from 'elasticsearch'; import { Subscription } from 'rxjs'; -import { SuggestParams } from 'elasticsearch'; -import { TasksCancelParams } from 'elasticsearch'; -import { TasksGetParams } from 'elasticsearch'; -import { TasksListParams } from 'elasticsearch'; -import { TermvectorsParams } from 'elasticsearch'; import { Toast } from 'kibana/public'; import { ToastInputFields } from 'src/core/public/notifications'; import { ToastsStart } from 'kibana/public'; +import { TransportRequestOptions } from '@elastic/elasticsearch/lib/Transport'; +import { TransportRequestParams } from '@elastic/elasticsearch/lib/Transport'; +import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; import { TypeOf } from '@kbn/config-schema'; import { UiActionsSetup } from 'src/plugins/ui_actions/public'; import { UiActionsStart } from 'src/plugins/ui_actions/public'; import { Unit } from '@elastic/datemath'; import { UnregisterCallback } from 'history'; import { UnwrapPromiseOrReturn } from '@kbn/utility-types'; -import { UpdateDocumentByQueryParams } from 'elasticsearch'; -import { UpdateDocumentParams } from 'elasticsearch'; import { UserProvidedValues } from 'src/core/server/types'; // Warning: (ae-forgotten-export) The symbol "AggConfigSerialized" needs to be exported by the entry point index.d.ts @@ -309,10 +199,11 @@ export const castEsToKbnFieldTypeName: (esType: ES_FIELD_TYPES | string) => KBN_ // Warning: (ae-missing-release-tag) "connectToQueryState" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public -export const connectToQueryState: ({ timefilter: { timefilter }, filterManager, state$, }: Pick, stateContainer: BaseStateContainer, syncConfig: { +export const connectToQueryState: ({ timefilter: { timefilter }, filterManager, queryString, state$, }: Pick, stateContainer: BaseStateContainer, syncConfig: { time?: boolean; refreshInterval?: boolean; filters?: FilterStateStore | boolean; + query?: boolean; }) => () => void; // Warning: (ae-missing-release-tag) "createSavedQueryService" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -1498,6 +1389,8 @@ export interface QueryState { // (undocumented) filters?: Filter[]; // (undocumented) + query?: Query; + // (undocumented) refreshInterval?: RefreshInterval; // (undocumented) time?: TimeRange; @@ -1872,7 +1765,7 @@ export type StatefulSearchBarProps = SearchBarOwnProps & { // Warning: (ae-missing-release-tag) "syncQueryStateWithUrl" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public -export const syncQueryStateWithUrl: (query: Pick, kbnUrlStateStorage: IKbnUrlStateStorage) => { +export const syncQueryStateWithUrl: (query: Pick, kbnUrlStateStorage: IKbnUrlStateStorage) => { stop: () => void; hasInheritedQueryFromUrl: boolean; }; @@ -2021,7 +1914,7 @@ export const UI_SETTINGS: { // src/plugins/data/public/index.ts:394:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:395:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:398:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:41:60 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:45:5 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts // src/plugins/data/public/types.ts:54:5 - (ae-forgotten-export) The symbol "createFiltersFromValueClickAction" needs to be exported by the entry point index.d.ts // src/plugins/data/public/types.ts:55:5 - (ae-forgotten-export) The symbol "createFiltersFromRangeSelectAction" needs to be exported by the entry point index.d.ts // src/plugins/data/public/types.ts:63:5 - (ae-forgotten-export) The symbol "IndexPatternSelectProps" needs to be exported by the entry point index.d.ts diff --git a/src/plugins/data/public/query/mocks.ts b/src/plugins/data/public/query/mocks.ts index 41896107bb868..8c15d9d6d0152 100644 --- a/src/plugins/data/public/query/mocks.ts +++ b/src/plugins/data/public/query/mocks.ts @@ -21,6 +21,7 @@ import { Observable } from 'rxjs'; import { QueryService, QuerySetup, QueryStart } from '.'; import { timefilterServiceMock } from './timefilter/timefilter_service.mock'; import { createFilterManagerMock } from './filter_manager/filter_manager.mock'; +import { queryStringManagerMock } from './query_string/query_string_manager.mock'; type QueryServiceClientContract = PublicMethodsOf; @@ -28,6 +29,7 @@ const createSetupContractMock = () => { const setupContract: jest.Mocked = { filterManager: createFilterManagerMock(), timefilter: timefilterServiceMock.createSetupContract(), + queryString: queryStringManagerMock.createSetupContract(), state$: new Observable(), }; @@ -38,6 +40,7 @@ const createStartContractMock = () => { const startContract: jest.Mocked = { addToQueryLog: jest.fn(), filterManager: createFilterManagerMock(), + queryString: queryStringManagerMock.createStartContract(), savedQueries: jest.fn() as any, state$: new Observable(), timefilter: timefilterServiceMock.createStartContract(), diff --git a/src/plugins/data/public/query/query_service.ts b/src/plugins/data/public/query/query_service.ts index eb1f985fa51db..da514c0e24ea4 100644 --- a/src/plugins/data/public/query/query_service.ts +++ b/src/plugins/data/public/query/query_service.ts @@ -25,6 +25,7 @@ import { createAddToQueryLog } from './lib'; import { TimefilterService, TimefilterSetup } from './timefilter'; import { createSavedQueryService } from './saved_query/saved_query_service'; import { createQueryStateObservable } from './state_sync/create_global_query_observable'; +import { QueryStringManager, QueryStringContract } from './query_string'; /** * Query Service @@ -45,6 +46,7 @@ interface QueryServiceStartDependencies { export class QueryService { filterManager!: FilterManager; timefilter!: TimefilterSetup; + queryStringManager!: QueryStringContract; state$!: ReturnType; @@ -57,14 +59,18 @@ export class QueryService { storage, }); + this.queryStringManager = new QueryStringManager(storage, uiSettings); + this.state$ = createQueryStateObservable({ filterManager: this.filterManager, timefilter: this.timefilter, + queryString: this.queryStringManager, }).pipe(share()); return { filterManager: this.filterManager, timefilter: this.timefilter, + queryString: this.queryStringManager, state$: this.state$, }; } @@ -76,6 +82,7 @@ export class QueryService { uiSettings, }), filterManager: this.filterManager, + queryString: this.queryStringManager, savedQueries: createSavedQueryService(savedObjectsClient), state$: this.state$, timefilter: this.timefilter, diff --git a/src/plugins/data/public/query/query_string/index.ts b/src/plugins/data/public/query/query_string/index.ts new file mode 100644 index 0000000000000..6ea87fde69ac8 --- /dev/null +++ b/src/plugins/data/public/query/query_string/index.ts @@ -0,0 +1,20 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { QueryStringContract, QueryStringManager } from './query_string_manager'; diff --git a/src/plugins/data/public/query/query_string/query_string_manager.mock.ts b/src/plugins/data/public/query/query_string/query_string_manager.mock.ts new file mode 100644 index 0000000000000..427662cb01ebb --- /dev/null +++ b/src/plugins/data/public/query/query_string/query_string_manager.mock.ts @@ -0,0 +1,37 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { QueryStringContract } from '.'; + +const createSetupContractMock = () => { + const queryStringManagerMock: jest.Mocked = { + getQuery: jest.fn(), + setQuery: jest.fn(), + getUpdates$: jest.fn(), + getDefaultQuery: jest.fn(), + formatQuery: jest.fn(), + clearQuery: jest.fn(), + }; + return queryStringManagerMock; +}; + +export const queryStringManagerMock = { + createSetupContract: createSetupContractMock, + createStartContract: createSetupContractMock, +}; diff --git a/src/plugins/data/public/query/query_string/query_string_manager.ts b/src/plugins/data/public/query/query_string/query_string_manager.ts new file mode 100644 index 0000000000000..bd02830f4aed8 --- /dev/null +++ b/src/plugins/data/public/query/query_string/query_string_manager.ts @@ -0,0 +1,90 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import _ from 'lodash'; +import { BehaviorSubject } from 'rxjs'; +import { CoreStart } from 'kibana/public'; +import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; +import { Query, UI_SETTINGS } from '../../../common'; + +export class QueryStringManager { + private query$: BehaviorSubject; + + constructor( + private readonly storage: IStorageWrapper, + private readonly uiSettings: CoreStart['uiSettings'] + ) { + this.query$ = new BehaviorSubject(this.getDefaultQuery()); + } + + private getDefaultLanguage() { + return ( + this.storage.get('kibana.userQueryLanguage') || + this.uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE) + ); + } + + public getDefaultQuery() { + return { + query: '', + language: this.getDefaultLanguage(), + }; + } + + public formatQuery(query: Query | string | undefined): Query { + if (!query) { + return this.getDefaultQuery(); + } else if (typeof query === 'string') { + return { + query, + language: this.getDefaultLanguage(), + }; + } else { + return query; + } + } + + public getUpdates$ = () => { + return this.query$.asObservable(); + }; + + public getQuery = (): Query => { + return this.query$.getValue(); + }; + + /** + * Updates the query. + * @param {Query} query + */ + public setQuery = (query: Query) => { + const curQuery = this.query$.getValue(); + if (query?.language !== curQuery.language || query?.query !== curQuery.query) { + this.query$.next(query); + } + }; + + /** + * Resets the query to the default one. + */ + public clearQuery = () => { + this.setQuery(this.getDefaultQuery()); + }; +} + +export type QueryStringContract = PublicMethodsOf; diff --git a/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts b/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts index cf98c87b18267..307d1fe1b2b0b 100644 --- a/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts +++ b/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts @@ -48,6 +48,8 @@ setupMock.uiSettings.get.mockImplementation((key: string) => { switch (key) { case UI_SETTINGS.FILTERS_PINNED_BY_DEFAULT: return true; + case UI_SETTINGS.SEARCH_QUERY_LANGUAGE: + return 'kuery'; case 'timepicker:timeDefaults': return { from: 'now-15m', to: 'now' }; case UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: diff --git a/src/plugins/data/public/query/state_sync/connect_to_query_state.ts b/src/plugins/data/public/query/state_sync/connect_to_query_state.ts index 2e62dac87f6ef..55edd04b5dab0 100644 --- a/src/plugins/data/public/query/state_sync/connect_to_query_state.ts +++ b/src/plugins/data/public/query/state_sync/connect_to_query_state.ts @@ -35,15 +35,24 @@ export const connectToQueryState = ( { timefilter: { timefilter }, filterManager, + queryString, state$, - }: Pick, + }: Pick, stateContainer: BaseStateContainer, - syncConfig: { time?: boolean; refreshInterval?: boolean; filters?: FilterStateStore | boolean } + syncConfig: { + time?: boolean; + refreshInterval?: boolean; + filters?: FilterStateStore | boolean; + query?: boolean; + } ) => { const syncKeys: Array = []; if (syncConfig.time) { syncKeys.push('time'); } + if (syncConfig.query) { + syncKeys.push('query'); + } if (syncConfig.refreshInterval) { syncKeys.push('refreshInterval'); } @@ -133,6 +142,9 @@ export const connectToQueryState = ( if (syncConfig.time && changes.time) { newState.time = timefilter.getTime(); } + if (syncConfig.query && changes.query) { + newState.query = queryString.getQuery(); + } if (syncConfig.refreshInterval && changes.refreshInterval) { newState.refreshInterval = timefilter.getRefreshInterval(); } @@ -173,6 +185,13 @@ export const connectToQueryState = ( } } + if (syncConfig.query) { + const curQuery = state.query || queryString.getQuery(); + if (!_.isEqual(curQuery, queryString.getQuery())) { + queryString.setQuery(_.cloneDeep(curQuery)); + } + } + if (syncConfig.filters) { const filters = state.filters || []; if (syncConfig.filters === true) { diff --git a/src/plugins/data/public/query/state_sync/create_global_query_observable.ts b/src/plugins/data/public/query/state_sync/create_global_query_observable.ts index 87032925294c6..5e2c575c74af7 100644 --- a/src/plugins/data/public/query/state_sync/create_global_query_observable.ts +++ b/src/plugins/data/public/query/state_sync/create_global_query_observable.ts @@ -24,23 +24,31 @@ import { FilterManager } from '../filter_manager'; import { QueryState, QueryStateChange } from './index'; import { createStateContainer } from '../../../../kibana_utils/public'; import { isFilterPinned, compareFilters, COMPARE_ALL_OPTIONS } from '../../../common'; +import { QueryStringContract } from '../query_string'; export function createQueryStateObservable({ timefilter: { timefilter }, filterManager, + queryString, }: { timefilter: TimefilterSetup; filterManager: FilterManager; + queryString: QueryStringContract; }): Observable<{ changes: QueryStateChange; state: QueryState }> { return new Observable((subscriber) => { const state = createStateContainer({ time: timefilter.getTime(), refreshInterval: timefilter.getRefreshInterval(), filters: filterManager.getFilters(), + query: queryString.getQuery(), }); let currentChange: QueryStateChange = {}; const subs: Subscription[] = [ + queryString.getUpdates$().subscribe(() => { + currentChange.query = true; + state.set({ ...state.get(), query: queryString.getQuery() }); + }), timefilter.getTimeUpdate$().subscribe(() => { currentChange.time = true; state.set({ ...state.get(), time: timefilter.getTime() }); diff --git a/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts b/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts index 122eb2ff6a343..0b4a3f663eb6b 100644 --- a/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts +++ b/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts @@ -43,6 +43,8 @@ setupMock.uiSettings.get.mockImplementation((key: string) => { return true; case 'timepicker:timeDefaults': return { from: 'now-15m', to: 'now' }; + case 'search:queryLanguage': + return 'kuery'; case UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: return { pause: false, value: 0 }; default: diff --git a/src/plugins/data/public/query/state_sync/sync_state_with_url.ts b/src/plugins/data/public/query/state_sync/sync_state_with_url.ts index 4d3da7b9313a3..46be800fbb558 100644 --- a/src/plugins/data/public/query/state_sync/sync_state_with_url.ts +++ b/src/plugins/data/public/query/state_sync/sync_state_with_url.ts @@ -35,7 +35,7 @@ const GLOBAL_STATE_STORAGE_KEY = '_g'; * @param kbnUrlStateStorage to use for syncing */ export const syncQueryStateWithUrl = ( - query: Pick, + query: Pick, kbnUrlStateStorage: IKbnUrlStateStorage ) => { const { diff --git a/src/plugins/data/public/query/state_sync/types.ts b/src/plugins/data/public/query/state_sync/types.ts index 747d4d45fe29b..2354db8cad11a 100644 --- a/src/plugins/data/public/query/state_sync/types.ts +++ b/src/plugins/data/public/query/state_sync/types.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Filter, RefreshInterval, TimeRange } from '../../../common'; +import { Filter, RefreshInterval, TimeRange, Query } from '../../../common'; /** * All query state service state @@ -26,6 +26,7 @@ export interface QueryState { time?: TimeRange; refreshInterval?: RefreshInterval; filters?: Filter[]; + query?: Query; } type QueryStateChangePartial = { diff --git a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx index f8b7e4f480911..9f0ba2378592a 100644 --- a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx +++ b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx @@ -18,7 +18,7 @@ */ import _ from 'lodash'; -import React, { useState, useEffect, useRef } from 'react'; +import React, { useEffect, useRef } from 'react'; import { CoreStart } from 'src/core/public'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; import { KibanaContextProvider } from '../../../../kibana_react/public'; @@ -28,7 +28,8 @@ import { useFilterManager } from './lib/use_filter_manager'; import { useTimefilter } from './lib/use_timefilter'; import { useSavedQuery } from './lib/use_saved_query'; import { DataPublicPluginStart } from '../../types'; -import { Filter, Query, TimeRange, UI_SETTINGS } from '../../../common'; +import { Filter, Query, TimeRange } from '../../../common'; +import { useQueryStringManager } from './lib/use_query_string_manager'; interface StatefulSearchBarDeps { core: CoreStart; @@ -65,8 +66,7 @@ const defaultOnRefreshChange = (queryService: QueryStart) => { const defaultOnQuerySubmit = ( props: StatefulSearchBarProps, queryService: QueryStart, - currentQuery: Query, - setQueryStringState: Function + currentQuery: Query ) => { if (!props.useDefaultBehaviors) return props.onQuerySubmit; @@ -78,7 +78,11 @@ const defaultOnQuerySubmit = ( !_.isEqual(payload.query, currentQuery); if (isUpdate) { timefilter.setTime(payload.dateRange); - setQueryStringState(payload.query); + if (payload.query) { + queryService.queryString.setQuery(payload.query); + } else { + queryService.queryString.clearQuery(); + } } else { // Refresh button triggered for an update if (props.onQuerySubmit) @@ -121,30 +125,7 @@ export function createSearchBar({ core, storage, data }: StatefulSearchBarDeps) return (props: StatefulSearchBarProps) => { const { useDefaultBehaviors } = props; // Handle queries - const queryRef = useRef(props.query); const onQuerySubmitRef = useRef(props.onQuerySubmit); - const defaultQuery = { - query: '', - language: - storage.get('kibana.userQueryLanguage') || - core.uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), - }; - const [query, setQuery] = useState(props.query || defaultQuery); - - useEffect(() => { - if (props.query !== queryRef.current) { - queryRef.current = props.query; - setQuery(props.query || defaultQuery); - } - /* eslint-disable-next-line react-hooks/exhaustive-deps */ - }, [defaultQuery, props.query]); - - useEffect(() => { - if (props.onQuerySubmit !== onQuerySubmitRef.current) { - onQuerySubmitRef.current = props.onQuerySubmit; - } - /* eslint-disable-next-line react-hooks/exhaustive-deps */ - }, [props.onQuerySubmit]); // handle service state updates. // i.e. filters being added from a visualization directly to filterManager. @@ -152,6 +133,10 @@ export function createSearchBar({ core, storage, data }: StatefulSearchBarDeps) filters: props.filters, filterManager: data.query.filterManager, }); + const { query } = useQueryStringManager({ + query: props.query, + queryStringManager: data.query.queryString, + }); const { timeRange, refreshInterval } = useTimefilter({ dateRangeFrom: props.dateRangeFrom, dateRangeTo: props.dateRangeTo, @@ -163,10 +148,8 @@ export function createSearchBar({ core, storage, data }: StatefulSearchBarDeps) // Fetch and update UI from saved query const { savedQuery, setSavedQuery, clearSavedQuery } = useSavedQuery({ queryService: data.query, - setQuery, savedQueryId: props.savedQueryId, notifications: core.notifications, - defaultLanguage: defaultQuery.language, }); // Fire onQuerySubmit on query or timerange change @@ -210,7 +193,7 @@ export function createSearchBar({ core, storage, data }: StatefulSearchBarDeps) onFiltersUpdated={defaultFiltersUpdated(data.query)} onRefreshChange={defaultOnRefreshChange(data.query)} savedQuery={savedQuery} - onQuerySubmit={defaultOnQuerySubmit(props, data.query, query, setQuery)} + onQuerySubmit={defaultOnQuerySubmit(props, data.query, query)} onClearSavedQuery={defaultOnClearSavedQuery(props, clearSavedQuery)} onSavedQueryUpdated={defaultOnSavedQueryUpdated(props, setSavedQuery)} onSaved={defaultOnSavedQueryUpdated(props, setSavedQuery)} diff --git a/src/plugins/data/public/ui/search_bar/lib/clear_saved_query.test.ts b/src/plugins/data/public/ui/search_bar/lib/clear_saved_query.test.ts index ccfe5464b9598..10520fc3714d5 100644 --- a/src/plugins/data/public/ui/search_bar/lib/clear_saved_query.test.ts +++ b/src/plugins/data/public/ui/search_bar/lib/clear_saved_query.test.ts @@ -21,10 +21,8 @@ import { clearStateFromSavedQuery } from './clear_saved_query'; import { dataPluginMock } from '../../../mocks'; import { DataPublicPluginStart } from '../../../types'; -import { Query } from '../../..'; describe('clearStateFromSavedQuery', () => { - const DEFAULT_LANGUAGE = 'banana'; let dataMock: jest.Mocked; beforeEach(() => { @@ -32,19 +30,9 @@ describe('clearStateFromSavedQuery', () => { }); it('should clear filters and query', async () => { - const setQueryState = jest.fn(); dataMock.query.filterManager.removeAll = jest.fn(); - clearStateFromSavedQuery(dataMock.query, setQueryState, DEFAULT_LANGUAGE); - expect(setQueryState).toHaveBeenCalled(); - expect(dataMock.query.filterManager.removeAll).toHaveBeenCalled(); - }); - - it('should use search:queryLanguage', async () => { - const setQueryState = jest.fn(); - dataMock.query.filterManager.removeAll = jest.fn(); - clearStateFromSavedQuery(dataMock.query, setQueryState, DEFAULT_LANGUAGE); - expect(setQueryState).toHaveBeenCalled(); - expect((setQueryState.mock.calls[0][0] as Query).language).toBe(DEFAULT_LANGUAGE); + clearStateFromSavedQuery(dataMock.query); + expect(dataMock.query.queryString.clearQuery).toHaveBeenCalled(); expect(dataMock.query.filterManager.removeAll).toHaveBeenCalled(); }); }); diff --git a/src/plugins/data/public/ui/search_bar/lib/clear_saved_query.ts b/src/plugins/data/public/ui/search_bar/lib/clear_saved_query.ts index b2c777261c257..06ee56e9e4385 100644 --- a/src/plugins/data/public/ui/search_bar/lib/clear_saved_query.ts +++ b/src/plugins/data/public/ui/search_bar/lib/clear_saved_query.ts @@ -18,14 +18,7 @@ */ import { QueryStart } from '../../../query'; -export const clearStateFromSavedQuery = ( - queryService: QueryStart, - setQueryStringState: Function, - defaultLanguage: string -) => { +export const clearStateFromSavedQuery = (queryService: QueryStart) => { queryService.filterManager.removeAll(); - setQueryStringState({ - query: '', - language: defaultLanguage, - }); + queryService.queryString.clearQuery(); }; diff --git a/src/plugins/data/public/ui/search_bar/lib/populate_state_from_saved_query.test.ts b/src/plugins/data/public/ui/search_bar/lib/populate_state_from_saved_query.test.ts index 1db900053e078..660aa2333d49c 100644 --- a/src/plugins/data/public/ui/search_bar/lib/populate_state_from_saved_query.test.ts +++ b/src/plugins/data/public/ui/search_bar/lib/populate_state_from_saved_query.test.ts @@ -47,37 +47,34 @@ describe('populateStateFromSavedQuery', () => { }); it('should set query', async () => { - const setQueryState = jest.fn(); const savedQuery: SavedQuery = { ...baseSavedQuery, }; - populateStateFromSavedQuery(dataMock.query, setQueryState, savedQuery); - expect(setQueryState).toHaveBeenCalled(); + populateStateFromSavedQuery(dataMock.query, savedQuery); + expect(dataMock.query.queryString.setQuery).toHaveBeenCalled(); }); it('should set filters', async () => { - const setQueryState = jest.fn(); const savedQuery: SavedQuery = { ...baseSavedQuery, }; const f1 = getFilter(FilterStateStore.APP_STATE, false, false, 'age', 34); savedQuery.attributes.filters = [f1]; - populateStateFromSavedQuery(dataMock.query, setQueryState, savedQuery); - expect(setQueryState).toHaveBeenCalled(); + populateStateFromSavedQuery(dataMock.query, savedQuery); + expect(dataMock.query.queryString.setQuery).toHaveBeenCalled(); expect(dataMock.query.filterManager.setFilters).toHaveBeenCalledWith([f1]); }); it('should preserve global filters', async () => { const globalFilter = getFilter(FilterStateStore.GLOBAL_STATE, false, false, 'age', 34); dataMock.query.filterManager.getGlobalFilters = jest.fn().mockReturnValue([globalFilter]); - const setQueryState = jest.fn(); const savedQuery: SavedQuery = { ...baseSavedQuery, }; const f1 = getFilter(FilterStateStore.APP_STATE, false, false, 'age', 34); savedQuery.attributes.filters = [f1]; - populateStateFromSavedQuery(dataMock.query, setQueryState, savedQuery); - expect(setQueryState).toHaveBeenCalled(); + populateStateFromSavedQuery(dataMock.query, savedQuery); + expect(dataMock.query.queryString.setQuery).toHaveBeenCalled(); expect(dataMock.query.filterManager.setFilters).toHaveBeenCalledWith([globalFilter, f1]); }); @@ -97,7 +94,7 @@ describe('populateStateFromSavedQuery', () => { dataMock.query.timefilter.timefilter.setTime = jest.fn(); dataMock.query.timefilter.timefilter.setRefreshInterval = jest.fn(); - populateStateFromSavedQuery(dataMock.query, jest.fn(), savedQuery); + populateStateFromSavedQuery(dataMock.query, savedQuery); expect(dataMock.query.timefilter.timefilter.setTime).toHaveBeenCalledWith({ from: savedQuery.attributes.timefilter.from, diff --git a/src/plugins/data/public/ui/search_bar/lib/populate_state_from_saved_query.ts b/src/plugins/data/public/ui/search_bar/lib/populate_state_from_saved_query.ts index 7ae6726b36df0..bb4b97cc4a9fd 100644 --- a/src/plugins/data/public/ui/search_bar/lib/populate_state_from_saved_query.ts +++ b/src/plugins/data/public/ui/search_bar/lib/populate_state_from_saved_query.ts @@ -19,14 +19,11 @@ import { QueryStart, SavedQuery } from '../../../query'; -export const populateStateFromSavedQuery = ( - queryService: QueryStart, - setQueryStringState: Function, - savedQuery: SavedQuery -) => { +export const populateStateFromSavedQuery = (queryService: QueryStart, savedQuery: SavedQuery) => { const { timefilter: { timefilter }, filterManager, + queryString, } = queryService; // timefilter if (savedQuery.attributes.timefilter) { @@ -40,7 +37,7 @@ export const populateStateFromSavedQuery = ( } // query string - setQueryStringState(savedQuery.attributes.query); + queryString.setQuery(savedQuery.attributes.query); // filters const savedQueryFilters = savedQuery.attributes.filters || []; diff --git a/src/plugins/data/public/ui/search_bar/lib/use_query_string_manager.ts b/src/plugins/data/public/ui/search_bar/lib/use_query_string_manager.ts new file mode 100644 index 0000000000000..e28129f20bb86 --- /dev/null +++ b/src/plugins/data/public/ui/search_bar/lib/use_query_string_manager.ts @@ -0,0 +1,51 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { useState, useEffect } from 'react'; +import { Subscription } from 'rxjs'; +import { Query } from '../../..'; +import { QueryStringContract } from '../../../query/query_string'; + +interface UseQueryStringProps { + query?: Query; + queryStringManager: QueryStringContract; +} + +export const useQueryStringManager = (props: UseQueryStringProps) => { + // Filters should be either what's passed in the initial state or the current state of the filter manager + const [query, setQuery] = useState(props.query || props.queryStringManager.getQuery()); + useEffect(() => { + const subscriptions = new Subscription(); + + subscriptions.add( + props.queryStringManager.getUpdates$().subscribe({ + next: () => { + const newQuery = props.queryStringManager.getQuery(); + setQuery(newQuery); + }, + }) + ); + + return () => { + subscriptions.unsubscribe(); + }; + }, [props.queryStringManager]); + + return { query }; +}; diff --git a/src/plugins/data/public/ui/search_bar/lib/use_saved_query.ts b/src/plugins/data/public/ui/search_bar/lib/use_saved_query.ts index 79aee3438d7aa..9f73a401f563b 100644 --- a/src/plugins/data/public/ui/search_bar/lib/use_saved_query.ts +++ b/src/plugins/data/public/ui/search_bar/lib/use_saved_query.ts @@ -27,10 +27,8 @@ import { clearStateFromSavedQuery } from './clear_saved_query'; interface UseSavedQueriesProps { queryService: DataPublicPluginStart['query']; - setQuery: Function; notifications: CoreStart['notifications']; savedQueryId?: string; - defaultLanguage: string; } interface UseSavedQueriesReturn { @@ -41,7 +39,6 @@ interface UseSavedQueriesReturn { export const useSavedQuery = (props: UseSavedQueriesProps): UseSavedQueriesReturn => { // Handle saved queries - const defaultLanguage = props.defaultLanguage; const [savedQuery, setSavedQuery] = useState(); // Effect is used to convert a saved query id into an object @@ -53,12 +50,12 @@ export const useSavedQuery = (props: UseSavedQueriesProps): UseSavedQueriesRetur // Make sure we set the saved query to the most recent one if (newSavedQuery && newSavedQuery.id === savedQueryId) { setSavedQuery(newSavedQuery); - populateStateFromSavedQuery(props.queryService, props.setQuery, newSavedQuery); + populateStateFromSavedQuery(props.queryService, newSavedQuery); } } catch (error) { // Clear saved query setSavedQuery(undefined); - clearStateFromSavedQuery(props.queryService, props.setQuery, defaultLanguage); + clearStateFromSavedQuery(props.queryService); // notify of saving error props.notifications.toasts.addWarning({ title: i18n.translate('data.search.unableToGetSavedQueryToastTitle', { @@ -73,23 +70,21 @@ export const useSavedQuery = (props: UseSavedQueriesProps): UseSavedQueriesRetur if (props.savedQueryId) fetchSavedQuery(props.savedQueryId); else setSavedQuery(undefined); }, [ - defaultLanguage, props.notifications.toasts, props.queryService, props.queryService.savedQueries, props.savedQueryId, - props.setQuery, ]); return { savedQuery, setSavedQuery: (q: SavedQuery) => { setSavedQuery(q); - populateStateFromSavedQuery(props.queryService, props.setQuery, q); + populateStateFromSavedQuery(props.queryService, q); }, clearSavedQuery: () => { setSavedQuery(undefined); - clearStateFromSavedQuery(props.queryService, props.setQuery, defaultLanguage); + clearStateFromSavedQuery(props.queryService); }, }; }; diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index 99a77ff9aeb10..7ad2f9edd3325 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -4,6 +4,7 @@ ```ts +import { ApiResponse } from '@elastic/elasticsearch/lib/Transport'; import Boom from 'boom'; import { BulkIndexDocumentsParams } from 'elasticsearch'; import { CatAliasesParams } from 'elasticsearch'; @@ -91,6 +92,7 @@ import { IngestDeletePipelineParams } from 'elasticsearch'; import { IngestGetPipelineParams } from 'elasticsearch'; import { IngestPutPipelineParams } from 'elasticsearch'; import { IngestSimulateParams } from 'elasticsearch'; +import { KibanaClient } from '@elastic/elasticsearch/api/kibana'; import { KibanaConfigType as KibanaConfigType_2 } from 'src/core/server/kibana_config'; import { KibanaRequest as KibanaRequest_2 } from 'kibana/server'; import { LegacyAPICaller as LegacyAPICaller_2 } from 'kibana/server'; @@ -143,6 +145,9 @@ import { TasksGetParams } from 'elasticsearch'; import { TasksListParams } from 'elasticsearch'; import { TermvectorsParams } from 'elasticsearch'; import { ToastInputFields } from 'src/core/public/notifications'; +import { TransportRequestOptions } from '@elastic/elasticsearch/lib/Transport'; +import { TransportRequestParams } from '@elastic/elasticsearch/lib/Transport'; +import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; import { Type } from '@kbn/config-schema'; import { TypeOf } from '@kbn/config-schema'; import { Unit } from '@elastic/datemath'; diff --git a/src/plugins/discover/public/application/angular/discover.html b/src/plugins/discover/public/application/angular/discover.html index 48a8442b06316..d3d4f524873d8 100644 --- a/src/plugins/discover/public/application/angular/discover.html +++ b/src/plugins/discover/public/application/angular/discover.html @@ -6,9 +6,8 @@

{{screenTitle}}

app-name="'discover'" config="topNavMenu" index-patterns="[indexPattern]" - on-query-submit="updateQuery" + on-query-submit="handleRefresh" on-saved-query-id-change="updateSavedQueryId" - query="state.query" saved-query-id="state.savedQuery" screen-title="screenTitle" show-date-picker="indexPattern.isTimeBased()" diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js index c791bdd850151..4a27f261a6220 100644 --- a/src/plugins/discover/public/application/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -70,9 +70,7 @@ import { indexPatterns as indexPatternsUtils, connectToQueryState, syncQueryStateWithUrl, - getDefaultQuery, search, - UI_SETTINGS, } from '../../../../data/public'; import { getIndexPatternId } from '../helpers/get_index_pattern_id'; import { addFatalError } from '../../../../kibana_legacy/public'; @@ -191,16 +189,7 @@ app.directive('discoverApp', function () { }; }); -function discoverController( - $element, - $route, - $scope, - $timeout, - $window, - Promise, - localStorage, - uiCapabilities -) { +function discoverController($element, $route, $scope, $timeout, $window, Promise, uiCapabilities) { const { isDefault: isDefaultType } = indexPatternsUtils; const subscriptions = new Subscription(); const $fetchObservable = new Subject(); @@ -246,11 +235,15 @@ function discoverController( // sync initial app filters from state to filterManager filterManager.setAppFilters(_.cloneDeep(appStateContainer.getState().filters)); + data.query.queryString.setQuery(appStateContainer.getState().query); const stopSyncingQueryAppStateWithStateContainer = connectToQueryState( data.query, appStateContainer, - { filters: esFilters.FilterStateStore.APP_STATE } + { + filters: esFilters.FilterStateStore.APP_STATE, + query: true, + } ); const appStateUnsubscribe = appStateContainer.subscribe(async (newState) => { @@ -262,7 +255,7 @@ function discoverController( $scope.state = { ...newState }; // detect changes that should trigger fetching of new data - const changes = ['interval', 'sort', 'query'].filter( + const changes = ['interval', 'sort'].filter( (prop) => !_.isEqual(newStatePartial[prop], oldStatePartial[prop]) ); @@ -593,12 +586,7 @@ function discoverController( }; function getStateDefaults() { - const query = - $scope.searchSource.getField('query') || - getDefaultQuery( - localStorage.get('kibana.userQueryLanguage') || - config.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE) - ); + const query = $scope.searchSource.getField('query') || data.query.queryString.getDefaultQuery(); return { query, sort: getSortArray(savedSearch.sort, $scope.indexPattern), @@ -635,12 +623,7 @@ function discoverController( const init = _.once(() => { $scope.updateDataSource().then(async () => { - const searchBarChanges = merge( - timefilter.getAutoRefreshFetch$(), - timefilter.getFetch$(), - filterManager.getFetches$(), - $fetchObservable - ).pipe(debounceTime(100)); + const searchBarChanges = merge(data.query.state$, $fetchObservable).pipe(debounceTime(100)); subscriptions.add( subscribeWithScope( @@ -824,9 +807,8 @@ function discoverController( }); }; - $scope.updateQuery = function ({ query }, isUpdate = true) { - if (!_.isEqual(query, appStateContainer.getState().query) || isUpdate === false) { - setAppState({ query }); + $scope.handleRefresh = function (_payload, isUpdate) { + if (isUpdate === false) { $fetchObservable.next(); } }; @@ -976,7 +958,7 @@ function discoverController( config.get(SORT_DEFAULT_ORDER_SETTING) ) ) - .setField('query', $scope.state.query || null) + .setField('query', data.query.queryString.getQuery() || null) .setField('filter', filterManager.getFilters()); return Promise.resolve(); }; diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx index c97f19f59d340..cb1d5a25c01ae 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx @@ -35,12 +35,7 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { - esQuery, - IndexPattern, - Query, - UI_SETTINGS, -} from '../../../../../../../plugins/data/public'; +import { esQuery, IndexPattern, Query } from '../../../../../../../plugins/data/public'; import { context as contextType } from '../../../../../../kibana_react/public'; import { IndexPatternManagmentContextValue } from '../../../../types'; import { ExecuteScript } from '../../types'; @@ -248,10 +243,7 @@ export class TestScript extends Component { showFilterBar={false} showDatePicker={false} showQueryInput={true} - query={{ - language: this.context.services.uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), - query: '', - }} + query={this.context.services.data.query.queryString.getDefaultQuery()} onQuerySubmit={this.previewScript} indexPatterns={[this.props.indexPattern]} customSubmitButton={ diff --git a/src/plugins/vis_default_editor/public/components/controls/filters.tsx b/src/plugins/vis_default_editor/public/components/controls/filters.tsx index 04d0df27927fa..fc676e25ff6d7 100644 --- a/src/plugins/vis_default_editor/public/components/controls/filters.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/filters.tsx @@ -23,7 +23,7 @@ import { htmlIdGenerator, EuiButton, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { useMount } from 'react-use'; -import { Query, UI_SETTINGS } from '../../../../data/public'; +import { Query } from '../../../../data/public'; import { useKibana } from '../../../../kibana_react/public'; import { FilterRow } from './filter'; import { AggParamEditorProps } from '../agg_param_props'; @@ -70,7 +70,7 @@ function FiltersParamEditor({ agg, value = [], setValue }: AggParamEditorProps { - if (!isEqual(currentAppState.query, query)) { - stateContainer.transitions.set('query', query || currentAppState.query); - } else { + const handleRefresh = useCallback( + (_payload: any, isUpdate?: boolean) => { + if (isUpdate === false) { savedVisInstance.embeddableHandler.reload(); } }, - [currentAppState.query, savedVisInstance.embeddableHandler, stateContainer.transitions] + [savedVisInstance.embeddableHandler] ); const config = useMemo(() => { @@ -149,8 +145,7 @@ const TopNav = ({ { to: 'now', }; mockFilters = ['mockFilters']; + const mockQuery = { + query: '', + language: 'kuery', + }; // @ts-expect-error mockServices.data.query.timefilter.timefilter.getTime.mockImplementation(() => timeRange); // @ts-expect-error mockServices.data.query.filterManager.getFilters.mockImplementation(() => mockFilters); + // @ts-expect-error + mockServices.data.query.queryString.getQuery.mockImplementation(() => mockQuery); }); test('should set up current app state and render the editor', () => { diff --git a/src/plugins/visualize/public/application/utils/use/use_editor_updates.ts b/src/plugins/visualize/public/application/utils/use/use_editor_updates.ts index 360e7560b1932..0f4b2d34e8e87 100644 --- a/src/plugins/visualize/public/application/utils/use/use_editor_updates.ts +++ b/src/plugins/visualize/public/application/utils/use/use_editor_updates.ts @@ -20,9 +20,7 @@ import { useEffect, useState } from 'react'; import { isEqual } from 'lodash'; import { EventEmitter } from 'events'; -import { merge } from 'rxjs'; -import { migrateLegacyQuery } from '../../../../../kibana_legacy/public'; import { VisualizeServices, VisualizeAppState, @@ -47,6 +45,8 @@ export const useEditorUpdates = ( const { timefilter: { timefilter }, filterManager, + queryString, + state$, } = services.data.query; const { embeddableHandler, savedVis, savedSearch, vis } = savedVisInstance; const initialState = appState.getState(); @@ -60,7 +60,7 @@ export const useEditorUpdates = ( uiState: vis.uiState, timeRange: timefilter.getTime(), filters: filterManager.getFilters(), - query: appState.getState().query, + query: queryString.getQuery(), linked: !!vis.data.savedSearchId, savedSearch, }); @@ -68,17 +68,12 @@ export const useEditorUpdates = ( embeddableHandler.updateInput({ timeRange: timefilter.getTime(), filters: filterManager.getFilters(), - query: appState.getState().query, + query: queryString.getQuery(), }); } }; - const subscriptions = merge( - timefilter.getTimeUpdate$(), - timefilter.getAutoRefreshFetch$(), - timefilter.getFetch$(), - filterManager.getFetches$() - ).subscribe({ + const subscriptions = state$.subscribe({ next: reloadVisualization, error: services.fatalErrors.add, }); @@ -116,10 +111,6 @@ export const useEditorUpdates = ( // and initializing different visualizations return; } - const newQuery = migrateLegacyQuery(state.query); - if (!isEqual(state.query, newQuery)) { - appState.transitions.set('query', newQuery); - } if (!isEqual(state.uiState, vis.uiState.getChanges())) { vis.uiState.set(state.uiState); diff --git a/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.test.ts b/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.test.ts index e885067c58184..8bde9a049c492 100644 --- a/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.test.ts +++ b/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.test.ts @@ -96,6 +96,7 @@ describe('useVisualizeAppState', () => { ); expect(connectToQueryState).toHaveBeenCalledWith(mockServices.data.query, expect.any(Object), { filters: 'appState', + query: true, }); expect(result.current).toEqual({ appState: stateContainer, diff --git a/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.tsx b/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.tsx index e4d891472fbfd..c44f67df3729f 100644 --- a/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.tsx +++ b/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.tsx @@ -24,6 +24,7 @@ import { EventEmitter } from 'events'; import { i18n } from '@kbn/i18n'; import { MarkdownSimple, toMountPoint } from '../../../../../kibana_react/public'; +import { migrateLegacyQuery } from '../../../../../kibana_legacy/public'; import { esFilters, connectToQueryState } from '../../../../../data/public'; import { VisualizeServices, VisualizeAppStateContainer, SavedVisInstance } from '../../types'; import { visStateToEditorState } from '../utils'; @@ -61,19 +62,35 @@ export const useVisualizeAppState = ( eventEmitter.on('dirtyStateChange', onDirtyStateChange); - const { filterManager } = services.data.query; - // sync initial app filters from state to filterManager + const { filterManager, queryString } = services.data.query; + // sync initial app state from state to managers filterManager.setAppFilters(cloneDeep(stateContainer.getState().filters)); - // setup syncing of app filters between appState and filterManager + queryString.setQuery(migrateLegacyQuery(stateContainer.getState().query)); + + // setup syncing of app filters between appState and query services const stopSyncingAppFilters = connectToQueryState( services.data.query, { - set: ({ filters }) => stateContainer.transitions.set('filters', filters), - get: () => ({ filters: stateContainer.getState().filters }), - state$: stateContainer.state$.pipe(map((state) => ({ filters: state.filters }))), + set: ({ filters, query }) => { + stateContainer.transitions.set('filters', filters); + stateContainer.transitions.set('query', query); + }, + get: () => { + return { + filters: stateContainer.getState().filters, + query: stateContainer.getState().query, + }; + }, + state$: stateContainer.state$.pipe( + map((state) => ({ + filters: state.filters, + query: state.query, + })) + ), }, { filters: esFilters.FilterStateStore.APP_STATE, + query: true, } ); diff --git a/src/plugins/visualize/public/application/utils/utils.ts b/src/plugins/visualize/public/application/utils/utils.ts index 9f32da3f785b5..532d87985a0b6 100644 --- a/src/plugins/visualize/public/application/utils/utils.ts +++ b/src/plugins/visualize/public/application/utils/utils.ts @@ -20,7 +20,7 @@ import { i18n } from '@kbn/i18n'; import { ChromeStart, DocLinksStart } from 'kibana/public'; -import { Filter, UI_SETTINGS } from '../../../../data/public'; +import { Filter } from '../../../../data/public'; import { VisualizeServices, SavedVisInstance } from '../types'; export const addHelpMenuToAppChrome = (chrome: ChromeStart, docLinks: DocLinksStart) => { @@ -49,12 +49,9 @@ export const addBadgeToAppChrome = (chrome: ChromeStart) => { }); }; -export const getDefaultQuery = ({ localStorage, uiSettings }: VisualizeServices) => ({ - query: '', - language: - localStorage.get('kibana.userQueryLanguage') || - uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), -}); +export const getDefaultQuery = ({ data }: VisualizeServices) => { + return data.query.queryString.getDefaultQuery(); +}; export const visStateToEditorState = ( { vis, savedVis }: SavedVisInstance, diff --git a/test/functional/apps/discover/_errors.js b/test/functional/apps/discover/_errors.js index f3936d06bb6df..614059dc8ac94 100644 --- a/test/functional/apps/discover/_errors.js +++ b/test/functional/apps/discover/_errors.js @@ -22,12 +22,13 @@ import expect from '@kbn/expect'; export default function ({ getService, getPageObjects }) { const esArchiver = getService('esArchiver'); const testSubjects = getService('testSubjects'); - const PageObjects = getPageObjects(['common', 'discover']); + const PageObjects = getPageObjects(['common', 'discover', 'timePicker']); describe('errors', function describeIndexTests() { before(async function () { await esArchiver.loadIfNeeded('logstash_functional'); await esArchiver.load('invalid_scripted_field'); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); await PageObjects.common.navigateToApp('discover'); }); @@ -35,8 +36,7 @@ export default function ({ getService, getPageObjects }) { await esArchiver.unload('invalid_scripted_field'); }); - // ES issue https://github.com/elastic/elasticsearch/issues/54235 - describe.skip('invalid scripted field error', () => { + describe('invalid scripted field error', () => { it('is rendered', async () => { const isFetchErrorVisible = await testSubjects.exists('discoverFetchError'); expect(isFetchErrorVisible).to.be(true); diff --git a/test/functional/apps/visualize/_area_chart.js b/test/functional/apps/visualize/_area_chart.js index 4321f0df89250..9ac2160a359da 100644 --- a/test/functional/apps/visualize/_area_chart.js +++ b/test/functional/apps/visualize/_area_chart.js @@ -563,6 +563,10 @@ export default function ({ getService, getPageObjects }) { it('should display updated scaled label text after time range is changed', async () => { await PageObjects.visEditor.setInterval('Millisecond'); + + // Apply interval + await testSubjects.clickWhenNotDisabled('visualizeEditorRenderButton'); + const isHelperScaledLabelExists = await find.existsByCssSelector( '[data-test-subj="currentlyScaledText"]' ); diff --git a/test/functional/page_objects/visual_builder_page.ts b/test/functional/page_objects/visual_builder_page.ts index 8488eb8cd2749..2771982fecdea 100644 --- a/test/functional/page_objects/visual_builder_page.ts +++ b/test/functional/page_objects/visual_builder_page.ts @@ -315,9 +315,9 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro public async getRhythmChartLegendValue(nth = 0) { await PageObjects.visChart.waitForVisualizationRenderingStabilized(); - const metricValue = (await find.allByCssSelector(`.echLegendItem .echLegendItem__extra`))[ - nth - ]; + const metricValue = ( + await find.allByCssSelector(`.echLegendItem .echLegendItem__extra`, 20000) + )[nth]; await metricValue.moveMouseTo(); return await metricValue.getVisibleText(); } diff --git a/vars/slackNotifications.groovy b/vars/slackNotifications.groovy index 2ffb420ecf3f4..30f86e6d6f0ad 100644 --- a/vars/slackNotifications.groovy +++ b/vars/slackNotifications.groovy @@ -13,12 +13,35 @@ def dividerBlock() { return [ type: "divider" ] } +// If a message is longer than the limit, split it up by '\n' into parts, and return as many parts as will fit within the limit +def shortenMessage(message, sizeLimit = 3000) { + if (message.size() <= sizeLimit) { + return message + } + + def truncatedMessage = "[...truncated...]" + + def parts = message.split("\n") + message = "" + + for(def part in parts) { + if ((message.size() + part.size() + truncatedMessage.size() + 1) > sizeLimit) { + break; + } + message += part+"\n" + } + + message += truncatedMessage + + return message.size() <= sizeLimit ? message : truncatedMessage +} + def markdownBlock(message) { return [ type: "section", text: [ type: "mrkdwn", - text: message, + text: shortenMessage(message, 3000), // 3000 is max text length for `section`s only ], ] } @@ -29,7 +52,7 @@ def contextBlock(message) { elements: [ [ type: 'mrkdwn', - text: message, + text: message, // Not sure what the size limit is here, I tried 10000s of characters and it still worked ] ] ] @@ -62,7 +85,7 @@ def getTestFailures() { def messages = [] messages << "*Test Failures*" - def list = failures.collect { + def list = failures.take(10).collect { def name = it .fullDisplayName .split(/\./, 2)[-1] @@ -73,7 +96,9 @@ def getTestFailures() { return "• <${it.url}|${name}>" }.join("\n") - return "*Test Failures*\n${list}" + + def moreText = failures.size() > 10 ? "\n• ...and ${failures.size()-10} more" : "" + return "*Test Failures*\n${list}${moreText}" } def getDefaultDisplayName() { @@ -98,6 +123,10 @@ def getStatusIcon() { return ':broken_heart:' } +def getBackupMessage(config) { + return "${getStatusIcon()} ${config.title}\n\nFirst attempt at sending this notification failed. Please check the build." +} + def sendFailedBuild(Map params = [:]) { def config = [ channel: '#kibana-operations-alerts', @@ -117,7 +146,7 @@ def sendFailedBuild(Map params = [:]) { blocks << dividerBlock() blocks << config.context - slackSend( + def resp = slackSend( channel: config.channel, username: config.username, iconEmoji: config.icon, @@ -125,6 +154,17 @@ def sendFailedBuild(Map params = [:]) { message: message, blocks: blocks ) + + if (!resp) { + slackSend( + channel: config.channel, + username: config.username, + iconEmoji: config.icon, + color: config.color, + message: message, + blocks: [markdownBlock(getBackupMessage(config))] + ) + } } def onFailure(Map options = [:]) { diff --git a/x-pack/package.json b/x-pack/package.json index 76655f75cadcc..3a9b3ca606de6 100644 --- a/x-pack/package.json +++ b/x-pack/package.json @@ -37,12 +37,13 @@ "@kbn/storybook": "1.0.0", "@kbn/test": "1.0.0", "@kbn/utility-types": "1.0.0", - "@storybook/addon-actions": "^5.2.6", + "@storybook/addon-actions": "^5.3.19", "@storybook/addon-console": "^1.2.1", - "@storybook/addon-knobs": "^5.2.6", - "@storybook/addon-storyshots": "^5.2.6", - "@storybook/react": "^5.2.6", - "@storybook/theming": "^5.2.6", + "@storybook/addon-info": "^5.3.19", + "@storybook/addon-knobs": "^5.3.19", + "@storybook/addon-storyshots": "^5.3.19", + "@storybook/react": "^5.3.19", + "@storybook/theming": "^5.3.19", "@testing-library/react": "^9.3.2", "@testing-library/react-hooks": "^3.2.1", "@testing-library/jest-dom": "^5.8.0", diff --git a/x-pack/plugins/actions/server/feature.ts b/x-pack/plugins/actions/server/feature.ts index c06acb6761454..321509a7b9de6 100644 --- a/x-pack/plugins/actions/server/feature.ts +++ b/x-pack/plugins/actions/server/feature.ts @@ -15,11 +15,17 @@ export const ACTIONS_FEATURE = { icon: 'bell', navLinkId: 'actions', app: [], + management: { + insightsAndAlerting: ['triggersActions'], + }, privileges: { all: { app: [], api: [], catalogue: [], + management: { + insightsAndAlerting: ['triggersActions'], + }, savedObject: { all: [ACTION_SAVED_OBJECT_TYPE, ACTION_TASK_PARAMS_SAVED_OBJECT_TYPE], read: [], @@ -30,6 +36,9 @@ export const ACTIONS_FEATURE = { app: [], api: [], catalogue: [], + management: { + insightsAndAlerting: ['triggersActions'], + }, savedObject: { // action execution requires 'read' over `actions`, but 'all' over `action_task_params` all: [ACTION_TASK_PARAMS_SAVED_OBJECT_TYPE], diff --git a/x-pack/plugins/alerting_builtins/server/feature.ts b/x-pack/plugins/alerting_builtins/server/feature.ts index 669d2ba627059..316bae98bf8c1 100644 --- a/x-pack/plugins/alerting_builtins/server/feature.ts +++ b/x-pack/plugins/alerting_builtins/server/feature.ts @@ -15,11 +15,17 @@ export const BUILT_IN_ALERTS_FEATURE = { }), icon: 'bell', app: [], + management: { + insightsAndAlerting: ['triggersActions'], + }, alerting: [IndexThreshold], privileges: { all: { app: [], catalogue: [], + management: { + insightsAndAlerting: ['triggersActions'], + }, alerting: { all: [IndexThreshold], read: [], @@ -29,11 +35,14 @@ export const BUILT_IN_ALERTS_FEATURE = { read: [], }, api: [], - ui: ['alerting:show'], + ui: [], }, read: { app: [], catalogue: [], + management: { + insightsAndAlerting: ['triggersActions'], + }, alerting: { all: [], read: [IndexThreshold], @@ -43,7 +52,7 @@ export const BUILT_IN_ALERTS_FEATURE = { read: [], }, api: [], - ui: ['alerting:show'], + ui: [], }, }, }; diff --git a/x-pack/plugins/alerts/server/plugin.ts b/x-pack/plugins/alerts/server/plugin.ts index cf6e1c9aebba6..2f0df44197553 100644 --- a/x-pack/plugins/alerts/server/plugin.ts +++ b/x-pack/plugins/alerts/server/plugin.ts @@ -129,6 +129,16 @@ export class AlertingPlugin { this.spaces = plugins.spaces?.spacesService; this.security = plugins.security; + core.capabilities.registerProvider(() => { + return { + management: { + insightsAndAlerting: { + triggersActions: true, + }, + }, + }; + }); + this.isESOUsingEphemeralEncryptionKey = plugins.encryptedSavedObjects.usingEphemeralEncryptionKey; diff --git a/x-pack/plugins/alerts/server/saved_objects/index.ts b/x-pack/plugins/alerts/server/saved_objects/index.ts index 06ce8d673e6b7..c98d9bcbd9ae5 100644 --- a/x-pack/plugins/alerts/server/saved_objects/index.ts +++ b/x-pack/plugins/alerts/server/saved_objects/index.ts @@ -6,7 +6,6 @@ import { SavedObjectsServiceSetup } from 'kibana/server'; import mappings from './mappings.json'; -import { getMigrations } from './migrations'; import { EncryptedSavedObjectsPluginSetup } from '../../../encrypted_saved_objects/server'; export function setupSavedObjects( @@ -17,7 +16,6 @@ export function setupSavedObjects( name: 'alert', hidden: true, namespaceType: 'single', - migrations: getMigrations(encryptedSavedObjects), mappings: mappings.alert, }); diff --git a/x-pack/plugins/alerts/server/saved_objects/migrations.test.ts b/x-pack/plugins/alerts/server/saved_objects/migrations.test.ts deleted file mode 100644 index 19f4e918b7862..0000000000000 --- a/x-pack/plugins/alerts/server/saved_objects/migrations.test.ts +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -import uuid from 'uuid'; -import { getMigrations } from './migrations'; -import { RawAlert } from '../types'; -import { SavedObjectUnsanitizedDoc } from 'kibana/server'; -import { encryptedSavedObjectsMock } from '../../../encrypted_saved_objects/server/mocks'; -import { migrationMocks } from 'src/core/server/mocks'; - -const { log } = migrationMocks.createContext(); -const encryptedSavedObjectsSetup = encryptedSavedObjectsMock.createSetup(); - -describe('7.9.0', () => { - beforeEach(() => { - jest.resetAllMocks(); - encryptedSavedObjectsSetup.createMigration.mockImplementation( - (shouldMigrateWhenPredicate, migration) => migration - ); - }); - - test('changes nothing on alerts by other plugins', () => { - const migration790 = getMigrations(encryptedSavedObjectsSetup)['7.9.0']; - const alert = getMockData({}); - expect(migration790(alert, { log })).toMatchObject(alert); - - expect(encryptedSavedObjectsSetup.createMigration).toHaveBeenCalledWith( - expect.any(Function), - expect.any(Function) - ); - }); - - test('migrates the consumer for alerting', () => { - const migration790 = getMigrations(encryptedSavedObjectsSetup)['7.9.0']; - const alert = getMockData({ - consumer: 'alerting', - }); - expect(migration790(alert, { log })).toMatchObject({ - ...alert, - attributes: { - ...alert.attributes, - consumer: 'alerts', - }, - }); - }); -}); - -describe('7.10.0', () => { - beforeEach(() => { - jest.resetAllMocks(); - encryptedSavedObjectsSetup.createMigration.mockImplementation( - (shouldMigrateWhenPredicate, migration) => migration - ); - }); - - test('changes nothing on alerts by other plugins', () => { - const migration710 = getMigrations(encryptedSavedObjectsSetup)['7.10.0']; - const alert = getMockData({}); - expect(migration710(alert, { log })).toMatchObject(alert); - - expect(encryptedSavedObjectsSetup.createMigration).toHaveBeenCalledWith( - expect.any(Function), - expect.any(Function) - ); - }); - - test('migrates the consumer for metrics', () => { - const migration710 = getMigrations(encryptedSavedObjectsSetup)['7.10.0']; - const alert = getMockData({ - consumer: 'metrics', - }); - expect(migration710(alert, { log })).toMatchObject({ - ...alert, - attributes: { - ...alert.attributes, - consumer: 'infrastructure', - }, - }); - }); -}); - -function getMockData( - overwrites: Record = {} -): SavedObjectUnsanitizedDoc { - return { - attributes: { - enabled: true, - name: 'abc', - tags: ['foo'], - alertTypeId: '123', - consumer: 'bar', - apiKey: '', - apiKeyOwner: '', - schedule: { interval: '10s' }, - throttle: null, - params: { - bar: true, - }, - muteAll: false, - mutedInstanceIds: [], - createdBy: new Date().toISOString(), - updatedBy: new Date().toISOString(), - createdAt: new Date().toISOString(), - actions: [ - { - group: 'default', - actionRef: '1', - actionTypeId: '1', - params: { - foo: true, - }, - }, - ], - ...overwrites, - }, - id: uuid.v4(), - type: 'alert', - }; -} diff --git a/x-pack/plugins/alerts/server/saved_objects/migrations.ts b/x-pack/plugins/alerts/server/saved_objects/migrations.ts deleted file mode 100644 index 57a4005887093..0000000000000 --- a/x-pack/plugins/alerts/server/saved_objects/migrations.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -import { - SavedObjectMigrationMap, - SavedObjectUnsanitizedDoc, - SavedObjectMigrationFn, -} from '../../../../../src/core/server'; -import { RawAlert } from '../types'; -import { EncryptedSavedObjectsPluginSetup } from '../../../encrypted_saved_objects/server'; - -export function getMigrations( - encryptedSavedObjects: EncryptedSavedObjectsPluginSetup -): SavedObjectMigrationMap { - return { - /** - * In v7.9.0 we changed the Alerting plugin so it uses the `consumer` value of `alerts` - * prior to that we were using `alerting` and we need to keep these in sync - */ - '7.9.0': changeAlertingConsumer(encryptedSavedObjects, 'alerting', 'alerts'), - /** - * In v7.10.0 we changed the Matrics plugin so it uses the `consumer` value of `infrastructure` - * prior to that we were using `metrics` and we need to keep these in sync - */ - '7.10.0': changeAlertingConsumer(encryptedSavedObjects, 'metrics', 'infrastructure'), - }; -} - -function changeAlertingConsumer( - encryptedSavedObjects: EncryptedSavedObjectsPluginSetup, - from: string, - to: string -): SavedObjectMigrationFn { - return encryptedSavedObjects.createMigration( - function shouldBeMigrated(doc): doc is SavedObjectUnsanitizedDoc { - return doc.attributes.consumer === from; - }, - (doc: SavedObjectUnsanitizedDoc): SavedObjectUnsanitizedDoc => { - const { - attributes: { consumer }, - } = doc; - return { - ...doc, - attributes: { - ...doc.attributes, - consumer: consumer === from ? to : consumer, - }, - }; - } - ); -} diff --git a/x-pack/plugins/apm/public/components/app/TraceOverview/TraceList.tsx b/x-pack/plugins/apm/public/components/app/TraceOverview/TraceList.tsx index 898e32f5c2c09..f54255ec0cd18 100644 --- a/x-pack/plugins/apm/public/components/app/TraceOverview/TraceList.tsx +++ b/x-pack/plugins/apm/public/components/app/TraceOverview/TraceList.tsx @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import styled from 'styled-components'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { ITransactionGroup } from '../../../../server/lib/transaction_groups/transform'; +import { TransactionGroup } from '../../../../server/lib/transaction_groups/fetcher'; import { fontSizes, truncate } from '../../../style/variables'; import { asMillisecondDuration } from '../../../utils/formatters'; import { EmptyMessage } from '../../shared/EmptyMessage'; @@ -24,11 +24,11 @@ const StyledTransactionLink = styled(TransactionDetailLink)` `; interface Props { - items: ITransactionGroup[]; + items: TransactionGroup[]; isLoading: boolean; } -const traceListColumns: Array> = [ +const traceListColumns: Array> = [ { field: 'name', name: i18n.translate('xpack.apm.tracesTable.nameColumnLabel', { @@ -36,8 +36,8 @@ const traceListColumns: Array> = [ }), width: '40%', sortable: true, - render: (name: string, { sample }: ITransactionGroup) => ( - + render: (_: string, { sample }: TransactionGroup) => ( + > = [ transactionName={sample.transaction.name} transactionType={sample.transaction.type} > - {name} + {sample.transaction.name} ), diff --git a/x-pack/plugins/apm/public/components/app/TransactionOverview/List/index.tsx b/x-pack/plugins/apm/public/components/app/TransactionOverview/List/index.tsx index ae1b07bde0c87..2b1c1b8e8c11c 100644 --- a/x-pack/plugins/apm/public/components/app/TransactionOverview/List/index.tsx +++ b/x-pack/plugins/apm/public/components/app/TransactionOverview/List/index.tsx @@ -10,7 +10,7 @@ import React, { useMemo } from 'react'; import styled from 'styled-components'; import { NOT_AVAILABLE_LABEL } from '../../../../../common/i18n'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { ITransactionGroup } from '../../../../../server/lib/transaction_groups/transform'; +import { TransactionGroup } from '../../../../../server/lib/transaction_groups/fetcher'; import { fontFamilyCode, truncate } from '../../../../style/variables'; import { asDecimal, asMillisecondDuration } from '../../../../utils/formatters'; import { ImpactBar } from '../../../shared/ImpactBar'; @@ -25,12 +25,12 @@ const TransactionNameLink = styled(TransactionDetailLink)` `; interface Props { - items: ITransactionGroup[]; + items: TransactionGroup[]; isLoading: boolean; } export function TransactionList({ items, isLoading }: Props) { - const columns: Array> = useMemo( + const columns: Array> = useMemo( () => [ { field: 'name', @@ -39,11 +39,11 @@ export function TransactionList({ items, isLoading }: Props) { }), width: '50%', sortable: true, - render: (transactionName: string, { sample }: ITransactionGroup) => { + render: (_, { sample }: TransactionGroup) => { return ( - {transactionName || NOT_AVAILABLE_LABEL} + {sample.transaction.name || NOT_AVAILABLE_LABEL} ); diff --git a/x-pack/plugins/apm/public/hooks/useTransactionList.ts b/x-pack/plugins/apm/public/hooks/useTransactionList.ts index ed6bb9309a557..0ad221b95b4ff 100644 --- a/x-pack/plugins/apm/public/hooks/useTransactionList.ts +++ b/x-pack/plugins/apm/public/hooks/useTransactionList.ts @@ -4,45 +4,15 @@ * you may not use this file except in compliance with the Elastic License. */ -import { useMemo } from 'react'; import { IUrlParams } from '../context/UrlParamsContext/types'; import { useUiFilters } from '../context/UrlParamsContext'; import { useFetcher } from './useFetcher'; import { APIReturnType } from '../services/rest/createCallApmApi'; -const getRelativeImpact = ( - impact: number, - impactMin: number, - impactMax: number -) => - Math.max( - ((impact - impactMin) / Math.max(impactMax - impactMin, 1)) * 100, - 1 - ); - type TransactionsAPIResponse = APIReturnType< '/api/apm/services/{serviceName}/transaction_groups' >; -function getWithRelativeImpact(items: TransactionsAPIResponse['items']) { - const impacts = items - .map(({ impact }) => impact) - .filter((impact) => impact !== null) as number[]; - - const impactMin = Math.min(...impacts); - const impactMax = Math.max(...impacts); - - return items.map((item) => { - return { - ...item, - impactRelative: - item.impact !== null - ? getRelativeImpact(item.impact, impactMin, impactMax) - : null, - }; - }); -} - const DEFAULT_RESPONSE: TransactionsAPIResponse = { items: [], isAggregationAccurate: true, @@ -72,16 +42,8 @@ export function useTransactionList(urlParams: IUrlParams) { [serviceName, start, end, transactionType, uiFilters] ); - const memoizedData = useMemo( - () => ({ - items: getWithRelativeImpact(data.items), - isAggregationAccurate: data.isAggregationAccurate, - bucketSize: data.bucketSize, - }), - [data] - ); return { - data: memoizedData, + data, status, error, }; diff --git a/x-pack/plugins/apm/scripts/aggregate-latency-metrics/index.ts b/x-pack/plugins/apm/scripts/aggregate-latency-metrics/index.ts index 28b095335e93d..c3cf363cbec05 100644 --- a/x-pack/plugins/apm/scripts/aggregate-latency-metrics/index.ts +++ b/x-pack/plugins/apm/scripts/aggregate-latency-metrics/index.ts @@ -10,7 +10,7 @@ import pLimit from 'p-limit'; import pRetry from 'p-retry'; import { parse, format } from 'url'; import { set } from '@elastic/safer-lodash-set'; -import { unique, without, merge, flatten } from 'lodash'; +import { uniq, without, merge, flatten } from 'lodash'; import * as histogram from 'hdr-histogram-js'; import { ESSearchResponse } from '../../typings/elasticsearch'; import { @@ -114,8 +114,8 @@ export async function aggregateLatencyMetrics() { .filter(Boolean) as string[]; const fields = only.length - ? unique(only) - : without(unique([...include, ...defaultFields]), ...exclude); + ? uniq(only) + : without(uniq([...include, ...defaultFields]), ...exclude); const globalFilter = argv.filter ? JSON.parse(String(argv.filter)) : {}; diff --git a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts index bc5f1afc63cac..fe226c8ab27d2 100644 --- a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts +++ b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts @@ -6,7 +6,7 @@ import path from 'path'; import fs from 'fs'; import yaml from 'js-yaml'; -import { identity, pick } from 'lodash'; +import { identity, pickBy } from 'lodash'; export type KibanaConfig = ReturnType; @@ -22,7 +22,7 @@ export const readKibanaConfig = () => { ) ) || {}) as {}; - const cliEsCredentials = pick( + const cliEsCredentials = pickBy( { 'elasticsearch.username': process.env.ELASTICSEARCH_USERNAME, 'elasticsearch.password': process.env.ELASTICSEARCH_PASSWORD, diff --git a/x-pack/plugins/apm/server/feature.ts b/x-pack/plugins/apm/server/feature.ts index 38e75f75ad04b..971bc96234376 100644 --- a/x-pack/plugins/apm/server/feature.ts +++ b/x-pack/plugins/apm/server/feature.ts @@ -17,6 +17,9 @@ export const APM_FEATURE = { navLinkId: 'apm', app: ['apm', 'kibana'], catalogue: ['apm'], + management: { + insightsAndAlerting: ['triggersActions'], + }, alerting: Object.values(AlertType), // see x-pack/plugins/features/common/feature_kibana_privileges.ts privileges: { @@ -31,6 +34,9 @@ export const APM_FEATURE = { alerting: { all: Object.values(AlertType), }, + management: { + insightsAndAlerting: ['triggersActions'], + }, ui: ['show', 'save', 'alerting:show', 'alerting:save'], }, read: { @@ -44,6 +50,9 @@ export const APM_FEATURE = { alerting: { all: Object.values(AlertType), }, + management: { + insightsAndAlerting: ['triggersActions'], + }, ui: ['show', 'alerting:show', 'alerting:save'], }, }, diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts index 1d14c509274a8..a922457b14cea 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts @@ -157,7 +157,7 @@ export function registerTransactionDurationAlertType({ const { agg } = response.aggregations; - const value = 'values' in agg ? agg.values[0] : agg?.value; + const value = 'values' in agg ? Object.values(agg.values)[0] : agg?.value; if (value && value > alertParams.threshold * 1000) { const alertInstance = services.alertInstanceFactory( diff --git a/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts b/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts index 6de2728ee4366..895920a9b6c7d 100644 --- a/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts +++ b/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts @@ -4,7 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { Unionize } from 'utility-types'; +import { Unionize, Overwrite } from 'utility-types'; +import { ESSearchRequest } from '../../../typings/elasticsearch'; import { Setup, SetupTimeRange, @@ -17,14 +18,28 @@ import { getMetricsProjection } from '../../../common/projections/metrics'; import { mergeProjection } from '../../../common/projections/util/merge_projection'; import { AggregationOptionsByType } from '../../../typings/elasticsearch/aggregations'; -interface Aggs { - [key: string]: Unionize<{ - min: AggregationOptionsByType['min']; - max: AggregationOptionsByType['max']; - sum: AggregationOptionsByType['sum']; - avg: AggregationOptionsByType['avg']; - }>; -} +type MetricsAggregationMap = Unionize<{ + min: AggregationOptionsByType['min']; + max: AggregationOptionsByType['max']; + sum: AggregationOptionsByType['sum']; + avg: AggregationOptionsByType['avg']; +}>; + +type MetricAggs = Record; + +export type GenericMetricsRequest = Overwrite< + ESSearchRequest, + { + body: { + aggs: { + timeseriesData: { + date_histogram: AggregationOptionsByType['date_histogram']; + aggs: MetricAggs; + }; + } & MetricAggs; + }; + } +>; interface Filter { exists?: { @@ -35,7 +50,7 @@ interface Filter { }; } -export async function fetchAndTransformMetrics({ +export async function fetchAndTransformMetrics({ setup, serviceName, serviceNodeName, @@ -58,7 +73,7 @@ export async function fetchAndTransformMetrics({ serviceNodeName, }); - const params = mergeProjection(projection, { + const params: GenericMetricsRequest = mergeProjection(projection, { body: { size: 0, query: { diff --git a/x-pack/plugins/apm/server/lib/metrics/transform_metrics_chart.ts b/x-pack/plugins/apm/server/lib/metrics/transform_metrics_chart.ts index affb7c2a12075..a191d5400e36c 100644 --- a/x-pack/plugins/apm/server/lib/metrics/transform_metrics_chart.ts +++ b/x-pack/plugins/apm/server/lib/metrics/transform_metrics_chart.ts @@ -4,40 +4,15 @@ * you may not use this file except in compliance with the Elastic License. */ import theme from '@elastic/eui/dist/eui_theme_light.json'; -import { Unionize, Overwrite } from 'utility-types'; import { ChartBase } from './types'; -import { - ESSearchResponse, - ESSearchRequest, -} from '../../../typings/elasticsearch'; -import { AggregationOptionsByType } from '../../../typings/elasticsearch/aggregations'; +import { ESSearchResponse } from '../../../typings/elasticsearch'; import { getVizColorForIndex } from '../../../common/viz_colors'; +import { GenericMetricsRequest } from './fetch_and_transform_metrics'; export type GenericMetricsChart = ReturnType< typeof transformDataToMetricsChart >; -interface MetricsAggregationMap { - min: AggregationOptionsByType['min']; - max: AggregationOptionsByType['max']; - sum: AggregationOptionsByType['sum']; - avg: AggregationOptionsByType['avg']; -} - -type GenericMetricsRequest = Overwrite< - ESSearchRequest, - { - body: { - aggs: { - timeseriesData: { - date_histogram: AggregationOptionsByType['date_histogram']; - aggs: Record>; - }; - } & Record>; - }; - } ->; - export function transformDataToMetricsChart( result: ESSearchResponse, chartBase: ChartBase @@ -51,11 +26,7 @@ export function transformDataToMetricsChart( yUnit: chartBase.yUnit, noHits: hits.total.value === 0, series: Object.keys(chartBase.series).map((seriesKey, i) => { - const overallValue = (aggregations?.[seriesKey] as - | { - value: number | null; - } - | undefined)?.value; + const overallValue = aggregations?.[seriesKey]?.value; return { title: chartBase.series[seriesKey].title, @@ -66,7 +37,7 @@ export function transformDataToMetricsChart( overallValue, data: timeseriesData?.buckets.map((bucket) => { - const { value } = bucket[seriesKey] as { value: number | null }; + const { value } = bucket[seriesKey]; const y = value === null || isNaN(value) ? null : value; return { x: bucket.key, diff --git a/x-pack/plugins/apm/server/lib/services/get_services/get_services_items_stats.ts b/x-pack/plugins/apm/server/lib/services/get_services/get_services_items_stats.ts index c28bcad841ffd..de699028f5675 100644 --- a/x-pack/plugins/apm/server/lib/services/get_services/get_services_items_stats.ts +++ b/x-pack/plugins/apm/server/lib/services/get_services/get_services_items_stats.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { arrayUnionToCallable } from '../../../../common/utils/array_union_to_callable'; import { PROCESSOR_EVENT, TRANSACTION_DURATION, @@ -187,7 +186,7 @@ export const getTransactionRates = async ({ const deltaAsMinutes = getDeltaAsMinutes(setup); - return arrayUnionToCallable(aggregations.services.buckets).map((bucket) => { + return aggregations.services.buckets.map((bucket) => { const transactionsPerMinute = bucket.doc_count / deltaAsMinutes; return { serviceName: bucket.key as string, diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/fetcher.test.ts.snap b/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/fetcher.test.ts.snap deleted file mode 100644 index b354d3ed1f88d..0000000000000 --- a/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/fetcher.test.ts.snap +++ /dev/null @@ -1,228 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`transactionGroupsFetcher type: top_traces should call client.search with correct query 1`] = ` -Array [ - Array [ - Object { - "body": Object { - "aggs": Object { - "transaction_groups": Object { - "aggs": Object { - "avg": Object { - "avg": Object { - "field": "transaction.duration.us", - }, - }, - "p95": Object { - "percentiles": Object { - "field": "transaction.duration.us", - "hdr": Object { - "number_of_significant_value_digits": 2, - }, - "percents": Array [ - 95, - ], - }, - }, - "sample": Object { - "top_hits": Object { - "size": 1, - "sort": Array [ - Object { - "_score": "desc", - }, - Object { - "@timestamp": Object { - "order": "desc", - }, - }, - ], - }, - }, - "sum": Object { - "sum": Object { - "field": "transaction.duration.us", - }, - }, - }, - "composite": Object { - "size": 10000, - "sources": Array [ - Object { - "service": Object { - "terms": Object { - "field": "service.name", - }, - }, - }, - Object { - "transaction": Object { - "terms": Object { - "field": "transaction.name", - }, - }, - }, - ], - }, - }, - }, - "query": Object { - "bool": Object { - "filter": Array [ - Object { - "range": Object { - "@timestamp": Object { - "format": "epoch_millis", - "gte": 1528113600000, - "lte": 1528977600000, - }, - }, - }, - Object { - "term": Object { - "processor.event": "transaction", - }, - }, - Object { - "term": Object { - "service.environment": "test", - }, - }, - ], - "must_not": Array [ - Object { - "exists": Object { - "field": "parent.id", - }, - }, - ], - "should": Array [ - Object { - "term": Object { - "transaction.sampled": true, - }, - }, - ], - }, - }, - "size": 0, - }, - "index": "myIndex", - }, - ], -] -`; - -exports[`transactionGroupsFetcher type: top_transactions should call client.search with correct query 1`] = ` -Array [ - Array [ - Object { - "body": Object { - "aggs": Object { - "transaction_groups": Object { - "aggs": Object { - "avg": Object { - "avg": Object { - "field": "transaction.duration.us", - }, - }, - "p95": Object { - "percentiles": Object { - "field": "transaction.duration.us", - "hdr": Object { - "number_of_significant_value_digits": 2, - }, - "percents": Array [ - 95, - ], - }, - }, - "sample": Object { - "top_hits": Object { - "size": 1, - "sort": Array [ - Object { - "_score": "desc", - }, - Object { - "@timestamp": Object { - "order": "desc", - }, - }, - ], - }, - }, - "sum": Object { - "sum": Object { - "field": "transaction.duration.us", - }, - }, - }, - "composite": Object { - "size": 101, - "sources": Array [ - Object { - "transaction": Object { - "terms": Object { - "field": "transaction.name", - }, - }, - }, - ], - }, - }, - "transactions": Object { - "terms": Object { - "field": "transaction.name", - }, - }, - }, - "query": Object { - "bool": Object { - "filter": Array [ - Object { - "range": Object { - "@timestamp": Object { - "format": "epoch_millis", - "gte": 1528113600000, - "lte": 1528977600000, - }, - }, - }, - Object { - "term": Object { - "processor.event": "transaction", - }, - }, - Object { - "term": Object { - "transaction.type": "request", - }, - }, - Object { - "term": Object { - "service.name": "opbeans-node", - }, - }, - Object { - "term": Object { - "service.environment": "test", - }, - }, - ], - "should": Array [ - Object { - "term": Object { - "transaction.sampled": true, - }, - }, - ], - }, - }, - "size": 0, - }, - "index": "myIndex", - }, - ], -] -`; diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap index 884a7d18cc4d4..deca46f4ebd0c 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap +++ b/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap @@ -1,220 +1,479 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`transaction group queries fetches top traces 1`] = ` -Object { - "body": Object { - "aggs": Object { - "transaction_groups": Object { - "aggs": Object { - "avg": Object { - "avg": Object { - "field": "transaction.duration.us", - }, - }, - "p95": Object { - "percentiles": Object { - "field": "transaction.duration.us", - "hdr": Object { - "number_of_significant_value_digits": 2, +Array [ + Object { + "body": Object { + "aggs": Object { + "transaction_groups": Object { + "aggs": Object { + "sample": Object { + "top_hits": Object { + "size": 1, }, - "percents": Array [ - 95, - ], }, }, - "sample": Object { - "top_hits": Object { - "size": 1, - "sort": Array [ - Object { - "_score": "desc", + "composite": Object { + "size": 10000, + "sources": Array [ + Object { + "service.name": Object { + "terms": Object { + "field": "service.name", + }, }, - Object { - "@timestamp": Object { - "order": "desc", + }, + Object { + "transaction.name": Object { + "terms": Object { + "field": "transaction.name", }, }, - ], + }, + ], + }, + }, + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "range": Object { + "@timestamp": Object { + "format": "epoch_millis", + "gte": 1528113600000, + "lte": 1528977600000, + }, + }, + }, + Object { + "term": Object { + "processor.event": "transaction", + }, + }, + Object { + "term": Object { + "my.custom.ui.filter": "foo-bar", + }, + }, + ], + "must_not": Array [ + Object { + "exists": Object { + "field": "parent.id", + }, + }, + ], + "should": Array [ + Object { + "term": Object { + "transaction.sampled": true, + }, }, + ], + }, + }, + "sort": Array [ + Object { + "_score": "desc", + }, + Object { + "@timestamp": Object { + "order": "desc", }, - "sum": Object { - "sum": Object { - "field": "transaction.duration.us", + }, + ], + }, + "index": "myIndex", + "size": 0, + }, + Object { + "body": Object { + "aggs": Object { + "transaction_groups": Object { + "aggs": Object { + "avg": Object { + "avg": Object { + "field": "transaction.duration.us", + }, }, }, + "composite": Object { + "size": 10000, + "sources": Array [ + Object { + "service.name": Object { + "terms": Object { + "field": "service.name", + }, + }, + }, + Object { + "transaction.name": Object { + "terms": Object { + "field": "transaction.name", + }, + }, + }, + ], + }, }, - "composite": Object { - "size": 10000, - "sources": Array [ + }, + "query": Object { + "bool": Object { + "filter": Array [ Object { - "service": Object { - "terms": Object { - "field": "service.name", + "range": Object { + "@timestamp": Object { + "format": "epoch_millis", + "gte": 1528113600000, + "lte": 1528977600000, }, }, }, Object { - "transaction": Object { - "terms": Object { - "field": "transaction.name", - }, + "term": Object { + "processor.event": "transaction", + }, + }, + Object { + "term": Object { + "my.custom.ui.filter": "foo-bar", + }, + }, + ], + "must_not": Array [ + Object { + "exists": Object { + "field": "parent.id", }, }, ], }, }, }, - "query": Object { - "bool": Object { - "filter": Array [ - Object { - "range": Object { - "@timestamp": Object { - "format": "epoch_millis", - "gte": 1528113600000, - "lte": 1528977600000, + "index": "myIndex", + "size": 0, + }, + Object { + "body": Object { + "aggs": Object { + "transaction_groups": Object { + "aggs": Object { + "sum": Object { + "sum": Object { + "field": "transaction.duration.us", }, }, }, - Object { - "term": Object { - "processor.event": "transaction", - }, + "composite": Object { + "size": 10000, + "sources": Array [ + Object { + "service.name": Object { + "terms": Object { + "field": "service.name", + }, + }, + }, + Object { + "transaction.name": Object { + "terms": Object { + "field": "transaction.name", + }, + }, + }, + ], }, - Object { - "term": Object { - "my.custom.ui.filter": "foo-bar", + }, + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "range": Object { + "@timestamp": Object { + "format": "epoch_millis", + "gte": 1528113600000, + "lte": 1528977600000, + }, + }, }, - }, - ], - "must_not": Array [ - Object { - "exists": Object { - "field": "parent.id", + Object { + "term": Object { + "processor.event": "transaction", + }, }, - }, - ], - "should": Array [ - Object { - "term": Object { - "transaction.sampled": true, + Object { + "term": Object { + "my.custom.ui.filter": "foo-bar", + }, }, - }, - ], + ], + "must_not": Array [ + Object { + "exists": Object { + "field": "parent.id", + }, + }, + ], + }, }, }, + "index": "myIndex", "size": 0, }, - "index": "myIndex", -} +] `; exports[`transaction group queries fetches top transactions 1`] = ` -Object { - "body": Object { - "aggs": Object { - "transaction_groups": Object { - "aggs": Object { - "avg": Object { - "avg": Object { - "field": "transaction.duration.us", - }, - }, - "p95": Object { - "percentiles": Object { - "field": "transaction.duration.us", - "hdr": Object { - "number_of_significant_value_digits": 2, +Array [ + Object { + "body": Object { + "aggs": Object { + "transaction_groups": Object { + "aggs": Object { + "sample": Object { + "top_hits": Object { + "size": 1, }, - "percents": Array [ - 95, - ], }, }, - "sample": Object { - "top_hits": Object { - "size": 1, - "sort": Array [ - Object { - "_score": "desc", - }, - Object { - "@timestamp": Object { - "order": "desc", - }, + "terms": Object { + "field": "transaction.name", + "size": 101, + }, + }, + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "range": Object { + "@timestamp": Object { + "format": "epoch_millis", + "gte": 1528113600000, + "lte": 1528977600000, }, - ], + }, }, + Object { + "term": Object { + "processor.event": "transaction", + }, + }, + Object { + "term": Object { + "transaction.type": "bar", + }, + }, + Object { + "term": Object { + "service.name": "foo", + }, + }, + Object { + "term": Object { + "my.custom.ui.filter": "foo-bar", + }, + }, + ], + "should": Array [ + Object { + "term": Object { + "transaction.sampled": true, + }, + }, + ], + }, + }, + "sort": Array [ + Object { + "_score": "desc", + }, + Object { + "@timestamp": Object { + "order": "desc", }, - "sum": Object { - "sum": Object { - "field": "transaction.duration.us", + }, + ], + }, + "index": "myIndex", + "size": 0, + }, + Object { + "body": Object { + "aggs": Object { + "transaction_groups": Object { + "aggs": Object { + "avg": Object { + "avg": Object { + "field": "transaction.duration.us", + }, }, }, + "terms": Object { + "field": "transaction.name", + "size": 101, + }, }, - "composite": Object { - "size": 101, - "sources": Array [ + }, + "query": Object { + "bool": Object { + "filter": Array [ Object { - "transaction": Object { - "terms": Object { - "field": "transaction.name", + "range": Object { + "@timestamp": Object { + "format": "epoch_millis", + "gte": 1528113600000, + "lte": 1528977600000, }, }, }, + Object { + "term": Object { + "processor.event": "transaction", + }, + }, + Object { + "term": Object { + "transaction.type": "bar", + }, + }, + Object { + "term": Object { + "service.name": "foo", + }, + }, + Object { + "term": Object { + "my.custom.ui.filter": "foo-bar", + }, + }, ], }, }, - "transactions": Object { - "terms": Object { - "field": "transaction.name", + }, + "index": "myIndex", + "size": 0, + }, + Object { + "body": Object { + "aggs": Object { + "transaction_groups": Object { + "aggs": Object { + "sum": Object { + "sum": Object { + "field": "transaction.duration.us", + }, + }, + }, + "terms": Object { + "field": "transaction.name", + "size": 101, + }, + }, + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "range": Object { + "@timestamp": Object { + "format": "epoch_millis", + "gte": 1528113600000, + "lte": 1528977600000, + }, + }, + }, + Object { + "term": Object { + "processor.event": "transaction", + }, + }, + Object { + "term": Object { + "transaction.type": "bar", + }, + }, + Object { + "term": Object { + "service.name": "foo", + }, + }, + Object { + "term": Object { + "my.custom.ui.filter": "foo-bar", + }, + }, + ], }, }, }, - "query": Object { - "bool": Object { - "filter": Array [ - Object { - "range": Object { - "@timestamp": Object { - "format": "epoch_millis", - "gte": 1528113600000, - "lte": 1528977600000, + "index": "myIndex", + "size": 0, + }, + Object { + "body": Object { + "aggs": Object { + "transaction_groups": Object { + "aggs": Object { + "p95": Object { + "percentiles": Object { + "field": "transaction.duration.us", + "hdr": Object { + "number_of_significant_value_digits": 2, + }, + "percents": Array [ + 95, + ], }, }, }, - Object { - "term": Object { - "processor.event": "transaction", - }, + "terms": Object { + "field": "transaction.name", + "size": 101, }, - Object { - "term": Object { - "transaction.type": "bar", + }, + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "range": Object { + "@timestamp": Object { + "format": "epoch_millis", + "gte": 1528113600000, + "lte": 1528977600000, + }, + }, }, - }, - Object { - "term": Object { - "service.name": "foo", + Object { + "term": Object { + "processor.event": "transaction", + }, }, - }, - Object { - "term": Object { - "my.custom.ui.filter": "foo-bar", + Object { + "term": Object { + "transaction.type": "bar", + }, }, - }, - ], - "should": Array [ - Object { - "term": Object { - "transaction.sampled": true, + Object { + "term": Object { + "service.name": "foo", + }, }, - }, - ], + Object { + "term": Object { + "my.custom.ui.filter": "foo-bar", + }, + }, + ], + }, }, }, + "index": "myIndex", "size": 0, }, - "index": "myIndex", -} +] `; diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/transform.test.ts.snap b/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/transform.test.ts.snap deleted file mode 100644 index 66b805ab2efc1..0000000000000 --- a/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/transform.test.ts.snap +++ /dev/null @@ -1,2822 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`transactionGroupsTransformer should match snapshot 1`] = ` -Array [ - Object { - "averageResponseTime": 48021.972616494, - "impact": 100, - "name": "GET /api", - "p95": 67138.18364917398, - "sample": Object { - "@timestamp": "2018-11-18T20:53:44.070Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 5176, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3756, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "accept": "*/*", - "accept-encoding": "gzip, deflate", - "connection": "keep-alive", - "elastic-apm-traceparent": "00-86c68779d8a65b06fb78e770ffc436a5-4aaea53dc1791183-01", - "host": "opbeans-node:3000", - "user-agent": "python-requests/2.20.0", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.6", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/types/3", - "hostname": "opbeans-node", - "pathname": "/api/types/3", - "port": "3000", - "protocol": "http:", - "raw": "/api/types/3", - }, - }, - "response": Object { - "headers": Object { - "connection": "close", - "content-type": "application/json;charset=UTF-8", - "date": "Sun, 18 Nov 2018 20:53:43 GMT", - "transfer-encoding": "chunked", - "x-powered-by": "Express", - }, - "status_code": 404, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "parent": Object { - "id": "4aaea53dc1791183", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574424070007, - }, - "trace": Object { - "id": "86c68779d8a65b06fb78e770ffc436a5", - }, - "transaction": Object { - "duration": Object { - "us": 8684, - }, - "id": "a78bca581dcd8ff8", - "name": "GET /api", - "result": "HTTP 4xx", - "sampled": true, - "span_count": Object { - "started": 1, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 691926.3157894736, - }, - Object { - "averageResponseTime": 2651.8784461553205, - "impact": 15.770246496477105, - "name": "GET static file", - "p95": 6140.579335038363, - "sample": Object { - "@timestamp": "2018-11-18T20:53:43.304Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3756, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "accept": "*/*", - "host": "opbeans-node:3000", - "user-agent": "curl/7.38.0", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/", - "hostname": "opbeans-node", - "pathname": "/", - "port": "3000", - "protocol": "http:", - "raw": "/", - }, - }, - "response": Object { - "headers": Object { - "accept-ranges": "bytes", - "cache-control": "public, max-age=0", - "connection": "keep-alive", - "content-length": "640", - "content-type": "text/html; charset=UTF-8", - "date": "Sun, 18 Nov 2018 20:53:43 GMT", - "etag": "W/\\"280-1670775e878\\"", - "last-modified": "Mon, 12 Nov 2018 10:27:07 GMT", - "x-powered-by": "Express", - }, - "status_code": 200, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574423304006, - }, - "trace": Object { - "id": "b303d2a4a007946b63b9db7fafe639a0", - }, - "transaction": Object { - "duration": Object { - "us": 1801, - }, - "id": "2869c13633534be5", - "name": "GET static file", - "result": "HTTP 2xx", - "sampled": true, - "span_count": Object { - "started": 0, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 1977031.5789473683, - }, - Object { - "averageResponseTime": 32554.36257814184, - "impact": 14.344171563678346, - "name": "GET /api/stats", - "p95": 59356.73611111111, - "sample": Object { - "@timestamp": "2018-11-18T20:53:42.560Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 207, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3756, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "accept": "*/*", - "accept-encoding": "gzip, deflate", - "connection": "keep-alive", - "elastic-apm-traceparent": "00-63ccc3b0929dafb7f2fbcabdc7f7af25-821a787e73ab1563-01", - "host": "opbeans-node:3000", - "if-none-match": "W/\\"77-uxKJrX5GSMJJWTKh3orUFAEVxSs\\"", - "referer": "http://opbeans-node:3000/dashboard", - "user-agent": "Chromeless 1.4.0", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.7", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/stats", - "hostname": "opbeans-node", - "pathname": "/api/stats", - "port": "3000", - "protocol": "http:", - "raw": "/api/stats", - }, - }, - "response": Object { - "headers": Object { - "connection": "keep-alive", - "date": "Sun, 18 Nov 2018 20:53:42 GMT", - "etag": "W/\\"77-uxKJrX5GSMJJWTKh3orUFAEVxSs\\"", - "x-powered-by": "Express", - }, - "status_code": 304, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "parent": Object { - "id": "821a787e73ab1563", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574422560002, - }, - "trace": Object { - "id": "63ccc3b0929dafb7f2fbcabdc7f7af25", - }, - "transaction": Object { - "duration": Object { - "us": 28753, - }, - "id": "fb754e7628da2fb5", - "name": "GET /api/stats", - "result": "HTTP 3xx", - "sampled": true, - "span_count": Object { - "started": 7, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 146494.73684210525, - }, - Object { - "averageResponseTime": 32159.926322043968, - "impact": 10.27904952170656, - "name": "GET /api/customers", - "p95": 59845.85714285714, - "sample": Object { - "@timestamp": "2018-11-18T20:53:21.180Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 2531, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3710, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "accept": "*/*", - "accept-encoding": "gzip, deflate", - "connection": "keep-alive", - "elastic-apm-traceparent": "00-541025da8ecc2f51f21c1a4ad6992b77-ca18d9d4c3879519-01", - "host": "opbeans-node:3000", - "user-agent": "python-requests/2.20.0", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.6", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/customers", - "hostname": "opbeans-node", - "pathname": "/api/customers", - "port": "3000", - "protocol": "http:", - "raw": "/api/customers", - }, - }, - "response": Object { - "headers": Object { - "connection": "keep-alive", - "content-length": "186769", - "content-type": "application/json; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:53:21 GMT", - "etag": "W/\\"2d991-yG3J8W/roH7fSxXTudZrO27Ax9s\\"", - "x-powered-by": "Express", - }, - "status_code": 200, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "parent": Object { - "id": "ca18d9d4c3879519", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574401180002, - }, - "trace": Object { - "id": "541025da8ecc2f51f21c1a4ad6992b77", - }, - "transaction": Object { - "duration": Object { - "us": 18077, - }, - "id": "94852b9dd1075982", - "name": "GET /api/customers", - "result": "HTTP 2xx", - "sampled": true, - "span_count": Object { - "started": 2, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 106294.73684210525, - }, - Object { - "averageResponseTime": 33265.03326147213, - "impact": 10.256357027376065, - "name": "GET /api/orders", - "p95": 58827.489999999976, - "sample": Object { - "@timestamp": "2018-11-18T20:53:40.973Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 408, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3756, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "connection": "close", - "host": "opbeans-node:3000", - "user-agent": "workload/2.4.3", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/orders", - "hostname": "opbeans-node", - "pathname": "/api/orders", - "port": "3000", - "protocol": "http:", - "raw": "/api/orders", - }, - }, - "response": Object { - "headers": Object { - "connection": "close", - "content-length": "103612", - "content-type": "application/json; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:53:40 GMT", - "etag": "W/\\"194bc-cOw6+iRf7XCeqMXHrle3IOig7tY\\"", - "x-powered-by": "Express", - }, - "status_code": 200, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574420973006, - }, - "trace": Object { - "id": "0afce85f593cbbdd09949936fe964f0f", - }, - "transaction": Object { - "duration": Object { - "us": 23040, - }, - "id": "89f200353eb50539", - "name": "GET /api/orders", - "result": "HTTP 2xx", - "sampled": true, - "span_count": Object { - "started": 2, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 102536.84210526315, - }, - Object { - "averageResponseTime": 27516.89144558744, - "impact": 9.651458992731666, - "name": "GET /api/products/top", - "p95": 56064.679999999986, - "sample": Object { - "@timestamp": "2018-11-18T20:52:57.316Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 5113, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3686, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "accept": "*/*", - "accept-encoding": "gzip, deflate", - "connection": "keep-alive", - "elastic-apm-traceparent": "00-74f12e705936d66350f4741ebeb55189-fcebe94cd2136215-01", - "host": "opbeans-node:3000", - "referer": "http://opbeans-node:3000/dashboard", - "user-agent": "Chromeless 1.4.0", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.7", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/products/top", - "hostname": "opbeans-node", - "pathname": "/api/products/top", - "port": "3000", - "protocol": "http:", - "raw": "/api/products/top", - }, - }, - "response": Object { - "headers": Object { - "connection": "keep-alive", - "content-length": "282", - "content-type": "application/json; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:52:57 GMT", - "etag": "W/\\"11a-lcI9zuMZYYsDRpEZgYqDYr96cKM\\"", - "x-powered-by": "Express", - }, - "status_code": 200, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "parent": Object { - "id": "fcebe94cd2136215", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574377316005, - }, - "trace": Object { - "id": "74f12e705936d66350f4741ebeb55189", - }, - "transaction": Object { - "duration": Object { - "us": 48781, - }, - "id": "be4bd5475d5d9e6f", - "name": "GET /api/products/top", - "result": "HTTP 2xx", - "sampled": true, - "span_count": Object { - "started": 4, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 116652.63157894736, - }, - Object { - "averageResponseTime": 12683.190864600327, - "impact": 4.4239778504968, - "name": "GET /api/products", - "p95": 35009.67999999999, - "sample": Object { - "@timestamp": "2018-11-18T20:53:43.477Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 2857, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3756, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "connection": "close", - "host": "opbeans-node:3000", - "user-agent": "workload/2.4.3", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/products", - "hostname": "opbeans-node", - "pathname": "/api/products", - "port": "3000", - "protocol": "http:", - "raw": "/api/products", - }, - }, - "response": Object { - "headers": Object { - "connection": "close", - "content-length": "1023", - "content-type": "application/json; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:53:43 GMT", - "etag": "W/\\"3ff-VyOxcDApb+a/lnjkm9FeTOGSDrs\\"", - "x-powered-by": "Express", - }, - "status_code": 200, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574423477006, - }, - "trace": Object { - "id": "bee00a8efb523ca4b72adad57f7caba3", - }, - "transaction": Object { - "duration": Object { - "us": 6915, - }, - "id": "d8fc6d3b8707b64c", - "name": "GET /api/products", - "result": "HTTP 2xx", - "sampled": true, - "span_count": Object { - "started": 2, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 116147.36842105263, - }, - Object { - "averageResponseTime": 255966.30555555556, - "impact": 4.3693406535517445, - "name": "POST /api/orders", - "p95": 320238.5, - "sample": Object { - "@timestamp": "2018-11-18T20:43:32.010Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 4669, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 2413, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "body": "[REDACTED]", - "headers": Object { - "accept": "application/json", - "connection": "close", - "content-length": "129", - "content-type": "application/json", - "host": "opbeans-node:3000", - "user-agent": "workload/2.4.3", - }, - "http_version": "1.1", - "method": "POST", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/orders", - "hostname": "opbeans-node", - "pathname": "/api/orders", - "port": "3000", - "protocol": "http:", - "raw": "/api/orders", - }, - }, - "response": Object { - "headers": Object { - "connection": "close", - "content-length": "13", - "content-type": "application/json; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:43:32 GMT", - "etag": "W/\\"d-g9K2iK4ordyN88lGL4LmPlYNfhc\\"", - "x-powered-by": "Express", - }, - "status_code": 200, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542573812010006, - }, - "trace": Object { - "id": "2b1252a338249daeecf6afb0c236e31b", - }, - "transaction": Object { - "duration": Object { - "us": 291572, - }, - "id": "2c9f39e9ec4a0111", - "name": "POST /api/orders", - "result": "HTTP 2xx", - "sampled": true, - "span_count": Object { - "started": 16, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 5684.210526315789, - }, - Object { - "averageResponseTime": 17189.329210275926, - "impact": 3.424381787142002, - "name": "GET /api/products/:id/customers", - "p95": 39284.79999999999, - "sample": Object { - "@timestamp": "2018-11-18T20:48:24.769Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 1735, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3100, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "accept": "*/*", - "accept-encoding": "gzip, deflate", - "connection": "keep-alive", - "elastic-apm-traceparent": "00-28f178c354d17f400dea04bc4a7b3c57-68f5d1607cac7779-01", - "host": "opbeans-node:3000", - "user-agent": "python-requests/2.20.0", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.6", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/products/2/customers", - "hostname": "opbeans-node", - "pathname": "/api/products/2/customers", - "port": "3000", - "protocol": "http:", - "raw": "/api/products/2/customers", - }, - }, - "response": Object { - "headers": Object { - "connection": "keep-alive", - "content-length": "186570", - "content-type": "application/json; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:48:24 GMT", - "etag": "W/\\"2d8ca-Z9NzuHyGyxwtzpOkcIxBvzm24iw\\"", - "x-powered-by": "Express", - }, - "status_code": 200, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "parent": Object { - "id": "68f5d1607cac7779", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574104769029, - }, - "trace": Object { - "id": "28f178c354d17f400dea04bc4a7b3c57", - }, - "transaction": Object { - "duration": Object { - "us": 49338, - }, - "id": "2a87ae20ad04ee0c", - "name": "GET /api/products/:id/customers", - "result": "HTTP 2xx", - "sampled": true, - "span_count": Object { - "started": 1, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 66378.94736842105, - }, - Object { - "averageResponseTime": 11257.757916666667, - "impact": 2.558180605569336, - "name": "GET /api/types", - "p95": 35222.944444444445, - "sample": Object { - "@timestamp": "2018-11-18T20:53:44.978Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 2193, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3756, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "connection": "close", - "host": "opbeans-node:3000", - "user-agent": "workload/2.4.3", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/types", - "hostname": "opbeans-node", - "pathname": "/api/types", - "port": "3000", - "protocol": "http:", - "raw": "/api/types", - }, - }, - "response": Object { - "headers": Object { - "connection": "close", - "content-length": "112", - "content-type": "application/json; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:53:44 GMT", - "etag": "W/\\"70-1z6hT7P1WHgBgS/BeUEVeHhOCQU\\"", - "x-powered-by": "Express", - }, - "status_code": 200, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574424978005, - }, - "trace": Object { - "id": "0d84126973411c19b470f2d9eea958d3", - }, - "transaction": Object { - "duration": Object { - "us": 7891, - }, - "id": "0f10668e4fb3adc7", - "name": "GET /api/types", - "result": "HTTP 2xx", - "sampled": true, - "span_count": Object { - "started": 2, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 75789.47368421052, - }, - Object { - "averageResponseTime": 3504.5108924806746, - "impact": 2.3600993453143766, - "name": "GET *", - "p95": 11431.738095238095, - "sample": Object { - "@timestamp": "2018-11-18T20:53:42.493Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 6446, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3756, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "accept-encoding": "gzip, deflate", - "connection": "keep-alive", - "host": "opbeans-node:3000", - "if-modified-since": "Mon, 12 Nov 2018 10:27:07 GMT", - "if-none-match": "W/\\"280-1670775e878\\"", - "upgrade-insecure-requests": "1", - "user-agent": "Chromeless 1.4.0", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.7", - }, - "url": Object { - "full": "http://opbeans-node:3000/dashboard", - "hostname": "opbeans-node", - "pathname": "/dashboard", - "port": "3000", - "protocol": "http:", - "raw": "/dashboard", - }, - }, - "response": Object { - "headers": Object { - "accept-ranges": "bytes", - "cache-control": "public, max-age=0", - "connection": "keep-alive", - "date": "Sun, 18 Nov 2018 20:53:42 GMT", - "etag": "W/\\"280-1670775e878\\"", - "last-modified": "Mon, 12 Nov 2018 10:27:07 GMT", - "x-powered-by": "Express", - }, - "status_code": 304, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574422493006, - }, - "trace": Object { - "id": "7efb6ade88cdea20cd96ca482681cde7", - }, - "transaction": Object { - "duration": Object { - "us": 1901, - }, - "id": "f5fc4621949b63fb", - "name": "GET *", - "result": "HTTP 3xx", - "sampled": true, - "span_count": Object { - "started": 0, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 224684.21052631576, - }, - Object { - "averageResponseTime": 32387.73641304348, - "impact": 2.2558112380477584, - "name": "GET /log-error", - "p95": 40061.1, - "sample": Object { - "@timestamp": "2018-11-18T20:52:51.462Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 4877, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3659, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "connection": "close", - "host": "opbeans-node:3000", - "user-agent": "workload/2.4.3", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/log-error", - "hostname": "opbeans-node", - "pathname": "/log-error", - "port": "3000", - "protocol": "http:", - "raw": "/log-error", - }, - }, - "response": Object { - "headers": Object { - "connection": "close", - "content-length": "24", - "content-type": "text/html; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:52:51 GMT", - "etag": "W/\\"18-MS3VbhH7auHMzO0fUuNF6v14N/M\\"", - "x-powered-by": "Express", - }, - "status_code": 500, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574371462005, - }, - "trace": Object { - "id": "15366d65659b5fc8f67ff127391b3aff", - }, - "transaction": Object { - "duration": Object { - "us": 33367, - }, - "id": "ec9c465c5042ded8", - "name": "GET /log-error", - "result": "HTTP 5xx", - "sampled": true, - "span_count": Object { - "started": 0, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 23242.105263157893, - }, - Object { - "averageResponseTime": 32900.72714285714, - "impact": 2.1791207411745854, - "name": "GET /log-message", - "p95": 40444, - "sample": Object { - "@timestamp": "2018-11-18T20:49:09.225Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 321, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3142, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "connection": "close", - "host": "opbeans-node:3000", - "user-agent": "workload/2.4.3", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/log-message", - "hostname": "opbeans-node", - "pathname": "/log-message", - "port": "3000", - "protocol": "http:", - "raw": "/log-message", - }, - }, - "response": Object { - "headers": Object { - "connection": "close", - "content-length": "24", - "content-type": "text/html; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:49:09 GMT", - "etag": "W/\\"18-MS3VbhH7auHMzO0fUuNF6v14N/M\\"", - "x-powered-by": "Express", - }, - "status_code": 500, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574149225004, - }, - "trace": Object { - "id": "ba18b741cdd3ac83eca89a5fede47577", - }, - "transaction": Object { - "duration": Object { - "us": 32381, - }, - "id": "b9a8f96d7554d09f", - "name": "GET /log-message", - "result": "HTTP 5xx", - "sampled": true, - "span_count": Object { - "started": 0, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 22105.263157894737, - }, - Object { - "averageResponseTime": 10548.218597063622, - "impact": 1.8338763992340905, - "name": "GET /api/products/:id", - "p95": 28413.383333333328, - "sample": Object { - "@timestamp": "2018-11-18T20:52:57.963Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 7184, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3686, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "connection": "close", - "host": "opbeans-node:3000", - "user-agent": "workload/2.4.3", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/products/3", - "hostname": "opbeans-node", - "pathname": "/api/products/3", - "port": "3000", - "protocol": "http:", - "raw": "/api/products/3", - }, - }, - "response": Object { - "headers": Object { - "connection": "close", - "content-length": "231", - "content-type": "application/json; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:52:57 GMT", - "etag": "W/\\"e7-kkuzj37GZDzXDh0CWqh5Gan0VO4\\"", - "x-powered-by": "Express", - }, - "status_code": 200, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574377963005, - }, - "trace": Object { - "id": "ca86ec845e412e4b4506a715d51548ec", - }, - "transaction": Object { - "duration": Object { - "us": 6959, - }, - "id": "d324897ffb7ebcdc", - "name": "GET /api/products/:id", - "result": "HTTP 2xx", - "sampled": true, - "span_count": Object { - "started": 1, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 58073.68421052631, - }, - Object { - "averageResponseTime": 9868.217894736843, - "impact": 1.7722323960215767, - "name": "GET /api/customers/:id", - "p95": 27486.5, - "sample": Object { - "@timestamp": "2018-11-18T20:52:56.797Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 8225, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3686, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "accept": "*/*", - "accept-encoding": "gzip, deflate", - "connection": "keep-alive", - "elastic-apm-traceparent": "00-e6140d30363f18b585f5d3b753f4d025-aa82e2c847265626-01", - "host": "opbeans-node:3000", - "user-agent": "python-requests/2.20.0", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.6", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/customers/700", - "hostname": "opbeans-node", - "pathname": "/api/customers/700", - "port": "3000", - "protocol": "http:", - "raw": "/api/customers/700", - }, - }, - "response": Object { - "headers": Object { - "connection": "keep-alive", - "content-length": "193", - "content-type": "application/json; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:52:56 GMT", - "etag": "W/\\"c1-LbuhkuLzFyZ0H+7+JQGA5b0kvNs\\"", - "x-powered-by": "Express", - }, - "status_code": 200, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "parent": Object { - "id": "aa82e2c847265626", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574376797031, - }, - "trace": Object { - "id": "e6140d30363f18b585f5d3b753f4d025", - }, - "transaction": Object { - "duration": Object { - "us": 9735, - }, - "id": "60e230d12f3f0960", - "name": "GET /api/customers/:id", - "result": "HTTP 2xx", - "sampled": true, - "span_count": Object { - "started": 1, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 59999.99999999999, - }, - Object { - "averageResponseTime": 12763.68806073154, - "impact": 1.7479924334286208, - "name": "GET /api/types/:id", - "p95": 30576.749999999996, - "sample": Object { - "@timestamp": "2018-11-18T20:53:35.967Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 5345, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3756, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "connection": "close", - "host": "opbeans-node:3000", - "user-agent": "workload/2.4.3", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/types/1", - "hostname": "opbeans-node", - "pathname": "/api/types/1", - "port": "3000", - "protocol": "http:", - "raw": "/api/types/1", - }, - }, - "response": Object { - "headers": Object { - "connection": "close", - "content-length": "217", - "content-type": "application/json; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:53:35 GMT", - "etag": "W/\\"d9-cebOOHODBQMZd1wt+ZZBaSPgQLQ\\"", - "x-powered-by": "Express", - }, - "status_code": 200, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574415967005, - }, - "trace": Object { - "id": "2223b30b5cbaf2e221fcf70ac6d9abbe", - }, - "transaction": Object { - "duration": Object { - "us": 13064, - }, - "id": "053436abacdec0a4", - "name": "GET /api/types/:id", - "result": "HTTP 2xx", - "sampled": true, - "span_count": Object { - "started": 2, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 45757.8947368421, - }, - Object { - "averageResponseTime": 10584.05144193297, - "impact": 1.280810614916383, - "name": "GET /api/orders/:id", - "p95": 26555.399999999998, - "sample": Object { - "@timestamp": "2018-11-18T20:51:36.949Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 5999, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3475, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "connection": "close", - "host": "opbeans-node:3000", - "user-agent": "workload/2.4.3", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/orders/183", - "hostname": "opbeans-node", - "pathname": "/api/orders/183", - "port": "3000", - "protocol": "http:", - "raw": "/api/orders/183", - }, - }, - "response": Object { - "headers": Object { - "connection": "close", - "content-length": "0", - "date": "Sun, 18 Nov 2018 20:51:36 GMT", - "x-powered-by": "Express", - }, - "status_code": 404, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574296949004, - }, - "trace": Object { - "id": "dab6421fa44a6869887e0edf32e1ad6f", - }, - "transaction": Object { - "duration": Object { - "us": 5906, - }, - "id": "937ef5588454f74a", - "name": "GET /api/orders/:id", - "result": "HTTP 4xx", - "sampled": true, - "span_count": Object { - "started": 1, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 40515.789473684206, - }, - Object { - "averageResponseTime": 1422.926672899693, - "impact": 1.0027124806135428, - "name": "GET unknown route", - "p95": 2311.885238095238, - "sample": Object { - "@timestamp": "2018-11-18T20:53:42.504Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3756, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "accept": "*/*", - "accept-encoding": "gzip, deflate", - "connection": "keep-alive", - "host": "opbeans-node:3000", - "referer": "http://opbeans-node:3000/dashboard", - "user-agent": "Chromeless 1.4.0", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.7", - }, - "url": Object { - "full": "http://opbeans-node:3000/rum-config.js", - "hostname": "opbeans-node", - "pathname": "/rum-config.js", - "port": "3000", - "protocol": "http:", - "raw": "/rum-config.js", - }, - }, - "response": Object { - "headers": Object { - "connection": "keep-alive", - "content-length": "172", - "content-type": "text/javascript", - "date": "Sun, 18 Nov 2018 20:53:42 GMT", - "x-powered-by": "Express", - }, - "status_code": 200, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574422504004, - }, - "trace": Object { - "id": "4399e7233e6e7b77e70c2fff111b8f28", - }, - "transaction": Object { - "duration": Object { - "us": 911, - }, - "id": "107881ae2be1b56d", - "name": "GET unknown route", - "result": "HTTP 2xx", - "sampled": true, - "span_count": Object { - "started": 0, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 236431.5789473684, - }, - Object { - "averageResponseTime": 21331.714285714286, - "impact": 0.28817487960409877, - "name": "POST /api", - "p95": 30938, - "sample": Object { - "@timestamp": "2018-11-18T20:29:42.751Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 2927, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 546, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "body": "[REDACTED]", - "headers": Object { - "accept": "application/json", - "connection": "close", - "content-length": "129", - "content-type": "application/json", - "host": "opbeans-node:3000", - "user-agent": "workload/2.4.3", - }, - "http_version": "1.1", - "method": "POST", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/api/orders", - "hostname": "opbeans-node", - "pathname": "/api/orders", - "port": "3000", - "protocol": "http:", - "raw": "/api/orders", - }, - }, - "response": Object { - "headers": Object { - "connection": "close", - "content-length": "0", - "date": "Sun, 18 Nov 2018 20:29:42 GMT", - "x-powered-by": "Express", - }, - "status_code": 400, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542572982751005, - }, - "trace": Object { - "id": "8ed4d94ec8fc11b1ea1b0aa59c2320ff", - }, - "transaction": Object { - "duration": Object { - "us": 21083, - }, - "id": "d67c2f7aa897110c", - "name": "POST /api", - "result": "HTTP 4xx", - "sampled": true, - "span_count": Object { - "started": 1, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 4642.105263157894, - }, - Object { - "averageResponseTime": 4694.005586592179, - "impact": 0.1498515000753004, - "name": "GET /is-it-coffee-time", - "p95": 11022.99999999992, - "sample": Object { - "@timestamp": "2018-11-18T20:46:19.317Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 8593, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 2760, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "connection": "close", - "host": "opbeans-node:3000", - "user-agent": "workload/2.4.3", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/is-it-coffee-time", - "hostname": "opbeans-node", - "pathname": "/is-it-coffee-time", - "port": "3000", - "protocol": "http:", - "raw": "/is-it-coffee-time", - }, - }, - "response": Object { - "headers": Object { - "connection": "close", - "content-length": "148", - "content-security-policy": "default-src 'self'", - "content-type": "text/html; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:46:19 GMT", - "x-content-type-options": "nosniff", - "x-powered-by": "Express", - }, - "status_code": 500, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542573979317007, - }, - "trace": Object { - "id": "821812b416de4c73ced87f8777fa46a6", - }, - "transaction": Object { - "duration": Object { - "us": 4253, - }, - "id": "319a5c555a1ab207", - "name": "GET /is-it-coffee-time", - "result": "HTTP 5xx", - "sampled": true, - "span_count": Object { - "started": 0, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 11305.263157894737, - }, - Object { - "averageResponseTime": 4549.889880952381, - "impact": 0.13543365054509587, - "name": "GET /throw-error", - "p95": 7719.700000000001, - "sample": Object { - "@timestamp": "2018-11-18T20:47:10.714Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 7220, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 2895, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "connection": "close", - "host": "opbeans-node:3000", - "user-agent": "workload/2.4.3", - }, - "http_version": "1.1", - "method": "GET", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/throw-error", - "hostname": "opbeans-node", - "pathname": "/throw-error", - "port": "3000", - "protocol": "http:", - "raw": "/throw-error", - }, - }, - "response": Object { - "headers": Object { - "connection": "close", - "content-length": "148", - "content-security-policy": "default-src 'self'", - "content-type": "text/html; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:47:10 GMT", - "x-content-type-options": "nosniff", - "x-powered-by": "Express", - }, - "status_code": 500, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574030714012, - }, - "trace": Object { - "id": "6c0ef23e1f963f304ce440a909914d35", - }, - "transaction": Object { - "duration": Object { - "us": 4458, - }, - "id": "ecd187dc53f09fbd", - "name": "GET /throw-error", - "result": "HTTP 5xx", - "sampled": true, - "span_count": Object { - "started": 0, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 10610.526315789473, - }, - Object { - "averageResponseTime": 2742.4615384615386, - "impact": 0.08501028923348058, - "name": "OPTIONS unknown route", - "p95": 4370.000000000002, - "sample": Object { - "@timestamp": "2018-11-18T20:49:00.707Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 3775, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 3142, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "headers": Object { - "connection": "close", - "content-length": "0", - "host": "opbeans-node:3000", - "user-agent": "workload/2.4.3", - }, - "http_version": "1.1", - "method": "OPTIONS", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.10", - }, - "url": Object { - "full": "http://opbeans-node:3000/", - "hostname": "opbeans-node", - "pathname": "/", - "port": "3000", - "protocol": "http:", - "raw": "/", - }, - }, - "response": Object { - "headers": Object { - "allow": "GET,HEAD", - "connection": "close", - "content-length": "8", - "content-type": "text/html; charset=utf-8", - "date": "Sun, 18 Nov 2018 20:49:00 GMT", - "etag": "W/\\"8-ZRAf8oNBS3Bjb/SU2GYZCmbtmXg\\"", - "x-powered-by": "Express", - }, - "status_code": 200, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542574140707006, - }, - "trace": Object { - "id": "469e3e5f91ffe3195a8e58cdd1cdefa8", - }, - "transaction": Object { - "duration": Object { - "us": 2371, - }, - "id": "a8c87ebc7ec68bc0", - "name": "OPTIONS unknown route", - "result": "HTTP 2xx", - "sampled": true, - "span_count": Object { - "started": 0, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 11494.736842105262, - }, - Object { - "averageResponseTime": 5192.9, - "impact": 0, - "name": "POST unknown route", - "p95": 13230.5, - "sample": Object { - "@timestamp": "2018-11-18T18:43:50.994Z", - "agent": Object { - "hostname": "b359e3afece8", - "type": "apm-server", - "version": "7.0.0-alpha1", - }, - "context": Object { - "custom": Object { - "containerId": 6102, - }, - "process": Object { - "argv": Array [ - "/usr/local/bin/node", - "/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js", - ], - "pid": 19196, - "ppid": 1, - "title": "node /app/server.js", - }, - "request": Object { - "body": "[REDACTED]", - "headers": Object { - "accept": "*/*", - "accept-encoding": "gzip, deflate", - "content-length": "380", - "content-type": "multipart/form-data; boundary=2b2e40be188a4cb5a56c05a0c182f6c9", - "elastic-apm-traceparent": "00-19688959ea6cbccda8013c11566ea329-1fc3665eef2dcdfc-01", - "host": "172.18.0.9:3000", - "user-agent": "Python/3.7 aiohttp/3.3.2", - "x-forwarded-for": "172.18.0.11", - }, - "http_version": "1.1", - "method": "POST", - "socket": Object { - "encrypted": false, - "remote_address": "::ffff:172.18.0.9", - }, - "url": Object { - "full": "http://172.18.0.9:3000/api/orders/csv", - "hostname": "172.18.0.9", - "pathname": "/api/orders/csv", - "port": "3000", - "protocol": "http:", - "raw": "/api/orders/csv", - }, - }, - "response": Object { - "headers": Object { - "connection": "keep-alive", - "content-length": "154", - "content-security-policy": "default-src 'self'", - "content-type": "text/html; charset=utf-8", - "date": "Sun, 18 Nov 2018 18:43:50 GMT", - "x-content-type-options": "nosniff", - "x-powered-by": "Express", - }, - "status_code": 404, - }, - "service": Object { - "agent": Object { - "name": "nodejs", - "version": "1.14.2", - }, - "language": Object { - "name": "javascript", - }, - "name": "opbeans-node", - "runtime": Object { - "name": "node", - "version": "8.12.0", - }, - "version": "1.0.0", - }, - "system": Object { - "architecture": "x64", - "hostname": "98195610c255", - "ip": "172.18.0.10", - "platform": "linux", - }, - "tags": Object { - "foo": "bar", - "lorem": "ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus, ipsum id scelerisque consequat, enim leo vulputate massa, vel ultricies ante neque ac risus. Curabitur tincidunt vitae sapien id pulvinar. Mauris eu vestibulum tortor. Integer sit amet lorem fringilla, egestas tellus vitae, vulputate purus. Nulla feugiat blandit nunc et semper. Morbi purus libero, mattis sed mauris non, euismod iaculis lacus. Curabitur eleifend ante eros, non faucibus velit lacinia id. Duis posuere libero augue, at dignissim urna consectetur eget. Praesent eu congue est, iaculis finibus augue.", - "multi-line": "foo -bar -baz", - "this-is-a-very-long-tag-name-without-any-spaces": "test", - }, - "user": Object { - "email": "kimchy@elastic.co", - "id": "42", - "username": "kimchy", - }, - }, - "host": Object { - "name": "b359e3afece8", - }, - "parent": Object { - "id": "1fc3665eef2dcdfc", - }, - "processor": Object { - "event": "transaction", - "name": "transaction", - }, - "timestamp": Object { - "us": 1542566630994005, - }, - "trace": Object { - "id": "19688959ea6cbccda8013c11566ea329", - }, - "transaction": Object { - "duration": Object { - "us": 3467, - }, - "id": "92c3ceea57899061", - "name": "POST unknown route", - "result": "HTTP 4xx", - "sampled": true, - "span_count": Object { - "started": 0, - }, - "type": "request", - }, - }, - "transactionsPerMinute": 631.578947368421, - }, -] -`; diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.test.ts b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.test.ts deleted file mode 100644 index a26c3d85a3fc4..0000000000000 --- a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { transactionGroupsFetcher } from './fetcher'; -import { APMConfig } from '../..'; - -function getSetup() { - return { - start: 1528113600000, - end: 1528977600000, - client: { - search: jest.fn(), - } as any, - internalClient: { - search: jest.fn(), - } as any, - config: { - 'xpack.apm.ui.transactionGroupBucketSize': 100, - } as APMConfig, - uiFiltersES: [{ term: { 'service.environment': 'test' } }], - indices: { - 'apm_oss.sourcemapIndices': 'myIndex', - 'apm_oss.errorIndices': 'myIndex', - 'apm_oss.onboardingIndices': 'myIndex', - 'apm_oss.spanIndices': 'myIndex', - 'apm_oss.transactionIndices': 'myIndex', - 'apm_oss.metricsIndices': 'myIndex', - apmAgentConfigurationIndex: 'myIndex', - apmCustomLinkIndex: 'myIndex', - }, - dynamicIndexPattern: null as any, - }; -} - -describe('transactionGroupsFetcher', () => { - describe('type: top_traces', () => { - it('should call client.search with correct query', async () => { - const setup = getSetup(); - const bucketSize = 100; - await transactionGroupsFetcher({ type: 'top_traces' }, setup, bucketSize); - expect(setup.client.search.mock.calls).toMatchSnapshot(); - }); - }); - - describe('type: top_transactions', () => { - it('should call client.search with correct query', async () => { - const setup = getSetup(); - const bucketSize = 100; - await transactionGroupsFetcher( - { - type: 'top_transactions', - serviceName: 'opbeans-node', - transactionType: 'request', - }, - setup, - bucketSize - ); - expect(setup.client.search.mock.calls).toMatchSnapshot(); - }); - }); -}); diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts index a5cc74b18a7ef..73bf1d01924e7 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts @@ -3,23 +3,31 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ - +import { take, sortBy } from 'lodash'; +import { Unionize } from 'utility-types'; +import moment from 'moment'; +import { joinByKey } from '../../../common/utils/join_by_key'; +import { ESSearchRequest } from '../../../typings/elasticsearch'; import { SERVICE_NAME, - TRANSACTION_DURATION, - TRANSACTION_SAMPLED, TRANSACTION_NAME, } from '../../../common/elasticsearch_fieldnames'; import { getTransactionGroupsProjection } from '../../../common/projections/transaction_groups'; import { mergeProjection } from '../../../common/projections/util/merge_projection'; import { PromiseReturnType } from '../../../../observability/typings/common'; -import { SortOptions } from '../../../typings/elasticsearch/aggregations'; +import { AggregationOptionsByType } from '../../../typings/elasticsearch/aggregations'; import { Transaction } from '../../../typings/es_schemas/ui/transaction'; import { Setup, SetupTimeRange, SetupUIFilters, } from '../helpers/setup_request'; +import { + getSamples, + getAverages, + getSums, + getPercentiles, +} from './get_transaction_group_stats'; interface TopTransactionOptions { type: 'top_transactions'; @@ -36,68 +44,149 @@ interface TopTraceOptions { export type Options = TopTransactionOptions | TopTraceOptions; export type ESResponse = PromiseReturnType; + +export type TransactionGroupRequestBase = ESSearchRequest & { + body: { + aggs: { + transaction_groups: Unionize< + Pick + >; + }; + }; +}; + +export type TransactionGroupSetup = Setup & SetupTimeRange & SetupUIFilters; + +function getItemsWithRelativeImpact( + setup: TransactionGroupSetup, + items: Array<{ + sum?: number | null; + key: string | Record; + avg?: number | null; + count?: number | null; + p95?: number; + sample?: Transaction; + }> +) { + const values = items + .map(({ sum }) => sum) + .filter((value) => value !== null) as number[]; + + const max = Math.max(...values); + const min = Math.min(...values); + + const duration = moment.duration(setup.end - setup.start); + const minutes = duration.asMinutes(); + + const itemsWithRelativeImpact: TransactionGroup[] = items + .map((item) => { + return { + key: item.key, + averageResponseTime: item.avg, + transactionsPerMinute: (item.count ?? 0) / minutes, + impact: + item.sum !== null && item.sum !== undefined + ? ((item.sum - min) / (max - min)) * 100 || 0 + : 0, + p95: item.p95, + sample: item.sample!, + }; + }) + .filter((item) => item.sample); + + return itemsWithRelativeImpact; +} + export async function transactionGroupsFetcher( options: Options, - setup: Setup & SetupTimeRange & SetupUIFilters, + setup: TransactionGroupSetup, bucketSize: number ) { - const { client } = setup; - const projection = getTransactionGroupsProjection({ setup, options, }); - const sort: SortOptions = [ - { _score: 'desc' as const }, // sort by _score to ensure that buckets with sampled:true ends up on top - { '@timestamp': { order: 'desc' as const } }, - ]; - const isTopTraces = options.type === 'top_traces'; - if (isTopTraces) { - // Delete the projection aggregation when searching for traces, as it should use the combined aggregation instead - delete projection.body.aggs; - } + delete projection.body.aggs; + + // traces overview is hardcoded to 10000 + // transactions overview: 1 extra bucket is added to check whether the total number of buckets exceed the specified bucket size. + const expectedBucketSize = isTopTraces ? 10000 : bucketSize; + const size = isTopTraces ? 10000 : expectedBucketSize + 1; - const params = mergeProjection(projection, { + const request = mergeProjection(projection, { + size: 0, body: { - size: 0, - query: { - bool: { - // prefer sampled transactions - should: [{ term: { [TRANSACTION_SAMPLED]: true } }], - }, - }, aggs: { transaction_groups: { - composite: { - // traces overview is hardcoded to 10000 - // transactions overview: 1 extra bucket is added to check whether the total number of buckets exceed the specified bucket size. - size: isTopTraces ? 10000 : bucketSize + 1, - sources: [ - ...(isTopTraces - ? [{ service: { terms: { field: SERVICE_NAME } } }] - : []), - { transaction: { terms: { field: TRANSACTION_NAME } } }, - ], - }, - aggs: { - sample: { top_hits: { size: 1, sort } }, - avg: { avg: { field: TRANSACTION_DURATION } }, - p95: { - percentiles: { - field: TRANSACTION_DURATION, - percents: [95], - hdr: { number_of_significant_value_digits: 2 }, - }, - }, - sum: { sum: { field: TRANSACTION_DURATION } }, - }, + ...(isTopTraces + ? { + composite: { + sources: [ + { [SERVICE_NAME]: { terms: { field: SERVICE_NAME } } }, + { + [TRANSACTION_NAME]: { + terms: { field: TRANSACTION_NAME }, + }, + }, + ], + size, + }, + } + : { + terms: { + field: TRANSACTION_NAME, + size, + }, + }), }, }, }, }); - return client.search(params); + const params = { + request, + setup, + }; + + const [samples, averages, sums, percentiles] = await Promise.all([ + getSamples(params), + getAverages(params), + getSums(params), + !isTopTraces ? getPercentiles(params) : Promise.resolve(undefined), + ]); + + const stats = [ + ...samples, + ...averages, + ...sums, + ...(percentiles ? percentiles : []), + ]; + + const items = joinByKey(stats, 'key'); + + const itemsWithRelativeImpact = getItemsWithRelativeImpact(setup, items); + + return { + items: take( + // sort by impact by default so most impactful services are not cut off + sortBy(itemsWithRelativeImpact, 'impact').reverse(), + expectedBucketSize + ), + // The aggregation is considered accurate if the configured bucket size is larger or equal to the number of buckets returned + // the actual number of buckets retrieved are `bucketsize + 1` to detect whether it's above the limit + isAggregationAccurate: expectedBucketSize >= itemsWithRelativeImpact.length, + bucketSize, + }; +} + +export interface TransactionGroup { + key: Record | string; + averageResponseTime: number | null | undefined; + transactionsPerMinute: number; + p95: number | undefined; + impact: number; + sample: Transaction; } diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts b/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts new file mode 100644 index 0000000000000..59fb370113ec2 --- /dev/null +++ b/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts @@ -0,0 +1,144 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { merge } from 'lodash'; +import { arrayUnionToCallable } from '../../../common/utils/array_union_to_callable'; +import { Transaction } from '../../../typings/es_schemas/ui/transaction'; +import { + TRANSACTION_SAMPLED, + TRANSACTION_DURATION, +} from '../../../common/elasticsearch_fieldnames'; +import { + AggregationInputMap, + SortOptions, +} from '../../../typings/elasticsearch/aggregations'; +import { TransactionGroupRequestBase, TransactionGroupSetup } from './fetcher'; + +interface MetricParams { + request: TransactionGroupRequestBase; + setup: TransactionGroupSetup; +} + +type BucketKey = string | Record; + +function mergeRequestWithAggs< + TRequestBase extends TransactionGroupRequestBase, + TInputMap extends AggregationInputMap +>(request: TRequestBase, aggs: TInputMap) { + return merge({}, request, { + body: { + aggs: { + transaction_groups: { + aggs, + }, + }, + }, + }); +} + +export async function getSamples({ request, setup }: MetricParams) { + const params = mergeRequestWithAggs(request, { + sample: { + top_hits: { + size: 1, + }, + }, + }); + + const sort: SortOptions = [ + { _score: 'desc' as const }, // sort by _score to ensure that buckets with sampled:true ends up on top + { '@timestamp': { order: 'desc' as const } }, + ]; + + const response = await setup.client.search({ + ...params, + body: { + ...params.body, + query: { + ...params.body.query, + bool: { + ...params.body.query.bool, + should: [{ term: { [TRANSACTION_SAMPLED]: true } }], + }, + }, + sort, + }, + }); + + return arrayUnionToCallable( + response.aggregations?.transaction_groups.buckets ?? [] + ).map((bucket) => { + return { + key: bucket.key as BucketKey, + count: bucket.doc_count, + sample: bucket.sample.hits.hits[0]._source as Transaction, + }; + }); +} + +export async function getAverages({ request, setup }: MetricParams) { + const params = mergeRequestWithAggs(request, { + avg: { + avg: { + field: TRANSACTION_DURATION, + }, + }, + }); + + const response = await setup.client.search(params); + + return arrayUnionToCallable( + response.aggregations?.transaction_groups.buckets ?? [] + ).map((bucket) => { + return { + key: bucket.key as BucketKey, + avg: bucket.avg.value, + }; + }); +} + +export async function getSums({ request, setup }: MetricParams) { + const params = mergeRequestWithAggs(request, { + sum: { + sum: { + field: TRANSACTION_DURATION, + }, + }, + }); + + const response = await setup.client.search(params); + + return arrayUnionToCallable( + response.aggregations?.transaction_groups.buckets ?? [] + ).map((bucket) => { + return { + key: bucket.key as BucketKey, + sum: bucket.sum.value, + }; + }); +} + +export async function getPercentiles({ request, setup }: MetricParams) { + const params = mergeRequestWithAggs(request, { + p95: { + percentiles: { + field: TRANSACTION_DURATION, + hdr: { number_of_significant_value_digits: 2 }, + percents: [95], + }, + }, + }); + + const response = await setup.client.search(params); + + return arrayUnionToCallable( + response.aggregations?.transaction_groups.buckets ?? [] + ).map((bucket) => { + return { + key: bucket.key as BucketKey, + p95: Object.values(bucket.p95.values)[0], + }; + }); +} diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/index.ts b/x-pack/plugins/apm/server/lib/transaction_groups/index.ts index 893e586b351a8..6e0d619268d44 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/index.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/index.ts @@ -10,19 +10,11 @@ import { SetupUIFilters, } from '../helpers/setup_request'; import { transactionGroupsFetcher, Options } from './fetcher'; -import { transactionGroupsTransformer } from './transform'; export async function getTransactionGroupList( options: Options, setup: Setup & SetupTimeRange & SetupUIFilters ) { - const { start, end } = setup; const bucketSize = setup.config['xpack.apm.ui.transactionGroupBucketSize']; - const response = await transactionGroupsFetcher(options, setup, bucketSize); - return transactionGroupsTransformer({ - response, - start, - end, - bucketSize, - }); + return await transactionGroupsFetcher(options, setup, bucketSize); } diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts b/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts index 2c5aa79bb3483..0b2ff3a72975b 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts @@ -31,7 +31,9 @@ describe('transaction group queries', () => { ) ); - expect(mock.params).toMatchSnapshot(); + const allParams = mock.spy.mock.calls.map((call) => call[0]); + + expect(allParams).toMatchSnapshot(); }); it('fetches top traces', async () => { @@ -46,6 +48,8 @@ describe('transaction group queries', () => { ) ); - expect(mock.params).toMatchSnapshot(); + const allParams = mock.spy.mock.calls.map((call) => call[0]); + + expect(allParams).toMatchSnapshot(); }); }); diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/transform.test.ts b/x-pack/plugins/apm/server/lib/transaction_groups/transform.test.ts deleted file mode 100644 index 0bb29e27f0219..0000000000000 --- a/x-pack/plugins/apm/server/lib/transaction_groups/transform.test.ts +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { ESResponse } from './fetcher'; -import { transactionGroupsResponse } from './mock_responses/transaction_groups_response'; -import { transactionGroupsTransformer } from './transform'; - -describe('transactionGroupsTransformer', () => { - it('should match snapshot', () => { - const { - bucketSize, - isAggregationAccurate, - items, - } = transactionGroupsTransformer({ - response: transactionGroupsResponse, - start: 100, - end: 2000, - bucketSize: 100, - }); - - expect(bucketSize).toBe(100); - expect(isAggregationAccurate).toBe(true); - expect(items).toMatchSnapshot(); - }); - - it('should transform response correctly', () => { - const bucket = { - key: { transaction: 'POST /api/orders' }, - doc_count: 180, - avg: { value: 255966.30555555556 }, - p95: { values: { '95.0': 320238.5 } }, - sum: { value: 3000000000 }, - sample: { - hits: { - total: 180, - hits: [{ _source: 'sample source' }], - }, - }, - }; - - const response = ({ - aggregations: { - transaction_groups: { - buckets: [bucket], - }, - }, - } as unknown) as ESResponse; - - expect( - transactionGroupsTransformer({ - response, - start: 100, - end: 20000, - bucketSize: 100, - }) - ).toEqual({ - bucketSize: 100, - isAggregationAccurate: true, - items: [ - { - averageResponseTime: 255966.30555555556, - impact: 0, - name: 'POST /api/orders', - p95: 320238.5, - sample: 'sample source', - transactionsPerMinute: 542.713567839196, - }, - ], - }); - }); - - it('`isAggregationAccurate` should be false if number of bucket is higher than `bucketSize`', () => { - const bucket = { - key: { transaction: 'POST /api/orders' }, - doc_count: 180, - avg: { value: 255966.30555555556 }, - p95: { values: { '95.0': 320238.5 } }, - sum: { value: 3000000000 }, - sample: { - hits: { - total: 180, - hits: [{ _source: 'sample source' }], - }, - }, - }; - - const response = ({ - aggregations: { - transaction_groups: { - buckets: [bucket, bucket, bucket, bucket], // four buckets returned - }, - }, - } as unknown) as ESResponse; - - const { isAggregationAccurate } = transactionGroupsTransformer({ - response, - start: 100, - end: 20000, - bucketSize: 3, // bucket size of three - }); - - expect(isAggregationAccurate).toEqual(false); - }); - - it('should calculate impact from sum', () => { - const getBucket = (sum: number) => ({ - key: { transaction: 'POST /api/orders' }, - doc_count: 180, - avg: { value: 300000 }, - p95: { values: { '95.0': 320000 } }, - sum: { value: sum }, - sample: { hits: { total: 180, hits: [{ _source: 'sample source' }] } }, - }); - - const response = ({ - aggregations: { - transaction_groups: { - buckets: [getBucket(10), getBucket(20), getBucket(50)], - }, - }, - } as unknown) as ESResponse; - - const { items } = transactionGroupsTransformer({ - response, - start: 100, - end: 20000, - bucketSize: 100, - }); - - expect(items.map((bucket) => bucket.impact)).toEqual([100, 25, 0]); - }); -}); diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/transform.ts b/x-pack/plugins/apm/server/lib/transaction_groups/transform.ts deleted file mode 100644 index b04ff6764675d..0000000000000 --- a/x-pack/plugins/apm/server/lib/transaction_groups/transform.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import moment from 'moment'; -import { orderBy } from 'lodash'; -import { ESResponse } from './fetcher'; - -function calculateRelativeImpacts(items: ITransactionGroup[]) { - const values = items - .map(({ impact }) => impact) - .filter((value) => value !== null) as number[]; - - const max = Math.max(...values); - const min = Math.min(...values); - - return items.map((bucket) => ({ - ...bucket, - impact: - bucket.impact !== null - ? ((bucket.impact - min) / (max - min)) * 100 || 0 - : 0, - })); -} - -const getBuckets = (response: ESResponse) => { - if (response.aggregations) { - return orderBy( - response.aggregations.transaction_groups.buckets, - ['sum.value'], - ['desc'] - ); - } - return []; -}; - -export type ITransactionGroup = ReturnType; -function getTransactionGroup( - bucket: ReturnType[0], - minutes: number -) { - const averageResponseTime = bucket.avg.value; - const transactionsPerMinute = bucket.doc_count / minutes; - const impact = bucket.sum.value; - const sample = bucket.sample.hits.hits[0]._source; - - return { - name: bucket.key.transaction, - sample, - p95: bucket.p95.values['95.0'], - averageResponseTime, - transactionsPerMinute, - impact, - }; -} - -export function transactionGroupsTransformer({ - response, - start, - end, - bucketSize, -}: { - response: ESResponse; - start: number; - end: number; - bucketSize: number; -}): { - items: ITransactionGroup[]; - isAggregationAccurate: boolean; - bucketSize: number; -} { - const buckets = getBuckets(response); - const duration = moment.duration(end - start); - const minutes = duration.asMinutes(); - const items = buckets.map((bucket) => getTransactionGroup(bucket, minutes)); - - const itemsWithRelativeImpact = calculateRelativeImpacts(items); - - return { - items: itemsWithRelativeImpact, - - // The aggregation is considered accurate if the configured bucket size is larger or equal to the number of buckets returned - // the actual number of buckets retrieved are `bucketsize + 1` to detect whether it's above the limit - isAggregationAccurate: bucketSize >= buckets.length, - bucketSize, - }; -} diff --git a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts index 1cecf14f2eeb8..e892284fd87cd 100644 --- a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts +++ b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/get_local_filter_query.ts @@ -35,7 +35,7 @@ export const getLocalFilterQuery = ({ }, }, } - : {}; + : null; return mergeProjection(projection, { body: { diff --git a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts index 588d5c7896db9..3833b93c8d1f7 100644 --- a/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts +++ b/x-pack/plugins/apm/server/lib/ui_filters/local_ui_filters/index.ts @@ -43,6 +43,7 @@ export async function getLocalUIFilters({ const response = await client.search(query); const filter = localUIFilters[name]; + const buckets = response?.aggregations?.by_terms?.buckets ?? []; return { diff --git a/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts b/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts index ac7499c23e926..d25ec8709e3be 100644 --- a/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts +++ b/x-pack/plugins/apm/typings/elasticsearch/aggregations.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { Unionize } from 'utility-types'; +import { Unionize, UnionToIntersection } from 'utility-types'; type SortOrder = 'asc' | 'desc'; type SortInstruction = Record; @@ -288,10 +288,13 @@ interface AggregationResponsePart< } | undefined; composite: { - after_key: Record, number>; + after_key: Record< + GetCompositeKeys, + string | number + >; buckets: Array< { - key: Record, number>; + key: Record, string | number>; doc_count: number; } & BucketSubAggregationResponse< TAggregationOptionsMap['aggs'], @@ -337,6 +340,15 @@ interface AggregationResponsePart< // keyof AggregationResponsePart<{}, unknown> // >; +// ensures aggregations work with requests where aggregation options are a union type, +// e.g. { transaction_groups: { composite: any } | { terms: any } }. +// Union keys are not included in keyof. The type will fall back to keyof T if +// UnionToIntersection fails, which happens when there are conflicts between the union +// types, e.g. { foo: string; bar?: undefined } | { foo?: undefined; bar: string }; +export type ValidAggregationKeysOf< + T extends Record +> = keyof (UnionToIntersection extends never ? T : UnionToIntersection); + export type AggregationResponseMap< TAggregationInputMap extends AggregationInputMap | undefined, TDocument @@ -345,6 +357,6 @@ export type AggregationResponseMap< [TName in keyof TAggregationInputMap]: AggregationResponsePart< TAggregationInputMap[TName], TDocument - >[AggregationType & keyof TAggregationInputMap[TName]]; + >[AggregationType & ValidAggregationKeysOf]; } : undefined; diff --git a/x-pack/plugins/canvas/public/components/alignment_guide/alignment_guide.js b/x-pack/plugins/canvas/public/components/alignment_guide/alignment_guide.js deleted file mode 100644 index d5a76efaf3d49..0000000000000 --- a/x-pack/plugins/canvas/public/components/alignment_guide/alignment_guide.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import PropTypes from 'prop-types'; -import { matrixToCSS } from '../../lib/dom'; - -export const AlignmentGuide = ({ transformMatrix, width, height }) => { - const newStyle = { - width, - height, - marginLeft: -width / 2, - marginTop: -height / 2, - background: 'magenta', - position: 'absolute', - transform: matrixToCSS(transformMatrix), - }; - return ( -
- ); -}; - -AlignmentGuide.propTypes = { - transformMatrix: PropTypes.arrayOf(PropTypes.number).isRequired, - width: PropTypes.number.isRequired, - height: PropTypes.number.isRequired, -}; diff --git a/x-pack/plugins/canvas/public/components/alignment_guide/alignment_guide.scss b/x-pack/plugins/canvas/public/components/alignment_guide/alignment_guide.scss deleted file mode 100644 index 27f06b42df453..0000000000000 --- a/x-pack/plugins/canvas/public/components/alignment_guide/alignment_guide.scss +++ /dev/null @@ -1,4 +0,0 @@ -.canvasAlignmentGuide { - transform-origin: center center; /* the default, only for clarity */ - transform-style: preserve-3d; -} diff --git a/x-pack/plugins/canvas/public/components/alignment_guide/index.js b/x-pack/plugins/canvas/public/components/alignment_guide/index.js deleted file mode 100644 index 6793e0151759b..0000000000000 --- a/x-pack/plugins/canvas/public/components/alignment_guide/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { pure } from 'recompose'; -import { AlignmentGuide as Component } from './alignment_guide'; - -export const AlignmentGuide = pure(Component); diff --git a/x-pack/plugins/canvas/public/components/arg_add/arg_add.js b/x-pack/plugins/canvas/public/components/arg_add/arg_add.tsx similarity index 71% rename from x-pack/plugins/canvas/public/components/arg_add/arg_add.js rename to x-pack/plugins/canvas/public/components/arg_add/arg_add.tsx index 2d6d7d1046fdd..e85a2915a82b1 100644 --- a/x-pack/plugins/canvas/public/components/arg_add/arg_add.js +++ b/x-pack/plugins/canvas/public/components/arg_add/arg_add.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { FC, ReactEventHandler } from 'react'; import PropTypes from 'prop-types'; import { EuiDescriptionList, @@ -12,7 +12,13 @@ import { EuiDescriptionListDescription, } from '@elastic/eui'; -export const ArgAdd = ({ onValueAdd, displayName, help }) => { +interface Props { + displayName: string; + help: string; + onValueAdd?: ReactEventHandler; +} + +export const ArgAdd: FC = ({ onValueAdd = () => {}, displayName, help }) => { return ( -
-
-
- Manage workpad assets -
-
-
-
-
- -
- -
-
-
-
-
-
-
-
-
-

- Below are the image assets in this workpad. Any assets that are currently in use cannot be determined at this time. To reclaim space, delete assets. -

-
-
-
-
-
-
-
-
- Asset thumbnail -
-
-
-
-

- - airplane - -
- - - ( - 1 - kb) - - -

-
-
-
-
- - - -
-
- -
- -
-
-
-
- -
- -
-
-
-
- - - -
-
-
-
-
-
-
-
- Asset thumbnail -
-
-
-
-

- - marker - -
- - - ( - 1 - kb) - - -

-
-
-
-
- - - -
-
- -
- -
-
-
-
- -
- -
-
-
-
- - - -
-
-
-
-
-
-
-
-
-
- -
-
-
- 0% space used -
-
-
- -
-
-
-
, -
, -] -`; - exports[`Storyshots components/Assets/AssetManager two assets 1`] = ` Array [
{ - const newStyle = { - width, - height, - marginLeft: -width / 2, - marginTop: -height / 2, - position: 'absolute', - transform: matrixToCSS(transformMatrix), - }; - return
; -}; - -BorderConnection.propTypes = { - width: PropTypes.number.isRequired, - height: PropTypes.number.isRequired, - transformMatrix: PropTypes.arrayOf(PropTypes.number).isRequired, -}; diff --git a/x-pack/plugins/canvas/public/components/border_connection/border_connection.scss b/x-pack/plugins/canvas/public/components/border_connection/border_connection.scss deleted file mode 100644 index ba09edd1090db..0000000000000 --- a/x-pack/plugins/canvas/public/components/border_connection/border_connection.scss +++ /dev/null @@ -1,9 +0,0 @@ -.canvasBorder--connection { - position: absolute; - top: 0; - width: 100%; - height: 100%; - pointer-events: none; - border-top: 1px dashed $euiColorLightShade; - border-left: 1px dashed $euiColorLightShade; -} diff --git a/x-pack/plugins/canvas/public/components/border_connection/index.js b/x-pack/plugins/canvas/public/components/border_connection/index.js deleted file mode 100644 index b99ab923d52d4..0000000000000 --- a/x-pack/plugins/canvas/public/components/border_connection/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { pure } from 'recompose'; -import { BorderConnection as Component } from './border_connection'; - -export const BorderConnection = pure(Component); diff --git a/x-pack/plugins/canvas/public/components/border_resize_handle/border_resize_handle.scss b/x-pack/plugins/canvas/public/components/border_resize_handle/border_resize_handle.scss deleted file mode 100644 index 4913a599b07f7..0000000000000 --- a/x-pack/plugins/canvas/public/components/border_resize_handle/border_resize_handle.scss +++ /dev/null @@ -1,13 +0,0 @@ -.canvasBorderResizeHandle { - @include euiSlightShadow; - transform-origin: center center; /* the default, only for clarity */ - transform-style: preserve-3d; - display: block; - position: absolute; - height: 8px; - width: 8px; - margin-left: -4px; - margin-top: -4px; - background-color: $euiColorEmptyShade; - border: 1px solid $euiColorDarkShade; -} diff --git a/x-pack/plugins/canvas/public/components/border_resize_handle/index.js b/x-pack/plugins/canvas/public/components/border_resize_handle/index.js deleted file mode 100644 index c3fea05d60f7e..0000000000000 --- a/x-pack/plugins/canvas/public/components/border_resize_handle/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { pure } from 'recompose'; -import { BorderResizeHandle as Component } from './border_resize_handle'; - -export const BorderResizeHandle = pure(Component); diff --git a/x-pack/plugins/canvas/public/components/color_dot/color_dot.tsx b/x-pack/plugins/canvas/public/components/color_dot/color_dot.tsx index f6afd11d405ca..478b501dcd5ec 100644 --- a/x-pack/plugins/canvas/public/components/color_dot/color_dot.tsx +++ b/x-pack/plugins/canvas/public/components/color_dot/color_dot.tsx @@ -4,18 +4,18 @@ * you may not use this file except in compliance with the Elastic License. */ +import React, { FC, ReactNode } from 'react'; import PropTypes from 'prop-types'; -import React, { FunctionComponent, ReactNode } from 'react'; import tinycolor from 'tinycolor2'; -export interface Props { - /** Any valid CSS color. If not a valid CSS string, the dot will be transparent and checkered */ - value?: string; +interface Props { /** Nodes to display within the dot. Should fit within the constraints. */ children?: ReactNode; + /** Any valid CSS color. If not a valid CSS string, the dot will be transparent and checkered */ + value?: string; } -export const ColorDot: FunctionComponent = ({ value, children }) => { +export const ColorDot: FC = ({ value, children }) => { const tc = tinycolor(value); let style = {}; @@ -34,6 +34,6 @@ export const ColorDot: FunctionComponent = ({ value, children }) => { }; ColorDot.propTypes = { - value: PropTypes.string, children: PropTypes.node, + value: PropTypes.string, }; diff --git a/x-pack/plugins/canvas/public/components/color_dot/index.ts b/x-pack/plugins/canvas/public/components/color_dot/index.ts index aacfdf4e0cc74..72936f6133886 100644 --- a/x-pack/plugins/canvas/public/components/color_dot/index.ts +++ b/x-pack/plugins/canvas/public/components/color_dot/index.ts @@ -4,9 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import { pure } from 'recompose'; - -import { ColorDot as Component } from './color_dot'; - -export { Props } from './color_dot'; -export const ColorDot = pure(Component); +export { ColorDot } from './color_dot'; diff --git a/x-pack/plugins/canvas/public/components/color_manager/color_manager.tsx b/x-pack/plugins/canvas/public/components/color_manager/color_manager.tsx index 8855bffc5e771..88bf93a3ca84a 100644 --- a/x-pack/plugins/canvas/public/components/color_manager/color_manager.tsx +++ b/x-pack/plugins/canvas/public/components/color_manager/color_manager.tsx @@ -4,9 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiButtonIcon, EuiFieldText, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; -import React, { FunctionComponent } from 'react'; +import { EuiButtonIcon, EuiFieldText, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import tinycolor from 'tinycolor2'; import { ColorDot } from '../color_dot/color_dot'; @@ -15,17 +15,17 @@ import { ComponentStrings } from '../../../i18n/components'; const { ColorManager: strings } = ComponentStrings; export interface Props { + /** + * Determines if the add/remove buttons are displayed. + * @default false + */ + hasButtons?: boolean; /** The function to call when the Add Color button is clicked. The button will be disabled if there is no handler. */ onAddColor?: (value: string) => void; /** The function to call when the value is changed */ onChange: (value: string) => void; /** The function to call when the Remove Color button is clicked. The button will be disabled if there is no handler. */ onRemoveColor?: (value: string) => void; - /** - * Determines if the add/remove buttons are displayed. - * @default false - */ - hasButtons?: boolean; /** * The value of the color manager. Only honors valid CSS values. * @default '' @@ -33,12 +33,12 @@ export interface Props { value?: string; } -export const ColorManager: FunctionComponent = ({ - value = '', +export const ColorManager: FC = ({ + hasButtons = false, onAddColor, - onRemoveColor, onChange, - hasButtons = false, + onRemoveColor, + value = '', }) => { const tc = tinycolor(value); const validColor = tc.isValid(); diff --git a/x-pack/plugins/canvas/public/components/color_manager/index.ts b/x-pack/plugins/canvas/public/components/color_manager/index.ts index d7f59b38a74c5..9958c17cf1941 100644 --- a/x-pack/plugins/canvas/public/components/color_manager/index.ts +++ b/x-pack/plugins/canvas/public/components/color_manager/index.ts @@ -4,9 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import { pure } from 'recompose'; - -import { ColorManager as Component } from './color_manager'; - -export { Props } from './color_manager'; -export const ColorManager = pure(Component); +export { ColorManager, Props } from './color_manager'; diff --git a/x-pack/plugins/canvas/public/components/color_palette/color_palette.tsx b/x-pack/plugins/canvas/public/components/color_palette/color_palette.tsx index 09bc08f9ae541..d3b1936d4c365 100644 --- a/x-pack/plugins/canvas/public/components/color_palette/color_palette.tsx +++ b/x-pack/plugins/canvas/public/components/color_palette/color_palette.tsx @@ -4,15 +4,15 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiIcon, EuiLink } from '@elastic/eui'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; -import React, { FunctionComponent } from 'react'; +import { EuiIcon, EuiLink } from '@elastic/eui'; import tinycolor from 'tinycolor2'; import { readableColor } from '../../lib/readable_color'; import { ColorDot } from '../color_dot'; import { ItemGrid } from '../item_grid'; -export interface Props { +interface Props { /** * An array of hexadecimal color values. Non-hex will be ignored. * @default [] @@ -32,7 +32,7 @@ export interface Props { value?: string; } -export const ColorPalette: FunctionComponent = ({ +export const ColorPalette: FC = ({ colors = [], colorsPerRow = 6, onChange, diff --git a/x-pack/plugins/canvas/public/components/color_palette/index.ts b/x-pack/plugins/canvas/public/components/color_palette/index.ts index fa71bc8b3b9b0..2605868b94279 100644 --- a/x-pack/plugins/canvas/public/components/color_palette/index.ts +++ b/x-pack/plugins/canvas/public/components/color_palette/index.ts @@ -4,8 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import { pure } from 'recompose'; -import { ColorPalette as Component } from './color_palette'; - -export { Props } from './color_palette'; -export const ColorPalette = pure(Component); +export { ColorPalette } from './color_palette'; diff --git a/x-pack/plugins/canvas/public/components/color_picker/color_picker.tsx b/x-pack/plugins/canvas/public/components/color_picker/color_picker.tsx index 2bf17301b7b38..8de3ddb3d03a4 100644 --- a/x-pack/plugins/canvas/public/components/color_picker/color_picker.tsx +++ b/x-pack/plugins/canvas/public/components/color_picker/color_picker.tsx @@ -4,9 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ +import React, { FC } from 'react'; import PropTypes from 'prop-types'; -import React, { FunctionComponent } from 'react'; import tinycolor from 'tinycolor2'; + import { ColorManager, Props as ColorManagerProps } from '../color_manager'; import { ColorPalette } from '../color_palette'; @@ -18,7 +19,7 @@ export interface Props extends ColorManagerProps { colors?: string[]; } -export const ColorPicker: FunctionComponent = ({ +export const ColorPicker: FC = ({ colors = [], hasButtons = false, onAddColor, diff --git a/x-pack/plugins/canvas/public/components/color_picker/index.ts b/x-pack/plugins/canvas/public/components/color_picker/index.ts index 88968d11a665c..35dd067ab6d39 100644 --- a/x-pack/plugins/canvas/public/components/color_picker/index.ts +++ b/x-pack/plugins/canvas/public/components/color_picker/index.ts @@ -4,9 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import { pure } from 'recompose'; - -import { ColorPicker as Component } from './color_picker'; - -export { Props } from './color_picker'; -export const ColorPicker = pure(Component); +export { ColorPicker, Props } from './color_picker'; diff --git a/x-pack/plugins/canvas/public/components/color_picker_popover/color_picker_popover.tsx b/x-pack/plugins/canvas/public/components/color_picker_popover/color_picker_popover.tsx index 9e8a6e88b649b..143e1a7cee6ac 100644 --- a/x-pack/plugins/canvas/public/components/color_picker_popover/color_picker_popover.tsx +++ b/x-pack/plugins/canvas/public/components/color_picker_popover/color_picker_popover.tsx @@ -4,20 +4,21 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiLink, PopoverAnchorPosition } from '@elastic/eui'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; -import React, { FunctionComponent } from 'react'; +import { EuiLink, PopoverAnchorPosition } from '@elastic/eui'; import tinycolor from 'tinycolor2'; + import { ColorDot } from '../color_dot'; import { ColorPicker, Props as ColorPickerProps } from '../color_picker'; import { Popover } from '../popover'; export interface Props extends ColorPickerProps { - anchorPosition: PopoverAnchorPosition; + anchorPosition?: PopoverAnchorPosition; ariaLabel?: string; } -export const ColorPickerPopover: FunctionComponent = (props: Props) => { +export const ColorPickerPopover: FC = (props: Props) => { const { value, anchorPosition, ariaLabel, ...rest } = props; const button = (handleClick: React.MouseEventHandler) => ( { +const getIcon = (type: IconType) => { if (type === null) { return; } @@ -36,19 +39,31 @@ const getIcon = (type) => { return ; }; -const getColumnName = (col) => (typeof col === 'string' ? col : col.name); +const getColumnName = (col: DatatableColumn) => (typeof col === 'string' ? col : col.name); -const getColumnType = (col) => col.type || null; +const getColumnType = (col: DatatableColumn) => col.type || null; -const getFormattedValue = (val, type) => { +const getFormattedValue = (val: any, type: any) => { if (type === 'date') { return moment(val).format(); } return String(val); }; -export const Datatable = ({ datatable, perPage, paginate, showHeader }) => ( - +interface Props { + datatable: DatatableType; + paginate?: boolean; + perPage?: number; + showHeader?: boolean; +} + +export const Datatable: FC = ({ + datatable, + paginate = false, + perPage = 10, + showHeader = false, +}) => ( + {({ rows, setPage, pageNumber, totalPages }) => (
@@ -91,7 +106,7 @@ export const Datatable = ({ datatable, perPage, paginate, showHeader }) => ( Datatable.propTypes = { datatable: PropTypes.object.isRequired, - perPage: PropTypes.number, paginate: PropTypes.bool, + perPage: PropTypes.number, showHeader: PropTypes.bool, }; diff --git a/x-pack/plugins/uptime/public/apps/index.ts b/x-pack/plugins/canvas/public/components/datatable/index.ts similarity index 85% rename from x-pack/plugins/uptime/public/apps/index.ts rename to x-pack/plugins/canvas/public/components/datatable/index.ts index 65b80d08d4f20..e39b909c53460 100644 --- a/x-pack/plugins/uptime/public/apps/index.ts +++ b/x-pack/plugins/canvas/public/components/datatable/index.ts @@ -4,4 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -export { UptimePlugin } from './plugin'; +export { Datatable } from './datatable'; diff --git a/x-pack/plugins/canvas/public/components/dragbox_annotation/dragbox_annotation.js b/x-pack/plugins/canvas/public/components/dragbox_annotation/dragbox_annotation.js deleted file mode 100644 index 8c67404cb9b7d..0000000000000 --- a/x-pack/plugins/canvas/public/components/dragbox_annotation/dragbox_annotation.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import PropTypes from 'prop-types'; -import { matrixToCSS } from '../../lib/dom'; - -export const DragBoxAnnotation = ({ transformMatrix, width, height }) => { - const newStyle = { - width, - height, - marginLeft: -width / 2, - marginTop: -height / 2, - transform: matrixToCSS(transformMatrix), - }; - return
; -}; - -DragBoxAnnotation.propTypes = { - transformMatrix: PropTypes.arrayOf(PropTypes.number).isRequired, - width: PropTypes.number.isRequired, - height: PropTypes.number.isRequired, -}; diff --git a/x-pack/plugins/canvas/public/components/dragbox_annotation/dragbox_annotation.scss b/x-pack/plugins/canvas/public/components/dragbox_annotation/dragbox_annotation.scss deleted file mode 100644 index bd14ced586dbd..0000000000000 --- a/x-pack/plugins/canvas/public/components/dragbox_annotation/dragbox_annotation.scss +++ /dev/null @@ -1,8 +0,0 @@ -.canvasDragBoxAnnotation { - position: absolute; - background: none; - transform-origin: center center; /* the default, only for clarity */ - transform-style: preserve-3d; - outline: dashed 1px $euiColorDarkShade; - pointer-events: none; -} diff --git a/x-pack/plugins/canvas/public/components/dragbox_annotation/index.js b/x-pack/plugins/canvas/public/components/dragbox_annotation/index.js deleted file mode 100644 index 85c97e90776c6..0000000000000 --- a/x-pack/plugins/canvas/public/components/dragbox_annotation/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { pure } from 'recompose'; -import { DragBoxAnnotation as Component } from './dragbox_annotation'; - -export const DragBoxAnnotation = pure(Component); diff --git a/x-pack/plugins/canvas/public/components/font_picker/__snapshots__/font_picker.stories.storyshot b/x-pack/plugins/canvas/public/components/font_picker/__stories__/__snapshots__/font_picker.stories.storyshot similarity index 100% rename from x-pack/plugins/canvas/public/components/font_picker/__snapshots__/font_picker.stories.storyshot rename to x-pack/plugins/canvas/public/components/font_picker/__stories__/__snapshots__/font_picker.stories.storyshot diff --git a/x-pack/plugins/canvas/public/components/font_picker/font_picker.stories.tsx b/x-pack/plugins/canvas/public/components/font_picker/__stories__/font_picker.stories.tsx similarity index 84% rename from x-pack/plugins/canvas/public/components/font_picker/font_picker.stories.tsx rename to x-pack/plugins/canvas/public/components/font_picker/__stories__/font_picker.stories.tsx index 0ad1e01252002..34cb3d644cccb 100644 --- a/x-pack/plugins/canvas/public/components/font_picker/font_picker.stories.tsx +++ b/x-pack/plugins/canvas/public/components/font_picker/__stories__/font_picker.stories.tsx @@ -7,8 +7,8 @@ import { action } from '@storybook/addon-actions'; import { storiesOf } from '@storybook/react'; import React from 'react'; -import { americanTypewriter } from '../../../common/lib/fonts'; -import { FontPicker } from './font_picker'; +import { americanTypewriter } from '../../../../common/lib/fonts'; +import { FontPicker } from '../font_picker'; storiesOf('components/FontPicker', module) .add('default', () => ) diff --git a/x-pack/plugins/canvas/public/components/font_picker/font_picker.tsx b/x-pack/plugins/canvas/public/components/font_picker/font_picker.tsx index 556a3c5452160..2b75841e1b7a5 100644 --- a/x-pack/plugins/canvas/public/components/font_picker/font_picker.tsx +++ b/x-pack/plugins/canvas/public/components/font_picker/font_picker.tsx @@ -4,14 +4,14 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiSuperSelect } from '@elastic/eui'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; -import React, { FunctionComponent } from 'react'; +import { EuiSuperSelect } from '@elastic/eui'; import { fonts, FontValue } from '../../../common/lib/fonts'; interface DisplayedFont { - value: string; label: string; + value: string; } interface Props { @@ -19,9 +19,7 @@ interface Props { value?: FontValue; } -export const FontPicker: FunctionComponent = (props) => { - const { value, onSelect } = props; - +export const FontPicker: FC = ({ value, onSelect }) => { // While fonts are strongly-typed, we also support custom fonts someone might type in. // So let's cast the fonts and allow for additions. const displayedFonts: DisplayedFont[] = fonts; @@ -46,10 +44,10 @@ export const FontPicker: FunctionComponent = (props) => { }; FontPicker.propTypes = { - /** Initial value of the Font Picker. */ - value: PropTypes.string, /** Function to execute when a Font is selected. */ onSelect: PropTypes.func, + /** Initial value of the Font Picker. */ + value: PropTypes.string, }; FontPicker.displayName = 'FontPicker'; diff --git a/x-pack/plugins/canvas/public/components/font_picker/index.js b/x-pack/plugins/canvas/public/components/font_picker/index.js deleted file mode 100644 index 5ccb7846b7a77..0000000000000 --- a/x-pack/plugins/canvas/public/components/font_picker/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { pure } from 'recompose'; - -import { FontPicker as Component } from './font_picker'; - -export const FontPicker = pure(Component); diff --git a/x-pack/plugins/canvas/public/components/arg_add/index.js b/x-pack/plugins/canvas/public/components/font_picker/index.ts similarity index 66% rename from x-pack/plugins/canvas/public/components/arg_add/index.js rename to x-pack/plugins/canvas/public/components/font_picker/index.ts index 9a89a48edcef6..339021a7e5712 100644 --- a/x-pack/plugins/canvas/public/components/arg_add/index.js +++ b/x-pack/plugins/canvas/public/components/font_picker/index.ts @@ -4,8 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import { pure } from 'recompose'; - -import { ArgAdd as Component } from './arg_add'; - -export const ArgAdd = pure(Component); +export { FontPicker } from './font_picker'; diff --git a/x-pack/plugins/canvas/public/components/hover_annotation/hover_annotation.scss b/x-pack/plugins/canvas/public/components/hover_annotation/hover_annotation.scss deleted file mode 100644 index 4771bbb6134be..0000000000000 --- a/x-pack/plugins/canvas/public/components/hover_annotation/hover_annotation.scss +++ /dev/null @@ -1,8 +0,0 @@ -.canvasHoverAnnotation { - position: absolute; - background: none; - transform-origin: center center; /* the default, only for clarity */ - transform-style: preserve-3d; - outline: solid 1px $euiColorVis0; - pointer-events: none; -} diff --git a/x-pack/plugins/canvas/public/components/hover_annotation/index.js b/x-pack/plugins/canvas/public/components/hover_annotation/index.js deleted file mode 100644 index 71c57a25d7960..0000000000000 --- a/x-pack/plugins/canvas/public/components/hover_annotation/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { pure } from 'recompose'; -import { HoverAnnotation as Component } from './hover_annotation'; - -export const HoverAnnotation = pure(Component); diff --git a/x-pack/plugins/canvas/public/components/layout_annotations/alignment_guide.tsx b/x-pack/plugins/canvas/public/components/layout_annotations/alignment_guide.tsx new file mode 100644 index 0000000000000..5ac23ab41f7c0 --- /dev/null +++ b/x-pack/plugins/canvas/public/components/layout_annotations/alignment_guide.tsx @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { FC } from 'react'; +import PropTypes from 'prop-types'; +import { matrixToCSS } from '../../lib/dom'; +import { TransformMatrix3d } from '../../lib/aeroelastic'; + +interface Props { + height: number; + transformMatrix: TransformMatrix3d; + width: number; +} + +export const AlignmentGuide: FC = ({ transformMatrix, width, height }) => ( +
+); + +AlignmentGuide.propTypes = { + height: PropTypes.number.isRequired, + transformMatrix: PropTypes.arrayOf(PropTypes.number).isRequired, + width: PropTypes.number.isRequired, +}; diff --git a/x-pack/plugins/canvas/public/components/layout_annotations/border_connection.tsx b/x-pack/plugins/canvas/public/components/layout_annotations/border_connection.tsx new file mode 100644 index 0000000000000..e47ec3cc89e7b --- /dev/null +++ b/x-pack/plugins/canvas/public/components/layout_annotations/border_connection.tsx @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { FC } from 'react'; +import PropTypes from 'prop-types'; +import { matrixToCSS } from '../../lib/dom'; +import { TransformMatrix3d } from '../../lib/aeroelastic'; + +interface Props { + height: number; + transformMatrix: TransformMatrix3d; + width: number; +} + +export const BorderConnection: FC = ({ transformMatrix, width, height }) => ( +
+); + +BorderConnection.propTypes = { + height: PropTypes.number.isRequired, + transformMatrix: PropTypes.arrayOf(PropTypes.number).isRequired, + width: PropTypes.number.isRequired, +}; diff --git a/x-pack/plugins/canvas/public/components/border_resize_handle/border_resize_handle.js b/x-pack/plugins/canvas/public/components/layout_annotations/border_resize_handle.tsx similarity index 68% rename from x-pack/plugins/canvas/public/components/border_resize_handle/border_resize_handle.js rename to x-pack/plugins/canvas/public/components/layout_annotations/border_resize_handle.tsx index de9d573724836..f7c49205568fe 100644 --- a/x-pack/plugins/canvas/public/components/border_resize_handle/border_resize_handle.js +++ b/x-pack/plugins/canvas/public/components/layout_annotations/border_resize_handle.tsx @@ -4,11 +4,17 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; import { matrixToCSS } from '../../lib/dom'; +import { TransformMatrix3d } from '../../lib/aeroelastic'; -export const BorderResizeHandle = ({ transformMatrix, zoomScale }) => ( +interface Props { + transformMatrix: TransformMatrix3d; + zoomScale?: number; +} + +export const BorderResizeHandle: FC = ({ transformMatrix, zoomScale = 1 }) => (
( BorderResizeHandle.propTypes = { transformMatrix: PropTypes.arrayOf(PropTypes.number).isRequired, + zoomScale: PropTypes.number, }; diff --git a/x-pack/plugins/canvas/public/components/layout_annotations/dragbox_annotation.tsx b/x-pack/plugins/canvas/public/components/layout_annotations/dragbox_annotation.tsx new file mode 100644 index 0000000000000..16a2a626b7975 --- /dev/null +++ b/x-pack/plugins/canvas/public/components/layout_annotations/dragbox_annotation.tsx @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { FC } from 'react'; +import PropTypes from 'prop-types'; +import { matrixToCSS } from '../../lib/dom'; +import { TransformMatrix3d } from '../../lib/aeroelastic'; + +interface Props { + height: number; + transformMatrix: TransformMatrix3d; + width: number; +} + +export const DragBoxAnnotation: FC = ({ transformMatrix, width, height }) => ( +
+); + +DragBoxAnnotation.propTypes = { + transformMatrix: PropTypes.arrayOf(PropTypes.number).isRequired, + width: PropTypes.number.isRequired, + height: PropTypes.number.isRequired, +}; diff --git a/x-pack/plugins/canvas/public/components/hover_annotation/hover_annotation.js b/x-pack/plugins/canvas/public/components/layout_annotations/hover_annotation.tsx similarity index 50% rename from x-pack/plugins/canvas/public/components/hover_annotation/hover_annotation.js rename to x-pack/plugins/canvas/public/components/layout_annotations/hover_annotation.tsx index 7337c0446e31c..a8d73f8bf9ec7 100644 --- a/x-pack/plugins/canvas/public/components/hover_annotation/hover_annotation.js +++ b/x-pack/plugins/canvas/public/components/layout_annotations/hover_annotation.tsx @@ -4,23 +4,32 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; import { matrixToCSS } from '../../lib/dom'; +import { TransformMatrix3d } from '../../lib/aeroelastic'; -export const HoverAnnotation = ({ transformMatrix, width, height }) => { - const newStyle = { - width, - height, - marginLeft: -width / 2, - marginTop: -height / 2, - transform: matrixToCSS(transformMatrix), - }; - return
; -}; +interface Props { + height: number; + transformMatrix: TransformMatrix3d; + width: number; +} + +export const HoverAnnotation: FC = ({ transformMatrix, width, height }) => ( +
+); HoverAnnotation.propTypes = { + height: PropTypes.number.isRequired, transformMatrix: PropTypes.arrayOf(PropTypes.number).isRequired, width: PropTypes.number.isRequired, - height: PropTypes.number.isRequired, }; diff --git a/x-pack/plugins/canvas/public/components/layout_annotations/index.ts b/x-pack/plugins/canvas/public/components/layout_annotations/index.ts new file mode 100644 index 0000000000000..d2334c6a225fe --- /dev/null +++ b/x-pack/plugins/canvas/public/components/layout_annotations/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { AlignmentGuide } from './alignment_guide'; +export { DragBoxAnnotation } from './dragbox_annotation'; +export { HoverAnnotation } from './hover_annotation'; +export { TooltipAnnotation } from './tooltip_annotation'; +export { RotationHandle } from './rotation_handle'; +export { BorderConnection } from './border_connection'; +export { BorderResizeHandle } from './border_resize_handle'; diff --git a/x-pack/plugins/canvas/public/components/layout_annotations/layout_annotations.scss b/x-pack/plugins/canvas/public/components/layout_annotations/layout_annotations.scss new file mode 100644 index 0000000000000..363aa1f241b9d --- /dev/null +++ b/x-pack/plugins/canvas/public/components/layout_annotations/layout_annotations.scss @@ -0,0 +1,81 @@ +.canvasAlignmentGuide { + transform-origin: center center; /* the default, only for clarity */ + transform-style: preserve-3d; +} + +.canvasBorderConnection { + position: absolute; + top: 0; + width: 100%; + height: 100%; + pointer-events: none; + border-top: 1px dashed $euiColorLightShade; + border-left: 1px dashed $euiColorLightShade; +} + +.canvasBorderResizeHandle { + @include euiSlightShadow; + transform-origin: center center; /* the default, only for clarity */ + transform-style: preserve-3d; + display: block; + position: absolute; + height: $euiSizeS; + width: $euiSizeS; + margin-left: -4px; + margin-top: -4px; + background-color: $euiColorEmptyShade; + border: 1px solid $euiColorDarkShade; +} + +.canvasDragBoxAnnotation { + position: absolute; + background: none; + transform-origin: center center; /* the default, only for clarity */ + transform-style: preserve-3d; + outline: dashed 1px $euiColorDarkShade; + pointer-events: none; +} + +.canvasHoverAnnotation { + position: absolute; + background: none; + transform-origin: center center; /* the default, only for clarity */ + transform-style: preserve-3d; + outline: solid 1px $euiColorVis0; + pointer-events: none; +} + +.canvasRotationHandle { + transform-origin: center center; /* the default, only for clarity */ + transform-style: preserve-3d; + display: block; + position: absolute; + height: $euiSizeL; + width: 0; + margin-left: -1px; + margin-top: -12px; + border-top: 1px dashed $euiColorLightShade; + border-left: 1px dashed $euiColorLightShade; +} + +.canvasRotationHandle__handle { + transform-origin: center center; /* the default, only for clarity */ + transform-style: preserve-3d; + display: block; + position: absolute; + height: 9px; + width: 9px; + margin-left: -5px; + margin-top: -6px; + border-radius: 50%; + background-color: $euiColorMediumShade; +} + +.tooltipAnnotation { + @include euiToolTipStyle($size: 's'); + position: absolute; + transform-origin: center center; /* the default, only for clarity */ + transform-style: preserve-3d; + outline: none; + pointer-events: none; +} diff --git a/x-pack/plugins/canvas/public/components/rotation_handle/rotation_handle.js b/x-pack/plugins/canvas/public/components/layout_annotations/rotation_handle.tsx similarity index 60% rename from x-pack/plugins/canvas/public/components/rotation_handle/rotation_handle.js rename to x-pack/plugins/canvas/public/components/layout_annotations/rotation_handle.tsx index dfadbbc39c547..e2a3f57efc672 100644 --- a/x-pack/plugins/canvas/public/components/rotation_handle/rotation_handle.js +++ b/x-pack/plugins/canvas/public/components/layout_annotations/rotation_handle.tsx @@ -4,19 +4,25 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; import { matrixToCSS } from '../../lib/dom'; +import { TransformMatrix3d } from '../../lib/aeroelastic'; -export const RotationHandle = ({ transformMatrix, zoomScale }) => ( +interface Props { + transformMatrix: TransformMatrix3d; + zoomScale?: number; +} + +export const RotationHandle: FC = ({ transformMatrix, zoomScale = 1 }) => (
@@ -24,4 +30,5 @@ export const RotationHandle = ({ transformMatrix, zoomScale }) => ( RotationHandle.propTypes = { transformMatrix: PropTypes.arrayOf(PropTypes.number).isRequired, + zoomScale: PropTypes.number, }; diff --git a/x-pack/plugins/canvas/public/components/tooltip_annotation/tooltip_annotation.js b/x-pack/plugins/canvas/public/components/layout_annotations/tooltip_annotation.tsx similarity index 70% rename from x-pack/plugins/canvas/public/components/tooltip_annotation/tooltip_annotation.js rename to x-pack/plugins/canvas/public/components/layout_annotations/tooltip_annotation.tsx index 1836bfd0162f3..84c527bf7af27 100644 --- a/x-pack/plugins/canvas/public/components/tooltip_annotation/tooltip_annotation.js +++ b/x-pack/plugins/canvas/public/components/layout_annotations/tooltip_annotation.tsx @@ -4,11 +4,17 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; import { matrixToCSS } from '../../lib/dom'; +import { TransformMatrix3d } from '../../lib/aeroelastic'; -export const HoverAnnotation = ({ transformMatrix, text }) => { +interface Props { + transformMatrix: TransformMatrix3d; + text: string; +} + +export const TooltipAnnotation: FC = ({ transformMatrix, text }) => { const newStyle = { transform: `${matrixToCSS(transformMatrix)} translate(1em, -1em)`, }; @@ -19,7 +25,7 @@ export const HoverAnnotation = ({ transformMatrix, text }) => { ); }; -HoverAnnotation.propTypes = { +TooltipAnnotation.propTypes = { transformMatrix: PropTypes.arrayOf(PropTypes.number).isRequired, text: PropTypes.string.isRequired, }; diff --git a/x-pack/plugins/canvas/public/components/loading/index.ts b/x-pack/plugins/canvas/public/components/loading/index.ts index 81fedf3287184..745639955dcba 100644 --- a/x-pack/plugins/canvas/public/components/loading/index.ts +++ b/x-pack/plugins/canvas/public/components/loading/index.ts @@ -4,7 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import { pure } from 'recompose'; -import { Loading as Component } from './loading'; - -export const Loading = pure(Component); +export { Loading } from './loading'; diff --git a/x-pack/plugins/canvas/public/components/loading/loading.tsx b/x-pack/plugins/canvas/public/components/loading/loading.tsx index 67db16d40d426..403be84295312 100644 --- a/x-pack/plugins/canvas/public/components/loading/loading.tsx +++ b/x-pack/plugins/canvas/public/components/loading/loading.tsx @@ -4,9 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiIcon, EuiLoadingSpinner, isColorDark } from '@elastic/eui'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; -import React, { FunctionComponent } from 'react'; +import { EuiIcon, EuiLoadingSpinner, isColorDark } from '@elastic/eui'; import { hexToRgb } from '../../../common/lib/hex_to_rgb'; interface Props { @@ -15,7 +15,7 @@ interface Props { text?: string; } -export const Loading: FunctionComponent = ({ +export const Loading: FC = ({ animated = false, text = '', backgroundColor = '#000000', diff --git a/x-pack/plugins/canvas/public/components/rotation_handle/index.js b/x-pack/plugins/canvas/public/components/rotation_handle/index.js deleted file mode 100644 index 86c99ce12a04e..0000000000000 --- a/x-pack/plugins/canvas/public/components/rotation_handle/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { pure } from 'recompose'; -import { RotationHandle as Component } from './rotation_handle'; - -export const RotationHandle = pure(Component); diff --git a/x-pack/plugins/canvas/public/components/rotation_handle/rotation_handle.scss b/x-pack/plugins/canvas/public/components/rotation_handle/rotation_handle.scss deleted file mode 100644 index 233a86199c483..0000000000000 --- a/x-pack/plugins/canvas/public/components/rotation_handle/rotation_handle.scss +++ /dev/null @@ -1,25 +0,0 @@ -.canvasRotationHandle--connector { - transform-origin: center center; /* the default, only for clarity */ - transform-style: preserve-3d; - display: block; - position: absolute; - height: 24px; - width: 0; - margin-left: -1px; - margin-top: -12px; - border-top: 1px dashed $euiColorLightShade; - border-left: 1px dashed $euiColorLightShade; -} - -.canvasRotationHandle--handle { - transform-origin: center center; /* the default, only for clarity */ - transform-style: preserve-3d; - display: block; - position: absolute; - height: 9px; - width: 9px; - margin-left: -5px; - margin-top: -6px; - border-radius: 50%; - background-color: $euiColorMediumShade; -} diff --git a/x-pack/plugins/canvas/public/components/shape_picker/index.ts b/x-pack/plugins/canvas/public/components/shape_picker/index.ts index d3ed85831cbe2..3ec86e45af236 100644 --- a/x-pack/plugins/canvas/public/components/shape_picker/index.ts +++ b/x-pack/plugins/canvas/public/components/shape_picker/index.ts @@ -4,8 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import { pure } from 'recompose'; - -import { ShapePicker as Component } from './shape_picker'; - -export const ShapePicker = pure(Component); +export { ShapePicker } from './shape_picker'; diff --git a/x-pack/plugins/canvas/public/components/shape_picker/shape_picker.tsx b/x-pack/plugins/canvas/public/components/shape_picker/shape_picker.tsx index 56874fd3080f7..263654522c059 100644 --- a/x-pack/plugins/canvas/public/components/shape_picker/shape_picker.tsx +++ b/x-pack/plugins/canvas/public/components/shape_picker/shape_picker.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; import { EuiFlexGrid, EuiFlexItem, EuiLink } from '@elastic/eui'; import { ShapePreview } from '../shape_preview'; @@ -16,7 +16,7 @@ interface Props { onChange?: (key: string) => void; } -export const ShapePicker = ({ shapes, onChange = () => {} }: Props) => { +export const ShapePicker: FC = ({ shapes, onChange = () => {} }) => { return ( {Object.keys(shapes) @@ -33,6 +33,6 @@ export const ShapePicker = ({ shapes, onChange = () => {} }: Props) => { }; ShapePicker.propTypes = { - shapes: PropTypes.object.isRequired, onChange: PropTypes.func, + shapes: PropTypes.object.isRequired, }; diff --git a/x-pack/plugins/canvas/public/components/shape_picker_popover/index.tsx b/x-pack/plugins/canvas/public/components/shape_picker_popover/index.tsx index 1d4ae25a38fa2..06619c0626daf 100644 --- a/x-pack/plugins/canvas/public/components/shape_picker_popover/index.tsx +++ b/x-pack/plugins/canvas/public/components/shape_picker_popover/index.tsx @@ -4,8 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import { pure } from 'recompose'; - -import { ShapePickerPopover as Component } from './shape_picker_popover'; - -export const ShapePickerPopover = pure(Component); +export { ShapePickerPopover } from './shape_picker_popover'; diff --git a/x-pack/plugins/canvas/public/components/shape_picker_popover/shape_picker_popover.tsx b/x-pack/plugins/canvas/public/components/shape_picker_popover/shape_picker_popover.tsx index d42e08d2bc852..d61d9e47a3a78 100644 --- a/x-pack/plugins/canvas/public/components/shape_picker_popover/shape_picker_popover.tsx +++ b/x-pack/plugins/canvas/public/components/shape_picker_popover/shape_picker_popover.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; import { EuiLink, EuiPanel } from '@elastic/eui'; import { Popover } from '../popover'; @@ -20,7 +20,7 @@ interface Props { ariaLabel?: string; } -export const ShapePickerPopover = ({ shapes, onChange, value, ariaLabel }: Props) => { +export const ShapePickerPopover: FC = ({ shapes, onChange, value, ariaLabel }) => { const button = (handleClick: React.MouseEventHandler) => ( @@ -37,7 +37,8 @@ export const ShapePickerPopover = ({ shapes, onChange, value, ariaLabel }: Props }; ShapePickerPopover.propTypes = { + ariaLabel: PropTypes.string, + onChange: PropTypes.func, shapes: PropTypes.object.isRequired, value: PropTypes.string, - onChange: PropTypes.func, }; diff --git a/x-pack/plugins/canvas/public/components/shape_preview/index.ts b/x-pack/plugins/canvas/public/components/shape_preview/index.ts index 4320a10d97a85..6027b1227a99a 100644 --- a/x-pack/plugins/canvas/public/components/shape_preview/index.ts +++ b/x-pack/plugins/canvas/public/components/shape_preview/index.ts @@ -4,8 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import { pure } from 'recompose'; - -import { ShapePreview as Component } from './shape_preview'; - -export const ShapePreview = pure(Component); +export { ShapePreview } from './shape_preview'; diff --git a/x-pack/plugins/canvas/public/components/shape_preview/shape_preview.tsx b/x-pack/plugins/canvas/public/components/shape_preview/shape_preview.tsx index 4f67945e9ce13..3ff18f3aa4bc4 100644 --- a/x-pack/plugins/canvas/public/components/shape_preview/shape_preview.tsx +++ b/x-pack/plugins/canvas/public/components/shape_preview/shape_preview.tsx @@ -4,14 +4,14 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; interface Props { shape?: string; } -export const ShapePreview = ({ shape }: Props) => { +export const ShapePreview: FC = ({ shape }) => { if (!shape) { return
; } diff --git a/x-pack/plugins/canvas/public/components/text_style_picker/__stories__/__snapshots__/text_style_picker.stories.storyshot b/x-pack/plugins/canvas/public/components/text_style_picker/__stories__/__snapshots__/text_style_picker.stories.storyshot new file mode 100644 index 0000000000000..ad236e701ceb0 --- /dev/null +++ b/x-pack/plugins/canvas/public/components/text_style_picker/__stories__/__snapshots__/text_style_picker.stories.storyshot @@ -0,0 +1,975 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots components/TextStylePicker default 1`] = ` +
+
+
+
+
+
+ +
+
+ + Select an option: + , is selected + +
+
+
+
+
+
+ +
+ +
+ + +
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+`; + +exports[`Storyshots components/TextStylePicker interactive 1`] = ` +
+
+
+
+
+
+ +
+
+ + Select an option: + , is selected + +
+
+
+
+
+
+ +
+ +
+ + +
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+`; diff --git a/x-pack/plugins/canvas/public/components/text_style_picker/__stories__/text_style_picker.stories.tsx b/x-pack/plugins/canvas/public/components/text_style_picker/__stories__/text_style_picker.stories.tsx new file mode 100644 index 0000000000000..b33a34fcd5e65 --- /dev/null +++ b/x-pack/plugins/canvas/public/components/text_style_picker/__stories__/text_style_picker.stories.tsx @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { useState } from 'react'; +import { storiesOf } from '@storybook/react'; +import { action } from '@storybook/addon-actions'; + +import { TextStylePicker } from '../text_style_picker'; + +const Interactive = () => { + const [props, setProps] = useState({}); + return ; +}; + +storiesOf('components/TextStylePicker', module) + .addDecorator((fn) =>
{fn()}
) + .add('default', () => ) + .add('interactive', () => ); diff --git a/x-pack/plugins/canvas/public/components/text_style_picker/font_sizes.js b/x-pack/plugins/canvas/public/components/text_style_picker/font_sizes.ts similarity index 100% rename from x-pack/plugins/canvas/public/components/text_style_picker/font_sizes.js rename to x-pack/plugins/canvas/public/components/text_style_picker/font_sizes.ts diff --git a/x-pack/plugins/canvas/public/components/text_style_picker/index.js b/x-pack/plugins/canvas/public/components/text_style_picker/index.js deleted file mode 100644 index 79bde95723682..0000000000000 --- a/x-pack/plugins/canvas/public/components/text_style_picker/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { pure } from 'recompose'; -import { TextStylePicker as Component } from './text_style_picker'; - -export const TextStylePicker = pure(Component); diff --git a/x-pack/plugins/canvas/public/components/datatable/index.js b/x-pack/plugins/canvas/public/components/text_style_picker/index.ts similarity index 64% rename from x-pack/plugins/canvas/public/components/datatable/index.js rename to x-pack/plugins/canvas/public/components/text_style_picker/index.ts index c7837005368e5..16fb39b660a0c 100644 --- a/x-pack/plugins/canvas/public/components/datatable/index.js +++ b/x-pack/plugins/canvas/public/components/text_style_picker/index.ts @@ -4,7 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import { pure } from 'recompose'; -import { Datatable as Component } from './datatable'; - -export const Datatable = pure(Component); +export { TextStylePicker } from './text_style_picker'; diff --git a/x-pack/plugins/canvas/public/components/text_style_picker/text_style_picker.js b/x-pack/plugins/canvas/public/components/text_style_picker/text_style_picker.tsx similarity index 54% rename from x-pack/plugins/canvas/public/components/text_style_picker/text_style_picker.js rename to x-pack/plugins/canvas/public/components/text_style_picker/text_style_picker.tsx index 48d52abb03125..3dfc55919395d 100644 --- a/x-pack/plugins/canvas/public/components/text_style_picker/text_style_picker.js +++ b/x-pack/plugins/canvas/public/components/text_style_picker/text_style_picker.tsx @@ -4,9 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { FC, useState, useEffect } from 'react'; import PropTypes from 'prop-types'; import { EuiFlexGroup, EuiFlexItem, EuiSelect, EuiSpacer, EuiButtonGroup } from '@elastic/eui'; +import { FontValue } from 'src/plugins/expressions'; import { ComponentStrings } from '../../../i18n'; import { FontPicker } from '../font_picker'; import { ColorPickerPopover } from '../color_picker_popover'; @@ -14,54 +15,75 @@ import { fontSizes } from './font_sizes'; const { TextStylePicker: strings } = ComponentStrings; -export const TextStylePicker = ({ - family, - size, - align, - color, - weight, - underline, - italic, - onChange, - colors, -}) => { - const alignmentButtons = [ - { - id: 'left', - label: strings.getAlignLeftOption(), - iconType: 'editorAlignLeft', - }, - { - id: 'center', - label: strings.getAlignCenterOption(), - iconType: 'editorAlignCenter', - }, - { - id: 'right', - label: strings.getAlignRightOption(), - iconType: 'editorAlignRight', - }, - ]; - - const styleButtons = [ - { - id: 'bold', - label: strings.getStyleBoldOption(), - iconType: 'editorBold', - }, - { - id: 'italic', - label: strings.getStyleItalicOption(), - iconType: 'editorItalic', - }, - { - id: 'underline', - label: strings.getStyleUnderlineOption(), - iconType: 'editorUnderline', - }, - ]; - - const stylesSelectedMap = { +interface BaseProps { + family?: FontValue; + size?: number; + align?: 'left' | 'center' | 'right'; + color?: string; + weight?: 'bold' | 'normal'; + underline?: boolean; + italic?: boolean; +} + +interface Props extends BaseProps { + colors?: string[]; + onChange: (props: BaseProps) => void; +} + +type StyleType = 'bold' | 'italic' | 'underline'; + +const alignmentButtons = [ + { + id: 'left', + label: strings.getAlignLeftOption(), + iconType: 'editorAlignLeft', + }, + { + id: 'center', + label: strings.getAlignCenterOption(), + iconType: 'editorAlignCenter', + }, + { + id: 'right', + label: strings.getAlignRightOption(), + iconType: 'editorAlignRight', + }, +]; + +const styleButtons = [ + { + id: 'bold', + label: strings.getStyleBoldOption(), + iconType: 'editorBold', + }, + { + id: 'italic', + label: strings.getStyleItalicOption(), + iconType: 'editorItalic', + }, + { + id: 'underline', + label: strings.getStyleUnderlineOption(), + iconType: 'editorUnderline', + }, +]; + +export const TextStylePicker: FC = (props) => { + const [style, setStyle] = useState(props); + + const { + align = 'left', + color, + colors, + family, + italic = false, + onChange, + size = 14, + underline = false, + weight = 'normal', + } = style; + + const stylesSelectedMap: Record = { ['bold']: weight === 'bold', ['italic']: Boolean(italic), ['underline']: Boolean(underline), @@ -72,31 +94,22 @@ export const TextStylePicker = ({ fontSizes.sort((a, b) => a - b); } - const doChange = (propName, value) => { - onChange({ - family, - size, - align, - color, - weight: weight || 'normal', - underline: underline || false, - italic: italic || false, - [propName]: value, - }); - }; + useEffect(() => onChange(style), [onChange, style]); - const onAlignmentChange = (optionId) => doChange('align', optionId); + const doChange = (propName: keyof Props, value: string | boolean | number) => { + setStyle({ ...style, [propName]: value }); + }; - const onStyleChange = (optionId) => { - let prop; + const onStyleChange = (optionId: string) => { + let prop: 'weight' | 'italic' | 'underline'; let value; if (optionId === 'bold') { prop = 'weight'; value = !stylesSelectedMap[optionId] ? 'bold' : 'normal'; } else { - prop = optionId; - value = !stylesSelectedMap[optionId]; + prop = optionId as 'italic' | 'underline'; + value = !stylesSelectedMap[prop]; } doChange(prop, value); @@ -106,14 +119,18 @@ export const TextStylePicker = ({
- doChange('family', value)} /> + {family ? ( + doChange('family', value)} /> + ) : ( + doChange('family', value)} /> + )} doChange('size', Number(e.target.value))} - options={fontSizes.map((size) => ({ text: String(size), value: size }))} + options={fontSizes.map((fontSize) => ({ text: String(fontSize), value: fontSize }))} prepend="Size" /> @@ -147,7 +164,7 @@ export const TextStylePicker = ({ buttonSize="compressed" isIconOnly idSelected={align} - onChange={onAlignmentChange} + onChange={(optionId: string) => doChange('align', optionId)} className="canvasSidebar__buttonGroup" /> @@ -159,9 +176,9 @@ export const TextStylePicker = ({ TextStylePicker.propTypes = { family: PropTypes.string, size: PropTypes.number, - align: PropTypes.string, + align: PropTypes.oneOf(['left', 'center', 'right']), color: PropTypes.string, - weight: PropTypes.string, + weight: PropTypes.oneOf(['normal', 'bold']), underline: PropTypes.bool, italic: PropTypes.bool, onChange: PropTypes.func.isRequired, @@ -171,4 +188,5 @@ TextStylePicker.propTypes = { TextStylePicker.defaultProps = { align: 'left', size: 14, + weight: 'normal', }; diff --git a/x-pack/plugins/canvas/public/components/tooltip_annotation/index.js b/x-pack/plugins/canvas/public/components/tooltip_annotation/index.js deleted file mode 100644 index c6d545be560ce..0000000000000 --- a/x-pack/plugins/canvas/public/components/tooltip_annotation/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { pure } from 'recompose'; -import { HoverAnnotation as Component } from './tooltip_annotation'; - -export const TooltipAnnotation = pure(Component); diff --git a/x-pack/plugins/canvas/public/components/tooltip_annotation/tooltip_annotation.scss b/x-pack/plugins/canvas/public/components/tooltip_annotation/tooltip_annotation.scss deleted file mode 100644 index d91e49c0c628f..0000000000000 --- a/x-pack/plugins/canvas/public/components/tooltip_annotation/tooltip_annotation.scss +++ /dev/null @@ -1,8 +0,0 @@ -.tooltipAnnotation { - @include euiToolTipStyle($size: 's'); - position: absolute; - transform-origin: center center; /* the default, only for clarity */ - transform-style: preserve-3d; - outline: none; - pointer-events: none; -} diff --git a/x-pack/plugins/canvas/public/components/tooltip_icon/index.ts b/x-pack/plugins/canvas/public/components/tooltip_icon/index.ts index 6e71baa364785..55c2f7090629c 100644 --- a/x-pack/plugins/canvas/public/components/tooltip_icon/index.ts +++ b/x-pack/plugins/canvas/public/components/tooltip_icon/index.ts @@ -4,8 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import { pure } from 'recompose'; -import { TooltipIcon as Component } from './tooltip_icon'; -export { IconType } from './tooltip_icon'; - -export const TooltipIcon = pure(Component); +export { TooltipIcon, IconType } from './tooltip_icon'; diff --git a/x-pack/plugins/canvas/public/components/tooltip_icon/tooltip_icon.tsx b/x-pack/plugins/canvas/public/components/tooltip_icon/tooltip_icon.tsx index 78c2b0ec53c9f..d91bb4bc9add9 100644 --- a/x-pack/plugins/canvas/public/components/tooltip_icon/tooltip_icon.tsx +++ b/x-pack/plugins/canvas/public/components/tooltip_icon/tooltip_icon.tsx @@ -5,7 +5,7 @@ */ /* eslint react/forbid-elements: 0 */ -import React from 'react'; +import React, { FC } from 'react'; import PropTypes from 'prop-types'; import { EuiIconTip, PropsOf } from '@elastic/eui'; @@ -21,7 +21,7 @@ interface Props extends Omit { icon: IconType; } -export const TooltipIcon = ({ icon = IconType.info, ...rest }: Props) => { +export const TooltipIcon: FC = ({ icon = IconType.info, ...rest }) => { const icons = { [IconType.error]: { type: 'alert', color: 'danger' }, [IconType.warning]: { type: 'alert', color: 'warning' }, diff --git a/x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/interactive_workpad_page.js b/x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/interactive_workpad_page.js index 152da323e89ea..4089a1d709299 100644 --- a/x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/interactive_workpad_page.js +++ b/x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/interactive_workpad_page.js @@ -6,13 +6,15 @@ import React, { PureComponent } from 'react'; import { ElementWrapper } from '../../element_wrapper'; -import { AlignmentGuide } from '../../alignment_guide'; -import { DragBoxAnnotation } from '../../dragbox_annotation'; -import { HoverAnnotation } from '../../hover_annotation'; -import { TooltipAnnotation } from '../../tooltip_annotation'; -import { RotationHandle } from '../../rotation_handle'; -import { BorderConnection } from '../../border_connection'; -import { BorderResizeHandle } from '../../border_resize_handle'; +import { + AlignmentGuide, + DragBoxAnnotation, + HoverAnnotation, + TooltipAnnotation, + RotationHandle, + BorderConnection, + BorderResizeHandle, +} from '../../layout_annotations'; import { WorkpadShortcuts } from '../../workpad_shortcuts'; import { interactiveWorkpadPagePropTypes } from '../prop_types'; import { InteractionBoundary } from './interaction_boundary'; diff --git a/x-pack/plugins/canvas/public/state/reducers/workpad.js b/x-pack/plugins/canvas/public/state/reducers/workpad.js index fffcb69c451ed..1c210577e1014 100644 --- a/x-pack/plugins/canvas/public/state/reducers/workpad.js +++ b/x-pack/plugins/canvas/public/state/reducers/workpad.js @@ -40,11 +40,7 @@ export const workpadReducer = handleActions( [setName]: (workpadState, { payload }) => { platformService .getService() - .coreStart.chrome.recentlyAccessed.add( - `${APP_ROUTE_WORKPAD}/${workpadState.id}`, - payload, - workpadState.id - ); + .setRecentlyAccessed(`${APP_ROUTE_WORKPAD}/${workpadState.id}`, payload, workpadState.id); return { ...workpadState, name: payload }; }, diff --git a/x-pack/plugins/canvas/public/style/index.scss b/x-pack/plugins/canvas/public/style/index.scss index ccaf6f1c1a478..3937d7fc05544 100644 --- a/x-pack/plugins/canvas/public/style/index.scss +++ b/x-pack/plugins/canvas/public/style/index.scss @@ -8,15 +8,12 @@ @import '../apps/export/export/export_app'; // Canvas components -@import '../components/alignment_guide/alignment_guide'; @import '../components/arg_add/arg_add'; @import '../components/arg_add_popover/arg_add_popover'; @import '../components/arg_form/arg_form'; @import '../components/asset_manager/asset_manager'; @import '../components/asset_picker/asset_picker'; @import '../components/autocomplete/autocomplete'; -@import '../components/border_connection/border_connection'; -@import '../components/border_resize_handle/border_resize_handle'; @import '../components/clipboard/clipboard'; @import '../components/color_dot/color_dot'; @import '../components/color_palette/color_palette'; @@ -27,25 +24,22 @@ @import '../components/datatable/datatable'; @import '../components/debug/debug'; @import '../components/dom_preview/dom_preview'; -@import '../components/dragbox_annotation/dragbox_annotation'; @import '../components/element_card/element_card'; @import '../components/element_content/element_content'; @import '../components/expression/expression'; @import '../components/fullscreen/fullscreen'; @import '../components/function_form/function_form'; -@import '../components/hover_annotation/hover_annotation'; +@import '../components/layout_annotations/layout_annotations'; @import '../components/loading/loading'; @import '../components/navbar/navbar'; @import '../components/page_manager/page_manager'; @import '../components/positionable/positionable'; -@import '../components/rotation_handle/rotation_handle'; @import '../components/shape_preview/shape_preview'; @import '../components/shape_picker/shape_picker'; @import '../components/sidebar/sidebar'; @import '../components/sidebar_header/sidebar_header'; @import '../components/toolbar/toolbar'; @import '../components/toolbar/tray/tray'; -@import '../components/tooltip_annotation/tooltip_annotation'; @import '../components/workpad/workpad'; @import '../components/workpad_header/element_menu/element_menu'; @import '../components/workpad_header/share_menu/share_menu'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx index cba496ee0f212..ebe1c12e2a079 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx @@ -40,6 +40,9 @@ const testBedConfig: TestBedConfig = { initialEntries: [`/policies/edit/${POLICY_NAME}`], componentRoutePath: `/policies/edit/:policyName`, }, + defaultProps: { + getUrlForApp: () => {}, + }, }; const initTestBed = registerTestBed(EditPolicy, testBedConfig); diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.js b/x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.js index c249a45fe8ed2..943f663a025d8 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.js +++ b/x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.js @@ -120,7 +120,7 @@ describe('edit policy', () => { store = indexLifecycleManagementStore(); component = ( - + {}} /> ); store.dispatch(fetchedPolicies(policies)); @@ -155,7 +155,7 @@ describe('edit policy', () => { test('should show error when trying to save as new policy but using the same name', () => { component = ( - + {}} /> ); const rendered = mountWithIntl(component); diff --git a/x-pack/plugins/index_lifecycle_management/public/application/app.tsx b/x-pack/plugins/index_lifecycle_management/public/application/app.tsx index 11cd5d181f4ad..14b0e72317c66 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/app.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/app.tsx @@ -17,9 +17,11 @@ import { trackUiMetric } from './services/ui_metric'; export const App = ({ history, navigateToApp, + getUrlForApp, }: { history: ScopedHistory; navigateToApp: ApplicationStart['navigateToApp']; + getUrlForApp: ApplicationStart['getUrlForApp']; }) => { useEffect(() => trackUiMetric(METRIC_TYPE.LOADED, UIM_APP_LOAD), []); @@ -32,7 +34,10 @@ export const App = ({ path={`/policies`} render={(props) => } /> - + } + /> ); diff --git a/x-pack/plugins/index_lifecycle_management/public/application/index.tsx b/x-pack/plugins/index_lifecycle_management/public/application/index.tsx index eddbb5528ad84..31a9abdc7145e 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/index.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/index.tsx @@ -17,12 +17,13 @@ export const renderApp = ( element: Element, I18nContext: I18nStart['Context'], history: ScopedHistory, - navigateToApp: ApplicationStart['navigateToApp'] + navigateToApp: ApplicationStart['navigateToApp'], + getUrlForApp: ApplicationStart['getUrlForApp'] ): UnmountCallback => { render( - + , element diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js index 34d1c0f8de216..2b12eec953e11 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js @@ -123,6 +123,7 @@ export class DeletePhase extends PureComponent { setPhaseData(PHASE_WAIT_FOR_SNAPSHOT_POLICY, value)} + getUrlForApp={this.props.getUrlForApp} /> diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/snapshot_policies/snapshot_policies.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/snapshot_policies/snapshot_policies.tsx index a1304d9fb0125..76115fd914b01 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/snapshot_policies/snapshot_policies.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/snapshot_policies/snapshot_policies.tsx @@ -8,12 +8,14 @@ import React, { Fragment } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; +import { ApplicationStart } from 'kibana/public'; import { EuiButtonIcon, EuiCallOut, EuiComboBox, EuiComboBoxOptionOption, + EuiLink, EuiSpacer, } from '@elastic/eui'; @@ -22,8 +24,13 @@ import { useLoadSnapshotPolicies } from '../../../../services/api'; interface Props { value: string; onChange: (value: string) => void; + getUrlForApp: ApplicationStart['getUrlForApp']; } -export const SnapshotPolicies: React.FunctionComponent = ({ value, onChange }) => { +export const SnapshotPolicies: React.FunctionComponent = ({ + value, + onChange, + getUrlForApp, +}) => { const { error, isLoading, data, sendRequest } = useLoadSnapshotPolicies(); const policies = data.map((name: string) => ({ @@ -43,6 +50,12 @@ export const SnapshotPolicies: React.FunctionComponent = ({ value, onChan onChange(newValue); }; + const getUrlForSnapshotPolicyWizard = () => { + return getUrlForApp('management', { + path: `data/snapshot_restore/add_policy`, + }); + }; + let calloutContent; if (error) { calloutContent = ( @@ -50,7 +63,6 @@ export const SnapshotPolicies: React.FunctionComponent = ({ value, onChan = ({ value, onChan > + {i18n.translate( + 'xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesCreatedLink', + { + defaultMessage: 'Create a snapshot lifecycle policy', + } + )} + + ), + }} /> @@ -110,7 +134,6 @@ export const SnapshotPolicies: React.FunctionComponent = ({ value, onChan = ({ value, onChan > + {i18n.translate( + 'xpack.indexLifecycleMgmt.editPolicy.deletePhase.customPolicyLink', + { + defaultMessage: 'create a new policy', + } + )} + + ), + }} /> diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.js index 998143929afef..04ee2391f0d20 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.js +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.js @@ -308,6 +308,7 @@ export class EditPolicy extends Component { diff --git a/x-pack/plugins/index_lifecycle_management/public/plugin.tsx b/x-pack/plugins/index_lifecycle_management/public/plugin.tsx index 1d26aa53752a9..0ca62c10f55f3 100644 --- a/x-pack/plugins/index_lifecycle_management/public/plugin.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/plugin.tsx @@ -47,7 +47,7 @@ export class IndexLifecycleManagementPlugin { chrome: { docTitle }, i18n: { Context: I18nContext }, docLinks: { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION }, - application: { navigateToApp }, + application: { navigateToApp, getUrlForApp }, } = coreStart; docTitle.change(PLUGIN.TITLE); @@ -58,7 +58,14 @@ export class IndexLifecycleManagementPlugin { ); const { renderApp } = await import('./application'); - const unmountAppCallback = renderApp(element, I18nContext, history, navigateToApp); + + const unmountAppCallback = renderApp( + element, + I18nContext, + history, + navigateToApp, + getUrlForApp + ); return () => { docTitle.reset(); diff --git a/x-pack/plugins/infra/common/http_api/log_sources/get_log_source_status.ts b/x-pack/plugins/infra/common/http_api/log_sources/get_log_source_status.ts index b522d86987283..dc4e4f1ea6217 100644 --- a/x-pack/plugins/infra/common/http_api/log_sources/get_log_source_status.ts +++ b/x-pack/plugins/infra/common/http_api/log_sources/get_log_source_status.ts @@ -40,9 +40,17 @@ const logIndexFieldRT = rt.strict({ export type LogIndexField = rt.TypeOf; +const logIndexStatusRT = rt.keyof({ + missing: null, + empty: null, + available: null, +}); + +export type LogIndexStatus = rt.TypeOf; + const logSourceStatusRT = rt.strict({ logIndexFields: rt.array(logIndexFieldRT), - logIndicesExist: rt.boolean, + logIndexStatus: logIndexStatusRT, }); export type LogSourceStatus = rt.TypeOf; diff --git a/x-pack/plugins/infra/common/http_api/snapshot_api.ts b/x-pack/plugins/infra/common/http_api/snapshot_api.ts index 9ddbcb17089f3..11cb57238f917 100644 --- a/x-pack/plugins/infra/common/http_api/snapshot_api.ts +++ b/x-pack/plugins/infra/common/http_api/snapshot_api.ts @@ -107,6 +107,7 @@ export const SnapshotRequestRT = rt.intersection([ region: rt.string, filterQuery: rt.union([rt.string, rt.null]), includeTimeseries: rt.boolean, + overrideCompositeSize: rt.number, }), ]); diff --git a/x-pack/plugins/infra/public/alerting/inventory/components/expression.tsx b/x-pack/plugins/infra/public/alerting/inventory/components/expression.tsx index 8d36262b55792..583cbe18ee9db 100644 --- a/x-pack/plugins/infra/public/alerting/inventory/components/expression.tsx +++ b/x-pack/plugins/infra/public/alerting/inventory/components/expression.tsx @@ -364,7 +364,7 @@ export const Expressions: React.FC = (props) => { (props: Props) { /> - + (props: Props) { {currentView ? currentView.name : i18n.translate('xpack.infra.savedView.unknownView', { - defaultMessage: 'Unknown', + defaultMessage: 'No view seleted', })} diff --git a/x-pack/plugins/infra/public/metrics_overview_fetchers.test.ts b/x-pack/plugins/infra/public/metrics_overview_fetchers.test.ts index 88bc426e9a0f7..135b4ea9a5335 100644 --- a/x-pack/plugins/infra/public/metrics_overview_fetchers.test.ts +++ b/x-pack/plugins/infra/public/metrics_overview_fetchers.test.ts @@ -75,6 +75,7 @@ describe('Metrics UI Observability Homepage Functions', () => { groupBy: [], nodeType: 'host', includeTimeseries: true, + overrideCompositeSize: 5, timerange: { from: startTime.valueOf(), to: endTime.valueOf(), diff --git a/x-pack/plugins/infra/public/metrics_overview_fetchers.ts b/x-pack/plugins/infra/public/metrics_overview_fetchers.ts index 4eaf903e17608..79e0850635138 100644 --- a/x-pack/plugins/infra/public/metrics_overview_fetchers.ts +++ b/x-pack/plugins/infra/public/metrics_overview_fetchers.ts @@ -87,6 +87,7 @@ export const createMetricsFetchData = ( groupBy: [], nodeType: 'host', includeTimeseries: true, + overrideCompositeSize: 5, timerange: { from: start, to: end, diff --git a/x-pack/plugins/infra/public/pages/logs/stream/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page_content.tsx index b2a4ce65ab2b6..fe362dcf8da8c 100644 --- a/x-pack/plugins/infra/public/pages/logs/stream/page_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/stream/page_content.tsx @@ -25,7 +25,7 @@ export const StreamPageContent: React.FunctionComponent = () => { return ; } else if (hasFailedLoadingSource) { return ; - } else if (sourceStatus?.logIndicesExist) { + } else if (sourceStatus?.logIndexStatus !== 'missing') { return ; } else { return ; diff --git a/x-pack/plugins/infra/public/pages/logs/stream/page_providers.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page_providers.tsx index 82c21f663bc96..1a1cc13576556 100644 --- a/x-pack/plugins/infra/public/pages/logs/stream/page_providers.tsx +++ b/x-pack/plugins/infra/public/pages/logs/stream/page_providers.tsx @@ -107,7 +107,7 @@ export const LogsPageProviders: React.FunctionComponent = ({ children }) => { const { sourceStatus } = useLogSourceContext(); // The providers assume the source is loaded, so short-circuit them otherwise - if (!sourceStatus?.logIndicesExist) { + if (sourceStatus?.logIndexStatus === 'missing') { return <>{children}; } diff --git a/x-pack/plugins/infra/public/utils/logs_overview_fetchers.ts b/x-pack/plugins/infra/public/utils/logs_overview_fetchers.ts index 53f7e00a3354c..3716e618068a3 100644 --- a/x-pack/plugins/infra/public/utils/logs_overview_fetchers.ts +++ b/x-pack/plugins/infra/public/utils/logs_overview_fetchers.ts @@ -43,7 +43,7 @@ export function getLogsHasDataFetcher( return async () => { const [core] = await getStartServices(); const sourceStatus = await callFetchLogSourceStatusAPI(DEFAULT_SOURCE_ID, core.http.fetch); - return sourceStatus.data.logIndicesExist; + return sourceStatus.data.logIndexStatus === 'available'; }; } diff --git a/x-pack/plugins/infra/public/utils/logs_overview_fetches.test.ts b/x-pack/plugins/infra/public/utils/logs_overview_fetches.test.ts index 6f9e41fbd08f3..a2b4e162756e3 100644 --- a/x-pack/plugins/infra/public/utils/logs_overview_fetches.test.ts +++ b/x-pack/plugins/infra/public/utils/logs_overview_fetches.test.ts @@ -3,17 +3,18 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ + +import { CoreStart } from 'kibana/public'; import { coreMock } from 'src/core/public/mocks'; import { dataPluginMock } from 'src/plugins/data/public/mocks'; -import { CoreStart } from 'kibana/public'; -import { getLogsHasDataFetcher } from './logs_overview_fetchers'; -import { InfraClientStartDeps, InfraClientStartExports } from '../types'; import { callFetchLogSourceStatusAPI } from '../containers/logs/log_source/api/fetch_log_source_status'; +import { InfraClientStartDeps, InfraClientStartExports } from '../types'; +import { getLogsHasDataFetcher } from './logs_overview_fetchers'; -// Note -// Calls to `.mock*` functions will fail the typecheck because how jest does the mocking. -// The calls will be preluded with a `@ts-expect-error` jest.mock('../containers/logs/log_source/api/fetch_log_source_status'); +const mockedCallFetchLogSourceStatusAPI = callFetchLogSourceStatusAPI as jest.MockedFunction< + typeof callFetchLogSourceStatusAPI +>; function setup() { const core = coreMock.createStart(); @@ -33,36 +34,47 @@ function setup() { describe('Logs UI Observability Homepage Functions', () => { describe('getLogsHasDataFetcher()', () => { beforeEach(() => { - // @ts-expect-error - callFetchLogSourceStatusAPI.mockReset(); + mockedCallFetchLogSourceStatusAPI.mockReset(); }); - it('should return true when some index is present', async () => { + it('should return true when non-empty indices exist', async () => { const { mockedGetStartServices } = setup(); - // @ts-expect-error - callFetchLogSourceStatusAPI.mockResolvedValue({ - data: { logIndexFields: [], logIndicesExist: true }, + mockedCallFetchLogSourceStatusAPI.mockResolvedValue({ + data: { logIndexFields: [], logIndexStatus: 'available' }, }); const hasData = getLogsHasDataFetcher(mockedGetStartServices); const response = await hasData(); - expect(callFetchLogSourceStatusAPI).toHaveBeenCalledTimes(1); + expect(mockedCallFetchLogSourceStatusAPI).toHaveBeenCalledTimes(1); expect(response).toBe(true); }); - it('should return false when no index is present', async () => { + it('should return false when only empty indices exist', async () => { + const { mockedGetStartServices } = setup(); + + mockedCallFetchLogSourceStatusAPI.mockResolvedValue({ + data: { logIndexFields: [], logIndexStatus: 'empty' }, + }); + + const hasData = getLogsHasDataFetcher(mockedGetStartServices); + const response = await hasData(); + + expect(mockedCallFetchLogSourceStatusAPI).toHaveBeenCalledTimes(1); + expect(response).toBe(false); + }); + + it('should return false when no index exists', async () => { const { mockedGetStartServices } = setup(); - // @ts-expect-error - callFetchLogSourceStatusAPI.mockResolvedValue({ - data: { logIndexFields: [], logIndicesExist: false }, + mockedCallFetchLogSourceStatusAPI.mockResolvedValue({ + data: { logIndexFields: [], logIndexStatus: 'missing' }, }); const hasData = getLogsHasDataFetcher(mockedGetStartServices); const response = await hasData(); - expect(callFetchLogSourceStatusAPI).toHaveBeenCalledTimes(1); + expect(mockedCallFetchLogSourceStatusAPI).toHaveBeenCalledTimes(1); expect(response).toBe(false); }); }); diff --git a/x-pack/plugins/infra/server/features.ts b/x-pack/plugins/infra/server/features.ts index fdbd1ec894022..3e32cebf19ac2 100644 --- a/x-pack/plugins/infra/server/features.ts +++ b/x-pack/plugins/infra/server/features.ts @@ -19,6 +19,9 @@ export const METRICS_FEATURE = { navLinkId: 'metrics', app: ['infra', 'metrics', 'kibana'], catalogue: ['infraops'], + management: { + insightsAndAlerting: ['triggersActions'], + }, alerting: [METRIC_THRESHOLD_ALERT_TYPE_ID, METRIC_INVENTORY_THRESHOLD_ALERT_TYPE_ID], privileges: { all: { @@ -32,7 +35,10 @@ export const METRICS_FEATURE = { alerting: { all: [METRIC_THRESHOLD_ALERT_TYPE_ID, METRIC_INVENTORY_THRESHOLD_ALERT_TYPE_ID], }, - ui: ['show', 'configureSource', 'save', 'alerting:show'], + management: { + insightsAndAlerting: ['triggersActions'], + }, + ui: ['show', 'configureSource', 'save'], }, read: { app: ['infra', 'metrics', 'kibana'], @@ -45,7 +51,10 @@ export const METRICS_FEATURE = { alerting: { all: [METRIC_THRESHOLD_ALERT_TYPE_ID, METRIC_INVENTORY_THRESHOLD_ALERT_TYPE_ID], }, - ui: ['show', 'alerting:show'], + management: { + insightsAndAlerting: ['triggersActions'], + }, + ui: ['show'], }, }, }; diff --git a/x-pack/plugins/infra/server/graphql/source_status/resolvers.ts b/x-pack/plugins/infra/server/graphql/source_status/resolvers.ts index 848d66058e64c..bd92dd0f7da8b 100644 --- a/x-pack/plugins/infra/server/graphql/source_status/resolvers.ts +++ b/x-pack/plugins/infra/server/graphql/source_status/resolvers.ts @@ -73,7 +73,7 @@ export const createSourceStatusResolvers = (libs: { return await libs.sourceStatus.hasLogAlias(req, source.id); }, async logIndicesExist(source, args, { req }) { - return await libs.sourceStatus.hasLogIndices(req, source.id); + return (await libs.sourceStatus.getLogIndexStatus(req, source.id)) !== 'missing'; }, async logIndices(source, args, { req }) { return await libs.sourceStatus.getLogIndexNames(req, source.id); diff --git a/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts b/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts index 018e5098a4291..117749ae87bbe 100644 --- a/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts +++ b/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts @@ -38,6 +38,7 @@ export interface CallWithRequestParams extends GenericParams { fields?: string | string[]; path?: string; query?: string | object; + track_total_hits?: boolean | number; } export type InfraResponse = Lifecycle.ReturnValue; diff --git a/x-pack/plugins/infra/server/lib/adapters/source_status/elasticsearch_source_status_adapter.ts b/x-pack/plugins/infra/server/lib/adapters/source_status/elasticsearch_source_status_adapter.ts index 9bc58604f12a5..2a61e64c94fcd 100644 --- a/x-pack/plugins/infra/server/lib/adapters/source_status/elasticsearch_source_status_adapter.ts +++ b/x-pack/plugins/infra/server/lib/adapters/source_status/elasticsearch_source_status_adapter.ts @@ -5,7 +5,7 @@ */ import { RequestHandlerContext } from 'src/core/server'; -import { InfraSourceStatusAdapter } from '../../source_status'; +import { InfraSourceStatusAdapter, SourceIndexStatus } from '../../source_status'; import { InfraDatabaseGetIndicesResponse } from '../framework'; import { KibanaFramework } from '../framework/kibana_framework_adapter'; @@ -40,7 +40,10 @@ export class InfraElasticsearchSourceStatusAdapter implements InfraSourceStatusA }); } - public async hasIndices(requestContext: RequestHandlerContext, indexNames: string) { + public async getIndexStatus( + requestContext: RequestHandlerContext, + indexNames: string + ): Promise { return await this.framework .callWithRequest(requestContext, 'search', { ignore_unavailable: true, @@ -48,12 +51,23 @@ export class InfraElasticsearchSourceStatusAdapter implements InfraSourceStatusA index: indexNames, size: 0, terminate_after: 1, + track_total_hits: 1, }) .then( - (response) => response._shards.total > 0, + (response) => { + if (response._shards.total <= 0) { + return 'missing'; + } + + if (response.hits.total.value > 0) { + return 'available'; + } + + return 'empty'; + }, (err) => { if (err.status === 404) { - return false; + return 'missing'; } throw err; } diff --git a/x-pack/plugins/infra/server/lib/alerting/common/messages.ts b/x-pack/plugins/infra/server/lib/alerting/common/messages.ts index 4add0ee9af5d3..18b1460d643d5 100644 --- a/x-pack/plugins/infra/server/lib/alerting/common/messages.ts +++ b/x-pack/plugins/infra/server/lib/alerting/common/messages.ts @@ -29,6 +29,9 @@ export const stateToAlertMessage = { }), }; +const toNumber = (value: number | string) => + typeof value === 'string' ? parseFloat(value) : value; + const comparatorToI18n = (comparator: Comparator, threshold: number[], currentValue: number) => { const gtText = i18n.translate('xpack.infra.metrics.alerting.threshold.gtComparator', { defaultMessage: 'greater than', @@ -54,10 +57,11 @@ const comparatorToI18n = (comparator: Comparator, threshold: number[], currentVa case Comparator.LT: return ltText; case Comparator.GT_OR_EQ: - case Comparator.LT_OR_EQ: + case Comparator.LT_OR_EQ: { if (threshold[0] === currentValue) return eqText; else if (threshold[0] < currentValue) return ltText; return gtText; + } } }; @@ -88,7 +92,7 @@ const recoveredComparatorToI18n = ( } }; -const thresholdToI18n = ([a, b]: number[]) => { +const thresholdToI18n = ([a, b]: Array) => { if (typeof b === 'undefined') return a; return i18n.translate('xpack.infra.metrics.alerting.threshold.thresholdRange', { defaultMessage: '{a} and {b}', @@ -99,15 +103,15 @@ const thresholdToI18n = ([a, b]: number[]) => { export const buildFiredAlertReason: (alertResult: { metric: string; comparator: Comparator; - threshold: number[]; - currentValue: number; + threshold: Array; + currentValue: number | string; }) => string = ({ metric, comparator, threshold, currentValue }) => i18n.translate('xpack.infra.metrics.alerting.threshold.firedAlertReason', { defaultMessage: '{metric} is {comparator} a threshold of {threshold} (current value is {currentValue})', values: { metric, - comparator: comparatorToI18n(comparator, threshold, currentValue), + comparator: comparatorToI18n(comparator, threshold.map(toNumber), toNumber(currentValue)), threshold: thresholdToI18n(threshold), currentValue, }, @@ -116,15 +120,19 @@ export const buildFiredAlertReason: (alertResult: { export const buildRecoveredAlertReason: (alertResult: { metric: string; comparator: Comparator; - threshold: number[]; - currentValue: number; + threshold: Array; + currentValue: number | string; }) => string = ({ metric, comparator, threshold, currentValue }) => i18n.translate('xpack.infra.metrics.alerting.threshold.recoveredAlertReason', { defaultMessage: '{metric} is now {comparator} a threshold of {threshold} (current value is {currentValue})', values: { metric, - comparator: recoveredComparatorToI18n(comparator, threshold, currentValue), + comparator: recoveredComparatorToI18n( + comparator, + threshold.map(toNumber), + toNumber(currentValue) + ), threshold: thresholdToI18n(threshold), currentValue, }, @@ -150,3 +158,56 @@ export const buildErrorAlertReason = (metric: string) => metric, }, }); + +export const groupActionVariableDescription = i18n.translate( + 'xpack.infra.metrics.alerting.groupActionVariableDescription', + { + defaultMessage: 'Name of the group reporting data', + } +); + +export const alertStateActionVariableDescription = i18n.translate( + 'xpack.infra.metrics.alerting.alertStateActionVariableDescription', + { + defaultMessage: 'Current state of the alert', + } +); + +export const reasonActionVariableDescription = i18n.translate( + 'xpack.infra.metrics.alerting.reasonActionVariableDescription', + { + defaultMessage: + 'A description of why the alert is in this state, including which metrics have crossed which thresholds', + } +); + +export const timestampActionVariableDescription = i18n.translate( + 'xpack.infra.metrics.alerting.timestampDescription', + { + defaultMessage: 'A timestamp of when the alert was detected.', + } +); + +export const valueActionVariableDescription = i18n.translate( + 'xpack.infra.metrics.alerting.valueActionVariableDescription', + { + defaultMessage: + 'The value of the metric in the specified condition. Usage: (ctx.value.condition0, ctx.value.condition1, etc...).', + } +); + +export const metricActionVariableDescription = i18n.translate( + 'xpack.infra.metrics.alerting.metricActionVariableDescription', + { + defaultMessage: + 'The metric name in the specified condition. Usage: (ctx.metric.condition0, ctx.metric.condition1, etc...).', + } +); + +export const thresholdActionVariableDescription = i18n.translate( + 'xpack.infra.metrics.alerting.thresholdActionVariableDescription', + { + defaultMessage: + 'The threshold value of the metric for the specified condition. Usage: (ctx.threshold.condition0, ctx.threshold.condition1, etc...).', + } +); diff --git a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/evaluate_condition.ts b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/evaluate_condition.ts index c991e482a62e5..5c31c78b10fa9 100644 --- a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/evaluate_condition.ts +++ b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/evaluate_condition.ts @@ -112,6 +112,8 @@ const getData = async ( try { const { nodes } = await snapshot.getNodes(esClient, options); + if (!nodes.length) return { [UNGROUPED_FACTORY_KEY]: null }; // No Data state + return nodes.reduce((acc, n) => { const nodePathItem = last(n.path) as any; const m = first(n.metrics); diff --git a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.ts b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.ts index 0a3910f2c5d7c..60eee49a5010d 100644 --- a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.ts +++ b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.ts @@ -79,6 +79,7 @@ export const createInventoryMetricThresholdExecutor = (libs: InfraBackendLibs) = const resultWithVerboseMetricName = { ...result[item], metric: toMetricOpt(result[item].metric)?.text || result[item].metric, + currentValue: formatMetric(result[item].metric, result[item].currentValue), }; return buildFiredAlertReason(resultWithVerboseMetricName); }) diff --git a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/register_inventory_metric_threshold_alert_type.ts b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/register_inventory_metric_threshold_alert_type.ts index fa5277cb09987..f664a59acd165 100644 --- a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/register_inventory_metric_threshold_alert_type.ts +++ b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/register_inventory_metric_threshold_alert_type.ts @@ -3,7 +3,6 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { i18n } from '@kbn/i18n'; import { schema } from '@kbn/config-schema'; import { createInventoryMetricThresholdExecutor, @@ -12,6 +11,15 @@ import { import { METRIC_INVENTORY_THRESHOLD_ALERT_TYPE_ID, Comparator } from './types'; import { InfraBackendLibs } from '../../infra_types'; import { oneOfLiterals, validateIsStringElasticsearchJSONFilter } from '../common/utils'; +import { + groupActionVariableDescription, + alertStateActionVariableDescription, + reasonActionVariableDescription, + timestampActionVariableDescription, + valueActionVariableDescription, + metricActionVariableDescription, + thresholdActionVariableDescription, +} from '../common/messages'; const condition = schema.object({ threshold: schema.arrayOf(schema.number()), @@ -44,45 +52,13 @@ export const registerMetricInventoryThresholdAlertType = (libs: InfraBackendLibs executor: createInventoryMetricThresholdExecutor(libs), actionVariables: { context: [ - { - name: 'group', - description: i18n.translate( - 'xpack.infra.metrics.alerting.threshold.alerting.groupActionVariableDescription', - { - defaultMessage: 'Name of the group reporting data', - } - ), - }, - { - name: 'valueOf', - description: i18n.translate( - 'xpack.infra.metrics.alerting.threshold.alerting.valueOfActionVariableDescription', - { - defaultMessage: - 'Record of the current value of the watched metric; grouped by condition, i.e valueOf.condition0, valueOf.condition1, etc.', - } - ), - }, - { - name: 'thresholdOf', - description: i18n.translate( - 'xpack.infra.metrics.alerting.threshold.alerting.thresholdOfActionVariableDescription', - { - defaultMessage: - 'Record of the alerting threshold; grouped by condition, i.e thresholdOf.condition0, thresholdOf.condition1, etc.', - } - ), - }, - { - name: 'metricOf', - description: i18n.translate( - 'xpack.infra.metrics.alerting.threshold.alerting.metricOfActionVariableDescription', - { - defaultMessage: - 'Record of the watched metric; grouped by condition, i.e metricOf.condition0, metricOf.condition1, etc.', - } - ), - }, + { name: 'group', description: groupActionVariableDescription }, + { name: 'alertState', description: alertStateActionVariableDescription }, + { name: 'reason', description: reasonActionVariableDescription }, + { name: 'timestamp', description: timestampActionVariableDescription }, + { name: 'value', description: valueActionVariableDescription }, + { name: 'metric', description: metricActionVariableDescription }, + { name: 'threshold', description: thresholdActionVariableDescription }, ], }, }); diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/evaluate_alert.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/evaluate_alert.ts index d862f70c47cae..ca46f6cc16547 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/evaluate_alert.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/evaluate_alert.ts @@ -67,10 +67,13 @@ export const evaluateAlert = ( currentValue: Array.isArray(points) ? last(points)?.value : NaN, timestamp: Array.isArray(points) ? last(points)?.key : NaN, shouldFire: Array.isArray(points) - ? points.map((point) => comparisonFunction(point.value, threshold)) + ? points.map( + (point) => + typeof point.value === 'number' && comparisonFunction(point.value, threshold) + ) : [false], - isNoData: points === null, - isError: isNaN(points), + isNoData: (Array.isArray(points) ? last(points)?.value : points) === null, + isError: isNaN(Array.isArray(points) ? last(points)?.value : points), }; }); }) @@ -172,7 +175,7 @@ const getValuesFromAggregations = ( } return buckets.map((bucket) => ({ key: bucket.key_as_string, - value: bucket.aggregatedValue.value, + value: bucket.aggregatedValue?.value ?? null, })); } catch (e) { return NaN; // Error state diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts index 9a46925a51762..fa705798baf7a 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts @@ -318,6 +318,31 @@ describe('The metric threshold alert type', () => { }); }); + describe("querying a rate-aggregated metric that hasn't reported data", () => { + const instanceID = '*'; + const execute = () => + executor({ + services, + params: { + criteria: [ + { + ...baseCriterion, + comparator: Comparator.GT, + threshold: 1, + metric: 'test.metric.3', + aggType: 'rate', + }, + ], + alertOnNoData: true, + }, + }); + test('sends a No Data alert', async () => { + await execute(); + expect(mostRecentAction(instanceID).id).toBe(FIRED_ACTIONS.id); + expect(getState(instanceID).alertState).toBe(AlertStates.NO_DATA); + }); + }); + // describe('querying a metric that later recovers', () => { // const instanceID = '*'; // const execute = (threshold: number[]) => @@ -401,7 +426,9 @@ services.callCluster.mockImplementation(async (_: string, { body, index }: any) if (metric === 'test.metric.2') { return mocks.alternateMetricResponse; } else if (metric === 'test.metric.3') { - return mocks.emptyMetricResponse; + return body.aggs.aggregatedIntervals.aggregations.aggregatedValue_max + ? mocks.emptyRateResponse + : mocks.emptyMetricResponse; } return mocks.basicMetricResponse; }); diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts index 51a127e9345b4..45b1df2f03ea1 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts @@ -3,13 +3,21 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { i18n } from '@kbn/i18n'; import { schema } from '@kbn/config-schema'; import { METRIC_EXPLORER_AGGREGATIONS } from '../../../../common/http_api/metrics_explorer'; import { createMetricThresholdExecutor, FIRED_ACTIONS } from './metric_threshold_executor'; import { METRIC_THRESHOLD_ALERT_TYPE_ID, Comparator } from './types'; import { InfraBackendLibs } from '../../infra_types'; import { oneOfLiterals, validateIsStringElasticsearchJSONFilter } from '../common/utils'; +import { + groupActionVariableDescription, + alertStateActionVariableDescription, + reasonActionVariableDescription, + timestampActionVariableDescription, + valueActionVariableDescription, + metricActionVariableDescription, + thresholdActionVariableDescription, +} from '../common/messages'; export function registerMetricThresholdAlertType(libs: InfraBackendLibs) { const baseCriterion = { @@ -31,59 +39,6 @@ export function registerMetricThresholdAlertType(libs: InfraBackendLibs) { metric: schema.never(), }); - const groupActionVariableDescription = i18n.translate( - 'xpack.infra.metrics.alerting.threshold.alerting.groupActionVariableDescription', - { - defaultMessage: 'Name of the group reporting data', - } - ); - - const alertStateActionVariableDescription = i18n.translate( - 'xpack.infra.metrics.alerting.threshold.alerting.alertStateActionVariableDescription', - { - defaultMessage: 'Current state of the alert', - } - ); - - const reasonActionVariableDescription = i18n.translate( - 'xpack.infra.metrics.alerting.threshold.alerting.reasonActionVariableDescription', - { - defaultMessage: - 'A description of why the alert is in this state, including which metrics have crossed which thresholds', - } - ); - - const timestampActionVariableDescription = i18n.translate( - 'xpack.infra.metrics.alerting.threshold.alerting.timestampDescription', - { - defaultMessage: 'A timestamp of when the alert was detected.', - } - ); - - const valueActionVariableDescription = i18n.translate( - 'xpack.infra.metrics.alerting.threshold.alerting.valueActionVariableDescription', - { - defaultMessage: - 'The value of the metric in the specified condition. Usage: (ctx.value.condition0, ctx.value.condition1, etc...).', - } - ); - - const metricActionVariableDescription = i18n.translate( - 'xpack.infra.metrics.alerting.threshold.alerting.metricActionVariableDescription', - { - defaultMessage: - 'The metric name in the specified condition. Usage: (ctx.metric.condition0, ctx.metric.condition1, etc...).', - } - ); - - const thresholdActionVariableDescription = i18n.translate( - 'xpack.infra.metrics.alerting.threshold.alerting.thresholdActionVariableDescription', - { - defaultMessage: - 'The threshold value of the metric for the specified condition. Usage: (ctx.threshold.condition0, ctx.threshold.condition1, etc...).', - } - ); - return { id: METRIC_THRESHOLD_ALERT_TYPE_ID, name: 'Metric threshold', diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/test_mocks.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/test_mocks.ts index c7e53eb2008f5..5c2f76cea87c4 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/test_mocks.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/test_mocks.ts @@ -62,6 +62,19 @@ export const emptyMetricResponse = { }, }; +export const emptyRateResponse = { + aggregations: { + aggregatedIntervals: { + buckets: [ + { + doc_count: 2, + aggregatedValue_max: { value: null }, + }, + ], + }, + }, +}; + export const basicCompositeResponse = { aggregations: { groupings: { diff --git a/x-pack/plugins/infra/server/lib/create_search_client.ts b/x-pack/plugins/infra/server/lib/create_search_client.ts new file mode 100644 index 0000000000000..d79d20b502e94 --- /dev/null +++ b/x-pack/plugins/infra/server/lib/create_search_client.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { RequestHandlerContext } from 'src/core/server'; +import { CallWithRequestParams, InfraDatabaseSearchResponse } from './adapters/framework'; +import { KibanaFramework } from './adapters/framework/kibana_framework_adapter'; + +export const createSearchClient = ( + requestContext: RequestHandlerContext, + framework: KibanaFramework +) => ( + opts: CallWithRequestParams +): Promise> => + framework.callWithRequest(requestContext, 'search', opts); diff --git a/x-pack/plugins/infra/server/lib/snapshot/response_helpers.test.ts b/x-pack/plugins/infra/server/lib/snapshot/response_helpers.test.ts index 20220aef1133d..74840afc157d2 100644 --- a/x-pack/plugins/infra/server/lib/snapshot/response_helpers.test.ts +++ b/x-pack/plugins/infra/server/lib/snapshot/response_helpers.test.ts @@ -4,7 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import { isIPv4, getIPFromBucket, InfraSnapshotNodeGroupByBucket } from './response_helpers'; +import { + isIPv4, + getIPFromBucket, + InfraSnapshotNodeGroupByBucket, + getMetricValueFromBucket, + InfraSnapshotMetricsBucket, +} from './response_helpers'; describe('InfraOps ResponseHelpers', () => { describe('isIPv4', () => { @@ -74,4 +80,40 @@ describe('InfraOps ResponseHelpers', () => { expect(getIPFromBucket('host', bucket)).toBe(null); }); }); + + describe('getMetricValueFromBucket', () => { + it('should return the value of a bucket with data', () => { + expect(getMetricValueFromBucket('custom', testBucket, 1)).toBe(0.5); + }); + it('should return the normalized value of a bucket with data', () => { + expect(getMetricValueFromBucket('cpu', testNormalizedBucket, 1)).toBe(50); + }); + it('should return null for a bucket with no data', () => { + expect(getMetricValueFromBucket('custom', testEmptyBucket, 1)).toBe(null); + }); + }); }); + +// Hack to get around TypeScript +const buckets = [ + { + key: 'a', + doc_count: 1, + custom_1: { + value: 0.5, + }, + }, + { + key: 'b', + doc_count: 1, + cpu: { + value: 0.5, + normalized_value: 50, + }, + }, + { + key: 'c', + doc_count: 0, + }, +] as InfraSnapshotMetricsBucket[]; +const [testBucket, testNormalizedBucket, testEmptyBucket] = buckets; diff --git a/x-pack/plugins/infra/server/lib/snapshot/response_helpers.ts b/x-pack/plugins/infra/server/lib/snapshot/response_helpers.ts index 317a7da95ce6b..646ce9f2409af 100644 --- a/x-pack/plugins/infra/server/lib/snapshot/response_helpers.ts +++ b/x-pack/plugins/infra/server/lib/snapshot/response_helpers.ts @@ -158,14 +158,15 @@ const findLastFullBucket = ( }, last(buckets)); }; -const getMetricValueFromBucket = ( +export const getMetricValueFromBucket = ( type: SnapshotMetricType, bucket: InfraSnapshotMetricsBucket, index: number ) => { const key = type === 'custom' ? `custom_${index}` : type; const metric = bucket[key]; - return (metric && (metric.normalized_value || metric.value)) || 0; + const value = metric && (metric.normalized_value || metric.value); + return isFinite(value) ? value : null; }; function calculateMax( diff --git a/x-pack/plugins/infra/server/lib/snapshot/snapshot.ts b/x-pack/plugins/infra/server/lib/snapshot/snapshot.ts index 9ca10d5e39da7..5f359b0523d9f 100644 --- a/x-pack/plugins/infra/server/lib/snapshot/snapshot.ts +++ b/x-pack/plugins/infra/server/lib/snapshot/snapshot.ts @@ -86,7 +86,7 @@ const requestGroupedNodes = async ( aggregations: { nodes: { composite: { - size: SNAPSHOT_COMPOSITE_REQUEST_SIZE, + size: options.overrideCompositeSize || SNAPSHOT_COMPOSITE_REQUEST_SIZE, sources: getGroupedNodesSources(options), }, aggs: { @@ -142,7 +142,7 @@ const requestNodeMetrics = async ( aggregations: { nodes: { composite: { - size: SNAPSHOT_COMPOSITE_REQUEST_SIZE, + size: options.overrideCompositeSize || SNAPSHOT_COMPOSITE_REQUEST_SIZE, sources: getMetricsSources(options), }, aggregations: { diff --git a/x-pack/plugins/infra/server/lib/source_status.ts b/x-pack/plugins/infra/server/lib/source_status.ts index 9bb953845e5a1..c383d01933562 100644 --- a/x-pack/plugins/infra/server/lib/source_status.ts +++ b/x-pack/plugins/infra/server/lib/source_status.ts @@ -69,19 +69,19 @@ export class InfraSourceStatus { ); return hasAlias; } - public async hasLogIndices( + public async getLogIndexStatus( requestContext: RequestHandlerContext, sourceId: string - ): Promise { + ): Promise { const sourceConfiguration = await this.libs.sources.getSourceConfiguration( requestContext.core.savedObjects.client, sourceId ); - const hasIndices = await this.adapter.hasIndices( + const indexStatus = await this.adapter.getIndexStatus( requestContext, sourceConfiguration.configuration.logAlias ); - return hasIndices; + return indexStatus; } public async hasMetricIndices( requestContext: RequestHandlerContext, @@ -91,16 +91,21 @@ export class InfraSourceStatus { requestContext.core.savedObjects.client, sourceId ); - const hasIndices = await this.adapter.hasIndices( + const indexStatus = await this.adapter.getIndexStatus( requestContext, sourceConfiguration.configuration.metricAlias ); - return hasIndices; + return indexStatus !== 'missing'; } } +export type SourceIndexStatus = 'missing' | 'empty' | 'available'; + export interface InfraSourceStatusAdapter { getIndexNames(requestContext: RequestHandlerContext, aliasName: string): Promise; hasAlias(requestContext: RequestHandlerContext, aliasName: string): Promise; - hasIndices(requestContext: RequestHandlerContext, indexNames: string): Promise; + getIndexStatus( + requestContext: RequestHandlerContext, + indexNames: string + ): Promise; } diff --git a/x-pack/plugins/infra/server/lib/sources/has_data.ts b/x-pack/plugins/infra/server/lib/sources/has_data.ts new file mode 100644 index 0000000000000..79b1375059dcb --- /dev/null +++ b/x-pack/plugins/infra/server/lib/sources/has_data.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ESSearchClient } from '../snapshot'; + +export const hasData = async (index: string, client: ESSearchClient) => { + const params = { + index, + allowNoIndices: true, + terminate_after: 1, + ignoreUnavailable: true, + body: { + size: 0, + }, + }; + const results = await client(params); + return results.hits.total.value !== 0; +}; diff --git a/x-pack/plugins/infra/server/routes/log_sources/status.ts b/x-pack/plugins/infra/server/routes/log_sources/status.ts index 4cd85ecfe23c1..193c3541d740b 100644 --- a/x-pack/plugins/infra/server/routes/log_sources/status.ts +++ b/x-pack/plugins/infra/server/routes/log_sources/status.ts @@ -31,16 +31,17 @@ export const initLogSourceStatusRoutes = ({ const { sourceId } = request.params; try { - const logIndicesExist = await sourceStatus.hasLogIndices(requestContext, sourceId); - const logIndexFields = logIndicesExist - ? await fields.getFields(requestContext, sourceId, InfraIndexType.LOGS) - : []; + const logIndexStatus = await sourceStatus.getLogIndexStatus(requestContext, sourceId); + const logIndexFields = + logIndexStatus !== 'missing' + ? await fields.getFields(requestContext, sourceId, InfraIndexType.LOGS) + : []; return response.ok({ body: getLogSourceStatusSuccessResponsePayloadRT.encode({ data: { - logIndicesExist, logIndexFields, + logIndexStatus, }, }), }); diff --git a/x-pack/plugins/infra/server/routes/snapshot/index.ts b/x-pack/plugins/infra/server/routes/snapshot/index.ts index 7c81c6eef675f..00bc1e74ea871 100644 --- a/x-pack/plugins/infra/server/routes/snapshot/index.ts +++ b/x-pack/plugins/infra/server/routes/snapshot/index.ts @@ -13,7 +13,7 @@ import { UsageCollector } from '../../usage/usage_collector'; import { parseFilterQuery } from '../../utils/serialized_query'; import { SnapshotRequestRT, SnapshotNodeResponseRT } from '../../../common/http_api/snapshot_api'; import { throwErrors } from '../../../common/runtime_types'; -import { CallWithRequestParams, InfraDatabaseSearchResponse } from '../../lib/adapters/framework'; +import { createSearchClient } from '../../lib/create_search_client'; const escapeHatch = schema.object({}, { unknowns: 'allow' }); @@ -40,6 +40,7 @@ export const initSnapshotRoute = (libs: InfraBackendLibs) => { accountId, region, includeTimeseries, + overrideCompositeSize, } = pipe( SnapshotRequestRT.decode(request.body), fold(throwErrors(Boom.badRequest), identity) @@ -59,14 +60,11 @@ export const initSnapshotRoute = (libs: InfraBackendLibs) => { metrics, timerange, includeTimeseries, + overrideCompositeSize, }; - const searchES = ( - opts: CallWithRequestParams - ): Promise> => - framework.callWithRequest(requestContext, 'search', opts); - - const nodesWithInterval = await libs.snapshot.getNodes(searchES, options); + const client = createSearchClient(requestContext, framework); + const nodesWithInterval = await libs.snapshot.getNodes(client, options); return response.ok({ body: SnapshotNodeResponseRT.encode(nodesWithInterval), }); diff --git a/x-pack/plugins/infra/server/routes/source/index.ts b/x-pack/plugins/infra/server/routes/source/index.ts index 2843897071e19..9ff3902f1eae7 100644 --- a/x-pack/plugins/infra/server/routes/source/index.ts +++ b/x-pack/plugins/infra/server/routes/source/index.ts @@ -7,6 +7,8 @@ import { schema } from '@kbn/config-schema'; import { SourceResponseRuntimeType } from '../../../common/http_api/source_api'; import { InfraBackendLibs } from '../../lib/infra_types'; import { InfraIndexType } from '../../graphql/types'; +import { hasData } from '../../lib/sources/has_data'; +import { createSearchClient } from '../../lib/create_search_client'; const typeToInfraIndexType = (value: string | undefined) => { switch (value) { @@ -37,9 +39,9 @@ export const initSourceRoute = (libs: InfraBackendLibs) => { try { const { type, sourceId } = request.params; - const [source, logIndicesExist, metricIndicesExist, indexFields] = await Promise.all([ + const [source, logIndexStatus, metricIndicesExist, indexFields] = await Promise.all([ libs.sources.getSourceConfiguration(requestContext.core.savedObjects.client, sourceId), - libs.sourceStatus.hasLogIndices(requestContext, sourceId), + libs.sourceStatus.getLogIndexStatus(requestContext, sourceId), libs.sourceStatus.hasMetricIndices(requestContext, sourceId), libs.fields.getFields(requestContext, sourceId, typeToInfraIndexType(type)), ]); @@ -49,7 +51,7 @@ export const initSourceRoute = (libs: InfraBackendLibs) => { } const status = { - logIndicesExist, + logIndicesExist: logIndexStatus !== 'missing', metricIndicesExist, indexFields, }; @@ -80,13 +82,17 @@ export const initSourceRoute = (libs: InfraBackendLibs) => { try { const { type, sourceId } = request.params; - const hasData = - type === 'metrics' - ? await libs.sourceStatus.hasMetricIndices(requestContext, sourceId) - : await libs.sourceStatus.hasLogIndices(requestContext, sourceId); + const client = createSearchClient(requestContext, framework); + const source = await libs.sources.getSourceConfiguration( + requestContext.core.savedObjects.client, + sourceId + ); + const indexPattern = + type === 'metrics' ? source.configuration.metricAlias : source.configuration.logAlias; + const results = await hasData(indexPattern, client); return response.ok({ - body: { hasData }, + body: { hasData: results }, }); } catch (error) { return response.internalError({ diff --git a/x-pack/plugins/ingest_manager/common/openapi/spec_oas3.json b/x-pack/plugins/ingest_manager/common/openapi/spec_oas3.json index e16edac5ddb7a..cfae2c450c824 100644 --- a/x-pack/plugins/ingest_manager/common/openapi/spec_oas3.json +++ b/x-pack/plugins/ingest_manager/common/openapi/spec_oas3.json @@ -922,7 +922,7 @@ }, "parameters": [] }, - "/packageConfigs": { + "/package_configs": { "get": { "summary": "PackageConfigs - List", "tags": [], @@ -1237,7 +1237,7 @@ ] } }, - "/packageConfigs/{packageConfigId}": { + "/package_configs/{packageConfigId}": { "get": { "summary": "PackageConfigs - Info", "tags": [], diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/enrollment_instructions/manual/index.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/enrollment_instructions/manual/index.tsx index 78f4f73cf18be..fe11c4cb08d13 100644 --- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/enrollment_instructions/manual/index.tsx +++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/enrollment_instructions/manual/index.tsx @@ -5,7 +5,8 @@ */ import React from 'react'; -import { EuiText, EuiSpacer, EuiCode, EuiCodeBlock, EuiCopy, EuiButton } from '@elastic/eui'; +import styled from 'styled-components'; +import { EuiText, EuiSpacer, EuiCode, EuiTitle, EuiCodeBlock } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { EnrollmentAPIKey } from '../../../types'; @@ -15,42 +16,86 @@ interface Props { kibanaCASha256?: string; } +// Otherwise the copy button is over the text +const CommandCode = styled.pre({ + overflow: 'scroll', +}); + export const ManualInstructions: React.FunctionComponent = ({ kibanaUrl, apiKey, kibanaCASha256, }) => { - const command = ` -./elastic-agent enroll ${kibanaUrl} ${apiKey.api_key}${ + const enrollArgs = `${kibanaUrl} ${apiKey.api_key}${ kibanaCASha256 ? ` --ca_sha256=${kibanaCASha256}` : '' - } + }`; + const macOsLinuxTarCommand = `./elastic-agent enroll ${enrollArgs} ./elastic-agent run`; + + const linuxDebRpmCommand = `./elastic-agent enroll ${enrollArgs} +systemctl enable elastic-agent +systemctl start elastic-agent`; + + const windowsCommand = `./elastic-agent enroll ${enrollArgs} +./install-service-elastic-agent.ps1`; + return ( <> + + + +

+ +

+
+ + + {windowsCommand} + + + +

+ +

+
+ + + {linuxDebRpmCommand} + + + +

+ +

+
+ + + agent enroll, + command: ./elastic-agent run, }} /> - - -
{command}
+ + + {macOsLinuxTarCommand} - - - {(copy) => ( - - - - )} - ); }; diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_package_config_page/components/package_config_input_config.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_package_config_page/components/package_config_input_config.tsx index 98f04dbd92659..fd3a64bc760a0 100644 --- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_package_config_page/components/package_config_input_config.tsx +++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/create_package_config_page/components/package_config_input_config.tsx @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React, { useState, Fragment, memo, useMemo } from 'react'; +import styled from 'styled-components'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFlexGrid, @@ -21,6 +22,10 @@ import { } from '../services'; import { PackageConfigInputVarField } from './package_config_input_var_field'; +const FlexItemWithMaxWidth = styled(EuiFlexItem)` + max-width: calc(50% - ${(props) => props.theme.eui.euiSizeL}); +`; + export const PackageConfigInputConfig: React.FunctionComponent<{ packageInputVars?: RegistryVarsEntry[]; packageConfigInput: PackageConfigInput; @@ -88,7 +93,7 @@ export const PackageConfigInputConfig: React.FunctionComponent<{
- + {requiredVars.map((varDef) => { const { name: varName, type: varType } = varDef; @@ -176,7 +181,7 @@ export const PackageConfigInputConfig: React.FunctionComponent<{ ) : null} - + ); } diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/agent_details_page/components/actions_menu.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/agent_details_page/components/actions_menu.tsx index 7afc57b30cef4..0f48a230bbf5c 100644 --- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/agent_details_page/components/actions_menu.tsx +++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/agent_details_page/components/actions_menu.tsx @@ -53,6 +53,7 @@ export const AgentDetailsActionMenu: React.FunctionComponent<{ onClick={() => { setIsReassignFlyoutOpen(true); }} + disabled={!agent.active} key="reassignConfig" > void; refre onClick={() => { onReassignClick(); }} + disabled={!agent.active} key="reassignConfig" > void; refre defaultMessage="Assign new agent config" /> , - {(unenrollAgentsPrompt) => ( { unenrollAgentsPrompt([agent.id], 1, () => { @@ -536,9 +536,9 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { ), }} /> - ) : !isLoading && totalAgents === 0 ? ( + ) : ( emptyPrompt - ) : undefined + ) } items={totalAgents ? agents : []} itemId="id" diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/components/agent_enrollment_flyout/config_selection.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/components/agent_enrollment_flyout/config_selection.tsx index 09b00240dc127..e98ebb7cadc7c 100644 --- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/components/agent_enrollment_flyout/config_selection.tsx +++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/components/agent_enrollment_flyout/config_selection.tsx @@ -39,71 +39,105 @@ export const EnrollmentStepAgentConfig: React.FC = (props) => { enrollmentAPIKeyId?: string; }>({}); - useEffect(() => { - if (agentConfigs && agentConfigs.length && !selectedState.agentConfigId) { - setSelectedState({ - ...selectedState, - agentConfigId: agentConfigs[0].id, - }); - } - }, [agentConfigs, selectedState]); + useEffect( + function triggerOnConfigChangeEffect() { + if (onConfigChange && selectedState.agentConfigId) { + onConfigChange(selectedState.agentConfigId); + } + }, + [selectedState.agentConfigId, onConfigChange] + ); - useEffect(() => { - if (onConfigChange && selectedState.agentConfigId) { - onConfigChange(selectedState.agentConfigId); - } - }, [selectedState.agentConfigId, onConfigChange]); + useEffect( + function triggerOnKeyChangeEffect() { + if (!withKeySelection || !onKeyChange) { + return; + } - useEffect(() => { - if (!withKeySelection) { - return; - } - if (!selectedState.agentConfigId) { - setEnrollmentAPIKeys([]); - return; - } + if (selectedState.enrollmentAPIKeyId) { + onKeyChange(selectedState.enrollmentAPIKeyId); + } + }, + [withKeySelection, onKeyChange, selectedState.enrollmentAPIKeyId] + ); - async function fetchEnrollmentAPIKeys() { - try { - const res = await sendGetEnrollmentAPIKeys({ - page: 1, - perPage: 10000, - }); - if (res.error) { - throw res.error; + useEffect( + function useDefaultConfigEffect() { + if (agentConfigs && agentConfigs.length && !selectedState.agentConfigId) { + const defaultConfig = agentConfigs.find((config) => config.is_default); + if (defaultConfig) { + setSelectedState({ + ...selectedState, + agentConfigId: defaultConfig.id, + }); } + } + }, + [agentConfigs, selectedState] + ); - if (!res.data) { - throw new Error('No data while fetching enrollment API keys'); + useEffect( + function useEnrollmentKeysForConfigEffect() { + if (!withKeySelection) { + return; + } + if (!selectedState.agentConfigId) { + setEnrollmentAPIKeys([]); + return; + } + + async function fetchEnrollmentAPIKeys() { + try { + const res = await sendGetEnrollmentAPIKeys({ + page: 1, + perPage: 10000, + }); + if (res.error) { + throw res.error; + } + + if (!res.data) { + throw new Error('No data while fetching enrollment API keys'); + } + + setEnrollmentAPIKeys( + res.data.list.filter((key) => key.config_id === selectedState.agentConfigId) + ); + } catch (error) { + notifications.toasts.addError(error, { + title: 'Error', + }); } + } + fetchEnrollmentAPIKeys(); + }, + [withKeySelection, selectedState.agentConfigId, notifications.toasts] + ); - setEnrollmentAPIKeys( - res.data.list.filter((key) => key.config_id === selectedState.agentConfigId) - ); - } catch (error) { - notifications.toasts.addError(error, { - title: 'Error', + useEffect( + function useDefaultEnrollmentKeyForConfigEffect() { + if (!withKeySelection) { + return; + } + if ( + !selectedState.enrollmentAPIKeyId && + enrollmentAPIKeys.length > 0 && + enrollmentAPIKeys[0].config_id === selectedState.agentConfigId + ) { + const enrollmentAPIKeyId = enrollmentAPIKeys[0].id; + setSelectedState({ + agentConfigId: selectedState.agentConfigId, + enrollmentAPIKeyId, }); } - } - fetchEnrollmentAPIKeys(); - }, [withKeySelection, selectedState.agentConfigId, notifications.toasts]); - - // Select first API key when config change - React.useEffect(() => { - if (!withKeySelection || !onKeyChange) { - return; - } - if (!selectedState.enrollmentAPIKeyId && enrollmentAPIKeys.length > 0) { - const enrollmentAPIKeyId = enrollmentAPIKeys[0].id; - setSelectedState({ - agentConfigId: selectedState.agentConfigId, - enrollmentAPIKeyId, - }); - onKeyChange(enrollmentAPIKeyId); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [enrollmentAPIKeys, selectedState.enrollmentAPIKeyId, selectedState.agentConfigId]); + }, + [ + withKeySelection, + enrollmentAPIKeys, + selectedState.enrollmentAPIKeyId, + selectedState.agentConfigId, + ] + ); return ( <> @@ -174,7 +208,6 @@ export const EnrollmentStepAgentConfig: React.FC = (props) => { ...selectedState, enrollmentAPIKeyId: e.target.value, }); - onKeyChange(e.target.value); }} /> diff --git a/x-pack/plugins/ingest_manager/server/mocks.ts b/x-pack/plugins/ingest_manager/server/mocks.ts index f305d9dd0c1a7..52cd294783087 100644 --- a/x-pack/plugins/ingest_manager/server/mocks.ts +++ b/x-pack/plugins/ingest_manager/server/mocks.ts @@ -18,6 +18,7 @@ export const createAppContextStartContractMock = (): IngestManagerAppContext => logger: loggingSystemMock.create().get(), isProductionMode: true, kibanaVersion: '8.0.0', + kibanaBranch: 'master', }; }; diff --git a/x-pack/plugins/ingest_manager/server/plugin.ts b/x-pack/plugins/ingest_manager/server/plugin.ts index 69af475886bb9..e7495df254a09 100644 --- a/x-pack/plugins/ingest_manager/server/plugin.ts +++ b/x-pack/plugins/ingest_manager/server/plugin.ts @@ -85,6 +85,7 @@ export interface IngestManagerAppContext { savedObjects: SavedObjectsServiceStart; isProductionMode: boolean; kibanaVersion: string; + kibanaBranch: string; cloud?: CloudSetup; logger?: Logger; httpSetup?: HttpServiceSetup; @@ -145,6 +146,7 @@ export class IngestManagerPlugin private isProductionMode: boolean; private kibanaVersion: string; + private kibanaBranch: string; private httpSetup: HttpServiceSetup | undefined; private encryptedSavedObjectsSetup: EncryptedSavedObjectsPluginSetup | undefined; @@ -152,6 +154,7 @@ export class IngestManagerPlugin this.config$ = this.initializerContext.config.create(); this.isProductionMode = this.initializerContext.env.mode.prod; this.kibanaVersion = this.initializerContext.env.packageInfo.version; + this.kibanaBranch = this.initializerContext.env.packageInfo.branch; this.logger = this.initializerContext.logger.get(); } @@ -257,6 +260,7 @@ export class IngestManagerPlugin savedObjects: core.savedObjects, isProductionMode: this.isProductionMode, kibanaVersion: this.kibanaVersion, + kibanaBranch: this.kibanaBranch, httpSetup: this.httpSetup, cloud: this.cloud, logger: this.logger, diff --git a/x-pack/plugins/ingest_manager/server/routes/package_config/handlers.ts b/x-pack/plugins/ingest_manager/server/routes/package_config/handlers.ts index 6b0c2fe9c2ff7..d2820cdbeb6c8 100644 --- a/x-pack/plugins/ingest_manager/server/routes/package_config/handlers.ts +++ b/x-pack/plugins/ingest_manager/server/routes/package_config/handlers.ts @@ -5,7 +5,7 @@ */ import { TypeOf } from '@kbn/config-schema'; import Boom from 'boom'; -import { RequestHandler } from 'src/core/server'; +import { RequestHandler, SavedObjectsErrorHelpers } from '../../../../../../src/core/server'; import { appContextService, packageConfigService } from '../../services'; import { getPackageInfo } from '../../services/epm/packages'; import { @@ -49,8 +49,12 @@ export const getOnePackageConfigHandler: RequestHandler> = async (context, request, response) => { const soClient = context.core.savedObjects.client; + const { packageConfigId } = request.params; + const notFoundResponse = () => + response.notFound({ body: { message: `Package config ${packageConfigId} not found` } }); + try { - const packageConfig = await packageConfigService.get(soClient, request.params.packageConfigId); + const packageConfig = await packageConfigService.get(soClient, packageConfigId); if (packageConfig) { return response.ok({ body: { @@ -58,17 +62,18 @@ export const getOnePackageConfigHandler: RequestHandler { const registryUrl = getRegistryUrl(); const url = new URL(`${registryUrl}/search`); + const kibanaVersion = appContextService.getKibanaVersion().split('-')[0]; // may be x.y.z-SNAPSHOT + const kibanaBranch = appContextService.getKibanaBranch(); if (params) { if (params.category) { url.searchParams.set('category', params.category); @@ -48,8 +50,9 @@ export async function fetchList(params?: SearchParams): Promise { const registryUrl = getRegistryUrl(); + const kibanaVersion = appContextService.getKibanaVersion().split('-')[0]; // may be x.y.z-SNAPSHOT + const kibanaBranch = appContextService.getKibanaBranch(); const url = new URL( `${registryUrl}/search?package=${packageName}&internal=true&experimental=true` ); - const kibanaVersion = appContextService.getKibanaVersion().split('-')[0]; // may be 8.0.0-SNAPSHOT - if (kibanaVersion) { + + // on master, request all packages regardless of version + if (kibanaVersion && kibanaBranch !== 'master') { url.searchParams.set('kibana.version', kibanaVersion); } const res = await fetchUrl(url.toString()); diff --git a/x-pack/plugins/lens/public/app_plugin/app.test.tsx b/x-pack/plugins/lens/public/app_plugin/app.test.tsx index 3bd12a87456a0..a72f4f429a1be 100644 --- a/x-pack/plugins/lens/public/app_plugin/app.test.tsx +++ b/x-pack/plugins/lens/public/app_plugin/app.test.tsx @@ -95,6 +95,14 @@ function createMockFilterManager() { }; } +function createMockQueryString() { + return { + getQuery: jest.fn(() => ({ query: '', language: 'kuery' })), + setQuery: jest.fn(), + getDefaultQuery: jest.fn(() => ({ query: '', language: 'kuery' })), + }; +} + function createMockTimefilter() { const unsubscribe = jest.fn(); @@ -148,6 +156,7 @@ describe('Lens App', () => { timefilter: { timefilter: createMockTimefilter(), }, + queryString: createMockQueryString(), state$: new Observable(), }, indexPatterns: { diff --git a/x-pack/plugins/lens/public/app_plugin/app.tsx b/x-pack/plugins/lens/public/app_plugin/app.tsx index 082a3afcd513e..2a7eaff32fa08 100644 --- a/x-pack/plugins/lens/public/app_plugin/app.tsx +++ b/x-pack/plugins/lens/public/app_plugin/app.tsx @@ -36,7 +36,6 @@ import { IndexPattern as IndexPatternInstance, IndexPatternsContract, SavedQuery, - UI_SETTINGS, } from '../../../../../src/plugins/data/public'; interface State { @@ -83,17 +82,13 @@ export function App({ onAppLeave: AppMountParameters['onAppLeave']; history: History; }) { - const language = - storage.get('kibana.userQueryLanguage') || - core.uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE); - const [state, setState] = useState(() => { const currentRange = data.query.timefilter.timefilter.getTime(); return { isLoading: !!docId, isSaveModalVisible: false, indexPatternsForTopNav: [], - query: { query: '', language }, + query: data.query.queryString.getDefaultQuery(), dateRange: { fromDate: currentRange.from, toDate: currentRange.to, @@ -473,12 +468,7 @@ export function App({ ...s, savedQuery: undefined, filters: data.query.filterManager.getGlobalFilters(), - query: { - query: '', - language: - storage.get('kibana.userQueryLanguage') || - core.uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), - }, + query: data.query.queryString.getDefaultQuery(), })); }} query={state.query} diff --git a/x-pack/plugins/lists/common/constants.mock.ts b/x-pack/plugins/lists/common/constants.mock.ts index 22706890e2020..b7609b5a3602a 100644 --- a/x-pack/plugins/lists/common/constants.mock.ts +++ b/x-pack/plugins/lists/common/constants.mock.ts @@ -3,8 +3,9 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { EntriesArray } from './schemas/types'; +import moment from 'moment'; +import { EntriesArray } from './schemas/types'; export const DATE_NOW = '2020-04-20T15:25:31.830Z'; export const OLD_DATE_RELATIVE_TO_DATE_NOW = '2020-04-19T15:25:31.830Z'; export const USER = 'some user'; @@ -64,3 +65,4 @@ export const CURSOR = 'c29tZXN0cmluZ2ZvcnlvdQ=='; export const _VERSION = 'WzI5NywxXQ=='; export const VERSION = 1; export const IMMUTABLE = false; +export const IMPORT_TIMEOUT = moment.duration(5, 'minutes'); diff --git a/x-pack/plugins/lists/common/constants.ts b/x-pack/plugins/lists/common/constants.ts index df16085b53405..6c73dc1656302 100644 --- a/x-pack/plugins/lists/common/constants.ts +++ b/x-pack/plugins/lists/common/constants.ts @@ -48,3 +48,5 @@ export const ENDPOINT_LIST_NAME = 'Elastic Endpoint Security Exception List'; /** The description of the single global space agnostic endpoint list */ export const ENDPOINT_LIST_DESCRIPTION = 'Elastic Endpoint Security Exception List'; + +export const MAX_EXCEPTION_LIST_SIZE = 10000; diff --git a/x-pack/plugins/lists/common/schemas/types/entries.mock.ts b/x-pack/plugins/lists/common/schemas/types/entries.mock.ts index 3ed3f4e7ff88f..16794415138b2 100644 --- a/x-pack/plugins/lists/common/schemas/types/entries.mock.ts +++ b/x-pack/plugins/lists/common/schemas/types/entries.mock.ts @@ -11,10 +11,22 @@ import { getEntryListMock } from './entry_list.mock'; import { getEntryExistsMock } from './entry_exists.mock'; import { getEntryNestedMock } from './entry_nested.mock'; -export const getEntriesArrayMock = (): EntriesArray => [ +export const getListAndNonListEntriesArrayMock = (): EntriesArray => [ { ...getEntryMatchMock() }, { ...getEntryMatchAnyMock() }, { ...getEntryListMock() }, { ...getEntryExistsMock() }, { ...getEntryNestedMock() }, ]; + +export const getListEntriesArrayMock = (): EntriesArray => [ + { ...getEntryListMock() }, + { ...getEntryListMock() }, +]; + +export const getEntriesArrayMock = (): EntriesArray => [ + { ...getEntryMatchMock() }, + { ...getEntryMatchAnyMock() }, + { ...getEntryExistsMock() }, + { ...getEntryNestedMock() }, +]; diff --git a/x-pack/plugins/lists/common/schemas/types/non_empty_entries_array.test.ts b/x-pack/plugins/lists/common/schemas/types/non_empty_entries_array.test.ts index ab7002982cf28..a2697286aa038 100644 --- a/x-pack/plugins/lists/common/schemas/types/non_empty_entries_array.test.ts +++ b/x-pack/plugins/lists/common/schemas/types/non_empty_entries_array.test.ts @@ -11,10 +11,13 @@ import { foldLeftRight, getPaths } from '../../siem_common_deps'; import { getEntryMatchMock } from './entry_match.mock'; import { getEntryMatchAnyMock } from './entry_match_any.mock'; -import { getEntryListMock } from './entry_list.mock'; import { getEntryExistsMock } from './entry_exists.mock'; import { getEntryNestedMock } from './entry_nested.mock'; -import { getEntriesArrayMock } from './entries.mock'; +import { + getEntriesArrayMock, + getListAndNonListEntriesArrayMock, + getListEntriesArrayMock, +} from './entries.mock'; import { nonEmptyEntriesArray } from './non_empty_entries_array'; import { EntriesArray } from './entries'; @@ -80,7 +83,7 @@ describe('non_empty_entries_array', () => { }); test('it should validate an array of "list" entries', () => { - const payload: EntriesArray = [{ ...getEntryListMock() }, { ...getEntryListMock() }]; + const payload: EntriesArray = [...getListEntriesArrayMock()]; const decoded = nonEmptyEntriesArray.decode(payload); const message = pipe(decoded, foldLeftRight); @@ -106,6 +109,15 @@ describe('non_empty_entries_array', () => { expect(message.schema).toEqual(payload); }); + test('it should NOT validate an array of entries of value list and non-value list entries', () => { + const payload: EntriesArray = [...getListAndNonListEntriesArrayMock()]; + const decoded = nonEmptyEntriesArray.decode(payload); + const message = pipe(decoded, foldLeftRight); + + expect(getPaths(left(message.errors))).toEqual(['Cannot have entry of type list and other']); + expect(message.schema).toEqual({}); + }); + test('it should NOT validate an array of non entries', () => { const payload = [1]; const decoded = nonEmptyEntriesArray.decode(payload); diff --git a/x-pack/plugins/lists/common/schemas/types/non_empty_entries_array.ts b/x-pack/plugins/lists/common/schemas/types/non_empty_entries_array.ts index 1370fe022c258..3683ca97dedb8 100644 --- a/x-pack/plugins/lists/common/schemas/types/non_empty_entries_array.ts +++ b/x-pack/plugins/lists/common/schemas/types/non_empty_entries_array.ts @@ -8,6 +8,7 @@ import * as t from 'io-ts'; import { Either } from 'fp-ts/lib/Either'; import { EntriesArray, entriesArray } from './entries'; +import { entriesList } from './entry_list'; /** * Types the nonEmptyEntriesArray as: @@ -21,6 +22,14 @@ export const nonEmptyEntriesArray = new t.Type entriesList.is(entry)) && + input.some((entry) => !entriesList.is(entry)) + ) { + // fail when an exception item contains both a value list entry and a non-value list entry + return t.failure(input, context, 'Cannot have entry of type list and other'); + } return entriesArray.validate(input, context); } }, diff --git a/x-pack/plugins/lists/public/exceptions/hooks/use_exception_list.test.ts b/x-pack/plugins/lists/public/exceptions/hooks/use_exception_list.test.ts index 918397d01ce2c..f678ed4faeeda 100644 --- a/x-pack/plugins/lists/public/exceptions/hooks/use_exception_list.test.ts +++ b/x-pack/plugins/lists/public/exceptions/hooks/use_exception_list.test.ts @@ -41,7 +41,9 @@ describe('useExceptionList', () => { useExceptionList({ filterOptions: { filter: '', tags: [] }, http: mockKibanaHttpService, - lists: [{ id: 'myListId', namespaceType: 'single', type: 'detection' }], + lists: [ + { id: 'myListId', listId: 'list_id', namespaceType: 'single', type: 'detection' }, + ], onError: onErrorMock, pagination: { page: 1, @@ -76,7 +78,9 @@ describe('useExceptionList', () => { useExceptionList({ filterOptions: { filter: '', tags: [] }, http: mockKibanaHttpService, - lists: [{ id: 'myListId', namespaceType: 'single', type: 'detection' }], + lists: [ + { id: 'myListId', listId: 'list_id', namespaceType: 'single', type: 'detection' }, + ], onError: onErrorMock, onSuccess: onSuccessMock, pagination: { @@ -131,7 +135,9 @@ describe('useExceptionList', () => { initialProps: { filterOptions: { filter: '', tags: [] }, http: mockKibanaHttpService, - lists: [{ id: 'myListId', namespaceType: 'single', type: 'detection' }], + lists: [ + { id: 'myListId', listId: 'list_id', namespaceType: 'single', type: 'detection' }, + ], onError: onErrorMock, onSuccess: onSuccessMock, pagination: { @@ -146,7 +152,9 @@ describe('useExceptionList', () => { rerender({ filterOptions: { filter: '', tags: [] }, http: mockKibanaHttpService, - lists: [{ id: 'newListId', namespaceType: 'single', type: 'detection' }], + lists: [ + { id: 'newListId', listId: 'new_list_id', namespaceType: 'single', type: 'detection' }, + ], onError: onErrorMock, onSuccess: onSuccessMock, pagination: { @@ -173,7 +181,9 @@ describe('useExceptionList', () => { useExceptionList({ filterOptions: { filter: '', tags: [] }, http: mockKibanaHttpService, - lists: [{ id: 'myListId', namespaceType: 'single', type: 'detection' }], + lists: [ + { id: 'myListId', listId: 'list_id', namespaceType: 'single', type: 'detection' }, + ], onError: onErrorMock, pagination: { page: 1, @@ -210,7 +220,9 @@ describe('useExceptionList', () => { useExceptionList({ filterOptions: { filter: '', tags: [] }, http: mockKibanaHttpService, - lists: [{ id: 'myListId', namespaceType: 'single', type: 'detection' }], + lists: [ + { id: 'myListId', listId: 'list_id', namespaceType: 'single', type: 'detection' }, + ], onError: onErrorMock, pagination: { page: 1, @@ -238,7 +250,9 @@ describe('useExceptionList', () => { useExceptionList({ filterOptions: { filter: '', tags: [] }, http: mockKibanaHttpService, - lists: [{ id: 'myListId', namespaceType: 'single', type: 'detection' }], + lists: [ + { id: 'myListId', listId: 'list_id', namespaceType: 'single', type: 'detection' }, + ], onError: onErrorMock, pagination: { page: 1, diff --git a/x-pack/plugins/lists/public/exceptions/types.ts b/x-pack/plugins/lists/public/exceptions/types.ts index f99323b384781..c0ec72e1c19eb 100644 --- a/x-pack/plugins/lists/public/exceptions/types.ts +++ b/x-pack/plugins/lists/public/exceptions/types.ts @@ -60,6 +60,7 @@ export interface UseExceptionListProps { export interface ExceptionIdentifiers { id: string; + listId: string; namespaceType: NamespaceType; type: ExceptionListType; } diff --git a/x-pack/plugins/lists/server/config.mock.ts b/x-pack/plugins/lists/server/config.mock.ts index 3cf5040c73675..b272f18c4e809 100644 --- a/x-pack/plugins/lists/server/config.mock.ts +++ b/x-pack/plugins/lists/server/config.mock.ts @@ -6,6 +6,7 @@ import { IMPORT_BUFFER_SIZE, + IMPORT_TIMEOUT, LIST_INDEX, LIST_ITEM_INDEX, MAX_IMPORT_PAYLOAD_BYTES, @@ -21,6 +22,7 @@ export const getConfigMock = (): Partial => ({ export const getConfigMockDecoded = (): ConfigType => ({ enabled: true, importBufferSize: IMPORT_BUFFER_SIZE, + importTimeout: IMPORT_TIMEOUT, listIndex: LIST_INDEX, listItemIndex: LIST_ITEM_INDEX, maxImportPayloadBytes: MAX_IMPORT_PAYLOAD_BYTES, diff --git a/x-pack/plugins/lists/server/config.test.ts b/x-pack/plugins/lists/server/config.test.ts index 60501322dcfa2..40b04edd4c007 100644 --- a/x-pack/plugins/lists/server/config.test.ts +++ b/x-pack/plugins/lists/server/config.test.ts @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +import moment from 'moment'; + import { ConfigSchema, ConfigType } from './config'; import { getConfigMock, getConfigMockDecoded } from './config.mock'; @@ -61,4 +63,24 @@ describe('config_schema', () => { '[importBufferSize]: Value must be equal to or greater than [1].' ); }); + + test('it throws if the "importTimeout" value is less than 2 minutes', () => { + const mock: ConfigType = { + ...getConfigMockDecoded(), + importTimeout: moment.duration(2, 'minutes').subtract(1, 'second'), + }; + expect(() => ConfigSchema.validate(mock)).toThrow( + '[importTimeout]: duration cannot be less than 2 minutes' + ); + }); + + test('it throws if the "importTimeout" value is greater than 1 hour', () => { + const mock: ConfigType = { + ...getConfigMockDecoded(), + importTimeout: moment.duration(1, 'hour').add(1, 'second'), + }; + expect(() => ConfigSchema.validate(mock)).toThrow( + '[importTimeout]: duration cannot be greater than 30 minutes' + ); + }); }); diff --git a/x-pack/plugins/lists/server/config.ts b/x-pack/plugins/lists/server/config.ts index 394f85ecfb642..6e36d135abfcc 100644 --- a/x-pack/plugins/lists/server/config.ts +++ b/x-pack/plugins/lists/server/config.ts @@ -9,6 +9,16 @@ import { TypeOf, schema } from '@kbn/config-schema'; export const ConfigSchema = schema.object({ enabled: schema.boolean({ defaultValue: true }), importBufferSize: schema.number({ defaultValue: 1000, min: 1 }), + importTimeout: schema.duration({ + defaultValue: '5m', + validate: (value) => { + if (value.asMinutes() < 2) { + throw new Error('duration cannot be less than 2 minutes'); + } else if (value.asMinutes() > 30) { + throw new Error('duration cannot be greater than 30 minutes'); + } + }, + }), listIndex: schema.string({ defaultValue: '.lists' }), listItemIndex: schema.string({ defaultValue: '.items' }), maxImportPayloadBytes: schema.number({ defaultValue: 9000000, min: 1 }), diff --git a/x-pack/plugins/lists/server/routes/create_endpoint_list_item_route.ts b/x-pack/plugins/lists/server/routes/create_endpoint_list_item_route.ts index 5ff2a9d9df9f4..22aa1fb59858b 100644 --- a/x-pack/plugins/lists/server/routes/create_endpoint_list_item_route.ts +++ b/x-pack/plugins/lists/server/routes/create_endpoint_list_item_route.ts @@ -6,7 +6,7 @@ import { IRouter } from 'kibana/server'; -import { ENDPOINT_LIST_ITEM_URL } from '../../common/constants'; +import { ENDPOINT_LIST_ID, ENDPOINT_LIST_ITEM_URL } from '../../common/constants'; import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps'; import { validate } from '../../common/siem_common_deps'; import { @@ -16,6 +16,7 @@ import { } from '../../common/schemas'; import { getExceptionListClient } from './utils/get_exception_list_client'; +import { validateExceptionListSize } from './validate'; export const createEndpointListItemRoute = (router: IRouter): void => { router.post( @@ -71,6 +72,18 @@ export const createEndpointListItemRoute = (router: IRouter): void => { if (errors != null) { return siemResponse.error({ body: errors, statusCode: 500 }); } else { + const listSizeError = await validateExceptionListSize( + exceptionLists, + ENDPOINT_LIST_ID, + 'agnostic' + ); + if (listSizeError != null) { + await exceptionLists.deleteExceptionListItemById({ + id: createdList.id, + namespaceType: 'agnostic', + }); + return siemResponse.error(listSizeError); + } return response.ok({ body: validated ?? {} }); } } diff --git a/x-pack/plugins/lists/server/routes/create_exception_list_item_route.ts b/x-pack/plugins/lists/server/routes/create_exception_list_item_route.ts index e4885c7393bd4..ed58621dae973 100644 --- a/x-pack/plugins/lists/server/routes/create_exception_list_item_route.ts +++ b/x-pack/plugins/lists/server/routes/create_exception_list_item_route.ts @@ -17,6 +17,7 @@ import { import { getExceptionListClient } from './utils/get_exception_list_client'; import { endpointDisallowedFields } from './endpoint_disallowed_fields'; +import { validateExceptionListSize } from './validate'; export const createExceptionListItemRoute = (router: IRouter): void => { router.post( @@ -104,6 +105,18 @@ export const createExceptionListItemRoute = (router: IRouter): void => { if (errors != null) { return siemResponse.error({ body: errors, statusCode: 500 }); } else { + const listSizeError = await validateExceptionListSize( + exceptionLists, + listId, + namespaceType + ); + if (listSizeError != null) { + await exceptionLists.deleteExceptionListItemById({ + id: createdList.id, + namespaceType, + }); + return siemResponse.error(listSizeError); + } return response.ok({ body: validated ?? {} }); } } diff --git a/x-pack/plugins/lists/server/routes/import_list_item_route.ts b/x-pack/plugins/lists/server/routes/import_list_item_route.ts index 1003a0c52a794..e162e7829e456 100644 --- a/x-pack/plugins/lists/server/routes/import_list_item_route.ts +++ b/x-pack/plugins/lists/server/routes/import_list_item_route.ts @@ -27,6 +27,7 @@ export const importListItemRoute = (router: IRouter, config: ConfigType): void = parse: false, }, tags: ['access:lists-all'], + timeout: config.importTimeout.asMilliseconds(), }, path: `${LIST_ITEM_URL}/_import`, validate: { diff --git a/x-pack/plugins/lists/server/routes/validate.ts b/x-pack/plugins/lists/server/routes/validate.ts new file mode 100644 index 0000000000000..bbd4b0eaf0e33 --- /dev/null +++ b/x-pack/plugins/lists/server/routes/validate.ts @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ExceptionListClient } from '../services/exception_lists/exception_list_client'; +import { MAX_EXCEPTION_LIST_SIZE } from '../../common/constants'; +import { foundExceptionListItemSchema } from '../../common/schemas'; +import { NamespaceType } from '../../common/schemas/types'; +import { validate } from '../../common/siem_common_deps'; + +export const validateExceptionListSize = async ( + exceptionLists: ExceptionListClient, + listId: string, + namespaceType: NamespaceType +): Promise<{ body: string; statusCode: number } | null> => { + const exceptionListItems = await exceptionLists.findExceptionListItem({ + filter: undefined, + listId, + namespaceType, + page: undefined, + perPage: undefined, + sortField: undefined, + sortOrder: undefined, + }); + if (exceptionListItems == null) { + // If exceptionListItems is null then we couldn't find the list so it may have been deleted + return { + body: `Unable to find list id: ${listId} to verify max exception list size`, + statusCode: 500, + }; + } + const [validatedItems, err] = validate(exceptionListItems, foundExceptionListItemSchema); + if (err != null) { + return { + body: err, + statusCode: 500, + }; + } + // Unnecessary since validatedItems comes from exceptionListItems which is already + // checked for null, but typescript fails to detect that + if (validatedItems == null) { + return { + body: `Unable to find list id: ${listId} to verify max exception list size`, + statusCode: 500, + }; + } + if (validatedItems.total > MAX_EXCEPTION_LIST_SIZE) { + return { + body: `Failed to add exception item, exception list would exceed max size of ${MAX_EXCEPTION_LIST_SIZE}`, + statusCode: 400, + }; + } + return null; +}; diff --git a/x-pack/plugins/lists/server/services/exception_lists/delete_exception_list_item.ts b/x-pack/plugins/lists/server/services/exception_lists/delete_exception_list_item.ts index 8dce1f1f79e35..ee85cf36a48b5 100644 --- a/x-pack/plugins/lists/server/services/exception_lists/delete_exception_list_item.ts +++ b/x-pack/plugins/lists/server/services/exception_lists/delete_exception_list_item.ts @@ -8,6 +8,7 @@ import { SavedObjectsClientContract } from 'kibana/server'; import { ExceptionListItemSchema, + Id, IdOrUndefined, ItemIdOrUndefined, NamespaceType, @@ -23,6 +24,12 @@ interface DeleteExceptionListItemOptions { savedObjectsClient: SavedObjectsClientContract; } +interface DeleteExceptionListItemByIdOptions { + id: Id; + namespaceType: NamespaceType; + savedObjectsClient: SavedObjectsClientContract; +} + export const deleteExceptionListItem = async ({ itemId, id, @@ -43,3 +50,12 @@ export const deleteExceptionListItem = async ({ return exceptionListItem; } }; + +export const deleteExceptionListItemById = async ({ + id, + namespaceType, + savedObjectsClient, +}: DeleteExceptionListItemByIdOptions): Promise => { + const savedObjectType = getSavedObjectType({ namespaceType }); + await savedObjectsClient.delete(savedObjectType, id); +}; diff --git a/x-pack/plugins/lists/server/services/exception_lists/exception_list_client.ts b/x-pack/plugins/lists/server/services/exception_lists/exception_list_client.ts index 11302e64b3538..83b44ababf9de 100644 --- a/x-pack/plugins/lists/server/services/exception_lists/exception_list_client.ts +++ b/x-pack/plugins/lists/server/services/exception_lists/exception_list_client.ts @@ -20,6 +20,7 @@ import { CreateExceptionListItemOptions, CreateExceptionListOptions, DeleteEndpointListItemOptions, + DeleteExceptionListItemByIdOptions, DeleteExceptionListItemOptions, DeleteExceptionListOptions, FindEndpointListItemOptions, @@ -40,7 +41,7 @@ import { createExceptionListItem } from './create_exception_list_item'; import { updateExceptionList } from './update_exception_list'; import { updateExceptionListItem } from './update_exception_list_item'; import { deleteExceptionList } from './delete_exception_list'; -import { deleteExceptionListItem } from './delete_exception_list_item'; +import { deleteExceptionListItem, deleteExceptionListItemById } from './delete_exception_list_item'; import { findExceptionListItem } from './find_exception_list_item'; import { findExceptionList } from './find_exception_list'; import { findExceptionListsItem } from './find_exception_list_items'; @@ -326,6 +327,18 @@ export class ExceptionListClient { }); }; + public deleteExceptionListItemById = async ({ + id, + namespaceType, + }: DeleteExceptionListItemByIdOptions): Promise => { + const { savedObjectsClient } = this; + return deleteExceptionListItemById({ + id, + namespaceType, + savedObjectsClient, + }); + }; + /** * This is the same as "deleteExceptionListItem" except it applies specifically to the endpoint list. */ diff --git a/x-pack/plugins/lists/server/services/exception_lists/exception_list_client_types.ts b/x-pack/plugins/lists/server/services/exception_lists/exception_list_client_types.ts index 555b9c5e95a77..963716b55ea77 100644 --- a/x-pack/plugins/lists/server/services/exception_lists/exception_list_client_types.ts +++ b/x-pack/plugins/lists/server/services/exception_lists/exception_list_client_types.ts @@ -19,6 +19,7 @@ import { ExceptionListType, ExceptionListTypeOrUndefined, FilterOrUndefined, + Id, IdOrUndefined, Immutable, ItemId, @@ -93,6 +94,11 @@ export interface DeleteExceptionListItemOptions { namespaceType: NamespaceType; } +export interface DeleteExceptionListItemByIdOptions { + id: Id; + namespaceType: NamespaceType; +} + export interface DeleteEndpointListItemOptions { id: IdOrUndefined; itemId: ItemIdOrUndefined; diff --git a/x-pack/plugins/lists/server/services/lists/list_client.mock.ts b/x-pack/plugins/lists/server/services/lists/list_client.mock.ts index e5036d561ddc6..a2959a024f292 100644 --- a/x-pack/plugins/lists/server/services/lists/list_client.mock.ts +++ b/x-pack/plugins/lists/server/services/lists/list_client.mock.ts @@ -11,6 +11,7 @@ import { getListResponseMock } from '../../../common/schemas/response/list_schem import { getCallClusterMock } from '../../../common/get_call_cluster.mock'; import { IMPORT_BUFFER_SIZE, + IMPORT_TIMEOUT, LIST_INDEX, LIST_ITEM_INDEX, MAX_IMPORT_PAYLOAD_BYTES, @@ -65,6 +66,7 @@ export const getListClientMock = (): ListClient => { config: { enabled: true, importBufferSize: IMPORT_BUFFER_SIZE, + importTimeout: IMPORT_TIMEOUT, listIndex: LIST_INDEX, listItemIndex: LIST_ITEM_INDEX, maxImportPayloadBytes: MAX_IMPORT_PAYLOAD_BYTES, diff --git a/x-pack/plugins/maps/public/actions/data_request_actions.ts b/x-pack/plugins/maps/public/actions/data_request_actions.ts index 5919feadfcc2a..f91e272d625f6 100644 --- a/x-pack/plugins/maps/public/actions/data_request_actions.ts +++ b/x-pack/plugins/maps/public/actions/data_request_actions.ts @@ -40,7 +40,7 @@ import { ILayer } from '../classes/layers/layer'; import { IVectorLayer } from '../classes/layers/vector_layer/vector_layer'; import { DataMeta, MapExtent, MapFilters } from '../../common/descriptor_types'; import { DataRequestAbortError } from '../classes/util/data_request'; -import { scaleBounds } from '../elasticsearch_geo_utils'; +import { scaleBounds, turfBboxToBounds } from '../elasticsearch_geo_utils'; const FIT_TO_BOUNDS_SCALE_FACTOR = 0.1; @@ -368,13 +368,7 @@ export function fitToDataBounds() { return; } - const turfUnionBbox = turf.bbox(turf.multiPoint(corners)); - const dataBounds = { - minLon: turfUnionBbox[0], - minLat: turfUnionBbox[1], - maxLon: turfUnionBbox[2], - maxLat: turfUnionBbox[3], - }; + const dataBounds = turfBboxToBounds(turf.bbox(turf.multiPoint(corners))); dispatch(setGotoWithBounds(scaleBounds(dataBounds, FIT_TO_BOUNDS_SCALE_FACTOR))); }; diff --git a/x-pack/plugins/maps/public/classes/sources/es_pew_pew_source/es_pew_pew_source.js b/x-pack/plugins/maps/public/classes/sources/es_pew_pew_source/es_pew_pew_source.js index 98db7bcdcc8a3..33d5deef2e39f 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_pew_pew_source/es_pew_pew_source.js +++ b/x-pack/plugins/maps/public/classes/sources/es_pew_pew_source/es_pew_pew_source.js @@ -6,6 +6,7 @@ import React from 'react'; import uuid from 'uuid/v4'; +import turf from 'turf'; import { UpdateSourceEditor } from './update_source_editor'; import { i18n } from '@kbn/i18n'; @@ -13,8 +14,9 @@ import { SOURCE_TYPES, VECTOR_SHAPE_TYPE } from '../../../../common/constants'; import { getDataSourceLabel } from '../../../../common/i18n_getters'; import { convertToLines } from './convert_to_lines'; import { AbstractESAggSource, DEFAULT_METRIC } from '../es_agg_source'; -import { indexPatterns } from '../../../../../../../src/plugins/data/public'; import { registerSource } from '../source_registry'; +import { turfBboxToBounds } from '../../../elasticsearch_geo_utils'; +import { DataRequestAbortError } from '../../util/data_request'; const MAX_GEOTILE_LEVEL = 29; @@ -158,19 +160,63 @@ export class ESPewPewSource extends AbstractESAggSource { }; } - async _getGeoField() { - const indexPattern = await this.getIndexPattern(); - const field = indexPattern.fields.getByName(this._descriptor.destGeoField); - const geoField = indexPatterns.isNestedField(field) ? undefined : field; - if (!geoField) { - throw new Error( - i18n.translate('xpack.maps.source.esSource.noGeoFieldErrorMessage', { - defaultMessage: `Index pattern {indexPatternTitle} no longer contains the geo field {geoField}`, - values: { indexPatternTitle: indexPattern.title, geoField: this._descriptor.geoField }, - }) - ); + getGeoFieldName() { + return this._descriptor.destGeoField; + } + + async getBoundsForFilters(boundsFilters, registerCancelCallback) { + const searchSource = await this.makeSearchSource(boundsFilters, 0); + searchSource.setField('aggs', { + destFitToBounds: { + geo_bounds: { + field: this._descriptor.destGeoField, + }, + }, + sourceFitToBounds: { + geo_bounds: { + field: this._descriptor.sourceGeoField, + }, + }, + }); + + const corners = []; + try { + const abortController = new AbortController(); + registerCancelCallback(() => abortController.abort()); + const esResp = await searchSource.fetch({ abortSignal: abortController.signal }); + if (esResp.aggregations.destFitToBounds.bounds) { + corners.push([ + esResp.aggregations.destFitToBounds.bounds.top_left.lon, + esResp.aggregations.destFitToBounds.bounds.top_left.lat, + ]); + corners.push([ + esResp.aggregations.destFitToBounds.bounds.bottom_right.lon, + esResp.aggregations.destFitToBounds.bounds.bottom_right.lat, + ]); + } + if (esResp.aggregations.sourceFitToBounds.bounds) { + corners.push([ + esResp.aggregations.sourceFitToBounds.bounds.top_left.lon, + esResp.aggregations.sourceFitToBounds.bounds.top_left.lat, + ]); + corners.push([ + esResp.aggregations.sourceFitToBounds.bounds.bottom_right.lon, + esResp.aggregations.sourceFitToBounds.bounds.bottom_right.lat, + ]); + } + } catch (error) { + if (error.name === 'AbortError') { + throw new DataRequestAbortError(); + } + + return null; + } + + if (corners.length === 0) { + return null; } - return geoField; + + return turfBboxToBounds(turf.bbox(turf.multiPoint(corners))); } canFormatFeatureProperties() { diff --git a/x-pack/plugins/maps/public/classes/sources/es_source/es_source.js b/x-pack/plugins/maps/public/classes/sources/es_source/es_source.js index 450894d81485c..c043e6d6994ab 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_source/es_source.js +++ b/x-pack/plugins/maps/public/classes/sources/es_source/es_source.js @@ -150,7 +150,7 @@ export class AbstractESSource extends AbstractVectorSource { searchSource.setField('aggs', { fitToBounds: { geo_bounds: { - field: this._descriptor.geoField, + field: this.getGeoFieldName(), }, }, }); @@ -230,12 +230,12 @@ export class AbstractESSource extends AbstractVectorSource { async _getGeoField() { const indexPattern = await this.getIndexPattern(); - const geoField = indexPattern.fields.getByName(this._descriptor.geoField); + const geoField = indexPattern.fields.getByName(this.getGeoFieldName()); if (!geoField) { throw new Error( i18n.translate('xpack.maps.source.esSource.noGeoFieldErrorMessage', { defaultMessage: `Index pattern {indexPatternTitle} no longer contains the geo field {geoField}`, - values: { indexPatternTitle: indexPattern.title, geoField: this._descriptor.geoField }, + values: { indexPatternTitle: indexPattern.title, geoField: this.getGeoFieldName() }, }) ); } diff --git a/x-pack/plugins/maps/public/connected_components/_index.scss b/x-pack/plugins/maps/public/connected_components/_index.scss index bd8070e8c36fd..a952b3b545922 100644 --- a/x-pack/plugins/maps/public/connected_components/_index.scss +++ b/x-pack/plugins/maps/public/connected_components/_index.scss @@ -1,4 +1,4 @@ -@import 'gis_map/gis_map'; +@import 'map_container/map_container'; @import 'layer_panel/index'; @import 'widget_overlay/index'; @import 'toolbar_overlay/index'; diff --git a/x-pack/plugins/maps/public/connected_components/gis_map/index.d.ts b/x-pack/plugins/maps/public/connected_components/gis_map/index.d.ts deleted file mode 100644 index 3f3fa48b3d769..0000000000000 --- a/x-pack/plugins/maps/public/connected_components/gis_map/index.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import { Filter } from 'src/plugins/data/public'; - -import { RenderToolTipContent } from '../../classes/tooltips/tooltip_property'; - -declare const GisMap: React.ComponentType<{ - addFilters: ((filters: Filter[]) => void) | null; - renderTooltipContent?: RenderToolTipContent; -}>; - -export { GisMap }; -// eslint-disable-next-line import/no-default-export -export default GisMap; diff --git a/x-pack/plugins/maps/public/connected_components/layer_panel/filter_editor/filter_editor.js b/x-pack/plugins/maps/public/connected_components/layer_panel/filter_editor/filter_editor.js index 45c7507160e98..d2652fac5bd2c 100644 --- a/x-pack/plugins/maps/public/connected_components/layer_panel/filter_editor/filter_editor.js +++ b/x-pack/plugins/maps/public/connected_components/layer_panel/filter_editor/filter_editor.js @@ -20,8 +20,7 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { UI_SETTINGS } from '../../../../../../../src/plugins/data/public'; -import { getIndexPatternService, getUiSettings, getData } from '../../../kibana_services'; +import { getIndexPatternService, getData } from '../../../kibana_services'; import { GlobalFilterCheckbox } from '../../../components/global_filter_checkbox'; export class FilterEditor extends Component { @@ -82,7 +81,6 @@ export class FilterEditor extends Component { _renderQueryPopover() { const layerQuery = this.props.layer.getQuery(); - const uiSettings = getUiSettings(); const { SearchBar } = getData().ui; return ( @@ -99,11 +97,7 @@ export class FilterEditor extends Component { showFilterBar={false} showDatePicker={false} showQueryInput={true} - query={ - layerQuery - ? layerQuery - : { language: uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), query: '' } - } + query={layerQuery ? layerQuery : getData().query.queryString.getDefaultQuery()} onQuerySubmit={this._onQueryChange} indexPatterns={this.state.indexPatterns} customSubmitButton={ diff --git a/x-pack/plugins/maps/public/connected_components/layer_panel/join_editor/resources/where_expression.js b/x-pack/plugins/maps/public/connected_components/layer_panel/join_editor/resources/where_expression.js index 8fdb71de2dfed..60151219a994f 100644 --- a/x-pack/plugins/maps/public/connected_components/layer_panel/join_editor/resources/where_expression.js +++ b/x-pack/plugins/maps/public/connected_components/layer_panel/join_editor/resources/where_expression.js @@ -8,8 +8,7 @@ import React, { Component } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButton, EuiPopover, EuiExpression, EuiFormHelpText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { UI_SETTINGS } from '../../../../../../../../src/plugins/data/public'; -import { getUiSettings, getData } from '../../../../kibana_services'; +import { getData } from '../../../../kibana_services'; export class WhereExpression extends Component { state = { @@ -77,11 +76,7 @@ export class WhereExpression extends Component { showFilterBar={false} showDatePicker={false} showQueryInput={true} - query={ - whereQuery - ? whereQuery - : { language: getUiSettings().get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), query: '' } - } + query={whereQuery ? whereQuery : getData().query.queryString.getDefaultQuery()} onQuerySubmit={this._onQueryChange} indexPatterns={[indexPattern]} customSubmitButton={ diff --git a/x-pack/plugins/maps/public/connected_components/map/mb/index.js b/x-pack/plugins/maps/public/connected_components/map/mb/index.js index 189d6bc1f0a43..4b8df07bd1f39 100644 --- a/x-pack/plugins/maps/public/connected_components/map/mb/index.js +++ b/x-pack/plugins/maps/public/connected_components/map/mb/index.js @@ -5,7 +5,7 @@ */ import { connect } from 'react-redux'; -import { MBMapContainer } from './view'; +import { MBMap } from './view'; import { mapExtentChanged, mapReady, @@ -72,7 +72,7 @@ function mapDispatchToProps(dispatch) { }; } -const connectedMBMapContainer = connect(mapStateToProps, mapDispatchToProps, null, { +const connectedMBMap = connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true, -})(MBMapContainer); -export { connectedMBMapContainer as MBMapContainer }; +})(MBMap); +export { connectedMBMap as MBMap }; diff --git a/x-pack/plugins/maps/public/connected_components/map/mb/view.js b/x-pack/plugins/maps/public/connected_components/map/mb/view.js index d96deb226744b..d85959c3a08a4 100644 --- a/x-pack/plugins/maps/public/connected_components/map/mb/view.js +++ b/x-pack/plugins/maps/public/connected_components/map/mb/view.js @@ -26,7 +26,7 @@ import { getPreserveDrawingBuffer } from '../../../kibana_services'; mapboxgl.workerUrl = mbWorkerUrl; mapboxgl.setRTLTextPlugin(mbRtlPlugin); -export class MBMapContainer extends React.Component { +export class MBMap extends React.Component { state = { prevLayerList: undefined, hasSyncedLayerList: false, diff --git a/x-pack/plugins/maps/public/connected_components/gis_map/_gis_map.scss b/x-pack/plugins/maps/public/connected_components/map_container/_map_container.scss similarity index 100% rename from x-pack/plugins/maps/public/connected_components/gis_map/_gis_map.scss rename to x-pack/plugins/maps/public/connected_components/map_container/_map_container.scss diff --git a/x-pack/plugins/maps/public/connected_components/gis_map/index.js b/x-pack/plugins/maps/public/connected_components/map_container/index.ts similarity index 68% rename from x-pack/plugins/maps/public/connected_components/gis_map/index.js rename to x-pack/plugins/maps/public/connected_components/map_container/index.ts index b462c8aa4c02d..c3b49f1e807eb 100644 --- a/x-pack/plugins/maps/public/connected_components/gis_map/index.js +++ b/x-pack/plugins/maps/public/connected_components/map_container/index.ts @@ -4,8 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ +import { AnyAction, Dispatch } from 'redux'; import { connect } from 'react-redux'; -import { GisMap as UnconnectedGisMap } from './view'; +import { MapContainer } from './map_container'; import { getFlyoutDisplay, getIsFullScreen } from '../../selectors/ui_selectors'; import { triggerRefreshTimer, cancelAllInFlightRequests, exitFullScreen } from '../../actions'; import { @@ -15,10 +16,10 @@ import { getQueryableUniqueIndexPatternIds, isToolbarOverlayHidden, } from '../../selectors/map_selectors'; - +import { MapStoreState } from '../../reducers/store'; import { getCoreChrome } from '../../kibana_services'; -function mapStateToProps(state = {}) { +function mapStateToProps(state: MapStoreState) { return { areLayersLoaded: areLayersLoaded(state), flyoutDisplay: getFlyoutDisplay(state), @@ -30,17 +31,16 @@ function mapStateToProps(state = {}) { }; } -function mapDispatchToProps(dispatch) { +function mapDispatchToProps(dispatch: Dispatch) { return { - triggerRefreshTimer: () => dispatch(triggerRefreshTimer()), + triggerRefreshTimer: () => dispatch(triggerRefreshTimer()), exitFullScreen: () => { dispatch(exitFullScreen()); getCoreChrome().setIsVisible(true); }, - cancelAllInFlightRequests: () => dispatch(cancelAllInFlightRequests()), + cancelAllInFlightRequests: () => dispatch(cancelAllInFlightRequests()), }; } -const connectedGisMap = connect(mapStateToProps, mapDispatchToProps)(UnconnectedGisMap); -export { connectedGisMap as GisMap }; // GisMap is pulled in by name by the Maps-app itself -export default connectedGisMap; //lazy-loading in the embeddable requires default export +const connected = connect(mapStateToProps, mapDispatchToProps)(MapContainer); +export { connected as MapContainer }; diff --git a/x-pack/plugins/maps/public/connected_components/gis_map/view.js b/x-pack/plugins/maps/public/connected_components/map_container/map_container.tsx similarity index 70% rename from x-pack/plugins/maps/public/connected_components/gis_map/view.js rename to x-pack/plugins/maps/public/connected_components/map_container/map_container.tsx index 7199620d69fcf..beb1eb0947c50 100644 --- a/x-pack/plugins/maps/public/connected_components/gis_map/view.js +++ b/x-pack/plugins/maps/public/connected_components/map_container/map_container.tsx @@ -7,27 +7,63 @@ import _ from 'lodash'; import React, { Component } from 'react'; import classNames from 'classnames'; -import { MBMapContainer } from '../map/mb'; +import { EuiFlexGroup, EuiFlexItem, EuiCallOut } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import uuid from 'uuid/v4'; +import { Filter } from 'src/plugins/data/public'; +// @ts-expect-error +import { MBMap } from '../map/mb'; +// @ts-expect-error import { WidgetOverlay } from '../widget_overlay'; +// @ts-expect-error import { ToolbarOverlay } from '../toolbar_overlay'; +// @ts-expect-error import { LayerPanel } from '../layer_panel'; import { AddLayerPanel } from '../add_layer_panel'; -import { EuiFlexGroup, EuiFlexItem, EuiCallOut } from '@elastic/eui'; import { ExitFullScreenButton } from '../../../../../../src/plugins/kibana_react/public'; import { getIndexPatternsFromIds } from '../../index_pattern_util'; import { ES_GEO_FIELD_TYPE } from '../../../common/constants'; import { indexPatterns as indexPatternsUtils } from '../../../../../../src/plugins/data/public'; -import { i18n } from '@kbn/i18n'; -import uuid from 'uuid/v4'; import { FLYOUT_STATE } from '../../reducers/ui'; import { MapSettingsPanel } from '../map_settings_panel'; import { registerLayerWizards } from '../../classes/layers/load_layer_wizards'; +import { RenderToolTipContent } from '../../classes/tooltips/tooltip_property'; +import { GeoFieldWithIndex } from '../../components/geo_field_with_index'; +import { MapRefreshConfig } from '../../../common/descriptor_types'; import 'mapbox-gl/dist/mapbox-gl.css'; const RENDER_COMPLETE_EVENT = 'renderComplete'; -export class GisMap extends Component { - state = { +interface Props { + addFilters: ((filters: Filter[]) => void) | null; + areLayersLoaded: boolean; + cancelAllInFlightRequests: () => void; + exitFullScreen: () => void; + flyoutDisplay: FLYOUT_STATE; + hideToolbarOverlay: boolean; + isFullScreen: boolean; + indexPatternIds: string[]; + mapInitError: string | null | undefined; + refreshConfig: MapRefreshConfig; + renderTooltipContent?: RenderToolTipContent; + triggerRefreshTimer: () => void; +} + +interface State { + isInitialLoadRenderTimeoutComplete: boolean; + domId: string; + geoFields: GeoFieldWithIndex[]; +} + +export class MapContainer extends Component { + private _isMounted: boolean = false; + private _isInitalLoadRenderTimerStarted: boolean = false; + private _prevIndexPatternIds: string[] = []; + private _refreshTimerId: number | null = null; + private _prevIsPaused: boolean | null = null; + private _prevInterval: number | null = null; + + state: State = { isInitialLoadRenderTimeoutComplete: false, domId: uuid(), geoFields: [], @@ -35,7 +71,6 @@ export class GisMap extends Component { componentDidMount() { this._isMounted = true; - this._isInitalLoadRenderTimerStarted = false; this._setRefreshTimer(); registerLayerWizards(); } @@ -73,7 +108,7 @@ export class GisMap extends Component { } }; - _loadGeoFields = async (nextIndexPatternIds) => { + _loadGeoFields = async (nextIndexPatternIds: string[]) => { if (_.isEqual(nextIndexPatternIds, this._prevIndexPatternIds)) { // all ready loaded index pattern ids return; @@ -81,29 +116,24 @@ export class GisMap extends Component { this._prevIndexPatternIds = nextIndexPatternIds; - const geoFields = []; - try { - const indexPatterns = await getIndexPatternsFromIds(nextIndexPatternIds); - indexPatterns.forEach((indexPattern) => { - indexPattern.fields.forEach((field) => { - if ( - !indexPatternsUtils.isNestedField(field) && - (field.type === ES_GEO_FIELD_TYPE.GEO_POINT || - field.type === ES_GEO_FIELD_TYPE.GEO_SHAPE) - ) { - geoFields.push({ - geoFieldName: field.name, - geoFieldType: field.type, - indexPatternTitle: indexPattern.title, - indexPatternId: indexPattern.id, - }); - } - }); + const geoFields: GeoFieldWithIndex[] = []; + const indexPatterns = await getIndexPatternsFromIds(nextIndexPatternIds); + indexPatterns.forEach((indexPattern) => { + indexPattern.fields.forEach((field) => { + if ( + indexPattern.id && + !indexPatternsUtils.isNestedField(field) && + (field.type === ES_GEO_FIELD_TYPE.GEO_POINT || field.type === ES_GEO_FIELD_TYPE.GEO_SHAPE) + ) { + geoFields.push({ + geoFieldName: field.name, + geoFieldType: field.type, + indexPatternTitle: indexPattern.title, + indexPatternId: indexPattern.id, + }); + } }); - } catch (e) { - // swallow errors. - // the Layer-TOC will indicate which layers are disfunctional on a per-layer basis - } + }); if (!this._isMounted) { return; @@ -115,33 +145,34 @@ export class GisMap extends Component { _setRefreshTimer = () => { const { isPaused, interval } = this.props.refreshConfig; - if (this.isPaused === isPaused && this.interval === interval) { + if (this._prevIsPaused === isPaused && this._prevInterval === interval) { // refreshConfig is the same, nothing to do return; } - this.isPaused = isPaused; - this.interval = interval; + this._prevIsPaused = isPaused; + this._prevInterval = interval; this._clearRefreshTimer(); if (!isPaused && interval > 0) { - this.refreshTimerId = setInterval(() => { + this._refreshTimerId = window.setInterval(() => { this.props.triggerRefreshTimer(); }, interval); } }; _clearRefreshTimer = () => { - if (this.refreshTimerId) { - clearInterval(this.refreshTimerId); + if (this._refreshTimerId) { + window.clearInterval(this._refreshTimerId); + this._refreshTimerId = null; } }; // Mapbox does not provide any feedback when rendering is complete. // Temporary solution is just to wait set period of time after data has loaded. _startInitialLoadRenderTimer = () => { - setTimeout(() => { + window.setTimeout(() => { if (this._isMounted) { this.setState({ isInitialLoadRenderTimeoutComplete: true }); this._onInitialLoadRenderComplete(); @@ -159,8 +190,6 @@ export class GisMap extends Component { renderTooltipContent, } = this.props; - const { domId } = this.state; - if (mapInitError) { return (
@@ -194,12 +223,12 @@ export class GisMap extends Component { - import('../connected_components/gis_map')); export class MapEmbeddable extends Embeddable { type = MAP_SAVED_OBJECT_TYPE; @@ -223,12 +222,10 @@ export class MapEmbeddable extends Embeddable - }> - - + , this._domNode diff --git a/x-pack/plugins/maps/public/routing/bootstrap/get_initial_query.js b/x-pack/plugins/maps/public/routing/bootstrap/get_initial_query.js index dfc3a1c9de96a..1f2cf27077623 100644 --- a/x-pack/plugins/maps/public/routing/bootstrap/get_initial_query.js +++ b/x-pack/plugins/maps/public/routing/bootstrap/get_initial_query.js @@ -4,12 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ -import { getUiSettings } from '../../kibana_services'; -import { UI_SETTINGS } from '../../../../../../src/plugins/data/public'; - -export function getInitialQuery({ mapStateJSON, appState = {}, userQueryLanguage }) { - const settings = getUiSettings(); +import { getData } from '../../kibana_services'; +export function getInitialQuery({ mapStateJSON, appState = {} }) { if (appState.query) { return appState.query; } @@ -21,8 +18,5 @@ export function getInitialQuery({ mapStateJSON, appState = {}, userQueryLanguage } } - return { - query: '', - language: userQueryLanguage || settings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), - }; + return getData().query.queryString.getDefaultQuery(); } diff --git a/x-pack/plugins/maps/public/routing/page_elements/top_nav_menu/top_nav_menu.js b/x-pack/plugins/maps/public/routing/page_elements/top_nav_menu/top_nav_menu.js index ac2dec0db59cc..2340e3716547b 100644 --- a/x-pack/plugins/maps/public/routing/page_elements/top_nav_menu/top_nav_menu.js +++ b/x-pack/plugins/maps/public/routing/page_elements/top_nav_menu/top_nav_menu.js @@ -14,7 +14,6 @@ import { getToasts, getCoreI18n, getData, - getUiSettings, } from '../../../kibana_services'; import { SavedObjectSaveModal, @@ -46,16 +45,13 @@ export function MapsTopNavMenu({ isOpenSettingsDisabled, }) { const { TopNavMenu } = getNavigation().ui; - const { filterManager } = getData().query; + const { filterManager, queryString } = getData().query; const showSaveQuery = getMapsCapabilities().saveQuery; const onClearSavedQuery = () => { onQuerySaved(undefined); onQueryChange({ filters: filterManager.getGlobalFilters(), - query: { - query: '', - language: getUiSettings().get('search:queryLanguage'), - }, + query: queryString.getDefaultQuery(), }); }; diff --git a/x-pack/plugins/maps/public/routing/routes/maps_app/maps_app_view.js b/x-pack/plugins/maps/public/routing/routes/maps_app/maps_app_view.js index aa7f24155ab43..b26c44df25104 100644 --- a/x-pack/plugins/maps/public/routing/routes/maps_app/maps_app_view.js +++ b/x-pack/plugins/maps/public/routing/routes/maps_app/maps_app_view.js @@ -13,7 +13,6 @@ import { getIndexPatternService, getToasts, getData, - getUiSettings, getCoreChrome, } from '../../../kibana_services'; import { copyPersistentState } from '../../../reducers/util'; @@ -31,7 +30,7 @@ import { import { AppStateManager } from '../../state_syncing/app_state_manager'; import { useAppStateSyncing } from '../../state_syncing/app_sync'; import { esFilters } from '../../../../../../../src/plugins/data/public'; -import { GisMap } from '../../../connected_components/gis_map'; +import { MapContainer } from '../../../connected_components/map_container'; import { goToSpecifiedPath } from '../../maps_router'; const unsavedChangesWarning = i18n.translate('xpack.maps.breadCrumbs.unsavedChangesWarning', { @@ -274,6 +273,7 @@ export class MapsAppView extends React.Component { _initQueryTimeRefresh() { const { setRefreshConfig, savedMap } = this.props; + const { queryString } = getData().query; // TODO: Handle null when converting to TS const globalState = getGlobalState(); const mapStateJSON = savedMap ? savedMap.mapStateJSON : undefined; @@ -281,7 +281,6 @@ export class MapsAppView extends React.Component { query: getInitialQuery({ mapStateJSON, appState: this._appStateManager.getAppState(), - userQueryLanguage: getUiSettings().get('search:queryLanguage'), }), time: getInitialTimeFilters({ mapStateJSON, @@ -292,6 +291,8 @@ export class MapsAppView extends React.Component { globalState, }), }; + + if (newState.query) queryString.setQuery(newState.query); this.setState({ query: newState.query, time: newState.time }); updateGlobalState( { @@ -463,7 +464,7 @@ export class MapsAppView extends React.Component { {this._renderTopNav()}

{`screenTitle placeholder`}

- { newFilters.forEach((filter) => { filter.$state = { store: esFilters.FilterStateStore.APP_STATE }; diff --git a/x-pack/plugins/maps/public/routing/state_syncing/app_sync.js b/x-pack/plugins/maps/public/routing/state_syncing/app_sync.js index 36b20174f2436..69d6dbbe0c4d3 100644 --- a/x-pack/plugins/maps/public/routing/state_syncing/app_sync.js +++ b/x-pack/plugins/maps/public/routing/state_syncing/app_sync.js @@ -31,6 +31,7 @@ export function useAppStateSyncing(appStateManager) { }; const stopSyncingQueryAppStateWithStateContainer = connectToQueryState(query, stateContainer, { filters: esFilters.FilterStateStore.APP_STATE, + query: true, }); // sets up syncing app state container with url diff --git a/x-pack/plugins/ml/common/license/index.ts b/x-pack/plugins/ml/common/license/index.ts index e87986a26a3bd..e09040a9a26f4 100644 --- a/x-pack/plugins/ml/common/license/index.ts +++ b/x-pack/plugins/ml/common/license/index.ts @@ -11,4 +11,5 @@ export { MINIMUM_LICENSE, isFullLicense, isMinimumLicense, + isMlEnabled, } from './ml_license'; diff --git a/x-pack/plugins/ml/common/license/ml_license.ts b/x-pack/plugins/ml/common/license/ml_license.ts index e4367c9b921f4..44ed892ff0d0a 100644 --- a/x-pack/plugins/ml/common/license/ml_license.ts +++ b/x-pack/plugins/ml/common/license/ml_license.ts @@ -82,3 +82,7 @@ export function isFullLicense(license: ILicense) { export function isMinimumLicense(license: ILicense) { return license.check(PLUGIN_ID, MINIMUM_LICENSE).state === 'valid'; } + +export function isMlEnabled(license: ILicense) { + return license.getFeature(PLUGIN_ID).isEnabled; +} diff --git a/x-pack/plugins/ml/public/application/components/chart_tooltip/chart_tooltip.tsx b/x-pack/plugins/ml/public/application/components/chart_tooltip/chart_tooltip.tsx index 3bd4ae1748311..a354612a348dc 100644 --- a/x-pack/plugins/ml/public/application/components/chart_tooltip/chart_tooltip.tsx +++ b/x-pack/plugins/ml/public/application/components/chart_tooltip/chart_tooltip.tsx @@ -29,7 +29,7 @@ const Tooltip: FC<{ service: ChartTooltipService }> = React.memo(({ service }) = useEffect(() => { const subscription = service.tooltipState$.subscribe((tooltipState) => { - if (refCallback.current) { + if (refCallback.current && typeof refCallback.current === 'function') { // update trigger refCallback.current(tooltipState.target); } diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/outlier_exploration/outlier_exploration.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/outlier_exploration/outlier_exploration.tsx index 9341c0aa1a338..4c4731d0dad5f 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/outlier_exploration/outlier_exploration.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/outlier_exploration/outlier_exploration.tsx @@ -56,6 +56,13 @@ export const OutlierExploration: FC = React.memo(({ jobId }) = const { columnsWithCharts, errorMessage, status, tableItems } = outlierData; + /* eslint-disable-next-line react-hooks/rules-of-hooks */ + const colorRange = useColorRange( + COLOR_RANGE.BLUE, + COLOR_RANGE_SCALE.INFLUENCER, + jobConfig !== undefined ? getFeatureCount(jobConfig.dest.results_field, tableItems) : 1 + ); + // if it's a searchBar syntax error leave the table visible so they can try again if (status === INDEX_STATUS.ERROR && !errorMessage.includes('failed to create query')) { return ( @@ -74,13 +81,6 @@ export const OutlierExploration: FC = React.memo(({ jobId }) = ); } - /* eslint-disable-next-line react-hooks/rules-of-hooks */ - const colorRange = useColorRange( - COLOR_RANGE.BLUE, - COLOR_RANGE_SCALE.INFLUENCER, - jobConfig !== undefined ? getFeatureCount(jobConfig.dest.results_field, tableItems) : 1 - ); - return ( {jobConfig !== undefined && needsDestIndexPattern && ( diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_clone/clone_button.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_clone/clone_button.tsx index 6b99787a6c9a9..7a409e5238a57 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_clone/clone_button.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_clone/clone_button.tsx @@ -424,7 +424,7 @@ export const CloneButton: FC = ({ isDisabled, onClick }) => { iconType="copy" isDisabled={isDisabled} onClick={onClick} - size="s" + size="xs" > {buttonText} diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_delete/delete_button.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_delete/delete_button.tsx index c83fb6cbac387..2bc3935c3b9f1 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_delete/delete_button.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_delete/delete_button.tsx @@ -30,7 +30,7 @@ export const DeleteButton: FC = ({ isDisabled, item, onClick iconType="trash" isDisabled={isDisabled} onClick={onClick} - size="s" + size="xs" > {buttonText} diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_edit/edit_button.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_edit/edit_button.tsx index 764b421821ad0..e17862bf326f1 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_edit/edit_button.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_edit/edit_button.tsx @@ -29,7 +29,7 @@ export const EditButton: FC = ({ isDisabled, onClick }) => { iconType="pencil" isDisabled={isDisabled} onClick={onClick} - size="s" + size="xs" > {buttonText} diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_start/start_button.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_start/start_button.tsx index 3192a30f8312e..98b9279d8469a 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_start/start_button.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_start/start_button.tsx @@ -38,7 +38,7 @@ export const StartButton: FC = ({ iconType="play" isDisabled={isDisabled} onClick={onClick} - size="s" + size="xs" > {buttonText} diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_stop/stop_button.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_stop/stop_button.tsx index a3e8f16daf5ef..3bac183d9f391 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_stop/stop_button.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_stop/stop_button.tsx @@ -33,7 +33,7 @@ export const StopButton: FC = ({ isDisabled, item, onClick }) = iconType="stop" isDisabled={isDisabled} onClick={onClick} - size="s" + size="xs" > {buttonText} diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_view/get_view_link_status.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_view/get_view_link_status.ts new file mode 100644 index 0000000000000..e5f6c27582a05 --- /dev/null +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_view/get_view_link_status.ts @@ -0,0 +1,83 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; +import { + isRegressionAnalysis, + isOutlierAnalysis, + isClassificationAnalysis, +} from '../../../../common/analytics'; +import { + DataFrameAnalyticsListRow, + isDataFrameAnalyticsStopped, + isDataFrameAnalyticsFailed, + getDataFrameAnalyticsProgressPhase, +} from '../analytics_list/common'; + +const unknownJobTypeMessage = i18n.translate( + 'xpack.ml.dataframe.analyticsList.viewActionUnknownJobTypeToolTipContent', + { + defaultMessage: 'There is no results page available for this type of data frame analytics job.', + } +); +const jobNotStartedMessage = i18n.translate( + 'xpack.ml.dataframe.analyticsList.viewActionJobNotStartedToolTipContent', + { + defaultMessage: + 'The data frame analytics job did not start. There is no results page available.', + } +); +const jobNotFinishedMessage = i18n.translate( + 'xpack.ml.dataframe.analyticsList.viewActionJobNotFinishedToolTipContent', + { + defaultMessage: + 'The data frame analytics job is not finished. There is no results page available.', + } +); +const jobFailedMessage = i18n.translate( + 'xpack.ml.dataframe.analyticsList.viewActionJobFailedToolTipContent', + { + defaultMessage: 'The data frame analytics job failed. There is no results page available.', + } +); + +interface ViewLinkStatusReturn { + disabled: boolean; + tooltipContent?: string; +} + +export function getViewLinkStatus(item: DataFrameAnalyticsListRow): ViewLinkStatusReturn { + const viewLinkStatus: ViewLinkStatusReturn = { disabled: false }; + + const progressStats = getDataFrameAnalyticsProgressPhase(item.stats); + const jobFailed = isDataFrameAnalyticsFailed(item.stats.state); + const jobNotStarted = progressStats.currentPhase === 1 && progressStats.progress === 0; + const jobFinished = + isDataFrameAnalyticsStopped(item.stats.state) && + progressStats.currentPhase === progressStats.totalPhases && + progressStats.progress === 100; + const isUnknownJobType = + !isRegressionAnalysis(item.config.analysis) && + !isOutlierAnalysis(item.config.analysis) && + !isClassificationAnalysis(item.config.analysis); + + const disabled = !jobFinished || jobFailed || isUnknownJobType; + + if (disabled) { + viewLinkStatus.disabled = true; + if (isUnknownJobType) { + viewLinkStatus.tooltipContent = unknownJobTypeMessage; + } else if (jobFailed) { + viewLinkStatus.tooltipContent = jobFailedMessage; + } else if (jobNotStarted) { + viewLinkStatus.tooltipContent = jobNotStartedMessage; + } else if (!jobFinished) { + viewLinkStatus.tooltipContent = jobNotFinishedMessage; + } + } + + return viewLinkStatus; +} diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_view/view_button.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_view/view_button.tsx index 52b2513d13e39..a0790cd802409 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_view/view_button.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_view/view_button.tsx @@ -8,16 +8,13 @@ import React, { FC } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButtonEmpty, EuiToolTip } from '@elastic/eui'; -import { - getAnalysisType, - isRegressionAnalysis, - isOutlierAnalysis, - isClassificationAnalysis, -} from '../../../../common/analytics'; +import { getAnalysisType } from '../../../../common/analytics'; import { useMlKibana } from '../../../../../contexts/kibana'; import { getResultsUrl, DataFrameAnalyticsListRow } from '../analytics_list/common'; +import { getViewLinkStatus } from './get_view_link_status'; + interface ViewButtonProps { item: DataFrameAnalyticsListRow; isManagementTable: boolean; @@ -30,11 +27,8 @@ export const ViewButton: FC = ({ item, isManagementTable }) => }, } = useMlKibana(); + const { disabled, tooltipContent } = getViewLinkStatus(item); const analysisType = getAnalysisType(item.config.analysis); - const buttonDisabled = - !isRegressionAnalysis(item.config.analysis) && - !isOutlierAnalysis(item.config.analysis) && - !isClassificationAnalysis(item.config.analysis); const url = getResultsUrl(item.id, analysisType); const navigator = isManagementTable @@ -52,23 +46,17 @@ export const ViewButton: FC = ({ item, isManagementTable }) => data-test-subj="mlAnalyticsJobViewButton" flush="left" iconType="visTable" - isDisabled={buttonDisabled} + isDisabled={disabled} onClick={navigator} - size="s" + size="xs" > {buttonText} ); - if (buttonDisabled) { + if (disabled) { return ( - + {button} ); diff --git a/x-pack/plugins/ml/public/application/management/index.ts b/x-pack/plugins/ml/public/application/management/index.ts index 897731304ee7a..a1b8484f200ec 100644 --- a/x-pack/plugins/ml/public/application/management/index.ts +++ b/x-pack/plugins/ml/public/application/management/index.ts @@ -11,37 +11,28 @@ */ import { i18n } from '@kbn/i18n'; -import { take } from 'rxjs/operators'; import { CoreSetup } from 'kibana/public'; -import { MlStartDependencies, MlSetupDependencies } from '../../plugin'; +import { ManagementSetup } from 'src/plugins/management/public'; +import { MlStartDependencies } from '../../plugin'; import { ManagementAppMountParams } from '../../../../../../src/plugins/management/public'; -import { PLUGIN_ID } from '../../../common/constants/app'; -import { MINIMUM_FULL_LICENSE } from '../../../common/license'; -export function initManagementSection( - pluginsSetup: MlSetupDependencies, +export function registerManagementSection( + management: ManagementSetup | undefined, core: CoreSetup ) { - const licensing = pluginsSetup.licensing.license$.pipe(take(1)); - licensing.subscribe((license) => { - const management = pluginsSetup.management; - if ( - management !== undefined && - license.check(PLUGIN_ID, MINIMUM_FULL_LICENSE).state === 'valid' - ) { - management.sections.section.insightsAndAlerting.registerApp({ - id: 'jobsListLink', - title: i18n.translate('xpack.ml.management.jobsListTitle', { - defaultMessage: 'Machine Learning Jobs', - }), - order: 2, - async mount(params: ManagementAppMountParams) { - const { mountApp } = await import('./jobs_list'); - return mountApp(core, params); - }, - }); - } - }); + if (management !== undefined) { + management.sections.section.insightsAndAlerting.registerApp({ + id: 'jobsListLink', + title: i18n.translate('xpack.ml.management.jobsListTitle', { + defaultMessage: 'Machine Learning Jobs', + }), + order: 2, + async mount(params: ManagementAppMountParams) { + const { mountApp } = await import('./jobs_list'); + return mountApp(core, params); + }, + }); + } } diff --git a/x-pack/plugins/ml/public/plugin.ts b/x-pack/plugins/ml/public/plugin.ts index 449d8baa2a184..a8e1e804c2fe3 100644 --- a/x-pack/plugins/ml/public/plugin.ts +++ b/x-pack/plugins/ml/public/plugin.ts @@ -12,6 +12,8 @@ import { AppMountParameters, PluginInitializerContext, } from 'kibana/public'; +import { BehaviorSubject } from 'rxjs'; +import { take } from 'rxjs/operators'; import { ManagementSetup } from 'src/plugins/management/public'; import { SharePluginSetup, SharePluginStart, UrlGeneratorState } from 'src/plugins/share/public'; import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; @@ -19,9 +21,10 @@ import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import { DataPublicPluginStart } from 'src/plugins/data/public'; import { HomePublicPluginSetup } from 'src/plugins/home/public'; import { EmbeddableSetup } from 'src/plugins/embeddable/public'; +import { AppStatus, AppUpdater } from '../../../../src/core/public'; import { SecurityPluginSetup } from '../../security/public'; import { LicensingPluginSetup } from '../../licensing/public'; -import { initManagementSection } from './application/management'; +import { registerManagementSection } from './application/management'; import { LicenseManagementUIPluginSetup } from '../../license_management/public'; import { setDependencyCache } from './application/util/dependency_cache'; import { PLUGIN_ID, PLUGIN_ICON } from '../common/constants/app'; @@ -31,7 +34,8 @@ import { registerEmbeddables } from './embeddables'; import { UiActionsSetup, UiActionsStart } from '../../../../src/plugins/ui_actions/public'; import { registerMlUiActions } from './ui_actions'; import { KibanaLegacyStart } from '../../../../src/plugins/kibana_legacy/public'; -import { MlUrlGenerator, MlUrlGeneratorState, ML_APP_URL_GENERATOR } from './url_generator'; +import { registerUrlGenerator, MlUrlGeneratorState, ML_APP_URL_GENERATOR } from './url_generator'; +import { isMlEnabled, isFullLicense } from '../common/license'; export interface MlStartDependencies { data: DataPublicPluginStart; @@ -61,18 +65,11 @@ declare module '../../../../src/plugins/share/public' { export type MlCoreSetup = CoreSetup; export class MlPlugin implements Plugin { + private appUpdater = new BehaviorSubject(() => ({})); + constructor(private initializerContext: PluginInitializerContext) {} setup(core: MlCoreSetup, pluginsSetup: MlSetupDependencies) { - const baseUrl = core.http.basePath.prepend('/app/ml'); - - pluginsSetup.share.urlGenerators.registerUrlGenerator( - new MlUrlGenerator({ - appBasePath: baseUrl, - useHash: core.uiSettings.get('state:storeInSessionStorage'), - }) - ); - core.application.register({ id: PLUGIN_ID, title: i18n.translate('xpack.ml.plugin.title', { @@ -82,6 +79,7 @@ export class MlPlugin implements Plugin { euiIconType: PLUGIN_ICON, appRoute: '/app/ml', category: DEFAULT_APP_CATEGORIES.kibana, + updater$: this.appUpdater, mount: async (params: AppMountParameters) => { const [coreStart, pluginsStart] = await core.getStartServices(); const kibanaVersion = this.initializerContext.env.packageInfo.version; @@ -112,11 +110,26 @@ export class MlPlugin implements Plugin { }, }); - registerFeature(pluginsSetup.home); + const licensing = pluginsSetup.licensing.license$.pipe(take(1)); + licensing.subscribe((license) => { + if (isMlEnabled(license)) { + // add ML to home page + registerFeature(pluginsSetup.home); - initManagementSection(pluginsSetup, core); - registerEmbeddables(pluginsSetup.embeddable, core); - registerMlUiActions(pluginsSetup.uiActions, core); + // register various ML plugin features which require a full license + if (isFullLicense(license)) { + registerManagementSection(pluginsSetup.management, core); + registerEmbeddables(pluginsSetup.embeddable, core); + registerMlUiActions(pluginsSetup.uiActions, core); + registerUrlGenerator(pluginsSetup.share, core); + } + } else { + // if ml is disabled in elasticsearch, disable ML in kibana + this.appUpdater.next(() => ({ + status: AppStatus.inaccessible, + })); + } + }); return {}; } diff --git a/x-pack/plugins/ml/public/url_generator.ts b/x-pack/plugins/ml/public/url_generator.ts index 65d5077e081a3..c2b57f6349d81 100644 --- a/x-pack/plugins/ml/public/url_generator.ts +++ b/x-pack/plugins/ml/public/url_generator.ts @@ -4,11 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import { UrlGeneratorsDefinition } from '../../../../src/plugins/share/public'; +import { CoreSetup } from 'kibana/public'; +import { SharePluginSetup, UrlGeneratorsDefinition } from '../../../../src/plugins/share/public'; import { TimeRange } from '../../../../src/plugins/data/public'; import { setStateToKbnUrl } from '../../../../src/plugins/kibana_utils/public'; import { JobId } from '../../reporting/common/types'; import { ExplorerAppState } from './application/explorer/explorer_dashboard_service'; +import { MlStartDependencies } from './plugin'; export const ML_APP_URL_GENERATOR = 'ML_APP_URL_GENERATOR'; @@ -88,3 +90,19 @@ export class MlUrlGenerator implements UrlGeneratorsDefinition +) { + const baseUrl = core.http.basePath.prepend('/app/ml'); + share.urlGenerators.registerUrlGenerator( + new MlUrlGenerator({ + appBasePath: baseUrl, + useHash: core.uiSettings.get('state:storeInSessionStorage'), + }) + ); +} diff --git a/x-pack/plugins/ml/server/client/elasticsearch_ml.ts b/x-pack/plugins/ml/server/client/elasticsearch_ml.ts index 24c80c450f61a..63153d18cb10b 100644 --- a/x-pack/plugins/ml/server/client/elasticsearch_ml.ts +++ b/x-pack/plugins/ml/server/client/elasticsearch_ml.ts @@ -828,7 +828,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any) ml.categories = ca({ urls: [ { - fmt: '/_xpack/ml/anomaly_detectors/<%=jobId%>/results/categories/<%=categoryId%>', + fmt: '/_ml/anomaly_detectors/<%=jobId%>/results/categories/<%=categoryId%>', req: { jobId: { type: 'string', @@ -839,7 +839,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any) }, }, { - fmt: '/_xpack/ml/anomaly_detectors/<%=jobId%>/results/categories', + fmt: '/_ml/anomaly_detectors/<%=jobId%>/results/categories', req: { jobId: { type: 'string', @@ -853,7 +853,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any) ml.modelSnapshots = ca({ urls: [ { - fmt: '/_xpack/ml/anomaly_detectors/<%=jobId%>/model_snapshots/<%=snapshotId%>', + fmt: '/_ml/anomaly_detectors/<%=jobId%>/model_snapshots/<%=snapshotId%>', req: { jobId: { type: 'string', @@ -864,7 +864,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any) }, }, { - fmt: '/_xpack/ml/anomaly_detectors/<%=jobId%>/model_snapshots', + fmt: '/_ml/anomaly_detectors/<%=jobId%>/model_snapshots', req: { jobId: { type: 'string', @@ -878,7 +878,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any) ml.updateModelSnapshot = ca({ urls: [ { - fmt: '/_xpack/ml/anomaly_detectors/<%=jobId%>/model_snapshots/<%=snapshotId%>/_update', + fmt: '/_ml/anomaly_detectors/<%=jobId%>/model_snapshots/<%=snapshotId%>/_update', req: { jobId: { type: 'string', @@ -896,7 +896,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any) ml.deleteModelSnapshot = ca({ urls: [ { - fmt: '/_xpack/ml/anomaly_detectors/<%=jobId%>/model_snapshots/<%=snapshotId%>', + fmt: '/_ml/anomaly_detectors/<%=jobId%>/model_snapshots/<%=snapshotId%>', req: { jobId: { type: 'string', @@ -913,7 +913,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any) ml.revertModelSnapshot = ca({ urls: [ { - fmt: '/_xpack/ml/anomaly_detectors/<%=jobId%>/model_snapshots/<%=snapshotId%>/_revert', + fmt: '/_ml/anomaly_detectors/<%=jobId%>/model_snapshots/<%=snapshotId%>/_revert', req: { jobId: { type: 'string', diff --git a/x-pack/plugins/ml/server/lib/capabilities/capabilities_switcher.ts b/x-pack/plugins/ml/server/lib/capabilities/capabilities_switcher.ts index 5b8cbc4bdbbe8..f2fff4cc64aab 100644 --- a/x-pack/plugins/ml/server/lib/capabilities/capabilities_switcher.ts +++ b/x-pack/plugins/ml/server/lib/capabilities/capabilities_switcher.ts @@ -9,7 +9,7 @@ import { Observable } from 'rxjs'; import { take } from 'rxjs/operators'; import { CapabilitiesSwitcher, CoreSetup, Logger } from 'src/core/server'; import { ILicense } from '../../../../licensing/common/types'; -import { isFullLicense, isMinimumLicense } from '../../../common/license'; +import { isFullLicense, isMinimumLicense, isMlEnabled } from '../../../common/license'; import { MlCapabilities, basicLicenseMlCapabilities } from '../../../common/types/capabilities'; export const setupCapabilitiesSwitcher = ( @@ -30,9 +30,10 @@ function getSwitcher(license$: Observable, logger: Logger): Capabiliti try { const license = await license$.pipe(take(1)).toPromise(); + const mlEnabled = isMlEnabled(license); // full license, leave capabilities as they were - if (isFullLicense(license)) { + if (mlEnabled && isFullLicense(license)) { return capabilities; } @@ -45,7 +46,7 @@ function getSwitcher(license$: Observable, logger: Logger): Capabiliti }); // for a basic license, reapply the original capabilities for the basic license features - if (isMinimumLicense(license)) { + if (mlEnabled && isMinimumLicense(license)) { basicLicenseMlCapabilities.forEach((c) => (mlCaps[c] = originalCapabilities[c])); } diff --git a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.test.ts b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.test.ts index 105c5cd109533..f07235742a1d3 100644 --- a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.test.ts +++ b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.test.ts @@ -18,7 +18,11 @@ describe('GetCsvReportPanelAction', () => { beforeAll(() => { if (typeof window.URL.revokeObjectURL === 'undefined') { - Object.defineProperty(window.URL, 'revokeObjectURL', { value: () => {} }); + Object.defineProperty(window.URL, 'revokeObjectURL', { + configurable: true, + writable: true, + value: () => {}, + }); } }); diff --git a/x-pack/plugins/security_solution/common/constants.ts b/x-pack/plugins/security_solution/common/constants.ts index f934d90c740a5..c74cf888a2db6 100644 --- a/x-pack/plugins/security_solution/common/constants.ts +++ b/x-pack/plugins/security_solution/common/constants.ts @@ -32,6 +32,7 @@ export const DEFAULT_INTERVAL_PAUSE = true; export const DEFAULT_INTERVAL_TYPE = 'manual'; export const DEFAULT_INTERVAL_VALUE = 300000; // ms export const DEFAULT_TIMEPICKER_QUICK_RANGES = 'timepicker:quickRanges'; +export const SCROLLING_DISABLED_CLASS_NAME = 'scrolling-disabled'; export const FILTERS_GLOBAL_HEIGHT = 109; // px export const FULL_SCREEN_TOGGLED_CLASS_NAME = 'fullScreenToggled'; export const NO_ALERT_INDEX = 'no-alert-index-049FC71A-4C2C-446F-9901-37XMC5024C51'; diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/common/schemas.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/common/schemas.ts index 273ea72a2ffe3..21fa780badd84 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/common/schemas.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/common/schemas.ts @@ -222,8 +222,9 @@ export const risk_score_mapping_value = t.string; export const risk_score_mapping_item = t.exact( t.type({ field: risk_score_mapping_field, - operator, value: risk_score_mapping_value, + operator, + risk_score: riskScoreOrUndefined, }) ); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/add_prepackged_rules_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/add_prepackged_rules_schema.test.ts index 5fd2c3dbbf894..3cad48ec18fc1 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/add_prepackged_rules_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/add_prepackged_rules_schema.test.ts @@ -1446,11 +1446,13 @@ describe('add prepackaged rules schema', () => { exceptions_list: [ { id: 'some_uuid', + list_id: 'list_id_single', namespace_type: 'single', type: 'detection', }, { - id: 'some_uuid', + id: 'endpoint_list', + list_id: 'endpoint_list', namespace_type: 'agnostic', type: 'endpoint', }, @@ -1535,6 +1537,7 @@ describe('add prepackaged rules schema', () => { const checked = exactCheck(payload, decoded); const message = pipe(checked, foldLeftRight); expect(getPaths(left(message.errors))).toEqual([ + 'Invalid value "undefined" supplied to "exceptions_list,list_id"', 'Invalid value "undefined" supplied to "exceptions_list,type"', 'Invalid value "not a namespace type" supplied to "exceptions_list,namespace_type"', ]); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/create_rules_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/create_rules_schema.test.ts index 71f3964956249..c2c2f4784f2b5 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/create_rules_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/create_rules_schema.test.ts @@ -1513,11 +1513,13 @@ describe('create rules schema', () => { exceptions_list: [ { id: 'some_uuid', + list_id: 'list_id_single', namespace_type: 'single', type: 'detection', }, { - id: 'some_uuid', + id: 'endpoint_list', + list_id: 'endpoint_list', namespace_type: 'agnostic', type: 'endpoint', }, @@ -1600,6 +1602,7 @@ describe('create rules schema', () => { const checked = exactCheck(payload, decoded); const message = pipe(checked, foldLeftRight); expect(getPaths(left(message.errors))).toEqual([ + 'Invalid value "undefined" supplied to "exceptions_list,list_id"', 'Invalid value "undefined" supplied to "exceptions_list,type"', 'Invalid value "not a namespace type" supplied to "exceptions_list,namespace_type"', ]); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/import_rules_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/import_rules_schema.test.ts index 828626ef26d6f..00a3f2126f44a 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/import_rules_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/import_rules_schema.test.ts @@ -1642,11 +1642,13 @@ describe('import rules schema', () => { exceptions_list: [ { id: 'some_uuid', + list_id: 'list_id_single', namespace_type: 'single', type: 'detection', }, { - id: 'some_uuid', + id: 'endpoint_list', + list_id: 'endpoint_list', namespace_type: 'agnostic', type: 'endpoint', }, @@ -1730,6 +1732,7 @@ describe('import rules schema', () => { const checked = exactCheck(payload, decoded); const message = pipe(checked, foldLeftRight); expect(getPaths(left(message.errors))).toEqual([ + 'Invalid value "undefined" supplied to "exceptions_list,list_id"', 'Invalid value "undefined" supplied to "exceptions_list,type"', 'Invalid value "not a namespace type" supplied to "exceptions_list,namespace_type"', ]); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/patch_rules_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/patch_rules_schema.test.ts index e75aff1abe3e9..e4fc53b934f58 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/patch_rules_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/patch_rules_schema.test.ts @@ -1176,11 +1176,13 @@ describe('patch_rules_schema', () => { exceptions_list: [ { id: 'some_uuid', + list_id: 'list_id_single', namespace_type: 'single', type: 'detection', }, { - id: 'some_uuid', + id: 'endpoint_list', + list_id: 'endpoint_list', namespace_type: 'agnostic', type: 'endpoint', }, @@ -1251,6 +1253,7 @@ describe('patch_rules_schema', () => { const checked = exactCheck(payload, decoded); const message = pipe(checked, foldLeftRight); expect(getPaths(left(message.errors))).toEqual([ + 'Invalid value "undefined" supplied to "exceptions_list,list_id"', 'Invalid value "undefined" supplied to "exceptions_list,type"', 'Invalid value "not a namespace type" supplied to "exceptions_list,namespace_type"', 'Invalid value "[{"id":"uuid_here","namespace_type":"not a namespace type"}]" supplied to "exceptions_list"', diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/update_rules_schema.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/update_rules_schema.test.ts index d18d2d91b963c..024198d783048 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/request/update_rules_schema.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/request/update_rules_schema.test.ts @@ -1448,11 +1448,13 @@ describe('update rules schema', () => { exceptions_list: [ { id: 'some_uuid', + list_id: 'list_id_single', namespace_type: 'single', type: 'detection', }, { - id: 'some_uuid', + id: 'endpoint_list', + list_id: 'endpoint_list', namespace_type: 'agnostic', type: 'endpoint', }, @@ -1534,6 +1536,7 @@ describe('update rules schema', () => { const checked = exactCheck(payload, decoded); const message = pipe(checked, foldLeftRight); expect(getPaths(left(message.errors))).toEqual([ + 'Invalid value "undefined" supplied to "exceptions_list,list_id"', 'Invalid value "undefined" supplied to "exceptions_list,type"', 'Invalid value "not a namespace type" supplied to "exceptions_list,namespace_type"', ]); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.mock.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.mock.ts index 0c7853bc3c08a..fec7548811820 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.mock.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.mock.ts @@ -4,17 +4,20 @@ * you may not use this file except in compliance with the Elastic License. */ import { List, ListArray } from './lists'; +import { ENDPOINT_LIST_ID } from '../../../shared_imports'; export const getListMock = (): List => ({ id: 'some_uuid', + list_id: 'list_id_single', namespace_type: 'single', type: 'detection', }); -export const getListAgnosticMock = (): List => ({ - id: 'some_uuid', +export const getEndpointListMock = (): List => ({ + id: ENDPOINT_LIST_ID, + list_id: ENDPOINT_LIST_ID, namespace_type: 'agnostic', type: 'endpoint', }); -export const getListArrayMock = (): ListArray => [getListMock(), getListAgnosticMock()]; +export const getListArrayMock = (): ListArray => [getListMock(), getEndpointListMock()]; diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.test.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.test.ts index 56ee4630996fd..7a2c167bfd855 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.test.ts @@ -9,7 +9,7 @@ import { left } from 'fp-ts/lib/Either'; import { foldLeftRight, getPaths } from '../../../test_utils'; -import { getListAgnosticMock, getListMock, getListArrayMock } from './lists.mock'; +import { getEndpointListMock, getListMock, getListArrayMock } from './lists.mock'; import { List, ListArray, @@ -31,7 +31,7 @@ describe('Lists', () => { }); test('it should validate a list with "namespace_type" of "agnostic"', () => { - const payload = getListAgnosticMock(); + const payload = getEndpointListMock(); const decoded = list.decode(payload); const message = pipe(decoded, foldLeftRight); @@ -91,7 +91,7 @@ describe('Lists', () => { const message = pipe(decoded, foldLeftRight); expect(getPaths(left(message.errors))).toEqual([ - 'Invalid value "1" supplied to "Array<{| id: string, type: "detection" | "endpoint", namespace_type: "agnostic" | "single" |}>"', + 'Invalid value "1" supplied to "Array<{| id: NonEmptyString, list_id: NonEmptyString, type: "detection" | "endpoint", namespace_type: "agnostic" | "single" |}>"', ]); expect(message.schema).toEqual({}); }); @@ -122,8 +122,8 @@ describe('Lists', () => { const message = pipe(decoded, foldLeftRight); expect(getPaths(left(message.errors))).toEqual([ - 'Invalid value "1" supplied to "(Array<{| id: string, type: "detection" | "endpoint", namespace_type: "agnostic" | "single" |}> | undefined)"', - 'Invalid value "[1]" supplied to "(Array<{| id: string, type: "detection" | "endpoint", namespace_type: "agnostic" | "single" |}> | undefined)"', + 'Invalid value "1" supplied to "(Array<{| id: NonEmptyString, list_id: NonEmptyString, type: "detection" | "endpoint", namespace_type: "agnostic" | "single" |}> | undefined)"', + 'Invalid value "[1]" supplied to "(Array<{| id: NonEmptyString, list_id: NonEmptyString, type: "detection" | "endpoint", namespace_type: "agnostic" | "single" |}> | undefined)"', ]); expect(message.schema).toEqual({}); }); diff --git a/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.ts b/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.ts index e5aaee6d3ec74..fecdd0761aade 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/schemas/types/lists.ts @@ -8,9 +8,12 @@ import * as t from 'io-ts'; import { exceptionListType, namespaceType } from '../../../shared_imports'; +import { NonEmptyString } from './non_empty_string'; + export const list = t.exact( t.type({ - id: t.string, + id: NonEmptyString, + list_id: NonEmptyString, type: exceptionListType, namespace_type: namespaceType, }) diff --git a/x-pack/plugins/security_solution/common/endpoint/generate_data.test.ts b/x-pack/plugins/security_solution/common/endpoint/generate_data.test.ts index fcea86be4ae9e..debe4a3da6a6f 100644 --- a/x-pack/plugins/security_solution/common/endpoint/generate_data.test.ts +++ b/x-pack/plugins/security_solution/common/endpoint/generate_data.test.ts @@ -3,6 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ +import _ from 'lodash'; import { EndpointDocGenerator, Event, @@ -79,9 +80,9 @@ describe('data generator', () => { const timestamp = new Date().getTime(); const processEvent = generator.generateEvent({ timestamp }); expect(processEvent['@timestamp']).toEqual(timestamp); - expect(processEvent.event.category).toEqual('process'); + expect(processEvent.event.category).toEqual(['process']); expect(processEvent.event.kind).toEqual('event'); - expect(processEvent.event.type).toEqual('start'); + expect(processEvent.event.type).toEqual(['start']); expect(processEvent.agent).not.toBeNull(); expect(processEvent.host).not.toBeNull(); expect(processEvent.process.entity_id).not.toBeNull(); @@ -94,7 +95,7 @@ describe('data generator', () => { expect(processEvent['@timestamp']).toEqual(timestamp); expect(processEvent.event.category).toEqual('dns'); expect(processEvent.event.kind).toEqual('event'); - expect(processEvent.event.type).toEqual('start'); + expect(processEvent.event.type).toEqual(['start']); expect(processEvent.agent).not.toBeNull(); expect(processEvent.host).not.toBeNull(); expect(processEvent.process.entity_id).not.toBeNull(); @@ -332,6 +333,12 @@ describe('data generator', () => { describe('creates alert ancestor tree', () => { let events: Event[]; + const isCategoryProcess = (event: Event) => { + return ( + _.isEqual(event.event.category, ['process']) || _.isEqual(event.event.category, 'process') + ); + }; + beforeEach(() => { events = generator.createAlertEventAncestry({ ancestors: 3, @@ -343,11 +350,7 @@ describe('data generator', () => { it('with n-1 process events', () => { for (let i = events.length - 2; i > 0; ) { const parentEntityIdOfChild = events[i].process.parent?.entity_id; - for ( - ; - --i >= -1 && (events[i].event.kind !== 'event' || events[i].event.category !== 'process'); - - ) { + for (; --i >= -1 && (events[i].event.kind !== 'event' || !isCategoryProcess(events[i])); ) { // related event - skip it } expect(i).toBeGreaterThanOrEqual(0); @@ -361,7 +364,7 @@ describe('data generator', () => { ; previousProcessEventIndex >= -1 && (events[previousProcessEventIndex].event.kind !== 'event' || - events[previousProcessEventIndex].event.category !== 'process'); + !isCategoryProcess(events[previousProcessEventIndex])); previousProcessEventIndex-- ) { // related event - skip it diff --git a/x-pack/plugins/security_solution/common/endpoint/generate_data.ts b/x-pack/plugins/security_solution/common/endpoint/generate_data.ts index 66e786cb02e63..9a92270fc9c14 100644 --- a/x-pack/plugins/security_solution/common/endpoint/generate_data.ts +++ b/x-pack/plugins/security_solution/common/endpoint/generate_data.ts @@ -35,7 +35,7 @@ interface EventOptions { timestamp?: number; entityID?: string; parentEntityID?: string; - eventType?: string; + eventType?: string | string[]; eventCategory?: string | string[]; processName?: string; ancestry?: string[]; @@ -572,9 +572,9 @@ export class EndpointDocGenerator { }, ...detailRecordForEventType, event: { - category: options.eventCategory ? options.eventCategory : 'process', + category: options.eventCategory ? options.eventCategory : ['process'], kind: 'event', - type: options.eventType ? options.eventType : 'start', + type: options.eventType ? options.eventType : ['start'], id: this.seededUUIDv4(), }, host: this.commonInfo.host, @@ -633,7 +633,12 @@ export class EndpointDocGenerator { // place the event in the right array depending on its category if (event.event.kind === 'event') { - if (event.event.category === 'process') { + if ( + (Array.isArray(event.event.category) && + event.event.category.length === 1 && + event.event.category[0] === 'process') || + event.event.category === 'process' + ) { node.lifecycle.push(event); } else { node.relatedEvents.push(event); @@ -812,8 +817,8 @@ export class EndpointDocGenerator { timestamp: timestamp + termProcessDuration * 1000, entityID: root.process.entity_id, parentEntityID: root.process.parent?.entity_id, - eventCategory: 'process', - eventType: 'end', + eventCategory: ['process'], + eventType: ['end'], }) ); } @@ -838,8 +843,8 @@ export class EndpointDocGenerator { timestamp: timestamp + termProcessDuration * 1000, entityID: ancestor.process.entity_id, parentEntityID: ancestor.process.parent?.entity_id, - eventCategory: 'process', - eventType: 'end', + eventCategory: ['process'], + eventType: ['end'], ancestry: ancestor.process.Ext?.ancestry, ancestryArrayLimit: opts.ancestryArraySize, }) @@ -936,8 +941,8 @@ export class EndpointDocGenerator { timestamp: timestamp + processDuration * 1000, entityID: child.process.entity_id, parentEntityID: child.process.parent?.entity_id, - eventCategory: 'process', - eventType: 'end', + eventCategory: ['process'], + eventType: ['end'], ancestry: child.process.Ext?.ancestry, ancestryArrayLimit: opts.ancestryArraySize, }); @@ -1036,7 +1041,7 @@ export class EndpointDocGenerator { config: { artifact_manifest: { value: { - manifest_version: 'WzAsMF0=', + manifest_version: '1.0.0', schema_version: 'v1', artifacts: {}, }, diff --git a/x-pack/plugins/security_solution/common/endpoint/models/event.test.ts b/x-pack/plugins/security_solution/common/endpoint/models/event.test.ts index a0bf00f0274e6..62f923aa6d793 100644 --- a/x-pack/plugins/security_solution/common/endpoint/models/event.test.ts +++ b/x-pack/plugins/security_solution/common/endpoint/models/event.test.ts @@ -4,38 +4,90 @@ * you may not use this file except in compliance with the Elastic License. */ import { EndpointDocGenerator } from '../generate_data'; -import { descriptiveName } from './event'; +import { descriptiveName, isStart } from './event'; +import { ResolverEvent } from '../types'; -describe('Event descriptive names', () => { +describe('Generated documents', () => { let generator: EndpointDocGenerator; beforeEach(() => { generator = new EndpointDocGenerator('seed'); }); - it('returns the right name for a registry event', () => { - const extensions = { registry: { key: `HKLM/Windows/Software/abc` } }; - const event = generator.generateEvent({ eventCategory: 'registry', extensions }); - expect(descriptiveName(event)).toEqual({ subject: `HKLM/Windows/Software/abc` }); - }); + describe('Event descriptive names', () => { + it('returns the right name for a registry event', () => { + const extensions = { registry: { key: `HKLM/Windows/Software/abc` } }; + const event = generator.generateEvent({ eventCategory: 'registry', extensions }); + expect(descriptiveName(event)).toEqual({ subject: `HKLM/Windows/Software/abc` }); + }); - it('returns the right name for a network event', () => { - const randomIP = `${generator.randomIP()}`; - const extensions = { network: { direction: 'outbound', forwarded_ip: randomIP } }; - const event = generator.generateEvent({ eventCategory: 'network', extensions }); - expect(descriptiveName(event)).toEqual({ subject: `${randomIP}`, descriptor: 'outbound' }); - }); + it('returns the right name for a network event', () => { + const randomIP = `${generator.randomIP()}`; + const extensions = { network: { direction: 'outbound', forwarded_ip: randomIP } }; + const event = generator.generateEvent({ eventCategory: 'network', extensions }); + expect(descriptiveName(event)).toEqual({ subject: `${randomIP}`, descriptor: 'outbound' }); + }); - it('returns the right name for a file event', () => { - const extensions = { file: { path: 'C:\\My Documents\\business\\January\\processName' } }; - const event = generator.generateEvent({ eventCategory: 'file', extensions }); - expect(descriptiveName(event)).toEqual({ - subject: 'C:\\My Documents\\business\\January\\processName', + it('returns the right name for a file event', () => { + const extensions = { file: { path: 'C:\\My Documents\\business\\January\\processName' } }; + const event = generator.generateEvent({ eventCategory: 'file', extensions }); + expect(descriptiveName(event)).toEqual({ + subject: 'C:\\My Documents\\business\\January\\processName', + }); + }); + + it('returns the right name for a dns event', () => { + const extensions = { dns: { question: { name: `${generator.randomIP()}` } } }; + const event = generator.generateEvent({ eventCategory: 'dns', extensions }); + expect(descriptiveName(event)).toEqual({ subject: extensions.dns.question.name }); }); }); - it('returns the right name for a dns event', () => { - const extensions = { dns: { question: { name: `${generator.randomIP()}` } } }; - const event = generator.generateEvent({ eventCategory: 'dns', extensions }); - expect(descriptiveName(event)).toEqual({ subject: extensions.dns.question.name }); + describe('Start events', () => { + it('is a start event when event.type is a string', () => { + const event: ResolverEvent = generator.generateEvent({ + eventType: 'start', + }); + expect(isStart(event)).toBeTruthy(); + }); + + it('is a start event when event.type is an array of strings', () => { + const event: ResolverEvent = generator.generateEvent({ + eventType: ['start'], + }); + expect(isStart(event)).toBeTruthy(); + }); + + it('is a start event when event.type is an array of strings and contains start', () => { + let event: ResolverEvent = generator.generateEvent({ + eventType: ['bogus', 'start', 'creation'], + }); + expect(isStart(event)).toBeTruthy(); + + event = generator.generateEvent({ + eventType: ['start', 'bogus'], + }); + expect(isStart(event)).toBeTruthy(); + }); + + it('is not a start event when event.type is not start', () => { + const event: ResolverEvent = generator.generateEvent({ + eventType: ['end'], + }); + expect(isStart(event)).toBeFalsy(); + }); + + it('is not a start event when event.type is empty', () => { + const event: ResolverEvent = generator.generateEvent({ + eventType: [], + }); + expect(isStart(event)).toBeFalsy(); + }); + + it('is not a start event when event.type is bogus', () => { + const event: ResolverEvent = generator.generateEvent({ + eventType: ['bogus'], + }); + expect(isStart(event)).toBeFalsy(); + }); }); }); diff --git a/x-pack/plugins/security_solution/common/endpoint/models/event.ts b/x-pack/plugins/security_solution/common/endpoint/models/event.ts index f53da8fb1f096..216b5cc028588 100644 --- a/x-pack/plugins/security_solution/common/endpoint/models/event.ts +++ b/x-pack/plugins/security_solution/common/endpoint/models/event.ts @@ -9,10 +9,15 @@ export function isLegacyEvent(event: ResolverEvent): event is LegacyEndpointEven return (event as LegacyEndpointEvent).endgame !== undefined; } -export function isProcessStart(event: ResolverEvent): boolean { +export function isStart(event: ResolverEvent): boolean { if (isLegacyEvent(event)) { return event.event?.type === 'process_start' || event.event?.action === 'fork_event'; } + + if (Array.isArray(event.event.type)) { + return event.event.type.includes('start'); + } + return event.event.type === 'start'; } diff --git a/x-pack/plugins/security_solution/common/endpoint/schema/common.ts b/x-pack/plugins/security_solution/common/endpoint/schema/common.ts index 8f2ea1f8a6452..1c910927a7afa 100644 --- a/x-pack/plugins/security_solution/common/endpoint/schema/common.ts +++ b/x-pack/plugins/security_solution/common/endpoint/schema/common.ts @@ -23,8 +23,6 @@ export const encryptionAlgorithm = t.keyof({ export const identifier = t.string; -export const manifestVersion = t.string; - export const manifestSchemaVersion = t.keyof({ v1: null, }); @@ -34,4 +32,7 @@ export const relativeUrl = t.string; export const sha256 = t.string; +export const semanticVersion = t.string; +export type SemanticVersion = t.TypeOf; + export const size = t.number; diff --git a/x-pack/plugins/security_solution/common/endpoint/schema/manifest.ts b/x-pack/plugins/security_solution/common/endpoint/schema/manifest.ts index f8bb8b70f2d5b..f03db881837d5 100644 --- a/x-pack/plugins/security_solution/common/endpoint/schema/manifest.ts +++ b/x-pack/plugins/security_solution/common/endpoint/schema/manifest.ts @@ -11,9 +11,9 @@ import { encryptionAlgorithm, identifier, manifestSchemaVersion, - manifestVersion, relativeUrl, sha256, + semanticVersion, size, } from './common'; @@ -50,7 +50,7 @@ export type ManifestEntryDispatchSchema = t.TypeOf { before(() => { loginAndWaitForPage(HOSTS_URL); diff --git a/x-pack/plugins/security_solution/cypress/tasks/common.ts b/x-pack/plugins/security_solution/cypress/tasks/common.ts index a385ad78f63b7..e16db54599981 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/common.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/common.ts @@ -23,14 +23,14 @@ export const drag = (subject: JQuery) => { clientY: subjectLocation.top, force: true, }) - .wait(1000) + .wait(3000) .trigger('mousemove', { button: primaryButton, clientX: subjectLocation.left + dndSloppyClickDetectionThreshold, clientY: subjectLocation.top, force: true, }) - .wait(1000); + .wait(3000); }; /** Drags the subject being dragged on the specified drop target, but does not drop it */ @@ -44,9 +44,9 @@ export const dragWithoutDrop = (dropTarget: JQuery) => { export const drop = (dropTarget: JQuery) => { cy.wrap(dropTarget) .trigger('mousemove', { button: primaryButton, force: true }) - .wait(1000) + .wait(3000) .trigger('mouseup', { force: true }) - .wait(1000); + .wait(3000); }; export const reload = (afterReload: () => void) => { diff --git a/x-pack/plugins/security_solution/cypress/tasks/hosts/events.ts b/x-pack/plugins/security_solution/cypress/tasks/hosts/events.ts index 57c819d967883..1d2c4aa8d0834 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/hosts/events.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/hosts/events.ts @@ -68,7 +68,7 @@ export const dragAndDropColumn = ({ .eq(column) .then((header) => drag(header)); - cy.wait(3000); // wait for DOM updates before moving + cy.wait(5000); // wait for DOM updates before moving cy.get(DRAGGABLE_HEADER) .eq(newPosition) diff --git a/x-pack/plugins/security_solution/public/cases/pages/saved_object_no_permissions.tsx b/x-pack/plugins/security_solution/public/cases/pages/saved_object_no_permissions.tsx index 7129aa04bdf69..c61ff6d18caab 100644 --- a/x-pack/plugins/security_solution/public/cases/pages/saved_object_no_permissions.tsx +++ b/x-pack/plugins/security_solution/public/cases/pages/saved_object_no_permissions.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { useMemo } from 'react'; import { EmptyPage } from '../../common/components/empty_page'; import * as i18n from './translations'; @@ -12,13 +12,21 @@ import { useKibana } from '../../common/lib/kibana'; export const CaseSavedObjectNoPermissions = React.memo(() => { const docLinks = useKibana().services.docLinks; + const actions = useMemo( + () => ({ + savedObject: { + icon: 'documents', + label: i18n.GO_TO_DOCUMENTATION, + url: `${docLinks.ELASTIC_WEBSITE_URL}guide/en/security/${docLinks.DOC_LINK_VERSION}s`, + target: '_blank', + }, + }), + [docLinks] + ); return ( { ); beforeEach(() => { + jest.useFakeTimers(); store = createStore( state, SUB_PLUGINS_REDUCER, @@ -159,6 +160,8 @@ describe('AddFilterToGlobalSearchBar Component', () => { wrapper.find('[data-test-subj="withHoverActionsButton"]').simulate('mouseenter'); wrapper.update(); + jest.runAllTimers(); + wrapper.update(); wrapper .find('[data-test-subj="hover-actions-container"] [data-euiicon-type]') diff --git a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/draggable_wrapper.test.tsx b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/draggable_wrapper.test.tsx index e17fc7b9ef9bd..ebfa9ac22bdc7 100644 --- a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/draggable_wrapper.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/draggable_wrapper.test.tsx @@ -22,6 +22,10 @@ describe('DraggableWrapper', () => { const message = 'draggable wrapper content'; const mount = useMountAppended(); + beforeEach(() => { + jest.useFakeTimers(); + }); + describe('rendering', () => { test('it renders against the snapshot', () => { const wrapper = shallow( @@ -78,6 +82,8 @@ describe('DraggableWrapper', () => { wrapper.find('[data-test-subj="withHoverActionsButton"]').simulate('mouseenter'); wrapper.update(); + jest.runAllTimers(); + wrapper.update(); expect(wrapper.find('[data-test-subj="copy-to-clipboard"]').exists()).toBe(true); }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/provider_container.tsx b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/provider_container.tsx index 06cb8ee2e1a46..8db6d073f9687 100644 --- a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/provider_container.tsx +++ b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/provider_container.tsx @@ -13,13 +13,6 @@ interface ProviderContainerProps { } const ProviderContainerComponent = styled.div` - &, - &::before, - &::after { - transition: background ${({ theme }) => theme.eui.euiAnimSpeedFast} ease, - color ${({ theme }) => theme.eui.euiAnimSpeedFast} ease; - } - ${({ isDragging }) => !isDragging && css` diff --git a/x-pack/plugins/security_solution/public/common/components/empty_page/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/common/components/empty_page/__snapshots__/index.test.tsx.snap index 623b15aa76d12..9bf3be7b5dfa4 100644 --- a/x-pack/plugins/security_solution/public/common/components/empty_page/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/common/components/empty_page/__snapshots__/index.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders correctly 1`] = ` +exports[`EmptyPage component renders actions with descriptions 1`] = ` + + Do Something + + } + title={false} + /> + + + } + iconType="logoSecurity" + title={ +

+ My Super Title +

+ } +/> +`; + +exports[`EmptyPage component renders actions without descriptions 1`] = ` + + Do Something diff --git a/x-pack/plugins/security_solution/public/common/components/empty_page/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/empty_page/index.test.tsx index 6a14c12cee0f8..28e01eaa3eead 100644 --- a/x-pack/plugins/security_solution/public/common/components/empty_page/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/empty_page/index.test.tsx @@ -9,13 +9,27 @@ import React from 'react'; import { EmptyPage } from './index'; -test('renders correctly', () => { - const EmptyComponent = shallow( - - ); - expect(EmptyComponent).toMatchSnapshot(); +describe('EmptyPage component', () => { + it('renders actions without descriptions', () => { + const actions = { + actions: { + label: 'Do Something', + url: 'my/url/from/nowwhere', + }, + }; + const EmptyComponent = shallow(); + expect(EmptyComponent).toMatchSnapshot(); + }); + + it('renders actions with descriptions', () => { + const actions = { + actions: { + description: 'My Description', + label: 'Do Something', + url: 'my/url/from/nowwhere', + }, + }; + const EmptyComponent = shallow(); + expect(EmptyComponent).toMatchSnapshot(); + }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/empty_page/index.tsx b/x-pack/plugins/security_solution/public/common/components/empty_page/index.tsx index f6d6752729b6d..e0db1e90374ad 100644 --- a/x-pack/plugins/security_solution/public/common/components/empty_page/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/empty_page/index.tsx @@ -4,84 +4,114 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiButton, EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, IconType } from '@elastic/eui'; -import React, { MouseEventHandler, ReactNode } from 'react'; +import { + EuiButton, + EuiEmptyPrompt, + EuiFlexGroup, + EuiFlexItem, + IconType, + EuiCard, +} from '@elastic/eui'; +import React, { MouseEventHandler, ReactNode, useMemo } from 'react'; import styled from 'styled-components'; const EmptyPrompt = styled(EuiEmptyPrompt)` align-self: center; /* Corrects horizontal centering in IE11 */ + max-width: 60em; `; EmptyPrompt.displayName = 'EmptyPrompt'; +interface EmptyPageActions { + icon?: IconType; + label: string; + target?: string; + url: string; + descriptionTitle?: string; + description?: string; + fill?: boolean; + onClick?: MouseEventHandler; +} + +export type EmptyPageActionsProps = Record; + interface EmptyPageProps { - actionPrimaryIcon?: IconType; - actionPrimaryLabel: string; - actionPrimaryTarget?: string; - actionPrimaryUrl: string; - actionPrimaryFill?: boolean; - actionSecondaryIcon?: IconType; - actionSecondaryLabel?: string; - actionSecondaryTarget?: string; - actionSecondaryUrl?: string; - actionSecondaryOnClick?: MouseEventHandler; + actions: EmptyPageActionsProps; 'data-test-subj'?: string; message?: ReactNode; title: string; } -export const EmptyPage = React.memo( - ({ - actionPrimaryIcon, - actionPrimaryLabel, - actionPrimaryTarget, - actionPrimaryUrl, - actionPrimaryFill = true, - actionSecondaryIcon, - actionSecondaryLabel, - actionSecondaryTarget, - actionSecondaryUrl, - actionSecondaryOnClick, - message, - title, - ...rest - }) => ( +const EmptyPageComponent = React.memo(({ actions, message, title, ...rest }) => { + const titles = Object.keys(actions); + const maxItemWidth = 283; + const renderActions = useMemo( + () => + Object.values(actions) + .filter((a) => a.label && a.url) + .map( + ( + { icon, label, target, url, descriptionTitle, description, onClick, fill = true }, + idx + ) => + descriptionTitle != null || description != null ? ( + + + {label} + + } + /> + + ) : ( + + {/* eslint-disable-next-line @elastic/eui/href-or-on-click */} + + {label} + + + ) + ), + [actions, titles] + ); + + return ( {title}} body={message &&

{message}

} - actions={ - - - - {actionPrimaryLabel} - - - - {actionSecondaryLabel && actionSecondaryUrl && ( - - {/* eslint-disable-next-line @elastic/eui/href-or-on-click */} - - {actionSecondaryLabel} - - - )} - - } + actions={{renderActions}} {...rest} /> - ) -); + ); +}); + +EmptyPageComponent.displayName = 'EmptyPageComponent'; +export const EmptyPage = React.memo(EmptyPageComponent); EmptyPage.displayName = 'EmptyPage'; diff --git a/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.tsx b/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.tsx index bc036b38524ba..e836e2e20432a 100644 --- a/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.tsx +++ b/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.tsx @@ -222,6 +222,7 @@ const EventsViewerComponent: React.FC = ({ sourceId="default" startDate={start} endDate={end} + queryDeduplication="events_viewer" > {({ events, diff --git a/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx b/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx index 80831b4022ace..c402116ee2714 100644 --- a/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx @@ -69,7 +69,10 @@ const StatefulEventsViewerComponent: React.FC = ({ }) => { const [ { docValueFields, browserFields, indexPatterns, isLoading: isLoadingIndexPattern }, - ] = useFetchIndexPatterns(defaultIndices ?? useUiSetting(DEFAULT_INDEX_KEY)); + ] = useFetchIndexPatterns( + defaultIndices ?? useUiSetting(DEFAULT_INDEX_KEY), + 'events_viewer' + ); useEffect(() => { if (createTimeline != null) { diff --git a/x-pack/plugins/security_solution/public/common/components/events_viewer/mock.ts b/x-pack/plugins/security_solution/public/common/components/events_viewer/mock.ts index ea2e60ebc82b8..6266e84051901 100644 --- a/x-pack/plugins/security_solution/public/common/components/events_viewer/mock.ts +++ b/x-pack/plugins/security_solution/public/common/components/events_viewer/mock.ts @@ -40,6 +40,7 @@ export const mockEventViewerResponse = [ { field: 'event.end', format: 'date_time' }, ], inspect: false, + queryDeduplication: 'events_viewer', }, }, result: { diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx index 0f7e5b24ed8f9..bb547f05090b7 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx @@ -67,7 +67,8 @@ export interface AddExceptionModalProps extends AddExceptionModalBaseProps { const Modal = styled(EuiModal)` ${({ theme }) => css` - width: ${theme.eui.euiBreakpoints.m}; + width: ${theme.eui.euiBreakpoints.l}; + max-width: ${theme.eui.euiBreakpoints.l}; `} `; @@ -233,7 +234,7 @@ export const AddExceptionModal = memo(function AddExceptionModal({ ); const retrieveAlertOsTypes = useCallback(() => { - const osDefaults = ['windows', 'macos', 'linux']; + const osDefaults = ['windows', 'macos']; if (alertData) { const osTypes = getMappedNonEcsValue({ data: alertData.nonEcsData, @@ -285,7 +286,9 @@ export const AddExceptionModal = memo(function AddExceptionModal({ - {i18n.ADD_EXCEPTION} + + {exceptionListType === 'endpoint' ? i18n.ADD_ENDPOINT_EXCEPTION : i18n.ADD_EXCEPTION} + {ruleName} @@ -330,13 +333,6 @@ export const AddExceptionModal = memo(function AddExceptionModal({ - {exceptionListType === 'endpoint' && ( - <> - {i18n.ENDPOINT_QUARANTINE_TEXT} - - - )} - + {exceptionListType === 'endpoint' && ( + <> + + + {i18n.ENDPOINT_QUARANTINE_TEXT} + + + )} )} diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/translations.ts b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/translations.ts index 81db1b10f7021..abc296e9c0e1a 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/translations.ts +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/translations.ts @@ -17,6 +17,13 @@ export const ADD_EXCEPTION = i18n.translate( } ); +export const ADD_ENDPOINT_EXCEPTION = i18n.translate( + 'xpack.securitySolution.exceptions.addException.addEndpointException', + { + defaultMessage: 'Add Endpoint Exception', + } +); + export const ADD_EXCEPTION_ERROR = i18n.translate( 'xpack.securitySolution.exceptions.addException.error', { @@ -49,14 +56,15 @@ export const ENDPOINT_QUARANTINE_TEXT = i18n.translate( 'xpack.securitySolution.exceptions.addException.endpointQuarantineText', { defaultMessage: - 'Any file in quarantine on any endpoint that matches the attribute(s) selected will automatically be restored to its original location', + 'Any file in quarantine on any endpoint that matches the attribute(s) selected will automatically be restored to its original location. This exception will apply to any rule that is linked to the Global Endpoint Exception List.', } ); export const BULK_CLOSE_LABEL = i18n.translate( 'xpack.securitySolution.exceptions.addException.bulkCloseLabel', { - defaultMessage: 'Close all alerts that match attributes in this exception', + defaultMessage: + 'Close all alerts that match this exception, including alerts generated by other rules', } ); diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/builder_entry_item.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/builder_entry_item.tsx index dcc8a0e4fb1ba..5939a5a1b576e 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/builder/builder_entry_item.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/builder/builder_entry_item.tsx @@ -110,6 +110,7 @@ export const BuilderEntryItem: React.FC = ({ isDisabled={indexPattern == null} onChange={handleFieldChange} data-test-subj="exceptionBuilderEntryField" + fieldInputWidth={275} /> ); diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.tsx index 7ae4fe4ea7970..341d2f2bab37a 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.tsx @@ -54,7 +54,8 @@ interface EditExceptionModalProps { const Modal = styled(EuiModal)` ${({ theme }) => css` - width: ${theme.eui.euiBreakpoints.m}; + width: ${theme.eui.euiBreakpoints.l}; + max-width: ${theme.eui.euiBreakpoints.l}; `} `; @@ -211,7 +212,11 @@ export const EditExceptionModal = memo(function EditExceptionModal({ - {i18n.EDIT_EXCEPTION_TITLE} + + {exceptionListType === 'endpoint' + ? i18n.EDIT_ENDPOINT_EXCEPTION_TITLE + : i18n.EDIT_EXCEPTION_TITLE} + {ruleName} @@ -243,13 +248,6 @@ export const EditExceptionModal = memo(function EditExceptionModal({ - {exceptionListType === 'endpoint' && ( - <> - {i18n.ENDPOINT_QUARANTINE_TEXT} - - - )} - + {exceptionListType === 'endpoint' && ( + <> + + + {i18n.ENDPOINT_QUARANTINE_TEXT} + + + )} )} diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/translations.ts b/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/translations.ts index d09f0158b2e1d..c5b6fc8a6a9ae 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/translations.ts +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/translations.ts @@ -24,6 +24,13 @@ export const EDIT_EXCEPTION_TITLE = i18n.translate( } ); +export const EDIT_ENDPOINT_EXCEPTION_TITLE = i18n.translate( + 'xpack.securitySolution.exceptions.editException.editEndpointExceptionTitle', + { + defaultMessage: 'Edit Endpoint Exception', + } +); + export const EDIT_EXCEPTION_ERROR = i18n.translate( 'xpack.securitySolution.exceptions.editException.error', { @@ -41,7 +48,8 @@ export const EDIT_EXCEPTION_SUCCESS = i18n.translate( export const BULK_CLOSE_LABEL = i18n.translate( 'xpack.securitySolution.exceptions.editException.bulkCloseLabel', { - defaultMessage: 'Close all alerts that match attributes in this exception', + defaultMessage: + 'Close all alerts that match this exception, including alerts generated by other rules', } ); @@ -57,7 +65,7 @@ export const ENDPOINT_QUARANTINE_TEXT = i18n.translate( 'xpack.securitySolution.exceptions.editException.endpointQuarantineText', { defaultMessage: - 'Any file in quarantine on any endpoint that matches the attribute(s) selected will automatically be restored to its original location', + 'Any file in quarantine on any endpoint that matches the attribute(s) selected will automatically be restored to its original location. This exception will apply to any rule that is linked to the Global Endpoint Exception List.', } ); diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/exceptionable_fields.json b/x-pack/plugins/security_solution/public/common/components/exceptions/exceptionable_fields.json index 18257b0de0a17..fdf0ea60ecf6a 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/exceptionable_fields.json +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/exceptionable_fields.json @@ -7,25 +7,32 @@ "Target.process.Ext.services", "Target.process.Ext.user", "Target.process.command_line", + "Target.process.command_line.text", "Target.process.executable", + "Target.process.executable.text", "Target.process.hash.md5", "Target.process.hash.sha1", "Target.process.hash.sha256", "Target.process.hash.sha512", "Target.process.name", + "Target.process.name.text", "Target.process.parent.Ext.code_signature.status", "Target.process.parent.Ext.code_signature.subject_name", "Target.process.parent.Ext.code_signature.trusted", "Target.process.parent.Ext.code_signature.valid", "Target.process.parent.command_line", + "Target.process.parent.command_line.text", "Target.process.parent.executable", + "Target.process.parent.executable.text", "Target.process.parent.hash.md5", "Target.process.parent.hash.sha1", "Target.process.parent.hash.sha256", "Target.process.parent.hash.sha512", "Target.process.parent.name", + "Target.process.parent.name.text", "Target.process.parent.pgid", "Target.process.parent.working_directory", + "Target.process.parent.working_directory.text", "Target.process.pe.company", "Target.process.pe.description", "Target.process.pe.file_version", @@ -33,6 +40,7 @@ "Target.process.pe.product", "Target.process.pgid", "Target.process.working_directory", + "Target.process.working_directory.text", "agent.id", "agent.type", "agent.version", @@ -67,6 +75,7 @@ "file.name", "file.owner", "file.path", + "file.path.text", "file.pe.company", "file.pe.description", "file.pe.file_version", @@ -74,6 +83,7 @@ "file.pe.product", "file.size", "file.target_path", + "file.target_path.text", "file.type", "file.uid", "group.Ext.real.id", @@ -85,8 +95,10 @@ "host.os.Ext.variant", "host.os.family", "host.os.full", + "host.os.full.text", "host.os.kernel", "host.os.name", + "host.os.name.text", "host.os.platform", "host.os.version", "host.type", @@ -97,25 +109,32 @@ "process.Ext.services", "process.Ext.user", "process.command_line", + "process.command_line.text", "process.executable", + "process.executable.text", "process.hash.md5", "process.hash.sha1", "process.hash.sha256", "process.hash.sha512", "process.name", + "process.name.text", "process.parent.Ext.code_signature.status", "process.parent.Ext.code_signature.subject_name", "process.parent.Ext.code_signature.trusted", "process.parent.Ext.code_signature.valid", "process.parent.command_line", + "process.parent.command_line.text", "process.parent.executable", + "process.parent.executable.text", "process.parent.hash.md5", "process.parent.hash.sha1", "process.parent.hash.sha256", "process.parent.hash.sha512", "process.parent.name", + "process.parent.name.text", "process.parent.pgid", "process.parent.working_directory", + "process.parent.working_directory.text", "process.pe.company", "process.pe.description", "process.pe.file_version", @@ -123,5 +142,6 @@ "process.pe.product", "process.pgid", "process.working_directory", + "process.working_directory.text", "rule.uuid" ] \ No newline at end of file diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/helpers.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/helpers.tsx index ee45f9b5de1fa..3abb788312ff4 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/helpers.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/helpers.tsx @@ -440,7 +440,7 @@ export const defaultEndpointExceptionItems = ( ], }, { - field: 'file.path', + field: 'file.path.text', operator: 'included', type: 'match', value: filePath ?? '', diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/use_fetch_or_create_rule_exception_list.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/use_fetch_or_create_rule_exception_list.tsx index 2a5ef7b21b519..0d367e03a799f 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/use_fetch_or_create_rule_exception_list.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/use_fetch_or_create_rule_exception_list.tsx @@ -102,6 +102,7 @@ export const useFetchOrCreateRuleExceptionList = ({ const newExceptionListReference = { id: newExceptionList.id, + list_id: newExceptionList.list_id, type: newExceptionList.type, namespace_type: newExceptionList.namespace_type, }; diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/helpers.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/helpers.test.tsx index fe00e3530fa83..5d4340db9a448 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/helpers.test.tsx @@ -93,12 +93,6 @@ describe('Exception viewer helpers', () => { operator: 'is one of', value: ['some host name'], }, - { - fieldName: 'host.name', - isNested: false, - operator: 'is in list', - value: 'some-list-id', - }, { fieldName: 'host.name', isNested: false, diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/index.test.tsx index 986f27f6495ec..84613d1c73536 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/index.test.tsx @@ -72,6 +72,7 @@ describe('ExceptionsViewer', () => { exceptionListsMeta={[ { id: '5b543420', + listId: 'list_id', type: 'endpoint', namespaceType: 'single', }, @@ -124,6 +125,7 @@ describe('ExceptionsViewer', () => { exceptionListsMeta={[ { id: '5b543420', + listId: 'list_id', type: 'endpoint', namespaceType: 'single', }, diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/index.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/index.tsx index 16eaef4136983..7f4d825276406 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/index.tsx @@ -176,8 +176,6 @@ const ExceptionsViewerComponent = ({ const handleEditException = useCallback( (exception: ExceptionListItemSchema): void => { - // TODO: Added this just for testing. Update - // modal state logic as needed once ready dispatch({ type: 'updateExceptionToEdit', exception, diff --git a/x-pack/plugins/security_solution/public/common/components/filters_global/filters_global.test.tsx b/x-pack/plugins/security_solution/public/common/components/filters_global/filters_global.test.tsx index ffac0496e9f1a..9fda60b1f289d 100644 --- a/x-pack/plugins/security_solution/public/common/components/filters_global/filters_global.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/filters_global/filters_global.test.tsx @@ -4,20 +4,120 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallow } from 'enzyme'; +import { mount, ReactWrapper, shallow } from 'enzyme'; import React from 'react'; +import { StickyContainer } from 'react-sticky'; import '../../mock/match_media'; import { FiltersGlobal } from './filters_global'; +import { TestProviders } from '../../mock/test_providers'; describe('rendering', () => { test('renders correctly', () => { const wrapper = shallow( - +

{'Additional filters here.'}

); expect(wrapper).toMatchSnapshot(); }); + + describe('full screen mode', () => { + let wrapper: ReactWrapper; + + beforeEach(() => { + wrapper = mount( + + + +

{'Filter content'}

+
+
+
+ ); + }); + + test('it does NOT render the sticky container', () => { + expect(wrapper.find('[data-test-subj="sticky-filters-global-container"]').exists()).toBe( + false + ); + }); + + test('it renders the non-sticky container', () => { + expect(wrapper.find('[data-test-subj="non-sticky-global-container"]').exists()).toBe(true); + }); + + test('it does NOT render the container with a `display: none` style when `show` is true (the default)', () => { + expect( + wrapper.find('[data-test-subj="non-sticky-global-container"]').first() + ).not.toHaveStyleRule('display', 'none'); + }); + }); + + describe('non-full screen mode', () => { + let wrapper: ReactWrapper; + + beforeEach(() => { + wrapper = mount( + + + +

{'Filter content'}

+
+
+
+ ); + }); + + test('it renders the sticky container', () => { + expect(wrapper.find('[data-test-subj="sticky-filters-global-container"]').exists()).toBe( + true + ); + }); + + test('it does NOT render the non-sticky container', () => { + expect(wrapper.find('[data-test-subj="non-sticky-global-container"]').exists()).toBe(false); + }); + + test('it does NOT render the container with a `display: none` style when `show` is true (the default)', () => { + expect( + wrapper.find('[data-test-subj="sticky-filters-global-container"]').first() + ).not.toHaveStyleRule('display', 'none'); + }); + }); + + describe('when show is false', () => { + test('in full screen mode it renders the container with a `display: none` style', () => { + const wrapper = mount( + + + +

{'Filter content'}

+
+
+
+ ); + + expect( + wrapper.find('[data-test-subj="non-sticky-global-container"]').first() + ).toHaveStyleRule('display', 'none'); + }); + + test('in non-full screen mode it renders the container with a `display: none` style', () => { + const wrapper = mount( + + + +

{'Filter content'}

+
+
+
+ ); + + expect( + wrapper.find('[data-test-subj="sticky-filters-global-container"]').first() + ).toHaveStyleRule('display', 'none'); + }); + }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/filters_global/filters_global.tsx b/x-pack/plugins/security_solution/public/common/components/filters_global/filters_global.tsx index b52438486406e..80e7209492fa5 100644 --- a/x-pack/plugins/security_solution/public/common/components/filters_global/filters_global.tsx +++ b/x-pack/plugins/security_solution/public/common/components/filters_global/filters_global.tsx @@ -47,20 +47,33 @@ const FiltersGlobalContainer = styled.header<{ show: boolean }>` FiltersGlobalContainer.displayName = 'FiltersGlobalContainer'; +const NO_STYLE: React.CSSProperties = {}; + export interface FiltersGlobalProps { children: React.ReactNode; + globalFullScreen: boolean; show?: boolean; } -export const FiltersGlobal = React.memo(({ children, show = true }) => ( - - {({ style, isSticky }) => ( - - +export const FiltersGlobal = React.memo( + ({ children, globalFullScreen, show = true }) => + globalFullScreen ? ( + + {children} - )} - -)); + ) : ( + + {({ style, isSticky }) => ( + + + {children} + + + )} + + ) +); + FiltersGlobal.displayName = 'FiltersGlobal'; diff --git a/x-pack/plugins/security_solution/public/common/components/page/index.tsx b/x-pack/plugins/security_solution/public/common/components/page/index.tsx index 8737fa95c94a2..8bf0690bfd0ad 100644 --- a/x-pack/plugins/security_solution/public/common/components/page/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/page/index.tsx @@ -7,7 +7,10 @@ import { EuiBadge, EuiDescriptionList, EuiFlexGroup, EuiIcon, EuiPage } from '@elastic/eui'; import styled, { createGlobalStyle } from 'styled-components'; -import { FULL_SCREEN_TOGGLED_CLASS_NAME } from '../../../../common/constants'; +import { + FULL_SCREEN_TOGGLED_CLASS_NAME, + SCROLLING_DISABLED_CLASS_NAME, +} from '../../../../common/constants'; /* SIDE EFFECT: the following `createGlobalStyle` overrides default styling in angular code that was not theme-friendly @@ -63,6 +66,14 @@ export const AppGlobalStyle = createGlobalStyle<{ theme: { eui: { euiColorPrimar .${FULL_SCREEN_TOGGLED_CLASS_NAME} { ${({ theme }) => `background-color: ${theme.eui.euiColorPrimary} !important`}; } + + .${SCROLLING_DISABLED_CLASS_NAME} body { + overflow-y: hidden; + } + + .${SCROLLING_DISABLED_CLASS_NAME} #kibana-body { + overflow-y: hidden; + } `; export const DescriptionListStyled = styled(EuiDescriptionList)` diff --git a/x-pack/plugins/security_solution/public/common/components/with_hover_actions/index.tsx b/x-pack/plugins/security_solution/public/common/components/with_hover_actions/index.tsx index 9e28345ffbbcf..b4abdd4b91805 100644 --- a/x-pack/plugins/security_solution/public/common/components/with_hover_actions/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/with_hover_actions/index.tsx @@ -10,6 +10,11 @@ import styled from 'styled-components'; import { IS_DRAGGING_CLASS_NAME } from '../drag_and_drop/helpers'; +/** + * To avoid expensive changes to the DOM, delay showing the popover menu + */ +const HOVER_INTENT_DELAY = 100; // ms + // eslint-disable-next-line @typescript-eslint/no-explicit-any const WithHoverActionsPopover = (styled(EuiPopover as any)` .euiPopover__anchor { @@ -51,18 +56,27 @@ export const WithHoverActions = React.memo( ({ alwaysShow = false, closePopOverTrigger, hoverContent, render }) => { const [isOpen, setIsOpen] = useState(hoverContent != null && alwaysShow); const [showHoverContent, setShowHoverContent] = useState(false); + const [hoverTimeout, setHoverTimeout] = useState(undefined); + const onMouseEnter = useCallback(() => { - // NOTE: the following read from the DOM is expensive, but not as - // expensive as the default behavior, which adds a div to the body, - // which-in turn performs a more expensive change to the layout - if (!document.body.classList.contains(IS_DRAGGING_CLASS_NAME)) { - setShowHoverContent(true); - } - }, []); + setHoverTimeout( + Number( + setTimeout(() => { + // NOTE: the following read from the DOM is expensive, but not as + // expensive as the default behavior, which adds a div to the body, + // which-in turn performs a more expensive change to the layout + if (!document.body.classList.contains(IS_DRAGGING_CLASS_NAME)) { + setShowHoverContent(true); + } + }, HOVER_INTENT_DELAY) + ) + ); + }, [setHoverTimeout, setShowHoverContent]); const onMouseLeave = useCallback(() => { + clearTimeout(hoverTimeout); setShowHoverContent(false); - }, []); + }, [hoverTimeout, setShowHoverContent]); const content = useMemo( () => ( diff --git a/x-pack/plugins/security_solution/public/common/containers/source/index.tsx b/x-pack/plugins/security_solution/public/common/containers/source/index.tsx index 54d49d7279d68..ffbecf9e3d433 100644 --- a/x-pack/plugins/security_solution/public/common/containers/source/index.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/source/index.tsx @@ -122,7 +122,12 @@ interface UseWithSourceState { export const useWithSource = ( sourceId = 'default', indexToAdd?: string[] | null, - onlyCheckIndexToAdd?: boolean + onlyCheckIndexToAdd?: boolean, + // Fun fact: When using this hook multiple times within a component (e.g. add_exception_modal & edit_exception_modal), + // the apolloClient will perform queryDeduplication and prevent the first query from executing. A deep compare is not + // performed on `indices`, so another field must be passed to circumvent this. + // For details, see https://github.com/apollographql/react-apollo/issues/2202 + queryDeduplication = 'default' ) => { const [configIndex] = useUiSetting$(DEFAULT_INDEX_KEY); const defaultIndex = useMemo(() => { @@ -154,12 +159,16 @@ export const useWithSource = ( setState((prevState) => ({ ...prevState, loading: true })); try { - const result = await apolloClient.query({ + const result = await apolloClient.query< + SourceQuery.Query, + SourceQuery.Variables & { queryDeduplication: string } + >({ query: sourceQuery, - fetchPolicy: 'network-only', + fetchPolicy: 'cache-first', variables: { sourceId, defaultIndex, + queryDeduplication, }, context: { fetchOptions: { @@ -206,7 +215,7 @@ export const useWithSource = ( isSubscribed = false; return abortCtrl.abort(); }; - }, [apolloClient, sourceId, defaultIndex]); + }, [apolloClient, sourceId, defaultIndex, queryDeduplication]); return state; }; diff --git a/x-pack/plugins/security_solution/public/common/containers/use_full_screen/index.tsx b/x-pack/plugins/security_solution/public/common/containers/use_full_screen/index.tsx index b8050034d34a6..aa0d90a216035 100644 --- a/x-pack/plugins/security_solution/public/common/containers/use_full_screen/index.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/use_full_screen/index.tsx @@ -6,6 +6,7 @@ import { useCallback, useMemo } from 'react'; import { useDispatch, useSelector } from 'react-redux'; +import { SCROLLING_DISABLED_CLASS_NAME } from '../../../../common/constants'; import { inputsSelectors } from '../../store'; import { inputsActions } from '../../store/actions'; @@ -16,7 +17,16 @@ export const useFullScreen = () => { const timelineFullScreen = useSelector(inputsSelectors.timelineFullScreenSelector) ?? false; const setGlobalFullScreen = useCallback( - (fullScreen: boolean) => dispatch(inputsActions.setFullScreen({ id: 'global', fullScreen })), + (fullScreen: boolean) => { + if (fullScreen) { + document.body.classList.add(SCROLLING_DISABLED_CLASS_NAME); + } else { + document.body.classList.remove(SCROLLING_DISABLED_CLASS_NAME); + setTimeout(() => window.scrollTo(0, 0), 0); + } + + dispatch(inputsActions.setFullScreen({ id: 'global', fullScreen })); + }, [dispatch] ); diff --git a/x-pack/plugins/security_solution/public/common/translations.ts b/x-pack/plugins/security_solution/public/common/translations.ts index 413119fb40f14..3b94ac8959496 100644 --- a/x-pack/plugins/security_solution/public/common/translations.ts +++ b/x-pack/plugins/security_solution/public/common/translations.ts @@ -7,16 +7,39 @@ import { i18n } from '@kbn/i18n'; export const EMPTY_TITLE = i18n.translate('xpack.securitySolution.pages.common.emptyTitle', { - defaultMessage: 'Welcome to Security Solution. Let’s get you started.', + defaultMessage: 'Welcome to Elastic Security. Let’s get you started.', }); -export const EMPTY_ACTION_PRIMARY = i18n.translate( - 'xpack.securitySolution.pages.common.emptyActionPrimary', +export const EMPTY_ACTION_ELASTIC_AGENT = i18n.translate( + 'xpack.securitySolution.pages.common.emptyActionElasticAgent', + { + defaultMessage: 'Add data with Elastic Agent', + } +); + +export const EMPTY_ACTION_ELASTIC_AGENT_DESCRIPTION = i18n.translate( + 'xpack.securitySolution.pages.common.emptyActionElasticAgentDescription', + { + defaultMessage: + 'The Elastic Agent provides a simple, unified way to add monitoring to your hosts.', + } +); + +export const EMPTY_ACTION_BEATS = i18n.translate( + 'xpack.securitySolution.pages.common.emptyActionBeats', { defaultMessage: 'Add data with Beats', } ); +export const EMPTY_ACTION_BEATS_DESCRIPTION = i18n.translate( + 'xpack.securitySolution.pages.common.emptyActionBeatsDescription', + { + defaultMessage: + 'Lightweight Beats can send data from hundreds or thousands of machines and systems', + } +); + export const EMPTY_ACTION_SECONDARY = i18n.translate( 'xpack.securitySolution.pages.common.emptyActionSecondary', { @@ -27,6 +50,14 @@ export const EMPTY_ACTION_SECONDARY = i18n.translate( export const EMPTY_ACTION_ENDPOINT = i18n.translate( 'xpack.securitySolution.pages.common.emptyActionEndpoint', { - defaultMessage: 'Add data with Elastic Agent (Beta)', + defaultMessage: 'Add Elastic Endpoint Security', + } +); + +export const EMPTY_ACTION_ENDPOINT_DESCRIPTION = i18n.translate( + 'xpack.securitySolution.pages.common.emptyActionEndpointDescription', + { + defaultMessage: + 'Protect your hosts with threat prevention, detection, and deep security data visibility.', } ); diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/index.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/index.tsx index 1eda358fe5944..ab95e433d92f3 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/index.tsx @@ -116,8 +116,9 @@ export const AlertsTableComponent: React.FC = ({ const [addExceptionModalState, setAddExceptionModalState] = useState( addExceptionModalInitialState ); - const [{ browserFields, indexPatterns }] = useFetchIndexPatterns( - signalsIndex !== '' ? [signalsIndex] : [] + const [{ browserFields, indexPatterns, isLoading: indexPatternsLoading }] = useFetchIndexPatterns( + signalsIndex !== '' ? [signalsIndex] : [], + 'alerts_table' ); const kibana = useKibana(); const [, dispatchToaster] = useStateToaster(); @@ -433,7 +434,7 @@ export const AlertsTableComponent: React.FC = ({ closeAddExceptionModal, ]); - if (loading || isEmpty(signalsIndex)) { + if (loading || indexPatternsLoading || isEmpty(signalsIndex)) { return ( diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/description_step/helpers.test.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/description_step/helpers.test.tsx index 2a6cd3fc5bb7a..0d98a0f2f26ff 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/description_step/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/description_step/helpers.test.tsx @@ -331,6 +331,7 @@ describe('helpers', () => { const result: ListItems[] = buildSeverityDescription({ value: 'low', mapping: [{ field: 'host.name', operator: 'equals', value: 'hello', severity: 'high' }], + isMappingChecked: true, }); expect(result[0].title).toEqual('Severity'); diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/description_step/helpers.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/description_step/helpers.tsx index 1110c8c098988..600bc999849d1 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/description_step/helpers.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/description_step/helpers.tsx @@ -35,6 +35,7 @@ import { SeverityBadge } from '../severity_badge'; import ListTreeIcon from './assets/list_tree_icon.svg'; import { assertUnreachable } from '../../../../common/lib/helpers'; import { AboutStepRiskScore, AboutStepSeverity } from '../../../pages/detection_engine/rules/types'; +import { defaultToEmptyTag } from '../../../../common/components/empty_value'; const NoteDescriptionContainer = styled(EuiFlexItem)` height: 105px; @@ -236,35 +237,44 @@ export const buildSeverityDescription = (severity: AboutStepSeverity): ListItems title: i18nSeverity.DEFAULT_SEVERITY, description: , }, - ...severity.mapping.map((severityItem, index) => { - return { - title: index === 0 ? i18nSeverity.SEVERITY_MAPPING : '', - description: ( - - - - <>{severityItem.field} - - - - <>{severityItem.value} - - - - - - - - - ), - }; - }), + ...(severity.isMappingChecked + ? severity.mapping + .filter((severityItem) => severityItem.field !== '') + .map((severityItem, index) => { + return { + title: index === 0 ? i18nSeverity.SEVERITY_MAPPING : '', + description: ( + + + + <>{`${severityItem.field}:`} + + + + + {defaultToEmptyTag(severityItem.value)} + + + + + + + + + + ), + }; + }) + : []), ]; export const buildRiskScoreDescription = (riskScore: AboutStepRiskScore): ListItems[] => [ @@ -272,27 +282,31 @@ export const buildRiskScoreDescription = (riskScore: AboutStepRiskScore): ListIt title: i18nRiskScore.RISK_SCORE, description: riskScore.value, }, - ...riskScore.mapping.map((riskScoreItem, index) => { - return { - title: index === 0 ? i18nRiskScore.RISK_SCORE_MAPPING : '', - description: ( - - - - <>{riskScoreItem.field} - - - - - - {'signal.rule.risk_score'} - - ), - }; - }), + ...(riskScore.isMappingChecked + ? riskScore.mapping + .filter((riskScoreItem) => riskScoreItem.field !== '') + .map((riskScoreItem, index) => { + return { + title: index === 0 ? i18nRiskScore.RISK_SCORE_MAPPING : '', + description: ( + + + + <>{riskScoreItem.field} + + + + + + {'signal.rule.risk_score'} + + ), + }; + }) + : []), ]; const MyRefUrlLink = styled(EuiLink)` diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/risk_score_mapping/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/risk_score_mapping/index.tsx index c9e2cb1a8ca24..35816e82540d1 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/risk_score_mapping/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/risk_score_mapping/index.tsx @@ -14,8 +14,9 @@ import { EuiIcon, EuiSpacer, } from '@elastic/eui'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import React, { useCallback, useMemo } from 'react'; import styled from 'styled-components'; +import { noop } from 'lodash/fp'; import * as i18n from './translations'; import { FieldHook } from '../../../../../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; import { CommonUseField } from '../../../../cases/components/create'; @@ -24,6 +25,10 @@ import { FieldComponent } from '../../../../common/components/autocomplete/field import { IFieldType } from '../../../../../../../../src/plugins/data/common/index_patterns/fields'; import { IIndexPattern } from '../../../../../../../../src/plugins/data/common/index_patterns'; +const RiskScoreMappingEuiFormRow = styled(EuiFormRow)` + width: 468px; +`; + const NestedContent = styled.div` margin-left: 24px; `; @@ -41,6 +46,7 @@ interface RiskScoreFieldProps { field: FieldHook; idAria: string; indices: IIndexPattern; + isDisabled: boolean; placeholder?: string; } @@ -49,40 +55,23 @@ export const RiskScoreField = ({ field, idAria, indices, + isDisabled, placeholder, }: RiskScoreFieldProps) => { - const [isRiskScoreMappingChecked, setIsRiskScoreMappingChecked] = useState(false); - const [initialFieldCheck, setInitialFieldCheck] = useState(true); - const fieldTypeFilter = useMemo(() => ['number'], []); - useEffect(() => { - if ( - !isRiskScoreMappingChecked && - initialFieldCheck && - (field.value as AboutStepRiskScore).mapping?.length > 0 - ) { - setIsRiskScoreMappingChecked(true); - setInitialFieldCheck(false); - } - }, [ - field, - initialFieldCheck, - isRiskScoreMappingChecked, - setIsRiskScoreMappingChecked, - setInitialFieldCheck, - ]); - const handleFieldChange = useCallback( ([newField]: IFieldType[]): void => { const values = field.value as AboutStepRiskScore; field.setValue({ value: values.value, + isMappingChecked: values.isMappingChecked, mapping: [ { field: newField?.name ?? '', operator: 'equals', - value: '', + value: undefined, + riskScore: undefined, }, ], }); @@ -99,8 +88,13 @@ export const RiskScoreField = ({ }, [field.value, indices]); const handleRiskScoreMappingChecked = useCallback(() => { - setIsRiskScoreMappingChecked(!isRiskScoreMappingChecked); - }, [isRiskScoreMappingChecked, setIsRiskScoreMappingChecked]); + const values = field.value as AboutStepRiskScore; + field.setValue({ + value: values.value, + mapping: [...values.mapping], + isMappingChecked: !values.isMappingChecked, + }); + }, [field]); const riskScoreLabel = useMemo(() => { return ( @@ -117,11 +111,16 @@ export const RiskScoreField = ({ const riskScoreMappingLabel = useMemo(() => { return (
- + @@ -133,7 +132,7 @@ export const RiskScoreField = ({
); - }, [handleRiskScoreMappingChecked, isRiskScoreMappingChecked]); + }, [field.value, handleRiskScoreMappingChecked, isDisabled]); return ( @@ -153,6 +152,7 @@ export const RiskScoreField = ({ componentProps={{ idAria: 'detectionEngineStepAboutRuleRiskScore', 'data-test-subj': 'detectionEngineStepAboutRuleRiskScore', + isDisabled, euiFieldProps: { max: 100, min: 0, @@ -166,11 +166,11 @@ export const RiskScoreField = ({ - {i18n.RISK_SCORE_MAPPING_DETAILS} ) : ( '' @@ -184,7 +184,7 @@ export const RiskScoreField = ({ > - {isRiskScoreMappingChecked && ( + {(field.value as AboutStepRiskScore).isMappingChecked && ( @@ -208,11 +208,11 @@ export const RiskScoreField = ({ fieldTypeFilter={fieldTypeFilter} isLoading={false} isClearable={false} - isDisabled={false} + isDisabled={isDisabled} onChange={handleFieldChange} data-test-subj={dataTestSubj} aria-label={idAria} - fieldInputWidth={230} + fieldInputWidth={270} /> @@ -226,7 +226,7 @@ export const RiskScoreField = ({ )} - + ); diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/severity_mapping/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/severity_mapping/index.tsx index 579c60579b32e..54d505a4d867f 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/severity_mapping/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/severity_mapping/index.tsx @@ -14,7 +14,8 @@ import { EuiIcon, EuiSpacer, } from '@elastic/eui'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import { noop } from 'lodash/fp'; +import React, { useCallback, useMemo } from 'react'; import styled from 'styled-components'; import * as i18n from './translations'; import { FieldHook } from '../../../../../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; @@ -27,10 +28,16 @@ import { } from '../../../../../../../../src/plugins/data/common/index_patterns'; import { FieldComponent } from '../../../../common/components/autocomplete/field'; import { AutocompleteFieldMatchComponent } from '../../../../common/components/autocomplete/field_value_match'; +import { + Severity, + SeverityMapping, + SeverityMappingItem, +} from '../../../../../common/detection_engine/schemas/common/schemas'; -const SeverityMappingParentContainer = styled(EuiFlexItem)` - max-width: 471px; +const SeverityMappingEuiFormRow = styled(EuiFormRow)` + width: 468px; `; + const NestedContent = styled.div` margin-left: 24px; `; @@ -48,6 +55,7 @@ interface SeverityFieldProps { field: FieldHook; idAria: string; indices: IIndexPattern; + isDisabled: boolean; options: SeverityOptionItem[]; } @@ -56,42 +64,20 @@ export const SeverityField = ({ field, idAria, indices, + isDisabled, options, }: SeverityFieldProps) => { - const [isSeverityMappingChecked, setIsSeverityMappingChecked] = useState(false); - const [initialFieldCheck, setInitialFieldCheck] = useState(true); const fieldValueInputWidth = 160; - useEffect(() => { - if ( - !isSeverityMappingChecked && - initialFieldCheck && - (field.value as AboutStepSeverity).mapping?.length > 0 - ) { - setIsSeverityMappingChecked(true); - setInitialFieldCheck(false); - } - }, [ - field, - initialFieldCheck, - isSeverityMappingChecked, - setIsSeverityMappingChecked, - setInitialFieldCheck, - ]); - - const handleFieldChange = useCallback( - (index: number, severity: string, [newField]: IFieldType[]): void => { + const handleFieldValueChange = useCallback( + (newMappingItems: SeverityMapping, index: number): void => { const values = field.value as AboutStepSeverity; field.setValue({ value: values.value, + isMappingChecked: values.isMappingChecked, mapping: [ ...values.mapping.slice(0, index), - { - ...values.mapping[index], - field: newField?.name ?? '', - operator: 'equals', - severity, - }, + ...newMappingItems, ...values.mapping.slice(index + 1), ], }); @@ -99,40 +85,59 @@ export const SeverityField = ({ [field] ); + const handleFieldChange = useCallback( + (index: number, severity: Severity, [newField]: IFieldType[]): void => { + const values = field.value as AboutStepSeverity; + const newMappingItems: SeverityMapping = [ + { + ...values.mapping[index], + field: newField?.name ?? '', + value: newField != null ? values.mapping[index].value : '', + operator: 'equals', + severity, + }, + ]; + handleFieldValueChange(newMappingItems, index); + }, + [field, handleFieldValueChange] + ); + const handleFieldMatchValueChange = useCallback( - (index: number, severity: string, newMatchValue: string): void => { + (index: number, severity: Severity, newMatchValue: string): void => { const values = field.value as AboutStepSeverity; - field.setValue({ - value: values.value, - mapping: [ - ...values.mapping.slice(0, index), - { - ...values.mapping[index], - value: newMatchValue, - operator: 'equals', - severity, - }, - ...values.mapping.slice(index + 1), - ], - }); + const newMappingItems: SeverityMapping = [ + { + ...values.mapping[index], + field: values.mapping[index].field, + value: + values.mapping[index].field != null && values.mapping[index].field !== '' + ? newMatchValue + : '', + operator: 'equals', + severity, + }, + ]; + handleFieldValueChange(newMappingItems, index); }, - [field] + [field, handleFieldValueChange] ); - const selectedState = useMemo(() => { - return ( - (field.value as AboutStepSeverity).mapping?.map((mapping) => { - const [newSelectedField] = indices.fields.filter( - ({ name }) => mapping.field != null && mapping.field === name - ); - return { field: newSelectedField, value: mapping.value }; - }) ?? [] - ); - }, [field.value, indices]); + const getIFieldTypeFromFieldName = ( + fieldName: string | undefined, + iIndexPattern: IIndexPattern + ): IFieldType | undefined => { + const [iFieldType] = iIndexPattern.fields.filter(({ name }) => fieldName === name); + return iFieldType; + }; - const handleSeverityMappingSelected = useCallback(() => { - setIsSeverityMappingChecked(!isSeverityMappingChecked); - }, [isSeverityMappingChecked, setIsSeverityMappingChecked]); + const handleSeverityMappingChecked = useCallback(() => { + const values = field.value as AboutStepSeverity; + field.setValue({ + value: values.value, + mapping: [...values.mapping], + isMappingChecked: !values.isMappingChecked, + }); + }, [field]); const severityLabel = useMemo(() => { return ( @@ -149,12 +154,17 @@ export const SeverityField = ({ const severityMappingLabel = useMemo(() => { return (
- + {i18n.SEVERITY_MAPPING} @@ -165,7 +175,7 @@ export const SeverityField = ({
); - }, [handleSeverityMappingSelected, isSeverityMappingChecked]); + }, [field.value, handleSeverityMappingChecked, isDisabled]); return ( @@ -185,6 +195,7 @@ export const SeverityField = ({ componentProps={{ idAria: 'detectionEngineStepAboutRuleSeverity', 'data-test-subj': 'detectionEngineStepAboutRuleSeverity', + isDisabled, euiFieldProps: { fullWidth: false, disabled: false, @@ -195,12 +206,12 @@ export const SeverityField = ({ - - + {i18n.SEVERITY_MAPPING_DETAILS} ) : ( '' @@ -214,7 +225,7 @@ export const SeverityField = ({ > - {isSeverityMappingChecked && ( + {(field.value as AboutStepSeverity).isMappingChecked && ( @@ -231,53 +242,72 @@ export const SeverityField = ({ - {options.map((option, index) => ( - - - - - + {(field.value as AboutStepSeverity).mapping.map( + (severityMappingItem: SeverityMappingItem, index) => ( + + + + + - - - - - - - - {option.inputDisplay} - - - - ))} + + + + + + + + { + options.find((o) => o.value === severityMappingItem.severity) + ?.inputDisplay + } + + + + ) + )} )} - - + + ); }; diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/default_value.ts b/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/default_value.ts index f5d61553b595b..b9c3e4f84c18e 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/default_value.ts +++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/default_value.ts @@ -5,6 +5,7 @@ */ import { AboutStepRule } from '../../../pages/detection_engine/rules/types'; +import { fillEmptySeverityMappings } from '../../../pages/detection_engine/rules/helpers'; export const threatDefault = [ { @@ -21,8 +22,8 @@ export const stepAboutDefaultValue: AboutStepRule = { isAssociatedToEndpointList: false, isBuildingBlock: false, isNew: true, - severity: { value: 'low', mapping: [] }, - riskScore: { value: 50, mapping: [] }, + severity: { value: 'low', mapping: fillEmptySeverityMappings([]), isMappingChecked: false }, + riskScore: { value: 50, mapping: [], isMappingChecked: false }, references: [''], falsePositives: [''], license: '', diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/index.test.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/index.test.tsx index a86c1b7ce1bea..cb3fd5e5bec32 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/index.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/index.test.tsx @@ -16,6 +16,7 @@ import { stepAboutDefaultValue } from './default_value'; // we don't have the types for waitFor just yet, so using "as waitFor" until when we do import { wait as waitFor } from '@testing-library/react'; import { AboutStepRule } from '../../../pages/detection_engine/rules/types'; +import { fillEmptySeverityMappings } from '../../../pages/detection_engine/rules/helpers'; const theme = () => ({ eui: euiDarkVars, darkMode: true }); @@ -176,8 +177,8 @@ describe('StepAboutRuleComponent', () => { name: 'Test name text', note: '', references: [''], - riskScore: { value: 50, mapping: [] }, - severity: { value: 'low', mapping: [] }, + riskScore: { value: 50, mapping: [], isMappingChecked: false }, + severity: { value: 'low', mapping: fillEmptySeverityMappings([]), isMappingChecked: false }, tags: [], threat: [ { @@ -236,8 +237,8 @@ describe('StepAboutRuleComponent', () => { name: 'Test name text', note: '', references: [''], - riskScore: { value: 80, mapping: [] }, - severity: { value: 'low', mapping: [] }, + riskScore: { value: 80, mapping: [], isMappingChecked: false }, + severity: { value: 'low', mapping: fillEmptySeverityMappings([]), isMappingChecked: false }, tags: [], threat: [ { diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/index.tsx index ec812fa63eadf..5edf6f0a9312e 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/index.tsx @@ -74,7 +74,8 @@ const StepAboutRuleComponent: FC = ({ const initialState = defaultValues ?? stepAboutDefaultValue; const [myStepData, setMyStepData] = useState(initialState); const [{ isLoading: indexPatternLoading, indexPatterns }] = useFetchIndexPatterns( - defineRuleData?.index ?? [] + defineRuleData?.index ?? [], + 'step_about_rule' ); const canUseExceptions = defineRuleData?.ruleType && diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/schema.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/schema.tsx index fbd03850eee75..20470d7bb924f 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/schema.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/schema.tsx @@ -117,18 +117,16 @@ export const schema: FormSchema = { }, ], }, - mapping: { - type: FIELD_TYPES.TEXT, - }, + mapping: {}, + isMappingChecked: {}, }, riskScore: { value: { type: FIELD_TYPES.RANGE, serializer: (input: string) => Number(input), }, - mapping: { - type: FIELD_TYPES.TEXT, - }, + mapping: {}, + isMappingChecked: {}, }, references: { label: i18n.translate( diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx index 51e9291f31941..3d5b66b8869cc 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx @@ -117,7 +117,7 @@ const StepDefineRuleComponent: FC = ({ const [myStepData, setMyStepData] = useState(initialState); const [ { browserFields, indexPatterns: indexPatternQueryBar, isLoading: indexPatternLoadingQueryBar }, - ] = useFetchIndexPatterns(myStepData.index); + ] = useFetchIndexPatterns(myStepData.index, 'step_define_rule'); const { form } = useForm({ defaultValue: initialState, diff --git a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/auto_download.test.tsx b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/auto_download.test.tsx new file mode 100644 index 0000000000000..be84c37d40606 --- /dev/null +++ b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/auto_download.test.tsx @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { mount } from 'enzyme'; + +import { globalNode } from '../../../common/mock'; +import { AutoDownload } from './auto_download'; + +describe('AutoDownload', () => { + beforeEach(() => { + Object.defineProperty(globalNode.window.URL, 'revokeObjectURL', { + configurable: true, + writable: true, + value: jest.fn(), + }); + }); + + it('calls onDownload once if a blob is provided', () => { + const onDownload = jest.fn(); + mount(); + + expect(onDownload).toHaveBeenCalledTimes(1); + }); + + it('does not call onDownload if no blob is provided', () => { + const onDownload = jest.fn(); + mount(); + + expect(onDownload).not.toHaveBeenCalled(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/auto_download.tsx b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/auto_download.tsx new file mode 100644 index 0000000000000..9c8280bebe4fd --- /dev/null +++ b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/auto_download.tsx @@ -0,0 +1,42 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { useEffect, useRef } from 'react'; +import styled from 'styled-components'; + +const InvisibleAnchor = styled.a` + display: none; +`; + +interface AutoDownloadProps { + blob: Blob | undefined; + name?: string; + onDownload?: () => void; +} + +export const AutoDownload: React.FC = ({ blob, name, onDownload }) => { + const anchorRef = useRef(null); + + useEffect(() => { + if (blob && anchorRef?.current) { + if (typeof window.navigator.msSaveOrOpenBlob === 'function') { + window.navigator.msSaveBlob(blob); + } else { + const objectURL = window.URL.createObjectURL(blob); + anchorRef.current.href = objectURL; + anchorRef.current.download = name ?? 'download.txt'; + anchorRef.current.click(); + window.URL.revokeObjectURL(objectURL); + } + + if (onDownload) { + onDownload(); + } + } + }, [blob, name, onDownload]); + + return ; +}; diff --git a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/modal.test.tsx b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/modal.test.tsx index 175882de551cb..ff743d1d5090a 100644 --- a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/modal.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/modal.test.tsx @@ -6,11 +6,38 @@ import React from 'react'; import { mount } from 'enzyme'; +import { act } from 'react-dom/test-utils'; +import { getListResponseMock } from '../../../../../lists/common/schemas/response/list_schema.mock'; +import { exportList, useDeleteList, useFindLists, ListSchema } from '../../../shared_imports'; import { TestProviders } from '../../../common/mock'; import { ValueListsModal } from './modal'; +jest.mock('../../../shared_imports', () => { + const actual = jest.requireActual('../../../shared_imports'); + + return { + ...actual, + exportList: jest.fn(), + useDeleteList: jest.fn(), + useFindLists: jest.fn(), + }; +}); + describe('ValueListsModal', () => { + beforeEach(() => { + // Do not resolve the export in tests as it causes unexpected state updates + (exportList as jest.Mock).mockImplementation(() => new Promise(() => {})); + (useFindLists as jest.Mock).mockReturnValue({ + start: jest.fn(), + result: { data: Array(3).fill(getListResponseMock()), total: 3 }, + }); + (useDeleteList as jest.Mock).mockReturnValue({ + start: jest.fn(), + result: getListResponseMock(), + }); + }); + it('renders nothing if showModal is false', () => { const container = mount( @@ -47,7 +74,7 @@ describe('ValueListsModal', () => { container.unmount(); }); - it('renders ValueListsForm and ValueListsTable', () => { + it('renders ValueListsForm and an EuiTable', () => { const container = mount( @@ -55,7 +82,50 @@ describe('ValueListsModal', () => { ); expect(container.find('ValueListsForm')).toHaveLength(1); - expect(container.find('ValueListsTable')).toHaveLength(1); + expect(container.find('EuiBasicTable')).toHaveLength(1); container.unmount(); }); + + describe('modal table actions', () => { + it('calls exportList when export is clicked', () => { + const container = mount( + + + + ); + + act(() => { + container + .find('button[data-test-subj="action-export-value-list"]') + .first() + .simulate('click'); + container.unmount(); + }); + + expect(exportList).toHaveBeenCalledWith(expect.objectContaining({ listId: 'some-list-id' })); + }); + + it('calls deleteList when delete is clicked', () => { + const deleteListMock = jest.fn(); + (useDeleteList as jest.Mock).mockReturnValue({ + start: deleteListMock, + result: getListResponseMock(), + }); + const container = mount( + + + + ); + + act(() => { + container + .find('button[data-test-subj="action-delete-value-list"]') + .first() + .simulate('click'); + container.unmount(); + }); + + expect(deleteListMock).toHaveBeenCalledWith(expect.objectContaining({ id: 'some-list-id' })); + }); + }); }); diff --git a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/modal.tsx b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/modal.tsx index dc72260439090..4921a98b38bd1 100644 --- a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/modal.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/modal.tsx @@ -6,6 +6,7 @@ import React, { useCallback, useEffect, useState } from 'react'; import { + EuiBasicTable, EuiButton, EuiModal, EuiModalBody, @@ -13,7 +14,9 @@ import { EuiModalHeader, EuiModalHeaderTitle, EuiOverlayMask, + EuiPanel, EuiSpacer, + EuiText, } from '@elastic/eui'; import { @@ -25,10 +28,10 @@ import { } from '../../../shared_imports'; import { useKibana } from '../../../common/lib/kibana'; import { useAppToasts } from '../../../common/hooks/use_app_toasts'; -import { GenericDownloader } from '../../../common/components/generic_downloader'; import * as i18n from './translations'; -import { ValueListsTable } from './table'; +import { buildColumns } from './table_helpers'; import { ValueListsForm } from './form'; +import { AutoDownload } from './auto_download'; interface ValueListsModalProps { onClose: () => void; @@ -45,8 +48,9 @@ export const ValueListsModalComponent: React.FC = ({ const { http } = useKibana().services; const { start: findLists, ...lists } = useFindLists(); const { start: deleteList, result: deleteResult } = useDeleteList(); - const [exportListId, setExportListId] = useState(); const [deletingListIds, setDeletingListIds] = useState([]); + const [exportingListIds, setExportingListIds] = useState([]); + const [exportDownload, setExportDownload] = useState<{ name?: string; blob?: Blob }>({}); const { addError, addSuccess } = useAppToasts(); const fetchLists = useCallback(() => { @@ -62,19 +66,26 @@ export const ValueListsModalComponent: React.FC = ({ ); useEffect(() => { - if (deleteResult != null && deletingListIds.length > 0) { - setDeletingListIds([...deletingListIds.filter((id) => id !== deleteResult.id)]); + if (deleteResult != null) { + setDeletingListIds((ids) => [...ids.filter((id) => id !== deleteResult.id)]); fetchLists(); } - }, [deleteResult, deletingListIds, fetchLists]); + }, [deleteResult, fetchLists]); const handleExport = useCallback( - async ({ ids }: { ids: string[] }) => - exportList({ http, listId: ids[0], signal: new AbortController().signal }), - [http] + async ({ id }: { id: string }) => { + try { + setExportingListIds((ids) => [...ids, id]); + const blob = await exportList({ http, listId: id, signal: new AbortController().signal }); + setExportDownload({ name: id, blob }); + } catch (error) { + addError(error, { title: i18n.EXPORT_ERROR }); + } finally { + setExportingListIds((ids) => [...ids.filter((_id) => _id !== id)]); + } + }, + [addError, http] ); - const handleExportClick = useCallback(({ id }: { id: string }) => setExportListId(id), []); - const handleExportComplete = useCallback(() => setExportListId(undefined), []); const handleTableChange = useCallback( ({ page: { index, size } }: { page: { index: number; size: number } }) => { @@ -121,8 +132,8 @@ export const ValueListsModalComponent: React.FC = ({ const tableItems = (lists.result?.data ?? []).map((item) => ({ ...item, - isExporting: item.id === exportListId, isDeleting: deletingListIds.includes(item.id), + isExporting: exportingListIds.includes(item.id), })); const pagination = { @@ -131,6 +142,7 @@ export const ValueListsModalComponent: React.FC = ({ totalItemCount: lists.result?.total ?? 0, hidePerPageOptions: true, }; + const columns = buildColumns(handleExport, handleDelete); return ( @@ -141,14 +153,19 @@ export const ValueListsModalComponent: React.FC = ({ - + + +

{i18n.TABLE_TITLE}

+
+ +
@@ -156,12 +173,10 @@ export const ValueListsModalComponent: React.FC = ({ - setExportDownload({})} />
); diff --git a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/table.test.tsx b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/table.test.tsx deleted file mode 100644 index 2724c0a0696b6..0000000000000 --- a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/table.test.tsx +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import { mount } from 'enzyme'; -import { act } from 'react-dom/test-utils'; - -import { getListResponseMock } from '../../../../../lists/common/schemas/response/list_schema.mock'; -import { ListSchema } from '../../../../../lists/common/schemas/response'; -import { TestProviders } from '../../../common/mock'; -import { ValueListsTable } from './table'; -import { TableItem } from './types'; - -const buildItems = (lists: ListSchema[]): TableItem[] => - lists.map((list) => ({ - ...list, - isDeleting: false, - isExporting: false, - })); - -describe('ValueListsTable', () => { - it('renders a row for each list', () => { - const lists = Array(3).fill(getListResponseMock()); - const items = buildItems(lists); - const container = mount( - - - - ); - - expect(container.find('tbody tr')).toHaveLength(3); - }); - - it('calls onChange when pagination is modified', () => { - const lists = Array(6).fill(getListResponseMock()); - const items = buildItems(lists); - const onChange = jest.fn(); - const container = mount( - - - - ); - - act(() => { - container.find('a[data-test-subj="pagination-button-next"]').simulate('click'); - }); - - expect(onChange).toHaveBeenCalledWith( - expect.objectContaining({ page: expect.objectContaining({ index: 1 }) }) - ); - }); - - it('calls onExport when export is clicked', () => { - const lists = Array(3).fill(getListResponseMock()); - const items = buildItems(lists); - const onExport = jest.fn(); - const container = mount( - - - - ); - - act(() => { - container - .find('tbody tr') - .first() - .find('button[data-test-subj="action-export-value-list"]') - .simulate('click'); - }); - - expect(onExport).toHaveBeenCalledWith(expect.objectContaining({ id: 'some-list-id' })); - }); - - it('calls onDelete when delete is clicked', () => { - const lists = Array(3).fill(getListResponseMock()); - const items = buildItems(lists); - const onDelete = jest.fn(); - const container = mount( - - - - ); - - act(() => { - container - .find('tbody tr') - .first() - .find('button[data-test-subj="action-delete-value-list"]') - .simulate('click'); - }); - - expect(onDelete).toHaveBeenCalledWith(expect.objectContaining({ id: 'some-list-id' })); - }); -}); diff --git a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/table.tsx b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/table.tsx deleted file mode 100644 index a2e3b73a0abf0..0000000000000 --- a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/table.tsx +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import { EuiBasicTable, EuiText, EuiPanel } from '@elastic/eui'; - -import * as i18n from './translations'; -import { buildColumns } from './table_helpers'; -import { TableProps, TableItemCallback } from './types'; - -export interface ValueListsTableProps { - items: TableProps['items']; - loading: boolean; - onChange: TableProps['onChange']; - onExport: TableItemCallback; - onDelete: TableItemCallback; - pagination: Exclude; -} - -export const ValueListsTableComponent: React.FC = ({ - items, - loading, - onChange, - onExport, - onDelete, - pagination, -}) => { - const columns = buildColumns(onExport, onDelete); - return ( - - -

{i18n.TABLE_TITLE}

-
- -
- ); -}; - -ValueListsTableComponent.displayName = 'ValueListsTableComponent'; - -export const ValueListsTable = React.memo(ValueListsTableComponent); - -ValueListsTable.displayName = 'ValueListsTable'; diff --git a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/table_helpers.tsx b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/table_helpers.tsx index e90d106636e63..bb3a97749a11a 100644 --- a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/table_helpers.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/table_helpers.tsx @@ -8,40 +8,18 @@ import React from 'react'; import styled from 'styled-components'; -import { EuiButtonIcon, IconType, EuiLoadingSpinner, EuiToolTip } from '@elastic/eui'; +import { EuiButtonIcon, EuiLoadingSpinner, EuiToolTip } from '@elastic/eui'; import { ListSchema } from '../../../../../lists/common/schemas/response'; import { FormattedDate } from '../../../common/components/formatted_date'; import * as i18n from './translations'; -import { TableItem, TableItemCallback, TableProps } from './types'; +import { TableItemCallback, TableProps } from './types'; const AlignedSpinner = styled(EuiLoadingSpinner)` margin: ${({ theme }) => theme.eui.euiSizeXS}; vertical-align: middle; `; -const ActionButton: React.FC<{ - content: string; - dataTestSubj: string; - icon: IconType; - isLoading: boolean; - item: TableItem; - onClick: TableItemCallback; -}> = ({ content, dataTestSubj, icon, item, onClick, isLoading }) => ( - - {isLoading ? ( - - ) : ( - onClick(item)} - /> - )} - -); - export const buildColumns = ( onExport: TableItemCallback, onDelete: TableItemCallback @@ -70,26 +48,34 @@ export const buildColumns = ( actions: [ { render: (item) => ( - + + {item.isExporting ? ( + + ) : ( + onExport(item)} + /> + )} + ), }, { render: (item) => ( - + + {item.isDeleting ? ( + + ) : ( + onDelete(item)} + /> + )} + ), }, ], diff --git a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/translations.ts b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/translations.ts index b7b2cae7b0ad6..7063dca2341ca 100644 --- a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/translations.ts +++ b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/translations.ts @@ -65,6 +65,10 @@ export const uploadSuccessMessage = (fileName: string) => values: { fileName }, }); +export const EXPORT_ERROR = i18n.translate('xpack.securitySolution.lists.valueListsExportError', { + defaultMessage: 'There was an error exporting the value list.', +}); + export const COLUMN_FILE_NAME = i18n.translate( 'xpack.securitySolution.lists.valueListsTable.fileNameColumn', { diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/fetch_index_patterns.tsx b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/fetch_index_patterns.tsx index c0997a5e62908..82c9292af7451 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/fetch_index_patterns.tsx +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/fetch_index_patterns.tsx @@ -77,7 +77,7 @@ export const useFetchIndexPatterns = ( apolloClient .query({ query: sourceQuery, - fetchPolicy: 'network-only', + fetchPolicy: 'cache-first', variables: { sourceId: 'default', defaultIndex: indices, diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine.test.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine.test.tsx index 110620fad7eba..982712cbe9797 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine.test.tsx @@ -53,6 +53,9 @@ jest.mock('react-router-dom', () => { useHistory: jest.fn(), }; }); +jest.mock('../../components/alerts_info', () => ({ + useAlertInfo: jest.fn().mockReturnValue([]), +})); const state: State = { ...mockGlobalState, diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine.tsx index 090fdc4980933..c114e4519df10 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine.tsx @@ -36,7 +36,7 @@ import { alertsHistogramOptions } from '../../components/alerts_histogram_panel/ import { useUserInfo } from '../../components/user_info'; import { EVENTS_VIEWER_HEADER_HEIGHT } from '../../../common/components/events_viewer/events_viewer'; import { OverviewEmpty } from '../../../overview/components/overview_empty'; -import { DetectionEngineNoIndex } from './detection_engine_no_signal_index'; +import { DetectionEngineNoIndex } from './detection_engine_no_index'; import { DetectionEngineHeaderPage } from '../../components/detection_engine_header_page'; import { useListsConfig } from '../../containers/detection_engine/lists/use_lists_config'; import { DetectionEngineUserUnauthenticated } from './detection_engine_user_unauthenticated'; @@ -144,7 +144,10 @@ export const DetectionEnginePageComponent: React.FC = ({ return ( - + ); } @@ -156,7 +159,10 @@ export const DetectionEnginePageComponent: React.FC = ({ {indicesExist ? ( - + diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_no_signal_index.test.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_no_index.test.tsx similarity index 72% rename from x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_no_signal_index.test.tsx rename to x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_no_index.test.tsx index 34d55908c9ba1..82d8ee9c63862 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_no_signal_index.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_no_index.test.tsx @@ -7,12 +7,14 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { DetectionEngineNoIndex } from './detection_engine_no_signal_index'; +import { DetectionEngineNoIndex } from './detection_engine_no_index'; jest.mock('../../../common/lib/kibana'); describe('DetectionEngineNoIndex', () => { it('renders correctly', () => { - const wrapper = shallow(); + const wrapper = shallow( + + ); expect(wrapper.find('EmptyPage')).toHaveLength(1); }); diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_no_index.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_no_index.tsx new file mode 100644 index 0000000000000..648a9405606ef --- /dev/null +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_no_index.tsx @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { useMemo } from 'react'; + +import { EmptyPage } from '../../../common/components/empty_page'; +import * as i18n from './translations'; +import { useKibana } from '../../../common/lib/kibana'; + +const buildMessage = (needsListsIndex: boolean, needsSignalsIndex: boolean): string => { + if (needsSignalsIndex && needsListsIndex) { + return i18n.NEEDS_INDEX_PERMISSIONS(i18n.NEEDS_SIGNALS_AND_LISTS_INDEXES); + } else if (needsSignalsIndex) { + return i18n.NEEDS_INDEX_PERMISSIONS(i18n.NEEDS_SIGNALS_INDEX); + } else if (needsListsIndex) { + return i18n.NEEDS_INDEX_PERMISSIONS(i18n.NEEDS_LISTS_INDEXES); + } else { + return i18n.NEEDS_INDEX_PERMISSIONS(''); + } +}; + +const DetectionEngineNoIndexComponent: React.FC<{ + needsListsIndex: boolean; + needsSignalsIndex: boolean; +}> = ({ needsListsIndex, needsSignalsIndex }) => { + const docLinks = useKibana().services.docLinks; + const actions = useMemo( + () => ({ + detections: { + icon: 'documents', + label: i18n.GO_TO_DOCUMENTATION, + url: `${docLinks.ELASTIC_WEBSITE_URL}guide/en/security/${docLinks.DOC_LINK_VERSION}/detection-engine-overview.html#detections-permissions`, + target: '_blank', + }, + }), + [docLinks] + ); + const message = buildMessage(needsListsIndex, needsSignalsIndex); + + return ( + + ); +}; + +export const DetectionEngineNoIndex = React.memo(DetectionEngineNoIndexComponent); diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_no_signal_index.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_no_signal_index.tsx deleted file mode 100644 index 32ae585aec191..0000000000000 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_no_signal_index.tsx +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; - -import { EmptyPage } from '../../../common/components/empty_page'; -import * as i18n from './translations'; -import { useKibana } from '../../../common/lib/kibana'; - -export const DetectionEngineNoIndex = React.memo(() => { - const docLinks = useKibana().services.docLinks; - return ( - - ); -}); - -DetectionEngineNoIndex.displayName = 'DetectionEngineNoIndex'; diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_user_unauthenticated.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_user_unauthenticated.tsx index 6123e3740e306..355898cff0120 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_user_unauthenticated.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine_user_unauthenticated.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { useMemo } from 'react'; import { EmptyPage } from '../../../common/components/empty_page'; import * as i18n from './translations'; @@ -12,13 +12,20 @@ import { useKibana } from '../../../common/lib/kibana'; export const DetectionEngineUserUnauthenticated = React.memo(() => { const docLinks = useKibana().services.docLinks; - + const actions = useMemo( + () => ({ + detectionUnauthenticated: { + icon: 'documents', + label: i18n.GO_TO_DOCUMENTATION, + url: `${docLinks.ELASTIC_WEBSITE_URL}guide/en/security/${docLinks.DOC_LINK_VERSION}/detection-engine-overview.html#detections-permissions`, + target: '_blank', + }, + }), + [docLinks] + ); return ( ({ license: 'Elastic License', name: 'Query with rule-id', description: '24/7', - severity: { value: 'low', mapping: [] }, - riskScore: { value: 21, mapping: [] }, + riskScore: { value: 21, mapping: [], isMappingChecked: false }, + severity: { value: 'low', mapping: fillEmptySeverityMappings([]), isMappingChecked: false }, references: ['www.test.co'], falsePositives: ['test'], tags: ['tag1', 'tag2'], @@ -241,9 +241,3 @@ export const mockRules: Rule[] = [ mockRule('abe6c564-050d-45a5-aaf0-386c37dd1f61'), mockRule('63f06f34-c181-4b2d-af35-f2ace572a1ee'), ]; - -export const mockExceptionsList: List = { - namespace_type: 'single', - id: '75cd4380-cc5e-11ea-9101-5b34f44aeb44', - type: 'detection', -}; diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.test.ts b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.test.ts index 6458d2faa2468..4f2055424ca61 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.test.ts @@ -5,9 +5,11 @@ */ import { List } from '../../../../../../common/detection_engine/schemas/types'; -import { ENDPOINT_LIST_ID } from '../../../../../shared_imports'; import { NewRule } from '../../../../containers/detection_engine/rules'; - +import { + getListMock, + getEndpointListMock, +} from '../../../../../../common/detection_engine/schemas/types/lists.mock'; import { DefineStepRuleJson, ScheduleStepRuleJson, @@ -29,19 +31,12 @@ import { } from './helpers'; import { mockDefineStepRule, - mockExceptionsList, mockQueryBar, mockScheduleStepRule, mockAboutStepRule, mockActionsStepRule, } from '../all/__mocks__/mock'; -const ENDPOINT_LIST = { - id: ENDPOINT_LIST_ID, - namespace_type: 'agnostic', - type: 'endpoint', -} as List; - describe('helpers', () => { describe('getTimeTypeValue', () => { test('returns timeObj with value 0 if no time value found', () => { @@ -391,14 +386,12 @@ describe('helpers', () => { }, [] ); - expect(result.exceptions_list).toEqual([ - { id: ENDPOINT_LIST_ID, namespace_type: 'agnostic', type: 'endpoint' }, - ]); + expect(result.exceptions_list).toEqual([getEndpointListMock()]); }); test('returns formatted object with detections exceptions_list', () => { - const result: AboutStepRuleJson = formatAboutStepData(mockData, [mockExceptionsList]); - expect(result.exceptions_list).toEqual([mockExceptionsList]); + const result: AboutStepRuleJson = formatAboutStepData(mockData, [getListMock()]); + expect(result.exceptions_list).toEqual([getListMock()]); }); test('returns formatted object with both exceptions_lists', () => { @@ -407,13 +400,13 @@ describe('helpers', () => { ...mockData, isAssociatedToEndpointList: true, }, - [mockExceptionsList] + [getListMock()] ); - expect(result.exceptions_list).toEqual([ENDPOINT_LIST, mockExceptionsList]); + expect(result.exceptions_list).toEqual([getEndpointListMock(), getListMock()]); }); test('returns formatted object with pre-existing exceptions lists', () => { - const exceptionsLists: List[] = [ENDPOINT_LIST, mockExceptionsList]; + const exceptionsLists: List[] = [getEndpointListMock(), getListMock()]; const result: AboutStepRuleJson = formatAboutStepData( { ...mockData, @@ -425,9 +418,9 @@ describe('helpers', () => { }); test('returns formatted object with pre-existing endpoint exceptions list disabled', () => { - const exceptionsLists: List[] = [ENDPOINT_LIST, mockExceptionsList]; + const exceptionsLists: List[] = [getEndpointListMock(), getListMock()]; const result: AboutStepRuleJson = formatAboutStepData(mockData, exceptionsLists); - expect(result.exceptions_list).toEqual([mockExceptionsList]); + expect(result.exceptions_list).toEqual([getListMock()]); }); test('returns formatted object with empty falsePositive and references filtered out', () => { diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.ts b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.ts index a972afbd8c0c5..434a33ac37722 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.ts +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/create/helpers.ts @@ -12,6 +12,7 @@ import { NOTIFICATION_THROTTLE_NO_ACTIONS } from '../../../../../../common/const import { transformAlertToRuleAction } from '../../../../../../common/detection_engine/transform_actions'; import { RuleType } from '../../../../../../common/detection_engine/types'; import { isMlRule } from '../../../../../../common/machine_learning/helpers'; +import { isThresholdRule } from '../../../../../../common/detection_engine/utils'; import { List } from '../../../../../../common/detection_engine/schemas/types'; import { ENDPOINT_LIST_ID } from '../../../../../shared_imports'; import { NewRule, Rule } from '../../../../containers/detection_engine/rules'; @@ -57,7 +58,7 @@ export interface RuleFields { } type QueryRuleFields = Omit; type ThresholdRuleFields = Omit; -type MlRuleFields = Omit; +type MlRuleFields = Omit; const isMlFields = ( fields: QueryRuleFields | MlRuleFields | ThresholdRuleFields @@ -69,9 +70,9 @@ const isThresholdFields = ( export const filterRuleFieldsForType = (fields: T, type: RuleType) => { if (isMlRule(type)) { - const { index, queryBar, ...mlRuleFields } = fields; + const { index, queryBar, threshold, ...mlRuleFields } = fields; return mlRuleFields; - } else if (type === 'threshold') { + } else if (isThresholdRule(type)) { const { anomalyThreshold, machineLearningJobId, ...thresholdRuleFields } = fields; return thresholdRuleFields; } else { @@ -176,7 +177,12 @@ export const formatAboutStepData = ( ...(isAssociatedToEndpointList ? { exceptions_list: [ - { id: ENDPOINT_LIST_ID, namespace_type: 'agnostic', type: 'endpoint' }, + { + id: ENDPOINT_LIST_ID, + list_id: ENDPOINT_LIST_ID, + namespace_type: 'agnostic', + type: 'endpoint', + }, ...detectionExceptionLists, ] as AboutStepRuleJson['exceptions_list'], } @@ -188,10 +194,14 @@ export const formatAboutStepData = ( false_positives: falsePositives.filter((item) => !isEmpty(item)), references: references.filter((item) => !isEmpty(item)), risk_score: riskScore.value, - risk_score_mapping: riskScore.mapping, + risk_score_mapping: riskScore.isMappingChecked + ? riskScore.mapping.filter((m) => m.field != null && m.field !== '') + : [], rule_name_override: ruleNameOverride !== '' ? ruleNameOverride : undefined, severity: severity.value, - severity_mapping: severity.mapping, + severity_mapping: severity.isMappingChecked + ? severity.mapping.filter((m) => m.field != null && m.field !== '' && m.value != null) + : [], threat: threat .filter((singleThreat) => singleThreat.tactic.name !== 'none') .map((singleThreat) => ({ diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx index 9c130a7d351fa..789469e981fb4 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx @@ -328,13 +328,13 @@ export const RuleDetailsPageComponent: FC = ({ lists: ExceptionIdentifiers[]; allowedExceptionListTypes: ExceptionListTypeEnum[]; }>( - (acc, { id, namespace_type, type }) => { + (acc, { id, list_id, namespace_type, type }) => { const { allowedExceptionListTypes, lists } = acc; const shouldAddEndpoint = type === ExceptionListTypeEnum.ENDPOINT && !allowedExceptionListTypes.includes(ExceptionListTypeEnum.ENDPOINT); return { - lists: [...lists, { id, namespaceType: namespace_type, type }], + lists: [...lists, { id, listId: list_id, namespaceType: namespace_type, type }], allowedExceptionListTypes: shouldAddEndpoint ? [...allowedExceptionListTypes, ExceptionListTypeEnum.ENDPOINT] : allowedExceptionListTypes, @@ -366,7 +366,10 @@ export const RuleDetailsPageComponent: FC = ({ {indicesExist ? ( - + diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx index b40243efcfb46..10a20807d6f87 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx @@ -17,6 +17,7 @@ import { getPrePackagedTimelineStatus, determineDetailsValue, userHasNoPermissions, + fillEmptySeverityMappings, } from './helpers'; import { mockRuleWithEverything, mockRule } from './all/__mocks__/mock'; import { esFilters } from '../../../../../../../../src/plugins/data/public'; @@ -97,9 +98,9 @@ describe('rule helpers', () => { name: 'Query with rule-id', note: '# this is some markdown documentation', references: ['www.test.co'], - riskScore: { value: 21, mapping: [] }, + riskScore: { value: 21, mapping: [], isMappingChecked: false }, ruleNameOverride: 'message', - severity: { value: 'low', mapping: [] }, + severity: { value: 'low', mapping: fillEmptySeverityMappings([]), isMappingChecked: false }, tags: ['tag1', 'tag2'], threat: [ { diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.tsx index 8f8967f2ff6d5..f9279ce639534 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.tsx @@ -24,6 +24,8 @@ import { ScheduleStepRule, ActionsStepRule, } from './types'; +import { SeverityMapping } from '../../../../../common/detection_engine/schemas/common/schemas'; +import { severityOptions } from '../../../components/rules/step_about_rule/data'; export interface GetStepsData { aboutRuleData: AboutStepRule; @@ -150,18 +152,38 @@ export const getAboutStepsData = (rule: Rule, detailsView: boolean): AboutStepRu references, severity: { value: severity, - mapping: severityMapping, + mapping: fillEmptySeverityMappings(severityMapping), + isMappingChecked: severityMapping.length > 0, }, tags, riskScore: { value: riskScore, mapping: riskScoreMapping, + isMappingChecked: riskScoreMapping.length > 0, }, falsePositives, threat: threat as IMitreEnterpriseAttack[], }; }; +const severitySortMapping = { + low: 0, + medium: 1, + high: 2, + critical: 3, +}; + +export const fillEmptySeverityMappings = (mappings: SeverityMapping): SeverityMapping => { + const missingMappings: SeverityMapping = severityOptions.flatMap((so) => + mappings.find((mapping) => mapping.severity === so.value) == null + ? [{ field: '', value: '', operator: 'equals', severity: so.value }] + : [] + ); + return [...mappings, ...missingMappings].sort( + (a, b) => severitySortMapping[a.severity] - severitySortMapping[b.severity] + ); +}; + export const determineDetailsValue = ( rule: Rule, detailsView: boolean diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/index.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/index.tsx index f49ee8246024a..b6f58ef7045f8 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/index.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui'; import React, { useCallback, useRef, useState } from 'react'; import { useHistory } from 'react-router-dom'; @@ -204,14 +204,16 @@ const RulesPageComponent: React.FC = () => { )} - - {i18n.UPLOAD_VALUE_LISTS} - + + + {i18n.UPLOAD_VALUE_LISTS} + + + i18n.translate('xpack.securitySolution.detectionEngine.needsIndexPermissionsMessage', { + values: { additionalContext }, + defaultMessage: + 'To use the detection engine, a user with the required cluster and index privileges must first access this page. {additionalContext} For more help, contact your Elastic Stack administrator.', + }); + export const GO_TO_DOCUMENTATION = i18n.translate( 'xpack.securitySolution.detectionEngine.goToDocumentationButton', { diff --git a/x-pack/plugins/security_solution/public/hosts/pages/details/index.tsx b/x-pack/plugins/security_solution/public/hosts/pages/details/index.tsx index 781aa711ff0d9..b6c1727ee6afa 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/details/index.tsx +++ b/x-pack/plugins/security_solution/public/hosts/pages/details/index.tsx @@ -104,7 +104,10 @@ const HostDetailsComponent = React.memo( {indicesExist ? ( - + diff --git a/x-pack/plugins/security_solution/public/hosts/pages/hosts.tsx b/x-pack/plugins/security_solution/public/hosts/pages/hosts.tsx index 1219effa5ff6d..1d0b73f80a69a 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/hosts.tsx +++ b/x-pack/plugins/security_solution/public/hosts/pages/hosts.tsx @@ -98,7 +98,10 @@ export const HostsComponent = React.memo( {indicesExist ? ( - + diff --git a/x-pack/plugins/security_solution/public/management/components/management_empty_state.tsx b/x-pack/plugins/security_solution/public/management/components/management_empty_state.tsx index fb9f97f3f7570..a4518d1a1f493 100644 --- a/x-pack/plugins/security_solution/public/management/components/management_empty_state.tsx +++ b/x-pack/plugins/security_solution/public/management/components/management_empty_state.tsx @@ -77,57 +77,6 @@ const PolicyEmptyState = React.memo<{ /> - - - - - - - - -

- -

-
-
-
- - - - -
- - - - - - - -

- -

-
-
-
- - - - -
-
- [ { title: i18n.translate('xpack.securitySolution.endpoint.hostList.stepOneTitle', { - defaultMessage: 'Select the policy you want to use to protect your hosts', + defaultMessage: 'Select the integration you want to use', }), children: ( <> @@ -203,7 +152,7 @@ const HostsEmptyState = React.memo<{ ) : selectionOptions.length ? ( @@ -211,7 +160,7 @@ const HostsEmptyState = React.memo<{ ) : ( ); }} @@ -263,13 +212,13 @@ const HostsEmptyState = React.memo<{ headerComponent={ } bodyComponent={ } /> diff --git a/x-pack/plugins/security_solution/public/management/components/management_page_view.tsx b/x-pack/plugins/security_solution/public/management/components/management_page_view.tsx index 42341b524362d..aa562b9a20201 100644 --- a/x-pack/plugins/security_solution/public/management/components/management_page_view.tsx +++ b/x-pack/plugins/security_solution/public/management/components/management_page_view.tsx @@ -4,52 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { memo, useMemo } from 'react'; -import { i18n } from '@kbn/i18n'; -import { useParams } from 'react-router-dom'; +import React, { memo } from 'react'; import { PageView, PageViewProps } from '../../common/components/endpoint/page_view'; -import { AdministrationSubTab } from '../types'; -import { SecurityPageName } from '../../app/types'; -import { useFormatUrl } from '../../common/components/link_to'; -import { getHostListPath, getPoliciesPath } from '../common/routing'; -import { useNavigateByRouterEventHandler } from '../../common/hooks/endpoint/use_navigate_by_router_event_handler'; export const ManagementPageView = memo>((options) => { - const { formatUrl, search } = useFormatUrl(SecurityPageName.administration); - const { tabName } = useParams<{ tabName: AdministrationSubTab }>(); - - const goToEndpoint = useNavigateByRouterEventHandler( - getHostListPath({ name: 'hostList' }, search) - ); - - const goToPolicies = useNavigateByRouterEventHandler(getPoliciesPath(search)); - - const tabs = useMemo((): PageViewProps['tabs'] | undefined => { - if (options.viewType === 'details') { - return undefined; - } - return [ - { - name: i18n.translate('xpack.securitySolution.managementTabs.hosts', { - defaultMessage: 'Hosts', - }), - id: AdministrationSubTab.hosts, - isSelected: tabName === AdministrationSubTab.hosts, - href: formatUrl(getHostListPath({ name: 'hostList' })), - onClick: goToEndpoint, - }, - { - name: i18n.translate('xpack.securitySolution.managementTabs.policies', { - defaultMessage: 'Policies', - }), - id: AdministrationSubTab.policies, - isSelected: tabName === AdministrationSubTab.policies, - href: formatUrl(getPoliciesPath()), - onClick: goToPolicies, - }, - ]; - }, [formatUrl, goToEndpoint, goToPolicies, options.viewType, tabName]); - return ; + return ; }); ManagementPageView.displayName = 'ManagementPageView'; diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/host_details.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/host_details.tsx index cea66acbef8ca..109392cb7a929 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/host_details.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/host_details.tsx @@ -121,7 +121,7 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => { return [ { title: i18n.translate('xpack.securitySolution.endpoint.host.details.policy', { - defaultMessage: 'Policy', + defaultMessage: 'Integration', }), description: ( <> @@ -136,7 +136,7 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => { }, { title: i18n.translate('xpack.securitySolution.endpoint.host.details.policyStatus', { - defaultMessage: 'Policy Status', + defaultMessage: 'Configuration response', }), description: ( { diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/index.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/index.tsx index 71b3885308558..212c8977a8852 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/index.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/index.tsx @@ -158,7 +158,7 @@ const PolicyResponseFlyoutPanel = memo<{

@@ -167,7 +167,7 @@ const PolicyResponseFlyoutPanel = memo<{ title={ } /> diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx index 47227244b7066..9d49c8705affe 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx @@ -431,7 +431,7 @@ describe('when on the hosts page', () => { const renderResult = render(); const linkToReassign = await renderResult.findByTestId('hostDetailsLinkToIngest'); expect(linkToReassign).not.toBeNull(); - expect(linkToReassign.textContent).toEqual('Reassign Policy'); + expect(linkToReassign.textContent).toEqual('Reassign Configuration'); expect(linkToReassign.getAttribute('href')).toEqual( `/app/ingestManager#/fleet/agents/${agentId}/activity?openReassignFlyout=true` ); @@ -492,7 +492,7 @@ describe('when on the hosts page', () => { it('should include the sub-panel title', async () => { expect( (await renderResult.findByTestId('hostDetailsPolicyResponseFlyoutTitle')).textContent - ).toBe('Policy Response'); + ).toBe('Configuration Response'); }); it('should show a configuration section for each protection', async () => { diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx index e38ef1bd5fe86..2692f7791b7c0 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx @@ -237,7 +237,7 @@ export const HostList = () => { { field: 'metadata.Endpoint.policy.applied', name: i18n.translate('xpack.securitySolution.endpointList.policy', { - defaultMessage: 'Policy', + defaultMessage: 'Integration', }), truncateText: true, // eslint-disable-next-line react/display-name @@ -256,7 +256,7 @@ export const HostList = () => { { field: 'metadata.Endpoint.policy.applied', name: i18n.translate('xpack.securitySolution.endpointList.policyStatus', { - defaultMessage: 'Policy Status', + defaultMessage: 'Configuration Status', }), // eslint-disable-next-line react/display-name render: (policy: HostInfo['metadata']['Endpoint']['policy']['applied'], item: HostInfo) => { diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/index.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/index.tsx index 5122bbcd5d55d..681f1f1430926 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/index.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/index.tsx @@ -6,17 +6,13 @@ import React, { memo } from 'react'; import { Route, Switch } from 'react-router-dom'; -import { PolicyDetails, PolicyList } from './view'; -import { - MANAGEMENT_ROUTING_POLICIES_PATH, - MANAGEMENT_ROUTING_POLICY_DETAILS_PATH, -} from '../../common/constants'; +import { PolicyDetails } from './view'; +import { MANAGEMENT_ROUTING_POLICY_DETAILS_PATH } from '../../common/constants'; import { NotFoundPage } from '../../../app/404'; export const PolicyContainer = memo(() => { return ( - diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/configure_package_config.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/configure_package_config.tsx index 67f24977406c6..2b08bfd2b282b 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/configure_package_config.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/configure_package_config.tsx @@ -6,8 +6,7 @@ import React, { memo, useMemo } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiCallOut, EuiText, EuiTitle, EuiSpacer } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; +import { EuiCallOut, EuiText, EuiSpacer } from '@elastic/eui'; import { LinkToApp } from '../../../../../common/components/endpoint/link_to_app'; import { CustomConfigurePackageConfigContent, @@ -50,52 +49,37 @@ export const ConfigureEndpointPackageConfig = memo - -

- -

-

{from === 'edit' ? ( - <> - - - - - - + + + + ), + }} + /> ) : ( )}

diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx index 4f7c14735fe21..6ed4e06ee51c5 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx @@ -10,7 +10,7 @@ import { mount } from 'enzyme'; import { PolicyDetails } from './policy_details'; import { EndpointDocGenerator } from '../../../../../common/endpoint/generate_data'; import { AppContextTestRender, createAppRootMockRenderer } from '../../../../common/mock/endpoint'; -import { getPolicyDetailPath, getPoliciesPath } from '../../../common/routing'; +import { getPolicyDetailPath, getHostListPath } from '../../../common/routing'; import { apiPathMockResponseProviders } from '../store/policy_list/test_mock_utils'; jest.mock('../../../../common/components/link_to'); @@ -19,7 +19,7 @@ describe('Policy Details', () => { type FindReactWrapperResponse = ReturnType['find']>; const policyDetailsPathUrl = getPolicyDetailPath('1'); - const policyListPathUrl = getPoliciesPath(); + const hostListPath = getHostListPath({ name: 'hostList' }); const sleep = (ms = 100) => new Promise((wakeup) => setTimeout(wakeup, ms)); const generator = new EndpointDocGenerator(); let history: AppContextTestRender['history']; @@ -127,8 +127,8 @@ describe('Policy Details', () => { const backToListButton = pageHeaderLeft.find('EuiButtonEmpty'); expect(backToListButton.prop('iconType')).toBe('arrowLeft'); - expect(backToListButton.prop('href')).toBe(policyListPathUrl); - expect(backToListButton.text()).toBe('Back to policy list'); + expect(backToListButton.prop('href')).toBe(hostListPath); + expect(backToListButton.text()).toBe('Back to endpoint hosts'); const pageTitle = pageHeaderLeft.find('[data-test-subj="pageViewHeaderLeftTitle"]'); expect(pageTitle).toHaveLength(1); @@ -141,7 +141,7 @@ describe('Policy Details', () => { ); expect(history.location.pathname).toEqual(policyDetailsPathUrl); backToListButton.simulate('click', { button: 0 }); - expect(history.location.pathname).toEqual(policyListPathUrl); + expect(history.location.pathname).toEqual(hostListPath); }); it('should display agent stats', async () => { await asyncActions; @@ -173,7 +173,7 @@ describe('Policy Details', () => { const navigateToAppMockedCalls = coreStart.application.navigateToApp.mock.calls; expect(navigateToAppMockedCalls[navigateToAppMockedCalls.length - 1]).toEqual([ 'securitySolution:administration', - { path: policyListPathUrl }, + { path: hostListPath }, ]); }); it('should display save button', async () => { @@ -232,7 +232,7 @@ describe('Policy Details', () => { ); expect(warningCallout).toHaveLength(1); expect(warningCallout.text()).toEqual( - 'This action will update 5 hostsSaving these changes will apply updates to all endpoints assigned to this policy' + 'This action will update 5 hostsSaving these changes will apply updates to all endpoints assigned to this agent configuration.' ); }); it('should close dialog if cancel button is clicked', () => { diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx index 288bc484c23b5..cd63991dbac93 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx @@ -42,7 +42,7 @@ import { PageViewHeaderTitle } from '../../../../common/components/endpoint/page import { ManagementPageView } from '../../../components/management_page_view'; import { SpyRoute } from '../../../../common/utils/route/spy_routes'; import { SecurityPageName } from '../../../../app/types'; -import { getPoliciesPath } from '../../../common/routing'; +import { getHostListPath } from '../../../common/routing'; import { useFormatUrl } from '../../../../common/components/link_to'; import { useNavigateToAppEventHandler } from '../../../../common/hooks/endpoint/use_navigate_to_app_event_handler'; import { MANAGEMENT_APP_ID } from '../../../common/constants'; @@ -56,7 +56,7 @@ export const PolicyDetails = React.memo(() => { application: { navigateToApp }, }, } = useKibana(); - const { formatUrl, search } = useFormatUrl(SecurityPageName.administration); + const { formatUrl } = useFormatUrl(SecurityPageName.administration); const { state: locationRouteState } = useLocation(); // Store values @@ -70,6 +70,7 @@ export const PolicyDetails = React.memo(() => { const [showConfirm, setShowConfirm] = useState(false); const [routeState, setRouteState] = useState(); const policyName = policyItem?.name ?? ''; + const hostListRouterPath = getHostListPath({ name: 'hostList' }); // Handle showing update statuses useEffect(() => { @@ -87,7 +88,7 @@ export const PolicyDetails = React.memo(() => { @@ -109,11 +110,11 @@ export const PolicyDetails = React.memo(() => { } }, [navigateToApp, notifications.toasts, policyName, policyUpdateStatus, routeState]); - const handleBackToListOnClick = useNavigateByRouterEventHandler(getPoliciesPath()); + const handleBackToListOnClick = useNavigateByRouterEventHandler(hostListRouterPath); const navigateToAppArguments = useMemo((): Parameters => { - return routeState?.onCancelNavigateTo ?? [MANAGEMENT_APP_ID, { path: getPoliciesPath() }]; - }, [routeState?.onCancelNavigateTo]); + return routeState?.onCancelNavigateTo ?? [MANAGEMENT_APP_ID, { path: hostListRouterPath }]; + }, [hostListRouterPath, routeState?.onCancelNavigateTo]); const handleCancelOnClick = useNavigateToAppEventHandler(...navigateToAppArguments); const handleSaveOnClick = useCallback(() => { @@ -162,11 +163,11 @@ export const PolicyDetails = React.memo(() => { iconType="arrowLeft" contentProps={{ style: { paddingLeft: '0' } }} onClick={handleBackToListOnClick} - href={formatUrl(getPoliciesPath(search))} + href={formatUrl(hostListRouterPath)} > {policyItem.name} @@ -306,7 +307,7 @@ const ConfirmUpdate = React.memo<{ >
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/malware.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/malware.tsx index dee1e27782e69..84d4bf5355cd9 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/malware.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/malware.tsx @@ -7,9 +7,18 @@ import React, { useCallback, useMemo } from 'react'; import { useDispatch } from 'react-redux'; import styled from 'styled-components'; -import { EuiRadio, EuiSwitch, EuiTitle, EuiSpacer, htmlIdGenerator } from '@elastic/eui'; +import { + EuiRadio, + EuiSwitch, + EuiTitle, + EuiSpacer, + htmlIdGenerator, + EuiCallOut, +} from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; +import { APP_ID } from '../../../../../../../common/constants'; +import { SecurityPageName } from '../../../../../../app/types'; import { Immutable, ProtectionModes } from '../../../../../../../common/endpoint/types'; import { OS, MalwareProtectionOSes } from '../../../types'; @@ -17,6 +26,7 @@ import { ConfigForm } from '../config_form'; import { policyConfig } from '../../../store/policy_details/selectors'; import { usePolicyDetailsSelector } from '../../policy_hooks'; import { clone } from '../../../models/policy_details_config'; +import { LinkToApp } from '../../../../../../common/components/endpoint/link_to_app'; const ProtectionRadioGroup = styled.div` display: flex; @@ -177,6 +187,23 @@ export const MalwareProtections = React.memo(() => { rightCorner={protectionSwitch} > {radioButtons} + + + + + + ), + }} + /> + ); }); diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_list.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_list.test.tsx index 047aa6918736e..e35c97698f5cb 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_list.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_list.test.tsx @@ -14,7 +14,8 @@ import { AppAction } from '../../../../common/store/actions'; jest.mock('../../../../common/components/link_to'); -describe('when on the policies page', () => { +// Skipping these test now that the Policy List has been hidden +describe.skip('when on the policies page', () => { let render: () => ReturnType; let history: AppContextTestRender['history']; let store: AppContextTestRender['store']; diff --git a/x-pack/plugins/security_solution/public/network/pages/ip_details/index.tsx b/x-pack/plugins/security_solution/public/network/pages/ip_details/index.tsx index e06f5489a3fc2..42469a4bf29da 100644 --- a/x-pack/plugins/security_solution/public/network/pages/ip_details/index.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/ip_details/index.tsx @@ -90,7 +90,7 @@ export const IPDetailsComponent: React.FC {indicesExist ? ( - + diff --git a/x-pack/plugins/security_solution/public/network/pages/network.tsx b/x-pack/plugins/security_solution/public/network/pages/network.tsx index ca8da4eb711e5..f516f2a2de346 100644 --- a/x-pack/plugins/security_solution/public/network/pages/network.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/network.tsx @@ -106,7 +106,10 @@ const NetworkComponent = React.memo( {indicesExist ? ( - + diff --git a/x-pack/plugins/security_solution/public/overview/components/endpoint_notice/index.tsx b/x-pack/plugins/security_solution/public/overview/components/endpoint_notice/index.tsx index 7170412cb55ad..1d726a7dbd901 100644 --- a/x-pack/plugins/security_solution/public/overview/components/endpoint_notice/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/endpoint_notice/index.tsx @@ -33,7 +33,7 @@ export const EndpointNotice = memo<{ onDismiss: () => void }>(({ onDismiss }) => } @@ -49,7 +49,7 @@ export const EndpointNotice = memo<{ onDismiss: () => void }>(({ onDismiss }) => diff --git a/x-pack/plugins/security_solution/public/overview/components/host_overview/endpoint_overview/translations.ts b/x-pack/plugins/security_solution/public/overview/components/host_overview/endpoint_overview/translations.ts index 34e3347b5ff9a..a7f1be3debb83 100644 --- a/x-pack/plugins/security_solution/public/overview/components/host_overview/endpoint_overview/translations.ts +++ b/x-pack/plugins/security_solution/public/overview/components/host_overview/endpoint_overview/translations.ts @@ -9,14 +9,14 @@ import { i18n } from '@kbn/i18n'; export const ENDPOINT_POLICY = i18n.translate( 'xpack.securitySolution.host.details.endpoint.endpointPolicy', { - defaultMessage: 'Endpoint policy', + defaultMessage: 'Integration', } ); export const POLICY_STATUS = i18n.translate( 'xpack.securitySolution.host.details.endpoint.policyStatus', { - defaultMessage: 'Policy status', + defaultMessage: 'Configuration Status', } ); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_empty/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_empty/index.test.tsx new file mode 100644 index 0000000000000..2112350278e8e --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/components/overview_empty/index.test.tsx @@ -0,0 +1,83 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React from 'react'; +import { shallow, ShallowWrapper } from 'enzyme'; +import { OverviewEmpty } from '.'; +import { useIngestEnabledCheck } from '../../../common/hooks/endpoint/ingest_enabled'; +jest.mock('../../../common/lib/kibana'); +jest.mock('../../../management/pages/endpoint_hosts/view/hooks', () => ({ + useIngestUrl: jest + .fn() + .mockReturnValue({ appId: 'ingestAppId', appPath: 'ingestPath', url: 'ingestUrl' }), +})); + +jest.mock('../../../common/hooks/endpoint/ingest_enabled', () => ({ + useIngestEnabledCheck: jest.fn().mockReturnValue({ allEnabled: true }), +})); + +jest.mock('../../../common/hooks/endpoint/use_navigate_to_app_event_handler', () => ({ + useNavigateToAppEventHandler: jest.fn(), +})); + +describe('OverviewEmpty', () => { + describe('When isIngestEnabled = true', () => { + let wrapper: ShallowWrapper; + beforeAll(() => { + wrapper = shallow(); + }); + + afterAll(() => { + (useIngestEnabledCheck as jest.Mock).mockReset(); + }); + + test('render with correct actions ', () => { + expect(wrapper.find('[data-test-subj="empty-page"]').prop('actions')).toEqual({ + beats: { + description: + 'Lightweight Beats can send data from hundreds or thousands of machines and systems', + fill: false, + label: 'Add data with Beats', + url: '/app/home#/tutorial_directory/security', + }, + elasticAgent: { + description: + 'The Elastic Agent provides a simple, unified way to add monitoring to your hosts.', + fill: false, + label: 'Add data with Elastic Agent', + url: 'ingestUrl', + }, + endpoint: { + description: + 'Protect your hosts with threat prevention, detection, and deep security data visibility.', + fill: false, + label: 'Add Elastic Endpoint Security', + onClick: undefined, + url: '/app/home#/tutorial_directory/security', + }, + }); + }); + }); + + describe('When isIngestEnabled = false', () => { + let wrapper: ShallowWrapper; + beforeAll(() => { + (useIngestEnabledCheck as jest.Mock).mockReturnValue({ allEnabled: false }); + wrapper = shallow(); + }); + + test('render with correct actions ', () => { + expect(wrapper.find('[data-test-subj="empty-page"]').prop('actions')).toEqual({ + beats: { + description: + 'Lightweight Beats can send data from hundreds or thousands of machines and systems', + fill: false, + label: 'Add data with Beats', + url: '/app/home#/tutorial_directory/security', + }, + }); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_empty/index.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_empty/index.tsx index 33413be10079e..1d2c6889213f1 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_empty/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_empty/index.tsx @@ -4,11 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { useMemo } from 'react'; +import { omit } from 'lodash/fp'; + import { FormattedMessage } from '@kbn/i18n/react'; import { EuiLink } from '@elastic/eui'; import * as i18nCommon from '../../../common/translations'; -import { EmptyPage } from '../../../common/components/empty_page'; +import { EmptyPage, EmptyPageActionsProps } from '../../../common/components/empty_page'; import { useKibana } from '../../../common/lib/kibana'; import { ADD_DATA_PATH } from '../../../../common/constants'; import { useIngestUrl } from '../../../management/pages/endpoint_hosts/view/hooks'; @@ -23,23 +25,45 @@ const OverviewEmptyComponent: React.FC = () => { ); const handleOnClick = useNavigateToAppEventHandler(ingestAppId, { path: ingestPath }); const { allEnabled: isIngestEnabled } = useIngestEnabledCheck(); + const emptyPageActions: EmptyPageActionsProps = useMemo( + () => ({ + elasticAgent: { + label: i18nCommon.EMPTY_ACTION_ELASTIC_AGENT, + url: ingestUrl, + description: i18nCommon.EMPTY_ACTION_ELASTIC_AGENT_DESCRIPTION, + fill: false, + }, + beats: { + label: i18nCommon.EMPTY_ACTION_BEATS, + url: `${basePath}${ADD_DATA_PATH}`, + description: i18nCommon.EMPTY_ACTION_BEATS_DESCRIPTION, + fill: false, + }, + endpoint: { + label: i18nCommon.EMPTY_ACTION_ENDPOINT, + url: `${basePath}${ADD_DATA_PATH}`, + description: i18nCommon.EMPTY_ACTION_ENDPOINT_DESCRIPTION, + onClick: handleOnClick, + fill: false, + }, + }), + [basePath, ingestUrl, handleOnClick] + ); + + const emptyPageIngestDisabledActions = useMemo( + () => omit(['elasticAgent', 'endpoint'], emptyPageActions), + [emptyPageActions] + ); return isIngestEnabled === true ? ( {i18nCommon.EMPTY_ACTION_SECONDARY} @@ -50,16 +74,13 @@ const OverviewEmptyComponent: React.FC = () => { /> ) : ( {i18nCommon.EMPTY_ACTION_SECONDARY} diff --git a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx index 286cc870378e1..74225c4e4f823 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx @@ -83,7 +83,7 @@ describe('Overview', () => {
); - expect(wrapper.find('[data-test-subj="empty-page-secondary-action"]').exists()).toBe(false); + expect(wrapper.find('[data-test-subj="empty-page-endpoint-action"]').exists()).toBe(false); }); it('shows Endpoint get ready button when ingest is enabled', () => { @@ -95,7 +95,7 @@ describe('Overview', () => {
); - expect(wrapper.find('[data-test-subj="empty-page-secondary-action"]').exists()).toBe(true); + expect(wrapper.find('[data-test-subj="empty-page-endpoint-action"]').exists()).toBe(true); }); }); diff --git a/x-pack/plugins/security_solution/public/overview/pages/overview.tsx b/x-pack/plugins/security_solution/public/overview/pages/overview.tsx index 6563f3c2b824d..1b743c259555a 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/overview.tsx +++ b/x-pack/plugins/security_solution/public/overview/pages/overview.tsx @@ -17,6 +17,7 @@ import { SiemSearchBar } from '../../common/components/search_bar'; import { WrapperPage } from '../../common/components/wrapper_page'; import { useGlobalTime } from '../../common/containers/use_global_time'; import { useWithSource } from '../../common/containers/source'; + import { EventsByDataset } from '../components/events_by_dataset'; import { EventCounts } from '../components/event_counts'; import { OverviewEmpty } from '../components/overview_empty'; @@ -66,12 +67,11 @@ const OverviewComponent: React.FC = ({ addMessage('management', 'dismissEndpointNotice'); }, [addMessage]); const { allEnabled: isIngestEnabled } = useIngestEnabledCheck(); - return ( <> {indicesExist ? ( - + diff --git a/x-pack/plugins/security_solution/public/resolver/data_access_layer/factory.ts b/x-pack/plugins/security_solution/public/resolver/data_access_layer/factory.ts new file mode 100644 index 0000000000000..016ebfa0faee4 --- /dev/null +++ b/x-pack/plugins/security_solution/public/resolver/data_access_layer/factory.ts @@ -0,0 +1,70 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { KibanaReactContextValue } from '../../../../../../src/plugins/kibana_react/public'; +import { StartServices } from '../../types'; +import { DataAccessLayer } from '../types'; +import { + ResolverRelatedEvents, + ResolverTree, + ResolverEntityIndex, +} from '../../../common/endpoint/types'; +import { DEFAULT_INDEX_KEY as defaultIndexKey } from '../../../common/constants'; + +/** + * The data access layer for resolver. All communication with the Kibana server is done through this object. This object is provided to Resolver. In tests, a mock data access layer can be used instead. + */ +export function dataAccessLayerFactory( + context: KibanaReactContextValue +): DataAccessLayer { + const dataAccessLayer: DataAccessLayer = { + /** + * Used to get non-process related events for a node. + */ + async relatedEvents(entityID: string): Promise { + return context.services.http.get(`/api/endpoint/resolver/${entityID}/events`, { + query: { events: 100 }, + }); + }, + /** + * Used to get descendant and ancestor process events for a node. + */ + async resolverTree(entityID: string, signal: AbortSignal): Promise { + return context.services.http.get(`/api/endpoint/resolver/${entityID}`, { + signal, + }); + }, + + /** + * Used to get the default index pattern from the SIEM application. + */ + indexPatterns(): string[] { + return context.services.uiSettings.get(defaultIndexKey); + }, + + /** + * Used to get the entity_id for an _id. + */ + async entities({ + _id, + indices, + signal, + }: { + _id: string; + indices: string[]; + signal: AbortSignal; + }): Promise { + return context.services.http.get('/api/endpoint/resolver/entity', { + signal, + query: { + _id, + indices, + }, + }); + }, + }; + return dataAccessLayer; +} diff --git a/x-pack/plugins/security_solution/public/resolver/data_access_layer/mocks/one_ancestor_two_children.ts b/x-pack/plugins/security_solution/public/resolver/data_access_layer/mocks/one_ancestor_two_children.ts new file mode 100644 index 0000000000000..be0bc1b812a0b --- /dev/null +++ b/x-pack/plugins/security_solution/public/resolver/data_access_layer/mocks/one_ancestor_two_children.ts @@ -0,0 +1,96 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { + ResolverRelatedEvents, + ResolverTree, + ResolverEntityIndex, +} from '../../../../common/endpoint/types'; +import { mockEndpointEvent } from '../../store/mocks/endpoint_event'; +import { mockTreeWithNoAncestorsAnd2Children } from '../../store/mocks/resolver_tree'; +import { DataAccessLayer } from '../../types'; + +interface Metadata { + /** + * The `_id` of the document being analyzed. + */ + databaseDocumentID: string; + /** + * A record of entityIDs to be used in tests assertions. + */ + entityIDs: { + /** + * The entityID of the node related to the document being analyzed. + */ + origin: 'origin'; + /** + * The entityID of the first child of the origin. + */ + firstChild: 'firstChild'; + /** + * The entityID of the second child of the origin. + */ + secondChild: 'secondChild'; + }; +} + +/** + * A simple mock dataAccessLayer possible that returns a tree with 0 ancestors and 2 direct children. 1 related event is returned. The parameter to `entities` is ignored. + */ +export function oneAncestorTwoChildren(): { dataAccessLayer: DataAccessLayer; metadata: Metadata } { + const metadata: Metadata = { + databaseDocumentID: '_id', + entityIDs: { origin: 'origin', firstChild: 'firstChild', secondChild: 'secondChild' }, + }; + return { + metadata, + dataAccessLayer: { + /** + * Fetch related events for an entity ID + */ + relatedEvents(entityID: string): Promise { + return Promise.resolve({ + entityID, + events: [ + mockEndpointEvent({ + entityID, + name: 'event', + timestamp: 0, + }), + ], + nextEvent: null, + }); + }, + + /** + * Fetch a ResolverTree for a entityID + */ + resolverTree(): Promise { + return Promise.resolve( + mockTreeWithNoAncestorsAnd2Children({ + originID: metadata.entityIDs.origin, + firstChildID: metadata.entityIDs.firstChild, + secondChildID: metadata.entityIDs.secondChild, + }) + ); + }, + + /** + * Get an array of index patterns that contain events. + */ + indexPatterns(): string[] { + return ['index pattern']; + }, + + /** + * Get entities matching a document. + */ + entities(): Promise { + return Promise.resolve([{ entity_id: metadata.entityIDs.origin }]); + }, + }, + }; +} diff --git a/x-pack/plugins/security_solution/public/resolver/lib/date.test.ts b/x-pack/plugins/security_solution/public/resolver/lib/date.test.ts index 7a48245fcfc41..5555578e44f7b 100644 --- a/x-pack/plugins/security_solution/public/resolver/lib/date.test.ts +++ b/x-pack/plugins/security_solution/public/resolver/lib/date.test.ts @@ -3,38 +3,64 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { getFriendlyElapsedTime } from './date'; +import { getFriendlyElapsedTime, getUnixTime } from './date'; describe('date', () => { - describe('getFriendlyElapsedTime', () => { - const second = 1000; - const minute = second * 60; - const hour = minute * 60; - const day = hour * 24; - const week = day * 7; - const month = day * 30; - const year = day * 365; + const second = 1000; + const minute = second * 60; + const hour = minute * 60; + const day = hour * 24; + const week = day * 7; + const month = day * 30; + const year = day * 365; - const initialTime = new Date('6/1/2020').getTime(); + describe('getUnixTime', () => { + const unixTime = new Date('6/1/2020').getTime(); + const unixStringTime = String(unixTime); + const isoTime = new Date('6/1/2020').toISOString(); + const notATime = 'imLate'; + + it('should return the time if already a unix timestamp', () => { + expect(getUnixTime(unixTime)).toEqual(unixTime); + }); + + it('should properly convert a unix timestamp string to a number', () => { + expect(getUnixTime(unixStringTime)).toEqual(unixTime); + }); + + it('should properly convert an ISO string to a unix timestamp', () => { + expect(getUnixTime(isoTime)).toEqual(unixTime); + }); - const oneMillisecond = new Date(initialTime + 1).getTime(); + it('should return NaN if an invalid time is provided', () => { + expect(getUnixTime(notATime)).toBeNaN(); + }); + }); + + describe('getFriendlyElapsedTime', () => { + const initialTime = new Date('6/1/2020').getTime(); + const oneMillisecond = new Date(initialTime + 1).toISOString(); const oneSecond = new Date(initialTime + 1 * second).getTime(); const oneMinute = new Date(initialTime + 1 * minute).getTime(); - const oneHour = new Date(initialTime + 1 * hour).getTime(); + const oneHour = new Date(initialTime + 1 * hour).toISOString(); const oneDay = new Date(initialTime + 1 * day).getTime(); - const oneWeek = new Date(initialTime + 1 * week).getTime(); + const oneWeek = `${new Date(initialTime + 1 * week).getTime()}`; const oneMonth = new Date(initialTime + 1 * month).getTime(); const oneYear = new Date(initialTime + 1 * year).getTime(); const almostASecond = new Date(initialTime + 999).getTime(); - const almostAMinute = new Date(initialTime + 59.9 * second).getTime(); + const almostAMinute = new Date(initialTime + 59.9 * second).toISOString(); const almostAnHour = new Date(initialTime + 59.9 * minute).getTime(); const almostADay = new Date(initialTime + 23.9 * hour).getTime(); - const almostAWeek = new Date(initialTime + 6.9 * day).getTime(); + const almostAWeek = new Date(initialTime + 6.9 * day).toISOString(); const almostAMonth = new Date(initialTime + 3.9 * week).getTime(); const almostAYear = new Date(initialTime + 11.9 * month).getTime(); const threeYears = new Date(initialTime + 3 * year).getTime(); + it('should return null if invalid times are given', () => { + expect(getFriendlyElapsedTime(initialTime, 'ImTimeless')).toEqual(null); + }); + it('should return the correct singular relative time', () => { expect(getFriendlyElapsedTime(initialTime, initialTime)).toEqual({ duration: '<1', diff --git a/x-pack/plugins/security_solution/public/resolver/lib/date.ts b/x-pack/plugins/security_solution/public/resolver/lib/date.ts index a5e07e6a02a88..3cd0c910f46f3 100644 --- a/x-pack/plugins/security_solution/public/resolver/lib/date.ts +++ b/x-pack/plugins/security_solution/public/resolver/lib/date.ts @@ -6,6 +6,26 @@ import { DurationDetails, DurationTypes } from '../types'; +/** + * Given a time, it will convert it to a unix timestamp if not one already. If it is unable to do so, it will return NaN + */ +export const getUnixTime = (time: number | string): number | typeof NaN => { + if (!time) { + return NaN; + } + if (typeof time === 'number') { + return time; + } + // If it's a date string just get the time in MS + let unixTime = Date.parse(time); + if (Number.isNaN(unixTime)) { + // If not an ISO date string, last check will be if it's a unix timestamp string + unixTime = parseInt(time, 10); + } + + return unixTime; +}; + /* * Given two unix timestamps, it will return an object containing the time difference and properly pluralized friendly version of the time difference. * i.e. a time difference of 1000ms will yield => { duration: 1, durationType: 'second' } and 10000ms will yield => { duration: 10, durationType: 'seconds' } @@ -15,12 +35,13 @@ export const getFriendlyElapsedTime = ( from: number | string, to: number | string ): DurationDetails | null => { - const startTime = typeof from === 'number' ? from : parseInt(from, 10); - const endTime = typeof to === 'number' ? to : parseInt(to, 10); - const elapsedTimeInMs = endTime - startTime; - if (Number.isNaN(elapsedTimeInMs)) { + const startTime = getUnixTime(from); + const endTime = getUnixTime(to); + + if (Number.isNaN(startTime) || Number.isNaN(endTime)) { return null; } + const elapsedTimeInMs = endTime - startTime; const second = 1000; const minute = second * 60; diff --git a/x-pack/plugins/security_solution/public/resolver/models/process_event.test.ts b/x-pack/plugins/security_solution/public/resolver/models/process_event.test.ts index 7eb692851bc9b..4b1d555d0a7c3 100644 --- a/x-pack/plugins/security_solution/public/resolver/models/process_event.test.ts +++ b/x-pack/plugins/security_solution/public/resolver/models/process_event.test.ts @@ -3,7 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { eventType, orderByTime } from './process_event'; +import { eventType, orderByTime, userInfoForProcess } from './process_event'; import { mockProcessEvent } from './process_event_test_helpers'; import { LegacyEndpointEvent, ResolverEvent } from '../../../common/endpoint/types'; @@ -24,6 +24,22 @@ describe('process event', () => { expect(eventType(event)).toEqual('processCreated'); }); }); + describe('userInfoForProcess', () => { + let event: LegacyEndpointEvent; + beforeEach(() => { + event = mockProcessEvent({ + user: { + name: 'aaa', + domain: 'bbb', + }, + }); + }); + it('returns the right user info for the process', () => { + const { name, domain } = userInfoForProcess(event)!; + expect(name).toEqual('aaa'); + expect(domain).toEqual('bbb'); + }); + }); describe('orderByTime', () => { let mock: (time: number, eventID: string) => ResolverEvent; let events: ResolverEvent[]; diff --git a/x-pack/plugins/security_solution/public/resolver/models/process_event.ts b/x-pack/plugins/security_solution/public/resolver/models/process_event.ts index 4f8df87b3ac0b..1a5c67f6a6f2f 100644 --- a/x-pack/plugins/security_solution/public/resolver/models/process_event.ts +++ b/x-pack/plugins/security_solution/public/resolver/models/process_event.ts @@ -29,7 +29,7 @@ export function isTerminatedProcess(passedEvent: ResolverEvent) { } /** - * ms since unix epoc, based on timestamp. + * ms since Unix epoc, based on timestamp. * may return NaN if the timestamp wasn't present or was invalid. */ export function datetime(passedEvent: ResolverEvent): number | null { @@ -85,7 +85,7 @@ export function eventType(passedEvent: ResolverEvent): ResolverProcessType { } /** - * Returns the process event's pid + * Returns the process event's PID */ export function uniquePidForProcess(passedEvent: ResolverEvent): string { if (event.isLegacyEvent(passedEvent)) { @@ -96,7 +96,7 @@ export function uniquePidForProcess(passedEvent: ResolverEvent): string { } /** - * Returns the pid for the process on the host + * Returns the PID for the process on the host */ export function processPid(passedEvent: ResolverEvent): number | undefined { if (event.isLegacyEvent(passedEvent)) { @@ -107,7 +107,7 @@ export function processPid(passedEvent: ResolverEvent): number | undefined { } /** - * Returns the process event's parent pid + * Returns the process event's parent PID */ export function uniqueParentPidForProcess(passedEvent: ResolverEvent): string | undefined { if (event.isLegacyEvent(passedEvent)) { @@ -118,7 +118,7 @@ export function uniqueParentPidForProcess(passedEvent: ResolverEvent): string | } /** - * Returns the process event's parent pid + * Returns the process event's parent PID */ export function processParentPid(passedEvent: ResolverEvent): number | undefined { if (event.isLegacyEvent(passedEvent)) { @@ -144,12 +144,12 @@ export function processPath(passedEvent: ResolverEvent): string | undefined { */ export function userInfoForProcess( passedEvent: ResolverEvent -): { user?: string; domain?: string } | undefined { +): { name?: string; domain?: string } | undefined { return passedEvent.user; } /** - * Returns the MD5 hash for the `passedEvent` param, or undefined if it can't be located + * Returns the MD5 hash for the `passedEvent` parameter, or undefined if it can't be located * @param {ResolverEvent} passedEvent The `ResolverEvent` to get the MD5 value for * @returns {string | undefined} The MD5 string for the event */ @@ -164,7 +164,7 @@ export function md5HashForProcess(passedEvent: ResolverEvent): string | undefine /** * Returns the command line path and arguments used to run the `passedEvent` if any * - * @param {ResolverEvent} passedEvent The `ResolverEvent` to get the arguemnts value for + * @param {ResolverEvent} passedEvent The `ResolverEvent` to get the arguments value for * @returns {string | undefined} The arguments (including the path) used to run the process */ export function argsForProcess(passedEvent: ResolverEvent): string | undefined { diff --git a/x-pack/plugins/security_solution/public/resolver/store/data/selectors.test.ts b/x-pack/plugins/security_solution/public/resolver/store/data/selectors.test.ts index 0826391a10688..6786a93f1d9ca 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/data/selectors.test.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/data/selectors.test.ts @@ -14,6 +14,7 @@ import { mockTreeWith2AncestorsAndNoChildren, mockTreeWith1AncestorAnd2ChildrenAndAllNodesHave2GraphableEvents, mockTreeWithAllProcessesTerminated, + mockTreeWithNoProcessEvents, } from '../mocks/resolver_tree'; import { uniquePidForProcess } from '../../models/process_event'; import { EndpointEvent } from '../../../../common/endpoint/types'; @@ -408,4 +409,26 @@ describe('data state', () => { expect(selectors.graphableProcesses(state()).length).toBe(4); }); }); + describe('with a tree with no process events', () => { + beforeEach(() => { + const tree = mockTreeWithNoProcessEvents(); + actions.push({ + type: 'serverReturnedResolverData', + payload: { + result: tree, + // this value doesn't matter + databaseDocumentID: '', + }, + }); + }); + it('should return an empty layout', () => { + expect(selectors.layout(state())).toMatchInlineSnapshot(` + Object { + "ariaLevels": Map {}, + "edgeLineSegments": Array [], + "processNodePositions": Map {}, + } + `); + }); + }); }); diff --git a/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts b/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts index ea0cb8663d11d..10ace895b3267 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts @@ -374,9 +374,9 @@ export const layout = createSelector( // find the origin node const originNode = indexedProcessTreeModel.processEvent(indexedProcessTree, originID); - if (!originNode) { - // this should only happen if the `ResolverTree` from the server has an entity ID with no matching lifecycle events. - throw new Error('Origin node not found in ResolverTree'); + if (originNode === null) { + // If a tree is returned that has no process events for the origin, this can happen. + return taxiLayout; } // Find the position of the origin, we'll center the map on it intrinsically diff --git a/x-pack/plugins/security_solution/public/resolver/store/index.ts b/x-pack/plugins/security_solution/public/resolver/store/index.ts index d9e750241ced1..950a61db33f17 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/index.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/index.ts @@ -6,22 +6,20 @@ import { createStore, applyMiddleware, Store } from 'redux'; import { composeWithDevTools } from 'redux-devtools-extension/developmentOnly'; -import { KibanaReactContextValue } from '../../../../../../src/plugins/kibana_react/public'; -import { ResolverState } from '../types'; -import { StartServices } from '../../types'; +import { ResolverState, DataAccessLayer } from '../types'; import { resolverReducer } from './reducer'; import { resolverMiddlewareFactory } from './middleware'; import { ResolverAction } from './actions'; export const storeFactory = ( - context?: KibanaReactContextValue + dataAccessLayer: DataAccessLayer ): Store => { const actionsDenylist: Array = ['userMovedPointer']; const composeEnhancers = composeWithDevTools({ name: 'Resolver', actionsBlacklist: actionsDenylist, }); - const middlewareEnhancer = applyMiddleware(resolverMiddlewareFactory(context)); + const middlewareEnhancer = applyMiddleware(resolverMiddlewareFactory(dataAccessLayer)); return createStore(resolverReducer, composeEnhancers(middlewareEnhancer)); }; diff --git a/x-pack/plugins/security_solution/public/resolver/store/middleware/index.ts b/x-pack/plugins/security_solution/public/resolver/store/middleware/index.ts index 398e855a1f5d4..ef6b1f5eb3c6f 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/middleware/index.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/middleware/index.ts @@ -5,34 +5,26 @@ */ import { Dispatch, MiddlewareAPI } from 'redux'; -import { KibanaReactContextValue } from '../../../../../../../src/plugins/kibana_react/public'; -import { StartServices } from '../../../types'; -import { ResolverState } from '../../types'; +import { ResolverState, DataAccessLayer } from '../../types'; import { ResolverRelatedEvents } from '../../../../common/endpoint/types'; import { ResolverTreeFetcher } from './resolver_tree_fetcher'; import { ResolverAction } from '../actions'; type MiddlewareFactory = ( - context?: KibanaReactContextValue + dataAccessLayer: DataAccessLayer ) => ( api: MiddlewareAPI, S> ) => (next: Dispatch) => (action: ResolverAction) => unknown; /** - * The redux middleware that the app uses to trigger side effects. + * The `redux` middleware that the application uses to trigger side effects. * All data fetching should be done here. - * For actions that the app triggers directly, use `app` as a prefix for the type. + * For actions that the application triggers directly, use `app` as a prefix for the type. * For actions that are triggered as a result of server interaction, use `server` as a prefix for the type. */ -export const resolverMiddlewareFactory: MiddlewareFactory = (context) => { +export const resolverMiddlewareFactory: MiddlewareFactory = (dataAccessLayer: DataAccessLayer) => { return (api) => (next) => { - // This cannot work w/o `context`. - if (!context) { - return async (action: ResolverAction) => { - next(action); - }; - } - const resolverTreeFetcher = ResolverTreeFetcher(context, api); + const resolverTreeFetcher = ResolverTreeFetcher(dataAccessLayer, api); return async (action: ResolverAction) => { next(action); @@ -45,12 +37,7 @@ export const resolverMiddlewareFactory: MiddlewareFactory = (context) => { const entityIdToFetchFor = action.payload; let result: ResolverRelatedEvents | undefined; try { - result = await context.services.http.get( - `/api/endpoint/resolver/${entityIdToFetchFor}/events`, - { - query: { events: 100 }, - } - ); + result = await dataAccessLayer.relatedEvents(entityIdToFetchFor); } catch { api.dispatch({ type: 'serverFailedToReturnRelatedEventData', diff --git a/x-pack/plugins/security_solution/public/resolver/store/middleware/resolver_tree_fetcher.ts b/x-pack/plugins/security_solution/public/resolver/store/middleware/resolver_tree_fetcher.ts index 7d16dc251e6fc..2c98059d420e8 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/middleware/resolver_tree_fetcher.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/middleware/resolver_tree_fetcher.ts @@ -9,11 +9,8 @@ import { Dispatch, MiddlewareAPI } from 'redux'; import { ResolverTree, ResolverEntityIndex } from '../../../../common/endpoint/types'; -import { KibanaReactContextValue } from '../../../../../../../src/plugins/kibana_react/public'; -import { ResolverState } from '../../types'; +import { ResolverState, DataAccessLayer } from '../../types'; import * as selectors from '../selectors'; -import { StartServices } from '../../../types'; -import { DEFAULT_INDEX_KEY as defaultIndexKey } from '../../../../common/constants'; import { ResolverAction } from '../actions'; /** * A function that handles syncing ResolverTree data w/ the current entity ID. @@ -23,7 +20,7 @@ import { ResolverAction } from '../actions'; * This is a factory because it is stateful and keeps that state in closure. */ export function ResolverTreeFetcher( - context: KibanaReactContextValue, + dataAccessLayer: DataAccessLayer, api: MiddlewareAPI, ResolverState> ): () => void { let lastRequestAbortController: AbortController | undefined; @@ -48,17 +45,12 @@ export function ResolverTreeFetcher( payload: databaseDocumentIDToFetch, }); try { - const indices: string[] = context.services.uiSettings.get(defaultIndexKey); - const matchingEntities: ResolverEntityIndex = await context.services.http.get( - '/api/endpoint/resolver/entity', - { - signal: lastRequestAbortController.signal, - query: { - _id: databaseDocumentIDToFetch, - indices, - }, - } - ); + const indices: string[] = dataAccessLayer.indexPatterns(); + const matchingEntities: ResolverEntityIndex = await dataAccessLayer.entities({ + _id: databaseDocumentIDToFetch, + indices, + signal: lastRequestAbortController.signal, + }); if (matchingEntities.length < 1) { // If no entity_id could be found for the _id, bail out with a failure. api.dispatch({ @@ -68,9 +60,10 @@ export function ResolverTreeFetcher( return; } const entityIDToFetch = matchingEntities[0].entity_id; - result = await context.services.http.get(`/api/endpoint/resolver/${entityIDToFetch}`, { - signal: lastRequestAbortController.signal, - }); + result = await dataAccessLayer.resolverTree( + entityIDToFetch, + lastRequestAbortController.signal + ); } catch (error) { // https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-AbortError if (error instanceof DOMException && error.name === 'AbortError') { diff --git a/x-pack/plugins/security_solution/public/resolver/store/mocks/endpoint_event.ts b/x-pack/plugins/security_solution/public/resolver/store/mocks/endpoint_event.ts index 8f2e0ad3a6d85..709f2faf13b00 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/mocks/endpoint_event.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/mocks/endpoint_event.ts @@ -18,7 +18,7 @@ export function mockEndpointEvent({ }: { entityID: string; name: string; - parentEntityId: string | undefined; + parentEntityId?: string; timestamp: number; lifecycleType?: string; }): EndpointEvent { diff --git a/x-pack/plugins/security_solution/public/resolver/store/mocks/resolver_tree.ts b/x-pack/plugins/security_solution/public/resolver/store/mocks/resolver_tree.ts index ae43955f4c47c..6a8ab61ccf9b6 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/mocks/resolver_tree.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/mocks/resolver_tree.ts @@ -226,3 +226,33 @@ export function mockTreeWith1AncestorAnd2ChildrenAndAllNodesHave2GraphableEvents lifecycle: [origin, originClone], } as unknown) as ResolverTree; } + +export function mockTreeWithNoProcessEvents(): ResolverTree { + return { + entityID: 'entityID', + children: { + childNodes: [], + nextChild: null, + }, + relatedEvents: { + events: [], + nextEvent: null, + }, + relatedAlerts: { + alerts: [], + nextAlert: null, + }, + lifecycle: [], + ancestry: { + ancestors: [], + nextAncestor: null, + }, + stats: { + totalAlerts: 0, + events: { + total: 0, + byCategory: {}, + }, + }, + }; +} diff --git a/x-pack/plugins/security_solution/public/resolver/test_utilities/connect_enzyme_wrapper_and_store.ts b/x-pack/plugins/security_solution/public/resolver/test_utilities/connect_enzyme_wrapper_and_store.ts new file mode 100644 index 0000000000000..3a4a1f7d634d1 --- /dev/null +++ b/x-pack/plugins/security_solution/public/resolver/test_utilities/connect_enzyme_wrapper_and_store.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Store } from 'redux'; +import { ReactWrapper } from 'enzyme'; + +/** + * We use the full-DOM emulation mode of `enzyme` via `mount`. Even though we use `react-redux`, `enzyme` + * does not update the DOM after state transitions. This subscribes to the `redux` store and after any state + * transition it asks `enzyme` to update the DOM to match the React state. + */ +export function connectEnzymeWrapperAndStore(store: Store, wrapper: ReactWrapper): void { + store.subscribe(() => { + // See https://enzymejs.github.io/enzyme/docs/api/ReactWrapper/update.html + return wrapper.update(); + }); +} diff --git a/x-pack/plugins/security_solution/public/resolver/test_utilities/extend_jest.ts b/x-pack/plugins/security_solution/public/resolver/test_utilities/extend_jest.ts new file mode 100644 index 0000000000000..9fc7af38beb42 --- /dev/null +++ b/x-pack/plugins/security_solution/public/resolver/test_utilities/extend_jest.ts @@ -0,0 +1,88 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +/** + * Typescript won't allow global namespace stuff unless you're in a module. + * This wouldn't otherwise be a module. The code runs as soon as it's imported. + * This is done this way because the `declare` will be active on import, so in + * order to be correct, the code that the `declare` declares needs to be available on import as well. + */ +export {}; + +declare global { + /* eslint-disable @typescript-eslint/no-namespace */ + namespace jest { + interface Matchers { + toYieldEqualTo(expectedYield: T extends AsyncIterable ? E : never): Promise; + } + } +} + +expect.extend({ + /** + * A custom matcher that takes an async generator and compares each value it yields to an expected value. + * If any yielded value deep-equals the expected value, the matcher will pass. + * If the generator ends with none of the yielded values matching, it will fail. + */ + async toYieldEqualTo( + this: jest.MatcherContext, + receivedIterable: AsyncIterable, + expected: T + ): Promise<{ pass: boolean; message: () => string }> { + // Used in printing out the pass or fail message + const matcherName = 'toSometimesYieldEqualTo'; + const options: jest.MatcherHintOptions = { + comment: 'deep equality with any yielded value', + isNot: this.isNot, + promise: this.promise, + }; + // The last value received: Used in printing the message + const received: T[] = []; + + // Set to true if the test passes. + let pass: boolean = false; + + // Async iterate over the iterable + for await (const next of receivedIterable) { + // keep track of all received values. Used in pass and fail messages + received.push(next); + // Use deep equals to compare the value to the expected value + if (this.equals(next, expected)) { + // If the value is equal, break + pass = true; + break; + } + } + + // Use `pass` as set in the above loop (or initialized to `false`) + // See https://jestjs.io/docs/en/expect#custom-matchers-api and https://jestjs.io/docs/en/expect#thisutils + const message = pass + ? () => + `${this.utils.matcherHint(matcherName, undefined, undefined, options)}\n\n` + + `Expected: not ${this.utils.printExpected(expected)}\n${ + this.utils.stringify(expected) !== this.utils.stringify(received[received.length - 1]!) + ? `Received: ${this.utils.printReceived(received[received.length - 1])}` + : '' + }` + : () => + `${this.utils.matcherHint(matcherName, undefined, undefined, options)}\n\nCompared ${ + received.length + } yields.\n\n${received + .map( + (next, index) => + `yield ${index + 1}:\n\n${this.utils.printDiffOrStringify( + expected, + next, + 'Expected', + 'Received', + this.expand + )}` + ) + .join(`\n\n`)}`; + + return { message, pass }; + }, +}); diff --git a/x-pack/plugins/security_solution/public/resolver/test_utilities/react_wrapper.ts b/x-pack/plugins/security_solution/public/resolver/test_utilities/react_wrapper.ts new file mode 100644 index 0000000000000..40267d83c30f8 --- /dev/null +++ b/x-pack/plugins/security_solution/public/resolver/test_utilities/react_wrapper.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ReactWrapper } from 'enzyme'; + +/** + * Return a collection of attribute 'entries'. + * The 'entries' are attributeName-attributeValue tuples. + */ +export function attributeEntries(wrapper: ReactWrapper): Array<[string, string]> { + return Array.prototype.slice + .call(wrapper.getDOMNode().attributes) + .map(({ name, value }) => [name, value]); +} diff --git a/x-pack/plugins/security_solution/public/resolver/test_utilities/simulator/index.tsx b/x-pack/plugins/security_solution/public/resolver/test_utilities/simulator/index.tsx new file mode 100644 index 0000000000000..7a61427c56a3b --- /dev/null +++ b/x-pack/plugins/security_solution/public/resolver/test_utilities/simulator/index.tsx @@ -0,0 +1,290 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { Store, createStore, applyMiddleware } from 'redux'; +import { mount, ReactWrapper } from 'enzyme'; +import { createMemoryHistory, History as HistoryPackageHistoryInterface } from 'history'; +import { CoreStart } from '../../../../../../../src/core/public'; +import { coreMock } from '../../../../../../../src/core/public/mocks'; +import { connectEnzymeWrapperAndStore } from '../connect_enzyme_wrapper_and_store'; +import { spyMiddlewareFactory } from '../spy_middleware_factory'; +import { resolverMiddlewareFactory } from '../../store/middleware'; +import { resolverReducer } from '../../store/reducer'; +import { MockResolver } from './mock_resolver'; +import { ResolverState, DataAccessLayer, SpyMiddleware } from '../../types'; +import { ResolverAction } from '../../store/actions'; + +/** + * Test a Resolver instance using jest, enzyme, and a mock data layer. + */ +export class Simulator { + /** + * A string that uniquely identifies this Resolver instance among others mounted in the DOM. + */ + private readonly resolverComponentInstanceID: string; + /** + * The redux store, creating in the constructor using the `dataAccessLayer`. + * This code subscribes to state transitions. + */ + private readonly store: Store; + /** + * A fake 'History' API used with `react-router` to simulate a browser history. + */ + private readonly history: HistoryPackageHistoryInterface; + /** + * The 'wrapper' returned by `enzyme` that contains the rendered Resolver react code. + */ + private readonly wrapper: ReactWrapper; + /** + * A `redux` middleware that exposes all actions dispatched (along with the state at that point.) + * This is used by `debugActions`. + */ + private readonly spyMiddleware: SpyMiddleware; + constructor({ + dataAccessLayer, + resolverComponentInstanceID, + databaseDocumentID, + }: { + /** + * A (mock) data access layer that will be used to create the Resolver store. + */ + dataAccessLayer: DataAccessLayer; + /** + * A string that uniquely identifies this Resolver instance among others mounted in the DOM. + */ + resolverComponentInstanceID: string; + /** + * a databaseDocumentID to pass to Resolver. Resolver will use this in requests to the mock data layer. + */ + databaseDocumentID?: string; + }) { + this.resolverComponentInstanceID = resolverComponentInstanceID; + // create the spy middleware (for debugging tests) + this.spyMiddleware = spyMiddlewareFactory(); + + /** + * Create the real resolver middleware with a fake data access layer. + * By providing different data access layers, you can simulate different data and server environments. + */ + const middlewareEnhancer = applyMiddleware( + resolverMiddlewareFactory(dataAccessLayer), + // install the spyMiddleware + this.spyMiddleware.middleware + ); + + // Create a redux store w/ the top level Resolver reducer and the enhancer that includes the Resolver middleware and the `spyMiddleware` + this.store = createStore(resolverReducer, middlewareEnhancer); + + // Create a fake 'history' instance that Resolver will use to read and write query string values + this.history = createMemoryHistory(); + + // Used for `KibanaContextProvider` + const coreStart: CoreStart = coreMock.createStart(); + + // Render Resolver via the `MockResolver` component, using `enzyme`. + this.wrapper = mount( + + ); + + // Update the enzyme wrapper after each state transition + connectEnzymeWrapperAndStore(this.store, this.wrapper); + } + + /** + * Call this to console.log actions (and state). Use this to debug your tests. + * State and actions aren't exposed otherwise because the tests using this simulator should + * assert stuff about the DOM instead of internal state. Use selector/middleware/reducer + * unit tests to test that stuff. + */ + public debugActions(): /** + * Optionally call this to stop debugging actions. + */ () => void { + return this.spyMiddleware.debugActions(); + } + + /** + * Return a promise that resolves after the `store`'s next state transition. + * Used by `mapStateTransitions` + */ + private stateTransitioned(): Promise { + // keep track of the resolve function of the promise that has been returned. + let resolveState: (() => void) | null = null; + + const promise: Promise = new Promise((resolve) => { + // Immediately expose the resolve function in the outer scope. It will be resolved when the next state transition occurs. + resolveState = resolve; + }); + + // Subscribe to the store + const unsubscribe = this.store.subscribe(() => { + // Once a state transition occurs, unsubscribe. + unsubscribe(); + // Resolve the promise. The null assertion is safe here as Promise initializers run immediately (according to spec and node/browser implementations.) + // NB: the state is not resolved here. Code using the simulator should not rely on state or selectors of state. + resolveState!(); + }); + + // Return the promise that will be resolved on the next state transition, allowing code to `await` for the next state transition. + return promise; + } + + /** + * This will yield the return value of `mapper` after each state transition. If no state transition occurs for 10 event loops in a row, this will give up. + */ + public async *mapStateTransitions(mapper: () => R): AsyncIterable { + // Yield the value before any state transitions have occurred. + yield mapper(); + + /** Increment this each time an event loop completes without a state transition. + * If this value hits `10`, end the loop. + * + * Code will test assertions after each state transition. If the assertion hasn't passed and no further state transitions occur, + * then the jest timeout will happen. The timeout doesn't give a useful message about the assertion. + * By short-circuiting this function, code that uses it can short circuit the test timeout and print a useful error message. + * + * NB: the logic to short-circuit the loop is here because knowledge of state is a concern of the simulator, not tests. + */ + let timeoutCount = 0; + while (true) { + /** + * `await` a race between the next state transition and a timeout that happens after `0`ms. + * If the timeout wins, no `dispatch` call caused a state transition in the last loop. + * If this keeps happening, assume that Resolver isn't going to do anything else. + * + * If Resolver adds intentional delay logic (e.g. waiting before making a request), this code might have to change. + * In that case, Resolver should use the side effect context to schedule future work. This code could then subscribe to some event published by the side effect context. That way, this code will be aware of Resolver's intention to do work. + */ + const timedOut: boolean = await Promise.race([ + (async (): Promise => { + await this.stateTransitioned(); + // If a state transition occurs, return false for `timedOut` + return false; + })(), + new Promise((resolve) => { + setTimeout(() => { + // If a timeout occurs, resolve `timedOut` as true + return resolve(true); + }, 0); + }), + ]); + + if (timedOut) { + // If a timout occurred, note it. + timeoutCount++; + if (timeoutCount === 10) { + // if 10 timeouts happen in a row, end the loop early + return; + } + } else { + // If a state transition occurs, reset the timeout count and yield the value + timeoutCount = 0; + yield mapper(); + } + } + } + + /** + * Find a process node element. Takes options supported by `resolverNodeSelector`. + * returns a `ReactWrapper` even if nothing is found, as that is how `enzyme` does things. + */ + public processNodeElements(options: ProcessNodeElementSelectorOptions = {}): ReactWrapper { + return this.findInDOM(processNodeElementSelector(options)); + } + + /** + * true if a process node element is found for the entityID and if it has an [aria-selected] attribute. + */ + public processNodeElementLooksSelected(entityID: string): boolean { + return this.processNodeElements({ entityID, selected: true }).length === 1; + } + + /** + * true if a process node element is found for the entityID and if it *does not have* an [aria-selected] attribute. + */ + public processNodeElementLooksUnselected(entityID: string): boolean { + // find the process node, then exclude it if its selected. + return ( + this.processNodeElements({ entityID }).not( + processNodeElementSelector({ entityID, selected: true }) + ).length === 1 + ); + } + + /** + * Return the selected node query string values. + */ + public queryStringValues(): { selectedNode: string[] } { + const urlSearchParams = new URLSearchParams(this.history.location.search); + return { + selectedNode: urlSearchParams.getAll(`resolver-${this.resolverComponentInstanceID}-id`), + }; + } + + /** + * The element that shows when Resolver is waiting for the graph data. + */ + public graphLoadingElement(): ReactWrapper { + return this.findInDOM('[data-test-subj="resolver:graph:loading"]'); + } + + /** + * The element that shows if Resolver couldn't draw the graph. + */ + public graphErrorElement(): ReactWrapper { + return this.findInDOM('[data-test-subj="resolver:graph:error"]'); + } + + /** + * The element where nodes get drawn. + */ + public graphElement(): ReactWrapper { + return this.findInDOM('[data-test-subj="resolver:graph"]'); + } + + /** + * Like `this.wrapper.find` but only returns DOM nodes. + */ + private findInDOM(selector: string): ReactWrapper { + return this.wrapper.find(selector).filterWhere((wrapper) => typeof wrapper.type() === 'string'); + } +} + +const baseResolverSelector = '[data-test-subj="resolver:node"]'; + +interface ProcessNodeElementSelectorOptions { + /** + * Entity ID of the node. If passed, will be used to create an data-attribute CSS selector that should only get the related node element. + */ + entityID?: string; + /** + * If true, only get nodes with an `[aria-selected="true"]` attribute. + */ + selected?: boolean; +} + +/** + * An `enzyme` supported CSS selector for process node elements. + */ +function processNodeElementSelector({ + entityID, + selected = false, +}: ProcessNodeElementSelectorOptions = {}): string { + let selector: string = baseResolverSelector; + if (entityID !== undefined) { + selector += `[data-test-resolver-node-id="${entityID}"]`; + } + if (selected) { + selector += '[aria-selected="true"]'; + } + return selector; +} diff --git a/x-pack/plugins/security_solution/public/resolver/test_utilities/simulator/mock_resolver.tsx b/x-pack/plugins/security_solution/public/resolver/test_utilities/simulator/mock_resolver.tsx new file mode 100644 index 0000000000000..36bb2a5ffc9fe --- /dev/null +++ b/x-pack/plugins/security_solution/public/resolver/test_utilities/simulator/mock_resolver.tsx @@ -0,0 +1,109 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +/* eslint-disable no-duplicate-imports */ +/* eslint-disable react/display-name */ + +import React, { useMemo, useEffect, useState, useCallback } from 'react'; +import { Router } from 'react-router-dom'; +import { I18nProvider } from '@kbn/i18n/react'; +import { Provider } from 'react-redux'; +import { Store } from 'redux'; +import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public'; +import { CoreStart } from '../../../../../../../src/core/public'; +import { ResolverState, SideEffectSimulator, ResolverProps } from '../../types'; +import { ResolverAction } from '../../store/actions'; +import { ResolverWithoutProviders } from '../../view/resolver_without_providers'; +import { SideEffectContext } from '../../view/side_effect_context'; +import { sideEffectSimulatorFactory } from '../../view/side_effect_simulator_factory'; + +type MockResolverProps = { + /** + * Used to simulate a raster width. Defaults to 1600. + */ + rasterWidth?: number; + /** + * Used to simulate a raster height. Defaults to 1200. + */ + rasterHeight?: number; + /** + * Used for the `KibanaContextProvider` + */ + coreStart: CoreStart; + /** + * Used for `react-router`. + */ + history: React.ComponentProps['history']; + /** Pass a resolver store. See `storeFactory` and `mockDataAccessLayer` */ + store: Store; + /** + * All the props from `ResolverWithoutStore` can be passed. These aren't defaulted to anything (you might want to test what happens when they aren't present.) + */ +} & ResolverProps; + +/** + * This is a mock Resolver component. It is intended to be used with `enzyme` tests via the `Simulator` class. It wraps Resolver in the required providers: + * * `i18n` + * * `Router` using a provided `History` + * * `SideEffectContext.Provider` using side effect simulator it creates + * * `KibanaContextProvider` using a provided `CoreStart` instance + * * `react-redux`'s `Provider` using a provided `Store`. + * + * Resolver needs to measure its size in the DOM. The `SideEffectSimulator` instance can fake the size of an element. + * However in tests, React doesn't have good DOM reconciliation and the root element is often swapped out. When the + * element is replaced, the fake dimensions stop being applied. In order to get around this issue, this component will + * trigger a simulated resize on the root node reference any time it changes. This simulates the layout process a real + * browser would do when an element is attached to the DOM. + */ +export const MockResolver = React.memo((props: MockResolverProps) => { + const [resolverElement, setResolverElement] = useState(null); + + // Get a ref to the underlying Resolver element so we can resize. + // Use a callback function because the underlying DOM node can change. In fact, `enzyme` seems to change it a lot. + const resolverRef = useCallback((element: HTMLDivElement | null) => { + setResolverElement(element); + }, []); + + const simulator: SideEffectSimulator = useMemo(() => sideEffectSimulatorFactory(), []); + + // Resize the Resolver element to match the passed in props. Resolver is size dependent. + useEffect(() => { + if (resolverElement) { + const size: DOMRect = { + width: props.rasterWidth ?? 1600, + height: props.rasterHeight ?? 1200, + x: 0, + y: 0, + bottom: 0, + left: 0, + top: 0, + right: 0, + toJSON() { + return this; + }, + }; + simulator.controls.simulateElementResize(resolverElement, size); + } + }, [props.rasterWidth, props.rasterHeight, simulator.controls, resolverElement]); + + return ( + + + + + + + + + + + + ); +}); diff --git a/x-pack/plugins/security_solution/public/resolver/test_utilities/spy_middleware_factory.ts b/x-pack/plugins/security_solution/public/resolver/test_utilities/spy_middleware_factory.ts new file mode 100644 index 0000000000000..45730531cf467 --- /dev/null +++ b/x-pack/plugins/security_solution/public/resolver/test_utilities/spy_middleware_factory.ts @@ -0,0 +1,58 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ResolverAction } from '../store/actions'; +import { SpyMiddleware, SpyMiddlewareStateActionPair } from '../types'; + +/** + * Return a `SpyMiddleware` to be used in testing. Use `debugActions` to console.log actions and the state they produced. + * For reducer/middleware tests, you can use `actions` to get access to each dispatched action along with the state it produced. + */ +export const spyMiddlewareFactory: () => SpyMiddleware = () => { + const resolvers: Set<(stateActionPair: SpyMiddlewareStateActionPair) => void> = new Set(); + + const actions = async function* actions() { + while (true) { + const promise: Promise = new Promise((resolve) => { + resolvers.add(resolve); + }); + yield await promise; + } + }; + + return { + middleware: (api) => (next) => (action: ResolverAction) => { + // handle the action first so we get the state after the reducer + next(action); + + const state = api.getState(); + + // Resolving these promises may cause code to await the next result. That will add more resolve functions to `resolvers`. + // For this reason, copy all the existing resolvers to an array and clear the set. + const oldResolvers = [...resolvers]; + resolvers.clear(); + for (const resolve of oldResolvers) { + resolve({ action, state }); + } + }, + actions, + debugActions() { + let stop: boolean = false; + (async () => { + for await (const actionStatePair of actions()) { + if (stop) { + break; + } + // eslint-disable-next-line no-console + console.log('action', actionStatePair.action, 'state', actionStatePair.state); + } + })(); + return () => { + stop = true; + }; + }, + }; +}; diff --git a/x-pack/plugins/security_solution/public/resolver/types.ts b/x-pack/plugins/security_solution/public/resolver/types.ts index 02a890ca13ee8..38e0cd0483559 100644 --- a/x-pack/plugins/security_solution/public/resolver/types.ts +++ b/x-pack/plugins/security_solution/public/resolver/types.ts @@ -4,10 +4,18 @@ * you may not use this file except in compliance with the Elastic License. */ +/* eslint-disable no-duplicate-imports */ + import { Store } from 'redux'; +import { Middleware, Dispatch } from 'redux'; import { BBox } from 'rbush'; import { ResolverAction } from './store/actions'; -import { ResolverEvent, ResolverRelatedEvents, ResolverTree } from '../../common/endpoint/types'; +import { + ResolverEvent, + ResolverRelatedEvents, + ResolverTree, + ResolverEntityIndex, +} from '../../common/endpoint/types'; /** * Redux state for the Resolver feature. Properties on this interface are populated via multiple reducers using redux's `combineReducers`. @@ -30,21 +38,21 @@ export interface ResolverState { } /** - * Piece of redux state that models an animation for the camera. + * Piece of `redux` state that models an animation for the camera. */ export interface ResolverUIState { /** - * The nodeID for the process that is selected (in the aria-activedescendent sense of being selected.) + * The `nodeID` for the process that is selected (in the `aria-activedescendent` sense of being selected.) */ readonly ariaActiveDescendant: string | null; /** - * nodeID of the selected node + * `nodeID` of the selected node */ readonly selectedNode: string | null; } /** - * Piece of redux state that models an animation for the camera. + * Piece of `redux` state that models an animation for the camera. */ export interface CameraAnimationState { /** @@ -68,7 +76,7 @@ export interface CameraAnimationState { } /** - * The redux state for the `useCamera` hook. + * The `redux` state for the `useCamera` hook. */ export type CameraState = { /** @@ -88,7 +96,7 @@ export type CameraState = { readonly translationNotCountingCurrentPanning: Vector2; /** - * The world coordinates that the pointing device was last over. This is used during mousewheel zoom. + * The world coordinates that the pointing device was last over. This is used during mouse-wheel zoom. */ readonly latestFocusedWorldCoordinates: Vector2 | null; } & ( @@ -135,7 +143,7 @@ export type CameraState = { export type IndexedEntity = IndexedEdgeLineSegment | IndexedProcessNode; /** - * The entity stored in rbush for resolver edge lines. + * The entity stored in `rbush` for resolver edge lines. */ export interface IndexedEdgeLineSegment extends BBox { type: 'edgeLine'; @@ -143,7 +151,7 @@ export interface IndexedEdgeLineSegment extends BBox { } /** - * The entity store in rbush for resolver process nodes. + * The entity store in `rbush` for resolver process nodes. */ export interface IndexedProcessNode extends BBox { type: 'processNode'; @@ -160,7 +168,7 @@ export interface VisibleEntites { } /** - * State for `data` reducer which handles receiving Resolver data from the backend. + * State for `data` reducer which handles receiving Resolver data from the back-end. */ export interface DataState { readonly relatedEvents: Map; @@ -213,11 +221,11 @@ export type Vector2 = readonly [number, number]; */ export interface AABB { /** - * Vector who's `x` component is the _left_ side of the AABB and who's `y` component is the _bottom_ side of the AABB. + * Vector who's `x` component is the _left_ side of the `AABB` and who's `y` component is the _bottom_ side of the `AABB`. **/ readonly minimum: Vector2; /** - * Vector who's `x` component is the _right_ side of the AABB and who's `y` component is the _bottom_ side of the AABB. + * Vector who's `x` component is the _right_ side of the `AABB` and who's `y` component is the _bottom_ side of the `AABB`. **/ readonly maximum: Vector2; } @@ -266,7 +274,7 @@ export interface ProcessEvent { } /** - * A represention of a process tree with indices for O(1) access to children and values by id. + * A representation of a process tree with indices for O(1) access to children and values by id. */ export interface IndexedProcessTree { /** @@ -280,7 +288,7 @@ export interface IndexedProcessTree { } /** - * A map of ProcessEvents (representing process nodes) to the 'width' of their subtrees as calculated by `widthsOfProcessSubtrees` + * A map of `ProcessEvents` (representing process nodes) to the 'width' of their subtrees as calculated by `widthsOfProcessSubtrees` */ export type ProcessWidths = Map; /** @@ -318,16 +326,16 @@ export interface DurationDetails { */ export interface EdgeLineMetadata { elapsedTime?: DurationDetails; - // A string of the two joined process nodes concatted together. + // A string of the two joined process nodes concatenated together. uniqueId: string; } /** - * A tuple of 2 vector2 points forming a polyline. Used to connect process nodes in the graph. + * A tuple of 2 vector2 points forming a poly-line. Used to connect process nodes in the graph. */ export type EdgeLinePoints = Vector2[]; /** - * Edge line components including the points joining the edgeline and any optional associated metadata + * Edge line components including the points joining the edge-line and any optional associated metadata */ export interface EdgeLineSegment { points: EdgeLinePoints; @@ -335,7 +343,7 @@ export interface EdgeLineSegment { } /** - * Used to provide precalculated info from `widthsOfProcessSubtrees`. These 'width' values are used in the layout of the graph. + * Used to provide pre-calculated info from `widthsOfProcessSubtrees`. These 'width' values are used in the layout of the graph. */ export type ProcessWithWidthMetadata = { process: ResolverEvent; @@ -423,11 +431,11 @@ export type ResolverStore = Store; */ export interface IsometricTaxiLayout { /** - * A map of events to position. each event represents its own node. + * A map of events to position. Each event represents its own node. */ processNodePositions: Map; /** - * A map of edgline segments, which graphically connect nodes. + * A map of edge-line segments, which graphically connect nodes. */ edgeLineSegments: EdgeLineSegment[]; @@ -436,3 +444,91 @@ export interface IsometricTaxiLayout { */ ariaLevels: Map; } + +/** + * An object with methods that can be used to access data from the Kibana server. + * This is injected into Resolver. + * This allows tests to provide a mock data access layer. + * In the future, other implementations of Resolver could provide different data access layers. + */ +export interface DataAccessLayer { + /** + * Fetch related events for an entity ID + */ + relatedEvents: (entityID: string) => Promise; + + /** + * Fetch a ResolverTree for a entityID + */ + resolverTree: (entityID: string, signal: AbortSignal) => Promise; + + /** + * Get an array of index patterns that contain events. + */ + indexPatterns: () => string[]; + + /** + * Get entities matching a document. + */ + entities: (parameters: { + /** _id of the document to find an entity in. */ + _id: string; + /** indices to search in */ + indices: string[]; + /** signal to abort the request */ + signal: AbortSignal; + }) => Promise; +} + +/** + * The externally provided React props. + */ +export interface ResolverProps { + /** + * Used by `styled-components`. + */ + className?: string; + /** + * The `_id` value of an event in ES. + * Used as the origin of the Resolver graph. + */ + databaseDocumentID?: string; + /** + * A string literal describing where in the application resolver is located. + * Used to prevent collisions in things like query parameters. + */ + resolverComponentInstanceID: string; +} + +/** + * Used by `SpyMiddleware`. + */ +export interface SpyMiddlewareStateActionPair { + /** An action dispatched, `state` is the state that the reducer returned when handling this action. + */ + action: ResolverAction; + /** + * A resolver state that was returned by the reducer when handling `action`. + */ + state: ResolverState; +} + +/** + * A wrapper object that has a middleware along with an async generator that returns the actions dispatched to the store (along with state.) + */ +export interface SpyMiddleware { + /** + * A middleware to use with `applyMiddleware`. + */ + middleware: Middleware<{}, ResolverState, Dispatch>; + /** + * A generator that returns all state and action pairs that pass through the middleware. + */ + actions: () => AsyncGenerator; + + /** + * Prints actions to the console. + * Call the returned function to stop debugging. + */ + debugActions: () => () => void; +} diff --git a/x-pack/plugins/security_solution/public/resolver/view/clickthrough.test.tsx b/x-pack/plugins/security_solution/public/resolver/view/clickthrough.test.tsx new file mode 100644 index 0000000000000..9cb900736677e --- /dev/null +++ b/x-pack/plugins/security_solution/public/resolver/view/clickthrough.test.tsx @@ -0,0 +1,99 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { oneAncestorTwoChildren } from '../data_access_layer/mocks/one_ancestor_two_children'; +import { Simulator } from '../test_utilities/simulator'; +// Extend jest with a custom matcher +import '../test_utilities/extend_jest'; + +describe('Resolver, when analyzing a tree that has 1 ancestor and 2 children', () => { + let simulator: Simulator; + let databaseDocumentID: string; + let entityIDs: { origin: string; firstChild: string; secondChild: string }; + + // the resolver component instance ID, used by the react code to distinguish piece of global state from those used by other resolver instances + const resolverComponentInstanceID = 'resolverComponentInstanceID'; + + beforeEach(async () => { + // create a mock data access layer + const { metadata: dataAccessLayerMetadata, dataAccessLayer } = oneAncestorTwoChildren(); + + // save a reference to the entity IDs exposed by the mock data layer + entityIDs = dataAccessLayerMetadata.entityIDs; + + // save a reference to the `_id` supported by the mock data layer + databaseDocumentID = dataAccessLayerMetadata.databaseDocumentID; + + // create a resolver simulator, using the data access layer and an arbitrary component instance ID + simulator = new Simulator({ databaseDocumentID, dataAccessLayer, resolverComponentInstanceID }); + }); + + describe('when it has loaded', () => { + beforeEach(async () => { + await expect( + /** + * It's important that all of these are done in a single `expect`. + * If you do them concurrently with each other, you'll have incorrect results. + * + * For example, there might be no loading element at one point, and 1 graph element at one point, but never a single time when there is both 1 graph element and 0 loading elements. + */ + simulator.mapStateTransitions(() => ({ + graphElements: simulator.graphElement().length, + graphLoadingElements: simulator.graphLoadingElement().length, + graphErrorElements: simulator.graphErrorElement().length, + })) + ).toYieldEqualTo({ + // it should have 1 graph element, an no error or loading elements. + graphElements: 1, + graphLoadingElements: 0, + graphErrorElements: 0, + }); + }); + + // Combining assertions here for performance. Unfortunately, Enzyme + jsdom + React is slow. + it(`should have 3 nodes, with the entityID's 'origin', 'firstChild', and 'secondChild'. 'origin' should be selected.`, async () => { + expect(simulator.processNodeElementLooksSelected(entityIDs.origin)).toBe(true); + + expect(simulator.processNodeElementLooksUnselected(entityIDs.firstChild)).toBe(true); + expect(simulator.processNodeElementLooksUnselected(entityIDs.secondChild)).toBe(true); + + expect(simulator.processNodeElements().length).toBe(3); + }); + + describe("when the second child node's first button has been clicked", () => { + beforeEach(() => { + // Click the first button under the second child element. + simulator + .processNodeElements({ entityID: entityIDs.secondChild }) + .find('button') + .simulate('click'); + }); + it('should render the second child node as selected, and the first child not as not selected, and the query string should indicate that the second child is selected', async () => { + await expect( + simulator.mapStateTransitions(function value() { + return { + // the query string has a key showing that the second child is selected + queryStringSelectedNode: simulator.queryStringValues().selectedNode, + // the second child is rendered in the DOM, and shows up as selected + secondChildLooksSelected: simulator.processNodeElementLooksSelected( + entityIDs.secondChild + ), + // the origin is in the DOM, but shows up as unselected + originLooksUnselected: simulator.processNodeElementLooksUnselected(entityIDs.origin), + }; + }) + ).toYieldEqualTo({ + // Just the second child should be marked as selected in the query string + queryStringSelectedNode: [entityIDs.secondChild], + // The second child is rendered and has `[aria-selected]` + secondChildLooksSelected: true, + // The origin child is rendered and doesn't have `[aria-selected]` + originLooksUnselected: true, + }); + }); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/public/resolver/view/index.tsx b/x-pack/plugins/security_solution/public/resolver/view/index.tsx index c1ffa42d02abb..d9a0bf291d0e4 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/index.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/index.tsx @@ -7,50 +7,29 @@ import React, { useMemo } from 'react'; import { Provider } from 'react-redux'; -import { ResolverMap } from './map'; import { storeFactory } from '../store'; import { StartServices } from '../../types'; import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; +import { DataAccessLayer, ResolverProps } from '../types'; +import { dataAccessLayerFactory } from '../data_access_layer/factory'; +import { ResolverWithoutProviders } from './resolver_without_providers'; /** - * The top level, unconnected, Resolver component. + * The `Resolver` component to use. This sets up the DataAccessLayer provider. Use `ResolverWithoutProviders` in tests or in other scenarios where you want to provide a different (or fake) data access layer. */ -export const Resolver = React.memo(function ({ - className, - databaseDocumentID, - resolverComponentInstanceID, -}: { - /** - * Used by `styled-components`. - */ - className?: string; - /** - * The `_id` value of an event in ES. - * Used as the origin of the Resolver graph. - */ - databaseDocumentID?: string; - /** - * A string literal describing where in the app resolver is located, - * used to prevent collisions in things like query params - */ - resolverComponentInstanceID: string; -}) { +export const Resolver = React.memo((props: ResolverProps) => { const context = useKibana(); + const dataAccessLayer: DataAccessLayer = useMemo(() => dataAccessLayerFactory(context), [ + context, + ]); + const store = useMemo(() => { - return storeFactory(context); - }, [context]); + return storeFactory(dataAccessLayer); + }, [dataAccessLayer]); - /** - * Setup the store and use `Provider` here. This allows the ResolverMap component to - * dispatch actions and read from state. - */ return ( - + ); }); diff --git a/x-pack/plugins/security_solution/public/resolver/view/map.tsx b/x-pack/plugins/security_solution/public/resolver/view/map.tsx index 19c403f1257be..0ca71c5bf60ce 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/map.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/map.tsx @@ -8,7 +8,7 @@ /* eslint-disable react/display-name */ -import React, { useContext, useEffect } from 'react'; +import React, { useContext } from 'react'; import { useSelector } from 'react-redux'; import { useEffectOnce } from 'react-use'; import { EuiLoadingSpinner } from '@elastic/eui'; @@ -68,25 +68,12 @@ export const ResolverMap = React.memo(function ({ const hasError = useSelector(selectors.hasError); const activeDescendantId = useSelector(selectors.ariaActiveDescendant); const { colorMap } = useResolverTheme(); - const { - cleanUpQueryParams, - queryParams: { crumbId }, - pushToQueryParams, - } = useResolverQueryParams(); + const { cleanUpQueryParams } = useResolverQueryParams(); useEffectOnce(() => { return () => cleanUpQueryParams(); }); - useEffect(() => { - // When you refresh the page after selecting a process in the table view (not the timeline view) - // The old crumbId still exists in the query string even though a resolver is no longer visible - // This just makes sure the activeDescendant and crumbId are in sync on load for that view as well as the timeline - if (activeDescendantId && crumbId !== activeDescendantId) { - pushToQueryParams({ crumbId: activeDescendantId, crumbEvent: '' }); - } - }, [crumbId, activeDescendantId, pushToQueryParams]); - return ( {isLoading ? ( diff --git a/x-pack/plugins/security_solution/public/resolver/view/panels/panel_content_process_detail.tsx b/x-pack/plugins/security_solution/public/resolver/view/panels/panel_content_process_detail.tsx index 29c7676d2167d..7b5eb13359dbb 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/panels/panel_content_process_detail.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/panels/panel_content_process_detail.tsx @@ -1,184 +1,184 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -import React, { memo, useMemo } from 'react'; -import { useSelector } from 'react-redux'; -import { i18n } from '@kbn/i18n'; -import { - htmlIdGenerator, - EuiSpacer, - EuiTitle, - EuiText, - EuiTextColor, - EuiDescriptionList, -} from '@elastic/eui'; -import styled from 'styled-components'; -import { FormattedMessage } from 'react-intl'; -import * as selectors from '../../store/selectors'; -import * as event from '../../../../common/endpoint/models/event'; -import { CrumbInfo, formatDate, StyledBreadcrumbs } from './panel_content_utilities'; -import { - processPath, - processPid, - userInfoForProcess, - processParentPid, - md5HashForProcess, - argsForProcess, -} from '../../models/process_event'; -import { CubeForProcess } from './process_cube_icon'; -import { ResolverEvent } from '../../../../common/endpoint/types'; -import { useResolverTheme } from '../assets'; - -const StyledDescriptionList = styled(EuiDescriptionList)` - &.euiDescriptionList.euiDescriptionList--column dt.euiDescriptionList__title.desc-title { - max-width: 10em; - } -`; - -/** - * A description list view of all the Metadata that goes with a particular process event, like: - * Created, Pid, User/Domain, etc. - */ -export const ProcessDetails = memo(function ProcessDetails({ - processEvent, - pushToQueryParams, -}: { - processEvent: ResolverEvent; - pushToQueryParams: (queryStringKeyValuePair: CrumbInfo) => unknown; -}) { - const processName = event.eventName(processEvent); - const entityId = event.entityId(processEvent); - const isProcessTerminated = useSelector(selectors.isProcessTerminated)(entityId); - const processInfoEntry = useMemo(() => { - const eventTime = event.eventTimestamp(processEvent); - const dateTime = eventTime ? formatDate(eventTime) : ''; - - const createdEntry = { - title: '@timestamp', - description: dateTime, - }; - - const pathEntry = { - title: 'process.executable', - description: processPath(processEvent), - }; - - const pidEntry = { - title: 'process.pid', - description: processPid(processEvent), - }; - - const userEntry = { - title: 'user.name', - description: (userInfoForProcess(processEvent) as { name: string }).name, - }; - - const domainEntry = { - title: 'user.domain', - description: (userInfoForProcess(processEvent) as { domain: string }).domain, - }; - - const parentPidEntry = { - title: 'process.parent.pid', - description: processParentPid(processEvent), - }; - - const md5Entry = { - title: 'process.hash.md5', - description: md5HashForProcess(processEvent), - }; - - const commandLineEntry = { - title: 'process.args', - description: argsForProcess(processEvent), - }; - - // This is the data in {title, description} form for the EUIDescriptionList to display - const processDescriptionListData = [ - createdEntry, - pathEntry, - pidEntry, - userEntry, - domainEntry, - parentPidEntry, - md5Entry, - commandLineEntry, - ] - .filter((entry) => { - return entry.description; - }) - .map((entry) => { - return { - ...entry, - description: String(entry.description), - }; - }); - - return processDescriptionListData; - }, [processEvent]); - - const crumbs = useMemo(() => { - return [ - { - text: i18n.translate( - 'xpack.securitySolution.endpoint.resolver.panel.processDescList.events', - { - defaultMessage: 'Events', - } - ), - onClick: () => { - pushToQueryParams({ crumbId: '', crumbEvent: '' }); - }, - }, - { - text: ( - <> - - - ), - onClick: () => {}, - }, - ]; - }, [processName, pushToQueryParams]); - const { cubeAssetsForNode } = useResolverTheme(); - const { descriptionText } = useMemo(() => { - if (!processEvent) { - return { descriptionText: '' }; - } - return cubeAssetsForNode(isProcessTerminated, false); - }, [processEvent, cubeAssetsForNode, isProcessTerminated]); - - const titleId = useMemo(() => htmlIdGenerator('resolverTable')(), []); - return ( - <> - - - -

- - {processName} -

-
- - - {descriptionText} - - - - - - ); -}); -ProcessDetails.displayName = 'ProcessDetails'; +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React, { memo, useMemo } from 'react'; +import { useSelector } from 'react-redux'; +import { i18n } from '@kbn/i18n'; +import { + htmlIdGenerator, + EuiSpacer, + EuiTitle, + EuiText, + EuiTextColor, + EuiDescriptionList, +} from '@elastic/eui'; +import styled from 'styled-components'; +import { FormattedMessage } from 'react-intl'; +import * as selectors from '../../store/selectors'; +import * as event from '../../../../common/endpoint/models/event'; +import { CrumbInfo, formatDate, StyledBreadcrumbs } from './panel_content_utilities'; +import { + processPath, + processPid, + userInfoForProcess, + processParentPid, + md5HashForProcess, + argsForProcess, +} from '../../models/process_event'; +import { CubeForProcess } from './process_cube_icon'; +import { ResolverEvent } from '../../../../common/endpoint/types'; +import { useResolverTheme } from '../assets'; + +const StyledDescriptionList = styled(EuiDescriptionList)` + &.euiDescriptionList.euiDescriptionList--column dt.euiDescriptionList__title.desc-title { + max-width: 10em; + } +`; + +/** + * A description list view of all the Metadata that goes with a particular process event, like: + * Created, PID, User/Domain, etc. + */ +export const ProcessDetails = memo(function ProcessDetails({ + processEvent, + pushToQueryParams, +}: { + processEvent: ResolverEvent; + pushToQueryParams: (queryStringKeyValuePair: CrumbInfo) => unknown; +}) { + const processName = event.eventName(processEvent); + const entityId = event.entityId(processEvent); + const isProcessTerminated = useSelector(selectors.isProcessTerminated)(entityId); + const processInfoEntry = useMemo(() => { + const eventTime = event.eventTimestamp(processEvent); + const dateTime = eventTime ? formatDate(eventTime) : ''; + + const createdEntry = { + title: '@timestamp', + description: dateTime, + }; + + const pathEntry = { + title: 'process.executable', + description: processPath(processEvent), + }; + + const pidEntry = { + title: 'process.pid', + description: processPid(processEvent), + }; + + const userEntry = { + title: 'user.name', + description: userInfoForProcess(processEvent)?.name, + }; + + const domainEntry = { + title: 'user.domain', + description: userInfoForProcess(processEvent)?.domain, + }; + + const parentPidEntry = { + title: 'process.parent.pid', + description: processParentPid(processEvent), + }; + + const md5Entry = { + title: 'process.hash.md5', + description: md5HashForProcess(processEvent), + }; + + const commandLineEntry = { + title: 'process.args', + description: argsForProcess(processEvent), + }; + + // This is the data in {title, description} form for the EUIDescriptionList to display + const processDescriptionListData = [ + createdEntry, + pathEntry, + pidEntry, + userEntry, + domainEntry, + parentPidEntry, + md5Entry, + commandLineEntry, + ] + .filter((entry) => { + return entry.description; + }) + .map((entry) => { + return { + ...entry, + description: String(entry.description), + }; + }); + + return processDescriptionListData; + }, [processEvent]); + + const crumbs = useMemo(() => { + return [ + { + text: i18n.translate( + 'xpack.securitySolution.endpoint.resolver.panel.processDescList.events', + { + defaultMessage: 'Events', + } + ), + onClick: () => { + pushToQueryParams({ crumbId: '', crumbEvent: '' }); + }, + }, + { + text: ( + <> + + + ), + onClick: () => {}, + }, + ]; + }, [processName, pushToQueryParams]); + const { cubeAssetsForNode } = useResolverTheme(); + const { descriptionText } = useMemo(() => { + if (!processEvent) { + return { descriptionText: '' }; + } + return cubeAssetsForNode(isProcessTerminated, false); + }, [processEvent, cubeAssetsForNode, isProcessTerminated]); + + const titleId = useMemo(() => htmlIdGenerator('resolverTable')(), []); + return ( + <> + + + +

+ + {processName} +

+
+ + + {descriptionText} + + + + + + ); +}); +ProcessDetails.displayName = 'ProcessDetails'; diff --git a/x-pack/plugins/security_solution/public/resolver/view/process_event_dot.tsx b/x-pack/plugins/security_solution/public/resolver/view/process_event_dot.tsx index aed292e4a39d1..24de45ee894dc 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/process_event_dot.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/process_event_dot.tsx @@ -195,7 +195,7 @@ const UnstyledProcessEventDot = React.memo( * `beginElement` is by [w3](https://www.w3.org/TR/SVG11/animate.html#__smil__ElementTimeControl__beginElement) * but missing in [TSJS-lib-generator](https://github.com/microsoft/TSJS-lib-generator/blob/15a4678e0ef6de308e79451503e444e9949ee849/inputfiles/addedTypes.json#L1819) */ - beginElement: () => void; + beginElement?: () => void; }) | null; } = React.createRef(); @@ -238,10 +238,8 @@ const UnstyledProcessEventDot = React.memo( const { pushToQueryParams } = useResolverQueryParams(); const handleClick = useCallback(() => { - if (animationTarget.current !== null) { - // This works but the types are missing in the typescript DOM lib - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (animationTarget.current as any).beginElement(); + if (animationTarget.current?.beginElement) { + animationTarget.current.beginElement(); } dispatch({ type: 'userSelectedResolverNode', @@ -297,7 +295,8 @@ const UnstyledProcessEventDot = React.memo( */ return (
{ handleFocus(); handleClick(); - } /* a11y note: this is strictly an alternate to the button, so no tabindex is necessary*/ + } /* a11y note: this is strictly an alternate to the button, so no tabindex is necessary*/ } role="img" aria-labelledby={labelHTMLID} diff --git a/x-pack/plugins/security_solution/public/resolver/view/resolver_without_providers.tsx b/x-pack/plugins/security_solution/public/resolver/view/resolver_without_providers.tsx new file mode 100644 index 0000000000000..f444d5a25e1ef --- /dev/null +++ b/x-pack/plugins/security_solution/public/resolver/view/resolver_without_providers.tsx @@ -0,0 +1,139 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +/* eslint-disable no-duplicate-imports */ + +/* eslint-disable react/display-name */ + +import React, { useContext, useCallback } from 'react'; +import { useSelector } from 'react-redux'; +import { useEffectOnce } from 'react-use'; +import { EuiLoadingSpinner } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import * as selectors from '../store/selectors'; +import { EdgeLine } from './edge_line'; +import { GraphControls } from './graph_controls'; +import { ProcessEventDot } from './process_event_dot'; +import { useCamera } from './use_camera'; +import { SymbolDefinitions, useResolverTheme } from './assets'; +import { useStateSyncingActions } from './use_state_syncing_actions'; +import { useResolverQueryParams } from './use_resolver_query_params'; +import { StyledMapContainer, StyledPanel, GraphContainer } from './styles'; +import { entityId } from '../../../common/endpoint/models/event'; +import { SideEffectContext } from './side_effect_context'; +import { ResolverProps } from '../types'; + +/** + * The highest level connected Resolver component. Needs a `Provider` in its ancestry to work. + */ +export const ResolverWithoutProviders = React.memo( + /** + * Use `forwardRef` so that the `Simulator` used in testing can access the top level DOM element. + */ + React.forwardRef(function ( + { className, databaseDocumentID, resolverComponentInstanceID }: ResolverProps, + refToForward + ) { + /** + * This is responsible for dispatching actions that include any external data. + * `databaseDocumentID` + */ + useStateSyncingActions({ databaseDocumentID, resolverComponentInstanceID }); + + const { timestamp } = useContext(SideEffectContext); + + // use this for the entire render in order to keep things in sync + const timeAtRender = timestamp(); + + const { processNodePositions, connectingEdgeLineSegments } = useSelector( + selectors.visibleNodesAndEdgeLines + )(timeAtRender); + const terminatedProcesses = useSelector(selectors.terminatedProcesses); + const { projectionMatrix, ref: cameraRef, onMouseDown } = useCamera(); + + const ref = useCallback( + (element: HTMLDivElement | null) => { + // Supply `useCamera` with the ref + cameraRef(element); + + // If a ref is being forwarded, populate that as well. + if (typeof refToForward === 'function') { + refToForward(element); + } else if (refToForward !== null) { + refToForward.current = element; + } + }, + [cameraRef, refToForward] + ); + const isLoading = useSelector(selectors.isLoading); + const hasError = useSelector(selectors.hasError); + const activeDescendantId = useSelector(selectors.ariaActiveDescendant); + const { colorMap } = useResolverTheme(); + const { cleanUpQueryParams } = useResolverQueryParams(); + + useEffectOnce(() => { + return () => cleanUpQueryParams(); + }); + + return ( + + {isLoading ? ( +
+ +
+ ) : hasError ? ( +
+
+ {' '} + +
+
+ ) : ( + + {connectingEdgeLineSegments.map( + ({ points: [startPosition, endPosition], metadata }) => ( + + ) + )} + {[...processNodePositions].map(([processEvent, position]) => { + const processEntityId = entityId(processEvent); + return ( + + ); + })} + + )} + + + +
+ ); + }) +); diff --git a/x-pack/plugins/security_solution/public/resolver/view/side_effect_simulator.ts b/x-pack/plugins/security_solution/public/resolver/view/side_effect_simulator_factory.ts similarity index 95% rename from x-pack/plugins/security_solution/public/resolver/view/side_effect_simulator.ts rename to x-pack/plugins/security_solution/public/resolver/view/side_effect_simulator_factory.ts index 5e9073ba2d3c9..25be222e2fe4a 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/side_effect_simulator.ts +++ b/x-pack/plugins/security_solution/public/resolver/view/side_effect_simulator_factory.ts @@ -11,12 +11,13 @@ import { SideEffectSimulator } from '../types'; * Create mock `SideEffectors` for `SideEffectContext.Provider`. The `control` * object is used to control the mocks. */ -export const sideEffectSimulator: () => SideEffectSimulator = () => { +export const sideEffectSimulatorFactory: () => SideEffectSimulator = () => { // The set of mock `ResizeObserver` instances that currently exist const resizeObserverInstances: Set = new Set(); // A map of `Element`s to their fake `DOMRect`s - const contentRects: Map = new Map(); + // Use a `WeakMap` since elements can be removed from the DOM. + const contentRects: WeakMap = new Map(); /** * Simulate an element's size changing. This will trigger any `ResizeObserverCallback`s which diff --git a/x-pack/plugins/security_solution/public/resolver/view/use_camera.test.tsx b/x-pack/plugins/security_solution/public/resolver/view/use_camera.test.tsx index a27f157bc9364..b32d63283b547 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/use_camera.test.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/use_camera.test.tsx @@ -10,15 +10,16 @@ import { renderHook, act as hooksAct } from '@testing-library/react-hooks'; import { useCamera, useAutoUpdatingClientRect } from './use_camera'; import { Provider } from 'react-redux'; import * as selectors from '../store/selectors'; -import { storeFactory } from '../store'; import { Matrix3, ResolverStore, SideEffectSimulator } from '../types'; import { ResolverEvent } from '../../../common/endpoint/types'; import { SideEffectContext } from './side_effect_context'; import { applyMatrix3 } from '../models/vector2'; -import { sideEffectSimulator } from './side_effect_simulator'; +import { sideEffectSimulatorFactory } from './side_effect_simulator_factory'; import { mockProcessEvent } from '../models/process_event_test_helpers'; import { mock as mockResolverTree } from '../models/resolver_tree'; import { ResolverAction } from '../store/actions'; +import { createStore } from 'redux'; +import { resolverReducer } from '../store/reducer'; describe('useCamera on an unpainted element', () => { let element: HTMLElement; @@ -29,7 +30,7 @@ describe('useCamera on an unpainted element', () => { let simulator: SideEffectSimulator; beforeEach(async () => { - store = storeFactory(); + store = createStore(resolverReducer); const Test = function Test() { const camera = useCamera(); @@ -38,7 +39,7 @@ describe('useCamera on an unpainted element', () => { return
; }; - simulator = sideEffectSimulator(); + simulator = sideEffectSimulatorFactory(); reactRenderResult = render( diff --git a/x-pack/plugins/security_solution/public/resolver/view/use_resolver_query_params.ts b/x-pack/plugins/security_solution/public/resolver/view/use_resolver_query_params.ts index 84d954de6ef27..ed514a61d4e06 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/use_resolver_query_params.ts +++ b/x-pack/plugins/security_solution/public/resolver/view/use_resolver_query_params.ts @@ -20,12 +20,12 @@ export function useResolverQueryParams() { const history = useHistory(); const urlSearch = useLocation().search; const resolverComponentInstanceID = useSelector(selectors.resolverComponentInstanceID); - const uniqueCrumbIdKey: string = `resolver-id:${resolverComponentInstanceID}`; - const uniqueCrumbEventKey: string = `resolver-event:${resolverComponentInstanceID}`; + const uniqueCrumbIdKey: string = `resolver-${resolverComponentInstanceID}-id`; + const uniqueCrumbEventKey: string = `resolver-${resolverComponentInstanceID}-event`; const pushToQueryParams = useCallback( (newCrumbs: CrumbInfo) => { - // Construct a new set of params from the current set (minus empty params) - // by assigning the new set of params provided in `newCrumbs` + // Construct a new set of parameters from the current set (minus empty parameters) + // by assigning the new set of parameters provided in `newCrumbs` const crumbsToPass = { ...querystring.parse(urlSearch.slice(1)), [uniqueCrumbIdKey]: newCrumbs.crumbId, diff --git a/x-pack/plugins/security_solution/public/timelines/components/fields_browser/field_name.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/fields_browser/field_name.test.tsx index ddd5c6f07e8b5..2e48215a89473 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/fields_browser/field_name.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/fields_browser/field_name.test.tsx @@ -28,6 +28,10 @@ const defaultProps = { }; describe('FieldName', () => { + beforeEach(() => { + jest.useFakeTimers(); + }); + test('it renders the field name', () => { const wrapper = mount( @@ -48,6 +52,8 @@ describe('FieldName', () => { ); wrapper.find('[data-test-subj="withHoverActionsButton"]').at(0).simulate('mouseenter'); wrapper.update(); + jest.runAllTimers(); + wrapper.update(); expect(wrapper.find('[data-test-subj="copy-to-clipboard"]').exists()).toBe(true); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/helpers.test.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/helpers.test.ts index 8ba1a999e2b2a..c8adaa891610a 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/helpers.test.ts @@ -6,7 +6,13 @@ import { Ecs } from '../../../../graphql/types'; -import { eventHasNotes, eventIsPinned, getPinTooltip, stringifyEvent } from './helpers'; +import { + eventHasNotes, + eventIsPinned, + getPinTooltip, + stringifyEvent, + isInvestigateInResolverActionEnabled, +} from './helpers'; import { TimelineType } from '../../../../../common/types/timeline'; describe('helpers', () => { @@ -242,4 +248,54 @@ describe('helpers', () => { expect(eventIsPinned({ eventId, pinnedEventIds })).toEqual(false); }); }); + + describe('isInvestigateInResolverActionEnabled', () => { + it('returns false if agent.type does not equal endpoint', () => { + const data: Ecs = { _id: '1', agent: { type: ['blah'] } }; + + expect(isInvestigateInResolverActionEnabled(data)).toBeFalsy(); + }); + + it('returns false if agent.type does not have endpoint in first array index', () => { + const data: Ecs = { _id: '1', agent: { type: ['blah', 'endpoint'] } }; + + expect(isInvestigateInResolverActionEnabled(data)).toBeFalsy(); + }); + + it('returns false if process.entity_id is not defined', () => { + const data: Ecs = { _id: '1', agent: { type: ['endpoint'] } }; + + expect(isInvestigateInResolverActionEnabled(data)).toBeFalsy(); + }); + + it('returns true if agent.type has endpoint in first array index', () => { + const data: Ecs = { + _id: '1', + agent: { type: ['endpoint', 'blah'] }, + process: { entity_id: ['5'] }, + }; + + expect(isInvestigateInResolverActionEnabled(data)).toBeTruthy(); + }); + + it('returns false if multiple entity_ids', () => { + const data: Ecs = { + _id: '1', + agent: { type: ['endpoint', 'blah'] }, + process: { entity_id: ['5', '10'] }, + }; + + expect(isInvestigateInResolverActionEnabled(data)).toBeFalsy(); + }); + + it('returns false if entity_id is an empty string', () => { + const data: Ecs = { + _id: '1', + agent: { type: ['endpoint', 'blah'] }, + process: { entity_id: [''] }, + }; + + expect(isInvestigateInResolverActionEnabled(data)).toBeFalsy(); + }); + }); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/helpers.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/helpers.ts index 067cea175c99b..6a5e25632c29b 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/helpers.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/helpers.ts @@ -106,7 +106,8 @@ export const getEventType = (event: Ecs): Omit => { export const isInvestigateInResolverActionEnabled = (ecsData?: Ecs) => { return ( get(['agent', 'type', 0], ecsData) === 'endpoint' && - get(['process', 'entity_id'], ecsData)?.length > 0 + get(['process', 'entity_id'], ecsData)?.length === 1 && + get(['process', 'entity_id', 0], ecsData) !== '' ); }; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx index 452808e51c096..86334308558b8 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx @@ -17,7 +17,7 @@ import { EuiOverlayMask, EuiToolTip, } from '@elastic/eui'; -import React, { useCallback } from 'react'; +import React, { useCallback, useMemo } from 'react'; import uuid from 'uuid'; import styled from 'styled-components'; import { useDispatch, useSelector } from 'react-redux'; @@ -192,18 +192,28 @@ export const NewCase = React.memo( timelineTitle, ]); - return ( - - {buttonText} - + const button = useMemo( + () => ( + + {buttonText} + + ), + [compact, timelineStatus, handleClick, buttonText] + ); + return timelineStatus === TimelineStatus.draft ? ( + + {button} + + ) : ( + button ); } ); @@ -225,8 +235,8 @@ export const ExistingCase = React.memo( ? i18n.ATTACH_TO_EXISTING_CASE : i18n.ATTACH_TIMELINE_TO_EXISTING_CASE; - return ( - <> + const button = useMemo( + () => ( ( > {buttonText} - + ), + [buttonText, handleClick, timelineStatus, compact] + ); + return timelineStatus === TimelineStatus.draft ? ( + + {button} + + ) : ( + button ); } ); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/translations.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/translations.ts index 34681d5ed6809..1fc3b7b00f847 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/translations.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/translations.ts @@ -151,6 +151,13 @@ export const ATTACH_TO_EXISTING_CASE = i18n.translate( } ); +export const ATTACH_TIMELINE_TO_CASE_TOOLTIP = i18n.translate( + 'xpack.securitySolution.timeline.properties.attachTimelineToCaseTooltip', + { + defaultMessage: 'Please provide a title for your timeline in order to attach it to a case', + } +); + export const STREAM_LIVE = i18n.translate( 'xpack.securitySolution.timeline.properties.streamLiveButtonLabel', { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/search_super_select/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/search_super_select/index.tsx index 825d4fe3b29b1..3019a8add4e36 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/search_super_select/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/search_super_select/index.tsx @@ -4,19 +4,41 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiInputPopover, EuiSelectableOption, EuiSuperSelect } from '@elastic/eui'; +import { EuiInputPopover, EuiSelectableOption, EuiFieldText } from '@elastic/eui'; import React, { memo, useCallback, useMemo, useState } from 'react'; -import { createGlobalStyle } from 'styled-components'; +import styled from 'styled-components'; import { OpenTimelineResult } from '../../open_timeline/types'; import { SelectableTimeline } from '../selectable_timeline'; import * as i18n from '../translations'; import { TimelineType, TimelineTypeLiteral } from '../../../../../common/types/timeline'; -const SearchTimelineSuperSelectGlobalStyle = createGlobalStyle` - .euiPopover__panel.euiPopover__panel-isOpen.timeline-search-super-select-popover__popoverPanel { - visibility: hidden; - z-index: 0; +const StyledEuiFieldText = styled(EuiFieldText)` + padding-left: 12px; + padding-right: 40px; + + &[readonly] { + cursor: pointer; + background-size: 0 100%; + background-repeat: no-repeat; + + // To match EuiFieldText focus state + &:focus { + background-color: #fff; + background-image: linear-gradient( + to top, + #006bb4, + #006bb4 2px, + transparent 2px, + transparent 100% + ); + background-size: 100% 100%; + } + } + + & + .euiFormControlLayoutIcons { + left: unset; + right: 12px; } `; @@ -29,13 +51,6 @@ interface SearchTimelineSuperSelectProps { onTimelineChange: (timelineTitle: string, timelineId: string | null) => void; } -const basicSuperSelectOptions = [ - { - value: '-1', - inputDisplay: i18n.DEFAULT_TIMELINE_TITLE, - }, -]; - const getBasicSelectableOptions = (timelineId: string) => [ { description: i18n.DEFAULT_TIMELINE_DESCRIPTION, @@ -67,26 +82,15 @@ const SearchTimelineSuperSelectComponent: React.FC ( - ), - [handleOpenPopover, isDisabled, timelineId, timelineTitle] + [handleOpenPopover, isDisabled, timelineTitle] ); const handleGetSelectableOptions = useCallback( @@ -126,7 +130,6 @@ const SearchTimelineSuperSelectComponent: React.FC - ); }; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/selectable_timeline/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/selectable_timeline/index.tsx index ae8bf53090789..7ecbc9a53cb21 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/selectable_timeline/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/selectable_timeline/index.tsx @@ -165,7 +165,7 @@ const SelectableTimelineComponent: React.FC = ({ responsive={false} > - + diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.tsx index c27af94addeab..a2ee1e56306b5 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.tsx @@ -286,6 +286,7 @@ export const TimelineComponent: React.FC = ({ filterQuery={combinedQueries!.filterQuery} sortField={timelineQuerySortField} startDate={start} + queryDeduplication="timeline" > {({ events, diff --git a/x-pack/plugins/security_solution/public/timelines/containers/index.tsx b/x-pack/plugins/security_solution/public/timelines/containers/index.tsx index 510d58dbe6a69..562999108b4b0 100644 --- a/x-pack/plugins/security_solution/public/timelines/containers/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/containers/index.tsx @@ -58,6 +58,7 @@ export interface OwnProps extends QueryTemplateProps { sortField: SortField; fields: string[]; startDate: string; + queryDeduplication: string; } type TimelineQueryProps = OwnProps & PropsFromRedux & WithKibanaProps & CustomReduxProps; @@ -93,6 +94,7 @@ class TimelineQueryComponent extends QueryTemplate< sourceId, sortField, startDate, + queryDeduplication, } = this.props; const defaultKibanaIndex = kibana.services.uiSettings.get(DEFAULT_INDEX_KEY); const defaultIndex = @@ -102,7 +104,11 @@ class TimelineQueryComponent extends QueryTemplate< ...(['all', 'alert', 'signal'].includes(eventType) ? indexToAdd : []), ] : indexPattern?.title.split(',') ?? []; - const variables: GetTimelineQuery.Variables = { + // Fun fact: When using this hook multiple times within a component (e.g. add_exception_modal & edit_exception_modal), + // the apolloClient will perform queryDeduplication and prevent the first query from executing. A deep compare is not + // performed on `indices`, so another field must be passed to circumvent this. + // For details, see https://github.com/apollographql/react-apollo/issues/2202 + const variables: GetTimelineQuery.Variables & { queryDeduplication: string } = { fieldRequested: fields, filterQuery: createFilter(filterQuery), sourceId, @@ -116,6 +122,7 @@ class TimelineQueryComponent extends QueryTemplate< defaultIndex, docValueFields: docValueFields ?? [], inspect: isInspected, + queryDeduplication, }; return ( diff --git a/x-pack/plugins/security_solution/server/config.ts b/x-pack/plugins/security_solution/server/config.ts index f7d961ae3ec5c..e2c06ae9f931f 100644 --- a/x-pack/plugins/security_solution/server/config.ts +++ b/x-pack/plugins/security_solution/server/config.ts @@ -29,6 +29,12 @@ export const configSchema = schema.object({ from: schema.string({ defaultValue: 'now-15m' }), to: schema.string({ defaultValue: 'now' }), }), + + /** + * Artifacts Configuration + */ + packagerTaskInterval: schema.string({ defaultValue: '60s' }), + validateArtifactDownloads: schema.boolean({ defaultValue: true }), }); export const createConfig$ = (context: PluginInitializerContext) => diff --git a/x-pack/plugins/security_solution/server/endpoint/config.ts b/x-pack/plugins/security_solution/server/endpoint/config.ts index 908e14468c5c7..6a3644f7aaf71 100644 --- a/x-pack/plugins/security_solution/server/endpoint/config.ts +++ b/x-pack/plugins/security_solution/server/endpoint/config.ts @@ -27,6 +27,12 @@ export const EndpointConfigSchema = schema.object({ from: schema.string({ defaultValue: 'now-15m' }), to: schema.string({ defaultValue: 'now' }), }), + + /** + * Artifacts Configuration + */ + packagerTaskInterval: schema.string({ defaultValue: '60s' }), + validateArtifactDownloads: schema.boolean({ defaultValue: true }), }); export function createConfig$(context: PluginInitializerContext) { diff --git a/x-pack/plugins/security_solution/server/endpoint/ingest_integration.test.ts b/x-pack/plugins/security_solution/server/endpoint/ingest_integration.test.ts index be749b2ebd25a..03999715dfc71 100644 --- a/x-pack/plugins/security_solution/server/endpoint/ingest_integration.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/ingest_integration.test.ts @@ -12,7 +12,6 @@ import { ManifestManagerMockType, } from './services/artifacts/manifest_manager/manifest_manager.mock'; import { getPackageConfigCreateCallback } from './ingest_integration'; -import { ManifestConstants } from './lib/artifacts'; describe('ingest_integration tests ', () => { describe('ingest_integration sanity checks', () => { @@ -30,16 +29,6 @@ describe('ingest_integration tests ', () => { expect(newPolicyConfig.inputs[0]!.config!.policy.value).toEqual(policyConfigFactory()); expect(newPolicyConfig.inputs[0]!.config!.artifact_manifest.value).toEqual({ artifacts: { - 'endpoint-exceptionlist-linux-v1': { - compression_algorithm: 'zlib', - decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', - decoded_size: 14, - encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', - encoded_size: 22, - encryption_algorithm: 'none', - relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', - }, 'endpoint-exceptionlist-macos-v1': { compression_algorithm: 'zlib', decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', @@ -61,7 +50,7 @@ describe('ingest_integration tests ', () => { '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, }, - manifest_version: 'a9b7ef358a363f327f479e31efc4f228b2277a7fb4d1914ca9b4e7ca9ffcf537', + manifest_version: '1.0.0', schema_version: 'v1', }); }); @@ -70,9 +59,7 @@ describe('ingest_integration tests ', () => { const logger = loggingSystemMock.create().get('ingest_integration.test'); const manifestManager = getManifestManagerMock(); manifestManager.pushArtifacts = jest.fn().mockResolvedValue([new Error('error updating')]); - const lastComputed = await manifestManager.getLastComputedManifest( - ManifestConstants.SCHEMA_VERSION - ); + const lastComputed = await manifestManager.getLastComputedManifest(); const callback = getPackageConfigCreateCallback(logger, manifestManager); const policyConfig = createNewPackageConfigMock(); @@ -90,9 +77,7 @@ describe('ingest_integration tests ', () => { const manifestManager = getManifestManagerMock({ mockType: ManifestManagerMockType.InitialSystemState, }); - const lastComputed = await manifestManager.getLastComputedManifest( - ManifestConstants.SCHEMA_VERSION - ); + const lastComputed = await manifestManager.getLastComputedManifest(); expect(lastComputed).toEqual(null); manifestManager.buildNewManifest = jest.fn().mockRejectedValue(new Error('abcd')); @@ -107,9 +92,7 @@ describe('ingest_integration tests ', () => { test('subsequent policy creations succeed', async () => { const logger = loggingSystemMock.create().get('ingest_integration.test'); const manifestManager = getManifestManagerMock(); - const lastComputed = await manifestManager.getLastComputedManifest( - ManifestConstants.SCHEMA_VERSION - ); + const lastComputed = await manifestManager.getLastComputedManifest(); manifestManager.buildNewManifest = jest.fn().mockResolvedValue(lastComputed); // no diffs const callback = getPackageConfigCreateCallback(logger, manifestManager); diff --git a/x-pack/plugins/security_solution/server/endpoint/ingest_integration.ts b/x-pack/plugins/security_solution/server/endpoint/ingest_integration.ts index 11d4b12d0b76a..695267f322857 100644 --- a/x-pack/plugins/security_solution/server/endpoint/ingest_integration.ts +++ b/x-pack/plugins/security_solution/server/endpoint/ingest_integration.ts @@ -10,7 +10,7 @@ import { factory as policyConfigFactory } from '../../common/endpoint/models/pol import { NewPolicyData } from '../../common/endpoint/types'; import { ManifestManager } from './services/artifacts'; import { Manifest } from './lib/artifacts'; -import { reportErrors, ManifestConstants } from './lib/artifacts/common'; +import { reportErrors } from './lib/artifacts/common'; import { InternalArtifactCompleteSchema } from './schemas/artifacts'; import { manifestDispatchSchema } from '../../common/endpoint/schema/manifest'; @@ -18,14 +18,14 @@ const getManifest = async (logger: Logger, manifestManager: ManifestManager): Pr let manifest: Manifest | null = null; try { - manifest = await manifestManager.getLastComputedManifest(ManifestConstants.SCHEMA_VERSION); + manifest = await manifestManager.getLastComputedManifest(); // If we have not yet computed a manifest, then we have to do so now. This should only happen // once. if (manifest == null) { // New computed manifest based on current state of exception list - const newManifest = await manifestManager.buildNewManifest(ManifestConstants.SCHEMA_VERSION); - const diffs = newManifest.diff(Manifest.getDefault(ManifestConstants.SCHEMA_VERSION)); + const newManifest = await manifestManager.buildNewManifest(); + const diffs = newManifest.diff(Manifest.getDefault()); // Compress new artifacts const adds = diffs.filter((diff) => diff.type === 'add').map((diff) => diff.id); @@ -63,7 +63,7 @@ const getManifest = async (logger: Logger, manifestManager: ManifestManager): Pr logger.error(err); } - return manifest ?? Manifest.getDefault(ManifestConstants.SCHEMA_VERSION); + return manifest ?? Manifest.getDefault(); }; /** diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/common.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/common.ts index 7298a9bfa72a6..7f90aa7b91063 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/common.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/common.ts @@ -13,13 +13,11 @@ import { export const ArtifactConstants = { GLOBAL_ALLOWLIST_NAME: 'endpoint-exceptionlist', SAVED_OBJECT_TYPE: 'endpoint:user-artifact', - SUPPORTED_OPERATING_SYSTEMS: ['linux', 'macos', 'windows'], - SCHEMA_VERSION: 'v1', + SUPPORTED_OPERATING_SYSTEMS: ['macos', 'windows'], }; export const ManifestConstants = { SAVED_OBJECT_TYPE: 'endpoint:user-artifact-manifest', - SCHEMA_VERSION: 'v1', }; export const getArtifactId = (artifact: InternalArtifactSchema) => { diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/lists.test.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/lists.test.ts index bb8b4fb3d5ce7..fea3b2b9a4526 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/lists.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/lists.test.ts @@ -314,21 +314,23 @@ describe('buildEventTypeSignal', () => { test('it should convert the exception lists response to the proper endpoint format while paging', async () => { // The first call returns two exceptions const first = getFoundExceptionListItemSchemaMock(); + first.per_page = 2; + first.total = 4; first.data.push(getExceptionListItemSchemaMock()); // The second call returns two exceptions const second = getFoundExceptionListItemSchemaMock(); + second.per_page = 2; + second.total = 4; second.data.push(getExceptionListItemSchemaMock()); - // The third call returns no exceptions, paging stops - const third = getFoundExceptionListItemSchemaMock(); - third.data = []; mockExceptionClient.findExceptionListItem = jest .fn() .mockReturnValueOnce(first) - .mockReturnValueOnce(second) - .mockReturnValueOnce(third); + .mockReturnValueOnce(second); + const resp = await getFullEndpointExceptionList(mockExceptionClient, 'linux', 'v1'); + // Expect 2 exceptions, the first two calls returned the same exception list items expect(resp.entries.length).toEqual(2); }); diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/lists.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/lists.ts index 5998a88527f2f..e41781dd605a0 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/lists.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/lists.ts @@ -79,10 +79,10 @@ export async function getFullEndpointExceptionList( schemaVersion: string ): Promise { const exceptions: WrappedTranslatedExceptionList = { entries: [] }; - let numResponses = 0; let page = 1; + let paging = true; - do { + while (paging) { const response = await eClient.findExceptionListItem({ listId: ENDPOINT_LIST_ID, namespaceType: 'agnostic', @@ -94,17 +94,16 @@ export async function getFullEndpointExceptionList( }); if (response?.data !== undefined) { - numResponses = response.data.length; - exceptions.entries = exceptions.entries.concat( translateToEndpointExceptions(response, schemaVersion) ); + paging = (page - 1) * 100 + response.data.length < response.total; page++; } else { break; } - } while (numResponses > 0); + } const [validated, errors] = validate(exceptions, wrappedTranslatedExceptionList); if (errors != null) { diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.test.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.test.ts index 95587c6fc105d..3d70f7266277f 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.test.ts @@ -6,7 +6,7 @@ import { ManifestSchemaVersion } from '../../../../common/endpoint/schema/common'; import { InternalArtifactCompleteSchema } from '../../schemas'; -import { ManifestConstants, getArtifactId } from './common'; +import { getArtifactId } from './common'; import { Manifest } from './manifest'; import { getMockArtifacts, @@ -30,29 +30,21 @@ describe('manifest', () => { }); test('Can create manifest with valid schema version', () => { - const manifest = new Manifest('v1'); + const manifest = new Manifest(); expect(manifest).toBeInstanceOf(Manifest); }); test('Cannot create manifest with invalid schema version', () => { expect(() => { - new Manifest('abcd' as ManifestSchemaVersion); + new Manifest({ + schemaVersion: 'abcd' as ManifestSchemaVersion, + }); }).toThrow(); }); test('Empty manifest transforms correctly to expected endpoint format', async () => { expect(emptyManifest.toEndpointFormat()).toStrictEqual({ artifacts: { - 'endpoint-exceptionlist-linux-v1': { - compression_algorithm: 'zlib', - encryption_algorithm: 'none', - decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', - encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', - decoded_size: 14, - encoded_size: 22, - relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', - }, 'endpoint-exceptionlist-macos-v1': { compression_algorithm: 'zlib', encryption_algorithm: 'none', @@ -74,7 +66,7 @@ describe('manifest', () => { '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, }, - manifest_version: 'a9b7ef358a363f327f479e31efc4f228b2277a7fb4d1914ca9b4e7ca9ffcf537', + manifest_version: '1.0.0', schema_version: 'v1', }); }); @@ -82,16 +74,6 @@ describe('manifest', () => { test('Manifest transforms correctly to expected endpoint format', async () => { expect(manifest1.toEndpointFormat()).toStrictEqual({ artifacts: { - 'endpoint-exceptionlist-linux-v1': { - compression_algorithm: 'zlib', - encryption_algorithm: 'none', - decoded_sha256: '96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', - encoded_sha256: '975382ab55d019cbab0bbac207a54e2a7d489fad6e8f6de34fc6402e5ef37b1e', - decoded_size: 432, - encoded_size: 147, - relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-linux-v1/96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', - }, 'endpoint-exceptionlist-macos-v1': { compression_algorithm: 'zlib', encryption_algorithm: 'none', @@ -113,15 +95,16 @@ describe('manifest', () => { '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', }, }, - manifest_version: 'a7f4760bfa2662e85e30fe4fb8c01b4c4a20938c76ab21d3c5a3e781e547cce7', + manifest_version: '1.0.0', schema_version: 'v1', }); }); test('Manifest transforms correctly to expected saved object format', async () => { expect(manifest1.toSavedObject()).toStrictEqual({ + schemaVersion: 'v1', + semanticVersion: '1.0.0', ids: [ - 'endpoint-exceptionlist-linux-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', 'endpoint-exceptionlist-macos-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', 'endpoint-exceptionlist-windows-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', ], @@ -133,12 +116,12 @@ describe('manifest', () => { expect(diffs).toEqual([ { id: - 'endpoint-exceptionlist-linux-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', + 'endpoint-exceptionlist-macos-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', type: 'delete', }, { id: - 'endpoint-exceptionlist-linux-v1-0a5a2013a79f9e60682472284a1be45ab1ff68b9b43426d00d665016612c15c8', + 'endpoint-exceptionlist-macos-v1-0a5a2013a79f9e60682472284a1be45ab1ff68b9b43426d00d665016612c15c8', type: 'add', }, ]); @@ -154,7 +137,6 @@ describe('manifest', () => { const entries = manifest1.getEntries(); const keys = Object.keys(entries); expect(keys).toEqual([ - 'endpoint-exceptionlist-linux-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', 'endpoint-exceptionlist-macos-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', 'endpoint-exceptionlist-windows-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', ]); @@ -168,13 +150,8 @@ describe('manifest', () => { }); test('Manifest can be created from list of artifacts', async () => { - const oldManifest = new Manifest(ManifestConstants.SCHEMA_VERSION); - const manifest = Manifest.fromArtifacts(artifacts, 'v1', oldManifest); - expect( - manifest.contains( - 'endpoint-exceptionlist-linux-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3' - ) - ).toEqual(true); + const oldManifest = new Manifest(); + const manifest = Manifest.fromArtifacts(artifacts, oldManifest); expect( manifest.contains( 'endpoint-exceptionlist-macos-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3' diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.ts index 6ece2bf0f48e8..9e0e940ea9a1d 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/manifest.ts @@ -3,8 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ - -import { createHash } from 'crypto'; +import semver from 'semver'; import { validate } from '../../../../common/validate'; import { InternalArtifactSchema, @@ -13,13 +12,15 @@ import { InternalArtifactCompleteSchema, } from '../../schemas/artifacts'; import { - manifestSchemaVersion, ManifestSchemaVersion, + SemanticVersion, + semanticVersion, } from '../../../../common/endpoint/schema/common'; -import { ManifestSchema, manifestSchema } from '../../../../common/endpoint/schema/manifest'; +import { manifestSchema, ManifestSchema } from '../../../../common/endpoint/schema/manifest'; import { ManifestEntry } from './manifest_entry'; import { maybeCompressArtifact, isCompressed } from './lists'; import { getArtifactId } from './common'; +import { ManifestVersion, manifestVersion } from '../../schemas/artifacts/manifest'; export interface ManifestDiff { type: string; @@ -28,37 +29,39 @@ export interface ManifestDiff { export class Manifest { private entries: Record; - private schemaVersion: ManifestSchemaVersion; - - // For concurrency control - private version: string | undefined; + private version: ManifestVersion; - constructor(schemaVersion: string, version?: string) { + constructor(version?: Partial) { this.entries = {}; - this.version = version; - const [validated, errors] = validate( - (schemaVersion as unknown) as object, - manifestSchemaVersion - ); + const decodedVersion = { + schemaVersion: version?.schemaVersion ?? 'v1', + semanticVersion: version?.semanticVersion ?? '1.0.0', + soVersion: version?.soVersion, + }; + const [validated, errors] = validate(decodedVersion, manifestVersion); if (errors != null || validated === null) { - throw new Error(`Invalid manifest schema version: ${schemaVersion}`); + throw new Error(errors ?? 'Invalid version format.'); } - this.schemaVersion = validated; + this.version = validated; } - public static getDefault(schemaVersion: string) { - return new Manifest(schemaVersion); + public static getDefault(schemaVersion?: ManifestSchemaVersion) { + return new Manifest({ schemaVersion, semanticVersion: '1.0.0' }); } public static fromArtifacts( artifacts: InternalArtifactCompleteSchema[], - schemaVersion: string, - oldManifest: Manifest + oldManifest: Manifest, + schemaVersion?: ManifestSchemaVersion ): Manifest { - const manifest = new Manifest(schemaVersion, oldManifest.getSoVersion()); + const manifest = new Manifest({ + schemaVersion, + semanticVersion: oldManifest.getSemanticVersion(), + soVersion: oldManifest.getSavedObjectVersion(), + }); artifacts.forEach((artifact) => { const id = getArtifactId(artifact); const existingArtifact = oldManifest.getArtifact(id); @@ -71,25 +74,12 @@ export class Manifest { return manifest; } - public static fromPkgConfig(manifestPkgConfig: ManifestSchema): Manifest | null { - if (manifestSchema.is(manifestPkgConfig)) { - const manifest = new Manifest(manifestPkgConfig.schema_version); - for (const [identifier, artifactRecord] of Object.entries(manifestPkgConfig.artifacts)) { - const artifact = { - identifier, - compressionAlgorithm: artifactRecord.compression_algorithm, - encryptionAlgorithm: artifactRecord.encryption_algorithm, - decodedSha256: artifactRecord.decoded_sha256, - decodedSize: artifactRecord.decoded_size, - encodedSha256: artifactRecord.encoded_sha256, - encodedSize: artifactRecord.encoded_size, - }; - manifest.addEntry(artifact); - } - return manifest; - } else { - return null; + public bumpSemanticVersion() { + const newSemanticVersion = semver.inc(this.getSemanticVersion(), 'patch'); + if (!semanticVersion.is(newSemanticVersion)) { + throw new Error(`Invalid semver: ${newSemanticVersion}`); } + this.version.semanticVersion = newSemanticVersion; } public async compressArtifact(id: string): Promise { @@ -112,30 +102,16 @@ export class Manifest { return null; } - public equals(manifest: Manifest): boolean { - return this.getSha256() === manifest.getSha256(); - } - - public getSha256(): string { - let sha256 = createHash('sha256'); - Object.keys(this.entries) - .sort() - .forEach((docId) => { - sha256 = sha256.update(docId); - }); - return sha256.digest('hex'); - } - public getSchemaVersion(): ManifestSchemaVersion { - return this.schemaVersion; + return this.version.schemaVersion; } - public getSoVersion(): string | undefined { - return this.version; + public getSavedObjectVersion(): string | undefined { + return this.version.soVersion; } - public setSoVersion(version: string) { - this.version = version; + public getSemanticVersion(): SemanticVersion { + return this.version.semanticVersion; } public addEntry(artifact: InternalArtifactSchema) { @@ -179,8 +155,8 @@ export class Manifest { public toEndpointFormat(): ManifestSchema { const manifestObj: ManifestSchema = { - manifest_version: this.getSha256(), - schema_version: this.schemaVersion, + manifest_version: this.getSemanticVersion(), + schema_version: this.getSchemaVersion(), artifacts: {}, }; @@ -198,7 +174,9 @@ export class Manifest { public toSavedObject(): InternalManifestSchema { return { - ids: Object.keys(this.entries), + ids: Object.keys(this.getEntries()), + schemaVersion: this.getSchemaVersion(), + semanticVersion: this.getSemanticVersion(), }; } } diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/mocks.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/mocks.ts index 0ec6cb2bd61b3..62fff4715b562 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/mocks.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/mocks.ts @@ -29,7 +29,7 @@ export const getMockArtifactsWithDiff = async (opts?: { compress: boolean }) => return Promise.all( ArtifactConstants.SUPPORTED_OPERATING_SYSTEMS.map>( async (os) => { - if (os === 'linux') { + if (os === 'macos') { return getInternalArtifactMockWithDiffs(os, 'v1'); } return getInternalArtifactMock(os, 'v1', opts); @@ -49,21 +49,21 @@ export const getEmptyMockArtifacts = async (opts?: { compress: boolean }) => { }; export const getMockManifest = async (opts?: { compress: boolean }) => { - const manifest = new Manifest('v1'); + const manifest = new Manifest(); const artifacts = await getMockArtifacts(opts); artifacts.forEach((artifact) => manifest.addEntry(artifact)); return manifest; }; export const getMockManifestWithDiffs = async (opts?: { compress: boolean }) => { - const manifest = new Manifest('v1'); + const manifest = new Manifest(); const artifacts = await getMockArtifactsWithDiff(opts); artifacts.forEach((artifact) => manifest.addEntry(artifact)); return manifest; }; export const getEmptyMockManifest = async (opts?: { compress: boolean }) => { - const manifest = new Manifest('v1'); + const manifest = new Manifest(); const artifacts = await getEmptyMockArtifacts(opts); artifacts.forEach((artifact) => manifest.addEntry(artifact)); return manifest; @@ -74,16 +74,6 @@ export const createPackageConfigWithInitialManifestMock = (): PackageConfig => { packageConfig.inputs[0].config!.artifact_manifest = { value: { artifacts: { - 'endpoint-exceptionlist-linux-v1': { - compression_algorithm: 'zlib', - encryption_algorithm: 'none', - decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', - encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', - decoded_size: 14, - encoded_size: 22, - relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', - }, 'endpoint-exceptionlist-macos-v1': { compression_algorithm: 'zlib', encryption_algorithm: 'none', @@ -105,7 +95,7 @@ export const createPackageConfigWithInitialManifestMock = (): PackageConfig => { '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', }, }, - manifest_version: 'a9b7ef358a363f327f479e31efc4f228b2277a7fb4d1914ca9b4e7ca9ffcf537', + manifest_version: '1.0.0', schema_version: 'v1', }, }; @@ -117,16 +107,6 @@ export const createPackageConfigWithManifestMock = (): PackageConfig => { packageConfig.inputs[0].config!.artifact_manifest = { value: { artifacts: { - 'endpoint-exceptionlist-linux-v1': { - compression_algorithm: 'zlib', - encryption_algorithm: 'none', - decoded_sha256: '0a5a2013a79f9e60682472284a1be45ab1ff68b9b43426d00d665016612c15c8', - encoded_sha256: '57941169bb2c5416f9bd7224776c8462cb9a2be0fe8b87e6213e77a1d29be824', - decoded_size: 292, - encoded_size: 131, - relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-linux-v1/0a5a2013a79f9e60682472284a1be45ab1ff68b9b43426d00d665016612c15c8', - }, 'endpoint-exceptionlist-macos-v1': { compression_algorithm: 'zlib', encryption_algorithm: 'none', @@ -148,7 +128,7 @@ export const createPackageConfigWithManifestMock = (): PackageConfig => { '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', }, }, - manifest_version: '520f6cf88b3f36a065c6ca81058d5f8690aadadf6fe857f8dec4cc37589e7283', + manifest_version: '1.0.1', schema_version: 'v1', }, }; diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/saved_object_mappings.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/saved_object_mappings.ts index 0fb433df95de3..734304516e37e 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/saved_object_mappings.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/saved_object_mappings.ts @@ -55,7 +55,13 @@ export const manifestSavedObjectMappings: SavedObjectsType['mappings'] = { type: 'date', index: false, }, - // array of doc ids + schemaVersion: { + type: 'keyword', + }, + semanticVersion: { + type: 'keyword', + index: false, + }, ids: { type: 'keyword', index: false, diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/task.test.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/task.test.ts index daa8a7dd83ee0..32d58da5c3b78 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/task.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/task.test.ts @@ -38,7 +38,7 @@ describe('task', () => { taskManager: mockTaskManagerSetup, }); const mockTaskManagerStart = taskManagerMock.createStart(); - manifestTask.start({ taskManager: mockTaskManagerStart }); + await manifestTask.start({ taskManager: mockTaskManagerStart }); expect(mockTaskManagerStart.ensureScheduled).toHaveBeenCalled(); }); diff --git a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/task.ts b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/task.ts index ba164059866ea..4f2dbdf7644e2 100644 --- a/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/task.ts +++ b/x-pack/plugins/security_solution/server/endpoint/lib/artifacts/task.ts @@ -3,7 +3,6 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ - import { Logger } from 'src/core/server'; import { ConcreteTaskInstance, @@ -11,7 +10,7 @@ import { TaskManagerStartContract, } from '../../../../../task_manager/server'; import { EndpointAppContext } from '../../types'; -import { reportErrors, ManifestConstants } from './common'; +import { reportErrors } from './common'; import { InternalArtifactCompleteSchema } from '../../schemas/artifacts'; export const ManifestTaskConstants = { @@ -45,7 +44,23 @@ export class ManifestTask { createTaskRunner: ({ taskInstance }: { taskInstance: ConcreteTaskInstance }) => { return { run: async () => { + const taskInterval = (await this.endpointAppContext.config()).packagerTaskInterval; await this.runTask(taskInstance.id); + const nextRun = new Date(); + if (taskInterval.endsWith('s')) { + const seconds = parseInt(taskInterval.slice(0, -1), 10); + nextRun.setSeconds(nextRun.getSeconds() + seconds); + } else if (taskInterval.endsWith('m')) { + const minutes = parseInt(taskInterval.slice(0, -1), 10); + nextRun.setMinutes(nextRun.getMinutes() + minutes); + } else { + this.logger.error(`Invalid task interval: ${taskInterval}`); + return; + } + return { + state: {}, + runAt: nextRun, + }; }, cancel: async () => {}, }; @@ -61,7 +76,7 @@ export class ManifestTask { taskType: ManifestTaskConstants.TYPE, scope: ['securitySolution'], schedule: { - interval: '60s', + interval: (await this.endpointAppContext.config()).packagerTaskInterval, }, state: {}, params: { version: ManifestTaskConstants.VERSION }, @@ -92,19 +107,14 @@ export class ManifestTask { try { // Last manifest we computed, which was saved to ES - const oldManifest = await manifestManager.getLastComputedManifest( - ManifestConstants.SCHEMA_VERSION - ); + const oldManifest = await manifestManager.getLastComputedManifest(); if (oldManifest == null) { this.logger.debug('User manifest not available yet.'); return; } // New computed manifest based on current state of exception list - const newManifest = await manifestManager.buildNewManifest( - ManifestConstants.SCHEMA_VERSION, - oldManifest - ); + const newManifest = await manifestManager.buildNewManifest(oldManifest); const diffs = newManifest.diff(oldManifest); // Compress new artifacts @@ -131,6 +141,7 @@ export class ManifestTask { // Commit latest manifest state, if different if (diffs.length) { + newManifest.bumpSemanticVersion(); const error = await manifestManager.commit(newManifest); if (error) { throw error; diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_exception_list.ts b/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_exception_list.ts index 38e900c4d5015..d825841f1e257 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_exception_list.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/artifacts/download_exception_list.ts @@ -3,7 +3,6 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ - import { IRouter, SavedObjectsClientContract, @@ -14,7 +13,6 @@ import { import LRU from 'lru-cache'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { authenticateAgentWithAccessToken } from '../../../../../ingest_manager/server/services/agents/authenticate'; -import { validate } from '../../../../common/validate'; import { LIMITED_CONCURRENCY_ENDPOINT_ROUTE_TAG } from '../../../../common/endpoint/constants'; import { buildRouteValidation } from '../../../utils/build_validation/route_validation'; import { ArtifactConstants } from '../../lib/artifacts'; @@ -63,6 +61,7 @@ export function registerDownloadExceptionListRoute( } } + const validateDownload = (await endpointContext.config()).validateArtifactDownloads; const buildAndValidateResponse = (artName: string, body: Buffer): IKibanaResponse => { const artifact: HttpResponseOptions = { body, @@ -72,11 +71,10 @@ export function registerDownloadExceptionListRoute( }, }; - const [validated, errors] = validate(artifact, downloadArtifactResponseSchema); - if (errors !== null || validated === null) { - return res.internalError({ body: errors! }); + if (validateDownload && !downloadArtifactResponseSchema.is(artifact)) { + return res.internalError({ body: 'Artifact failed to validate.' }); } else { - return res.ok((validated as unknown) as HttpResponseOptions); + return res.ok(artifact); } }; diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/resolver/entity.ts b/x-pack/plugins/security_solution/server/endpoint/routes/resolver/entity.ts index ae91201646103..c79bcda71de9b 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/resolver/entity.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/resolver/entity.ts @@ -70,6 +70,13 @@ export function handleEntities(): RequestHandler implements MSearchQuer } private buildQuery(ids: string | string[]): { query: JsonObject; index: string | string[] } { - const idsArray = ResolverQuery.createIdsArray(ids); + // only accept queries for entity_ids that are not an empty string + const idsArray = ResolverQuery.createIdsArray(ids).filter((id) => id !== ''); if (this.endpointID) { return { query: this.legacyQuery(this.endpointID, idsArray), index: legacyEventIndexPattern }; } diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/resolver/queries/children.ts b/x-pack/plugins/security_solution/server/endpoint/routes/resolver/queries/children.ts index 7fd3808662baa..d99533e23f2c2 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/resolver/queries/children.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/resolver/queries/children.ts @@ -74,6 +74,18 @@ export class ChildrenQuery extends ResolverQuery { ], }, }, + { + exists: { + field: 'process.entity_id', + }, + }, + { + bool: { + must_not: { + term: { 'process.entity_id': '' }, + }, + }, + }, { term: { 'event.category': 'process' }, }, diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/resolver/utils/children_helper.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/resolver/utils/children_helper.test.ts index ca5b5aef0f651..01dd59b2611d9 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/resolver/utils/children_helper.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/resolver/utils/children_helper.test.ts @@ -10,12 +10,12 @@ import { TreeNode, } from '../../../../../common/endpoint/generate_data'; import { ChildrenNodesHelper } from './children_helper'; -import { eventId, isProcessStart } from '../../../../../common/endpoint/models/event'; +import { eventId, isStart } from '../../../../../common/endpoint/models/event'; function getStartEvents(events: Event[]): Event[] { const startEvents: Event[] = []; for (const event of events) { - if (isProcessStart(event)) { + if (isStart(event)) { startEvents.push(event); } } diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/resolver/utils/children_helper.ts b/x-pack/plugins/security_solution/server/endpoint/routes/resolver/utils/children_helper.ts index 01e356682ac47..d3ca7a54c16d2 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/resolver/utils/children_helper.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/resolver/utils/children_helper.ts @@ -7,7 +7,7 @@ import { entityId, parentEntityId, - isProcessStart, + isStart, getAncestryAsArray, } from '../../../../../common/endpoint/models/event'; import { @@ -99,7 +99,7 @@ export class ChildrenNodesHelper { for (const event of startEvents) { const parentID = parentEntityId(event); const entityID = entityId(event); - if (parentID && entityID && isProcessStart(event)) { + if (parentID && entityID && isStart(event)) { // don't actually add the start event to the node, because that'll be done in // a different call const childNode = this.getOrCreateChildNode(entityID); diff --git a/x-pack/plugins/security_solution/server/endpoint/schemas/artifacts/manifest.ts b/x-pack/plugins/security_solution/server/endpoint/schemas/artifacts/manifest.ts new file mode 100644 index 0000000000000..707d4c1374fe2 --- /dev/null +++ b/x-pack/plugins/security_solution/server/endpoint/schemas/artifacts/manifest.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as t from 'io-ts'; +import { manifestSchemaVersion, semanticVersion } from '../../../../common/endpoint/schema/common'; + +const optionalVersions = t.partial({ + soVersion: t.string, +}); + +export const manifestVersion = t.intersection([ + optionalVersions, + t.exact( + t.type({ + schemaVersion: manifestSchemaVersion, + semanticVersion, + }) + ), +]); +export type ManifestVersion = t.TypeOf; diff --git a/x-pack/plugins/security_solution/server/endpoint/schemas/artifacts/saved_objects.mock.ts b/x-pack/plugins/security_solution/server/endpoint/schemas/artifacts/saved_objects.mock.ts index d95627601a183..ae565f785c399 100644 --- a/x-pack/plugins/security_solution/server/endpoint/schemas/artifacts/saved_objects.mock.ts +++ b/x-pack/plugins/security_solution/server/endpoint/schemas/artifacts/saved_objects.mock.ts @@ -53,4 +53,6 @@ export const getInternalArtifactMockWithDiffs = async ( export const getInternalManifestMock = (): InternalManifestSchema => ({ ids: [], + schemaVersion: 'v1', + semanticVersion: '1.0.0', }); diff --git a/x-pack/plugins/security_solution/server/endpoint/schemas/artifacts/saved_objects.ts b/x-pack/plugins/security_solution/server/endpoint/schemas/artifacts/saved_objects.ts index 4dea916dcb436..56f247b65d802 100644 --- a/x-pack/plugins/security_solution/server/endpoint/schemas/artifacts/saved_objects.ts +++ b/x-pack/plugins/security_solution/server/endpoint/schemas/artifacts/saved_objects.ts @@ -9,8 +9,10 @@ import { compressionAlgorithm, encryptionAlgorithm, identifier, + semanticVersion, sha256, size, + manifestSchemaVersion, } from '../../../../common/endpoint/schema/common'; import { created } from './common'; @@ -58,6 +60,8 @@ export type InternalArtifactCreateSchema = t.TypeOf; diff --git a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_client.ts b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_client.ts index 385f115e6301a..e55243f0650a5 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_client.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_client.ts @@ -3,7 +3,6 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ - import { SavedObject, SavedObjectsClientContract, diff --git a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.test.ts b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.test.ts index c838f772fb66b..d99d6a959d7aa 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.test.ts @@ -16,22 +16,17 @@ describe('manifest_manager', () => { describe('ManifestManager sanity checks', () => { test('ManifestManager can retrieve and diff manifests', async () => { const manifestManager = getManifestManagerMock(); - const oldManifest = await manifestManager.getLastComputedManifest( - ManifestConstants.SCHEMA_VERSION - ); - const newManifest = await manifestManager.buildNewManifest( - ManifestConstants.SCHEMA_VERSION, - oldManifest! - ); + const oldManifest = await manifestManager.getLastComputedManifest(); + const newManifest = await manifestManager.buildNewManifest(oldManifest!); expect(newManifest.diff(oldManifest!)).toEqual([ { id: - 'endpoint-exceptionlist-linux-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', + 'endpoint-exceptionlist-macos-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', type: 'delete', }, { id: - 'endpoint-exceptionlist-linux-v1-0a5a2013a79f9e60682472284a1be45ab1ff68b9b43426d00d665016612c15c8', + 'endpoint-exceptionlist-macos-v1-0a5a2013a79f9e60682472284a1be45ab1ff68b9b43426d00d665016612c15c8', type: 'add', }, ]); @@ -40,23 +35,18 @@ describe('manifest_manager', () => { test('ManifestManager populates cache properly', async () => { const cache = new LRU({ max: 10, maxAge: 1000 * 60 * 60 }); const manifestManager = getManifestManagerMock({ cache }); - const oldManifest = await manifestManager.getLastComputedManifest( - ManifestConstants.SCHEMA_VERSION - ); - const newManifest = await manifestManager.buildNewManifest( - ManifestConstants.SCHEMA_VERSION, - oldManifest! - ); + const oldManifest = await manifestManager.getLastComputedManifest(); + const newManifest = await manifestManager.buildNewManifest(oldManifest!); const diffs = newManifest.diff(oldManifest!); expect(diffs).toEqual([ { id: - 'endpoint-exceptionlist-linux-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', + 'endpoint-exceptionlist-macos-v1-96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', type: 'delete', }, { id: - 'endpoint-exceptionlist-linux-v1-0a5a2013a79f9e60682472284a1be45ab1ff68b9b43426d00d665016612c15c8', + 'endpoint-exceptionlist-macos-v1-0a5a2013a79f9e60682472284a1be45ab1ff68b9b43426d00d665016612c15c8', type: 'add', }, ]); @@ -104,13 +94,8 @@ describe('manifest_manager', () => { test('ManifestManager cannot dispatch incomplete (uncompressed) artifact', async () => { const packageConfigService = createPackageConfigServiceMock(); const manifestManager = getManifestManagerMock({ packageConfigService }); - const oldManifest = await manifestManager.getLastComputedManifest( - ManifestConstants.SCHEMA_VERSION - ); - const newManifest = await manifestManager.buildNewManifest( - ManifestConstants.SCHEMA_VERSION, - oldManifest! - ); + const oldManifest = await manifestManager.getLastComputedManifest(); + const newManifest = await manifestManager.buildNewManifest(oldManifest!); const dispatchErrors = await manifestManager.tryDispatch(newManifest); expect(dispatchErrors.length).toEqual(1); expect(dispatchErrors[0].message).toEqual('Invalid manifest'); @@ -119,17 +104,14 @@ describe('manifest_manager', () => { test('ManifestManager can dispatch manifest', async () => { const packageConfigService = createPackageConfigServiceMock(); const manifestManager = getManifestManagerMock({ packageConfigService }); - const oldManifest = await manifestManager.getLastComputedManifest( - ManifestConstants.SCHEMA_VERSION - ); - const newManifest = await manifestManager.buildNewManifest( - ManifestConstants.SCHEMA_VERSION, - oldManifest! - ); + const oldManifest = await manifestManager.getLastComputedManifest(); + const newManifest = await manifestManager.buildNewManifest(oldManifest!); const diffs = newManifest.diff(oldManifest!); const newArtifactId = diffs[1].id; await newManifest.compressArtifact(newArtifactId); + newManifest.bumpSemanticVersion(); + const dispatchErrors = await manifestManager.tryDispatch(newManifest); expect(dispatchErrors).toEqual([]); @@ -140,10 +122,10 @@ describe('manifest_manager', () => { expect( packageConfigService.update.mock.calls[0][2].inputs[0].config!.artifact_manifest.value ).toEqual({ - manifest_version: '520f6cf88b3f36a065c6ca81058d5f8690aadadf6fe857f8dec4cc37589e7283', + manifest_version: '1.0.1', schema_version: 'v1', artifacts: { - 'endpoint-exceptionlist-linux-v1': { + 'endpoint-exceptionlist-macos-v1': { compression_algorithm: 'zlib', encryption_algorithm: 'none', decoded_sha256: '0a5a2013a79f9e60682472284a1be45ab1ff68b9b43426d00d665016612c15c8', @@ -151,17 +133,7 @@ describe('manifest_manager', () => { decoded_size: 292, encoded_size: 131, relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-linux-v1/0a5a2013a79f9e60682472284a1be45ab1ff68b9b43426d00d665016612c15c8', - }, - 'endpoint-exceptionlist-macos-v1': { - compression_algorithm: 'zlib', - encryption_algorithm: 'none', - decoded_sha256: '96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', - encoded_sha256: '975382ab55d019cbab0bbac207a54e2a7d489fad6e8f6de34fc6402e5ef37b1e', - decoded_size: 432, - encoded_size: 147, - relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-macos-v1/96b76a1a911662053a1562ac14c4ff1e87c2ff550d6fe52e1e0b3790526597d3', + '/api/endpoint/artifacts/download/endpoint-exceptionlist-macos-v1/0a5a2013a79f9e60682472284a1be45ab1ff68b9b43426d00d665016612c15c8', }, 'endpoint-exceptionlist-windows-v1': { compression_algorithm: 'zlib', @@ -180,17 +152,14 @@ describe('manifest_manager', () => { test('ManifestManager fails to dispatch on conflict', async () => { const packageConfigService = createPackageConfigServiceMock(); const manifestManager = getManifestManagerMock({ packageConfigService }); - const oldManifest = await manifestManager.getLastComputedManifest( - ManifestConstants.SCHEMA_VERSION - ); - const newManifest = await manifestManager.buildNewManifest( - ManifestConstants.SCHEMA_VERSION, - oldManifest! - ); + const oldManifest = await manifestManager.getLastComputedManifest(); + const newManifest = await manifestManager.buildNewManifest(oldManifest!); const diffs = newManifest.diff(oldManifest!); const newArtifactId = diffs[1].id; await newManifest.compressArtifact(newArtifactId); + newManifest.bumpSemanticVersion(); + packageConfigService.update.mockRejectedValueOnce({ status: 409 }); const dispatchErrors = await manifestManager.tryDispatch(newManifest); expect(dispatchErrors).toEqual([{ status: 409 }]); @@ -202,13 +171,8 @@ describe('manifest_manager', () => { savedObjectsClient, }); - const oldManifest = await manifestManager.getLastComputedManifest( - ManifestConstants.SCHEMA_VERSION - ); - const newManifest = await manifestManager.buildNewManifest( - ManifestConstants.SCHEMA_VERSION, - oldManifest! - ); + const oldManifest = await manifestManager.getLastComputedManifest(); + const newManifest = await manifestManager.buildNewManifest(oldManifest!); const diffs = newManifest.diff(oldManifest!); const oldArtifactId = diffs[0].id; const newArtifactId = diffs[1].id; diff --git a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts index b52c51ba789af..217fd6de2ba68 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts @@ -3,7 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ - +import semver from 'semver'; import { Logger, SavedObjectsClientContract } from 'src/core/server'; import LRU from 'lru-cache'; import { PackageConfigServiceInterface } from '../../../../../../ingest_manager/server'; @@ -13,7 +13,6 @@ import { manifestDispatchSchema } from '../../../../../common/endpoint/schema/ma import { ArtifactConstants, - ManifestConstants, Manifest, buildArtifact, getFullEndpointExceptionList, @@ -52,6 +51,7 @@ export class ManifestManager { protected savedObjectsClient: SavedObjectsClientContract; protected logger: Logger; protected cache: LRU; + protected schemaVersion: ManifestSchemaVersion; constructor(context: ManifestManagerContext) { this.artifactClient = context.artifactClient; @@ -60,28 +60,27 @@ export class ManifestManager { this.savedObjectsClient = context.savedObjectsClient; this.logger = context.logger; this.cache = context.cache; + this.schemaVersion = 'v1'; } /** - * Gets a ManifestClient for the provided schemaVersion. + * Gets a ManifestClient for this manager's schemaVersion. * - * @param schemaVersion The schema version of the manifest. - * @returns {ManifestClient} A ManifestClient scoped to the provided schemaVersion. + * @returns {ManifestClient} A ManifestClient scoped to the appropriate schemaVersion. */ - protected getManifestClient(schemaVersion: string): ManifestClient { - return new ManifestClient(this.savedObjectsClient, schemaVersion as ManifestSchemaVersion); + protected getManifestClient(): ManifestClient { + return new ManifestClient(this.savedObjectsClient, this.schemaVersion); } /** * Builds an array of artifacts (one per supported OS) based on the current * state of exception-list-agnostic SOs. * - * @param schemaVersion The schema version of the artifact * @returns {Promise} An array of uncompressed artifacts built from exception-list-agnostic SOs. * @throws Throws/rejects if there are errors building the list. */ protected async buildExceptionListArtifacts( - schemaVersion: string + artifactSchemaVersion?: string ): Promise { return ArtifactConstants.SUPPORTED_OPERATING_SYSTEMS.reduce< Promise @@ -89,10 +88,10 @@ export class ManifestManager { const exceptionList = await getFullEndpointExceptionList( this.exceptionListClient, os, - schemaVersion + artifactSchemaVersion ?? 'v1' ); const artifacts = await acc; - const artifact = await buildArtifact(exceptionList, os, schemaVersion); + const artifact = await buildArtifact(exceptionList, os, artifactSchemaVersion ?? 'v1'); return Promise.resolve([...artifacts, artifact]); }, Promise.resolve([])); } @@ -168,20 +167,23 @@ export class ManifestManager { * Returns the last computed manifest based on the state of the * user-artifact-manifest SO. * - * @param schemaVersion The schema version of the manifest. * @returns {Promise} The last computed manifest, or null if does not exist. * @throws Throws/rejects if there is an unexpected error retrieving the manifest. */ - public async getLastComputedManifest(schemaVersion: string): Promise { + public async getLastComputedManifest(): Promise { try { - const manifestClient = this.getManifestClient(schemaVersion); + const manifestClient = this.getManifestClient(); const manifestSo = await manifestClient.getManifest(); if (manifestSo.version === undefined) { throw new Error('No version returned for manifest.'); } - const manifest = new Manifest(schemaVersion, manifestSo.version); + const manifest = new Manifest({ + schemaVersion: this.schemaVersion, + semanticVersion: manifestSo.attributes.semanticVersion, + soVersion: manifestSo.version, + }); for (const id of manifestSo.attributes.ids) { const artifactSo = await this.artifactClient.getArtifact(id); @@ -199,22 +201,17 @@ export class ManifestManager { /** * Builds a new manifest based on the current user exception list. * - * @param schemaVersion The schema version of the manifest. * @param baselineManifest A baseline manifest to use for initializing pre-existing artifacts. * @returns {Promise} A new Manifest object reprenting the current exception list. */ - public async buildNewManifest( - schemaVersion: string, - baselineManifest?: Manifest - ): Promise { + public async buildNewManifest(baselineManifest?: Manifest): Promise { // Build new exception list artifacts - const artifacts = await this.buildExceptionListArtifacts(ArtifactConstants.SCHEMA_VERSION); + const artifacts = await this.buildExceptionListArtifacts(); // Build new manifest const manifest = Manifest.fromArtifacts( artifacts, - ManifestConstants.SCHEMA_VERSION, - baselineManifest ?? Manifest.getDefault(schemaVersion) + baselineManifest ?? Manifest.getDefault(this.schemaVersion) ); return manifest; @@ -247,14 +244,12 @@ export class ManifestManager { for (const packageConfig of items) { const { id, revision, updated_at, updated_by, ...newPackageConfig } = packageConfig; if (newPackageConfig.inputs.length > 0 && newPackageConfig.inputs[0].config !== undefined) { - const artifactManifest = newPackageConfig.inputs[0].config.artifact_manifest ?? { + const oldManifest = newPackageConfig.inputs[0].config.artifact_manifest ?? { value: {}, }; - const oldManifest = - Manifest.fromPkgConfig(artifactManifest.value) ?? - Manifest.getDefault(ManifestConstants.SCHEMA_VERSION); - if (!manifest.equals(oldManifest)) { + const newManifestVersion = manifest.getSemanticVersion(); + if (semver.gt(newManifestVersion, oldManifest.value.manifest_version)) { newPackageConfig.inputs[0].config.artifact_manifest = { value: serializedManifest, }; @@ -262,7 +257,7 @@ export class ManifestManager { try { await this.packageConfigService.update(this.savedObjectsClient, id, newPackageConfig); this.logger.debug( - `Updated package config ${id} with manifest version ${manifest.getSha256()}` + `Updated package config ${id} with manifest version ${manifest.getSemanticVersion()}` ); } catch (err) { errors.push(err); @@ -274,8 +269,7 @@ export class ManifestManager { errors.push(new Error(`Package config ${id} has no config.`)); } } - - paging = page * items.length < total; + paging = (page - 1) * 20 + items.length < total; page++; } @@ -290,11 +284,11 @@ export class ManifestManager { */ public async commit(manifest: Manifest): Promise { try { - const manifestClient = this.getManifestClient(manifest.getSchemaVersion()); + const manifestClient = this.getManifestClient(); // Commit the new manifest const manifestSo = manifest.toSavedObject(); - const version = manifest.getSoVersion(); + const version = manifest.getSavedObjectVersion(); if (version == null) { await manifestClient.createManifest(manifestSo); @@ -304,7 +298,7 @@ export class ManifestManager { }); } - this.logger.info(`Committed manifest ${manifest.getSha256()}`); + this.logger.info(`Committed manifest ${manifest.getSemanticVersion()}`); } catch (err) { return err; } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/index.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/index.ts index bfaab096a5013..196d816b6b257 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/index.ts @@ -25,6 +25,8 @@ export const createMockConfig = () => ({ from: 'now-15m', to: 'now', }, + packagerTaskInterval: '60s', + validateArtifactDownloads: true, }); export const mockGetCurrentUser = { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/elastic_endpoint.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/elastic_endpoint.json index e6a517d85db81..05601ec8ffb4c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/elastic_endpoint.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/elastic_endpoint.json @@ -1,20 +1,17 @@ { - "author": [ - "Elastic" - ], + "author": ["Elastic"], "description": "Generates a detection alert each time an Elastic Endpoint Security alert is received. Enabling this rule allows you to immediately begin investigating your Elastic Endpoint alerts.", "enabled": true, "exceptions_list": [ { "id": "endpoint_list", + "list_id": "endpoint_list", "namespace_type": "agnostic", "type": "endpoint" } ], "from": "now-10m", - "index": [ - "logs-endpoint.alerts-*" - ], + "index": ["logs-endpoint.alerts-*"], "language": "kuery", "license": "Elastic License", "max_signals": 10000, @@ -57,10 +54,7 @@ "value": "99" } ], - "tags": [ - "Elastic", - "Endpoint" - ], + "tags": ["Elastic", "Endpoint"], "timestamp_override": "event.ingested", "type": "query", "version": 1 diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/external_alerts.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/external_alerts.json index 678ad9eb03b50..8b627c48d2904 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/external_alerts.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/external_alerts.json @@ -1,12 +1,9 @@ { - "author": [ - "Elastic" - ], + "author": ["Elastic"], "description": "Generates a detection alert for each external alert written to the configured indices. Enabling this rule allows you to immediately begin investigating external alerts in the app.", "index": [ "apm-*-transaction*", "auditbeat-*", - "endgame-*", "filebeat-*", "logs-*", "packetbeat-*", @@ -54,9 +51,7 @@ "value": "99" } ], - "tags": [ - "Elastic" - ], + "tags": ["Elastic"], "timestamp_override": "event.ingested", "type": "query", "version": 1 diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/mappings/build_risk_score_from_mapping.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/mappings/build_risk_score_from_mapping.ts index 356cf95fc0d24..888642f77af60 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/mappings/build_risk_score_from_mapping.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/mappings/build_risk_score_from_mapping.ts @@ -10,7 +10,6 @@ import { RiskScoreMappingOrUndefined, } from '../../../../../common/detection_engine/schemas/common/schemas'; import { SignalSourceHit } from '../types'; -import { RiskScore as RiskScoreIOTS } from '../../../../../common/detection_engine/schemas/types'; interface BuildRiskScoreFromMappingProps { doc: SignalSourceHit; @@ -33,8 +32,12 @@ export const buildRiskScoreFromMapping = ({ const mappedField = riskScoreMapping[0].field; // TODO: Expand by verifying fieldType from index via doc._index const mappedValue = get(mappedField, doc._source); - // TODO: This doesn't seem to validate...identified riskScore > 100 😬 - if (RiskScoreIOTS.is(mappedValue)) { + if ( + typeof mappedValue === 'number' && + Number.isSafeInteger(mappedValue) && + mappedValue >= 0 && + mappedValue <= 100 + ) { return { riskScore: mappedValue, riskScoreMeta: { riskScoreOverridden: true } }; } } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts index a610970907bf8..3c41f29625a51 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts @@ -716,26 +716,31 @@ describe('utils', () => { describe('#getExceptions', () => { test('it successfully returns array of exception list items', async () => { + listMock.getExceptionListClient = () => + (({ + findExceptionListsItem: jest.fn().mockResolvedValue({ + data: [getExceptionListItemSchemaMock()], + page: 1, + per_page: 10000, + total: 1, + }), + } as unknown) as ExceptionListClient); const client = listMock.getExceptionListClient(); const exceptions = await getExceptions({ client, lists: getListArrayMock(), }); - expect(client.getExceptionList).toHaveBeenNthCalledWith(1, { - id: 'some_uuid', - listId: undefined, - namespaceType: 'single', - }); - expect(client.getExceptionList).toHaveBeenNthCalledWith(2, { - id: 'some_uuid', - listId: undefined, - namespaceType: 'agnostic', + expect(client.findExceptionListsItem).toHaveBeenCalledWith({ + listId: ['list_id_single', 'endpoint_list'], + namespaceType: ['single', 'agnostic'], + page: 1, + perPage: 10000, + filter: [], + sortOrder: undefined, + sortField: undefined, }); - expect(exceptions).toEqual([ - getExceptionListItemSchemaMock(), - getExceptionListItemSchemaMock(), - ]); + expect(exceptions).toEqual([getExceptionListItemSchemaMock()]); }); test('it throws if "client" is undefined', async () => { @@ -747,7 +752,7 @@ describe('utils', () => { ).rejects.toThrowError('lists plugin unavailable during rule execution'); }); - test('it returns empty array if no "lists" is undefined', async () => { + test('it returns empty array if "lists" is undefined', async () => { const exceptions = await getExceptions({ client: listMock.getExceptionListClient(), lists: undefined, @@ -771,11 +776,11 @@ describe('utils', () => { ).rejects.toThrowError('unable to fetch exception list items'); }); - test('it throws if "findExceptionListItem" fails', async () => { + test('it throws if "findExceptionListsItem" fails', async () => { const err = new Error('error fetching list'); listMock.getExceptionListClient = () => (({ - findExceptionListItem: jest.fn().mockRejectedValue(err), + findExceptionListsItem: jest.fn().mockRejectedValue(err), } as unknown) as ExceptionListClient); await expect(() => @@ -786,24 +791,10 @@ describe('utils', () => { ).rejects.toThrowError('unable to fetch exception list items'); }); - test('it returns empty array if "getExceptionList" returns null', async () => { - listMock.getExceptionListClient = () => - (({ - getExceptionList: jest.fn().mockResolvedValue(null), - } as unknown) as ExceptionListClient); - - const exceptions = await getExceptions({ - client: listMock.getExceptionListClient(), - lists: undefined, - }); - - expect(exceptions).toEqual([]); - }); - - test('it returns empty array if "findExceptionListItem" returns null', async () => { + test('it returns empty array if "findExceptionListsItem" returns null', async () => { listMock.getExceptionListClient = () => (({ - findExceptionListItem: jest.fn().mockResolvedValue(null), + findExceptionListsItem: jest.fn().mockResolvedValue(null), } as unknown) as ExceptionListClient); const exceptions = await getExceptions({ diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts index 90373ee676121..9519720d0bbec 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts @@ -15,6 +15,7 @@ import { ListArrayOrUndefined } from '../../../../common/detection_engine/schema import { BulkResponse, BulkResponseErrorAggregation, isValidUnit } from './types'; import { BuildRuleMessage } from './rule_messages'; import { hasLargeValueList } from '../../../../common/detection_engine/utils'; +import { MAX_EXCEPTION_LIST_SIZE } from '../../../../../lists/common/constants'; interface SortExceptionsReturn { exceptionsWithValueLists: ExceptionListItemSchema[]; @@ -160,43 +161,20 @@ export const getExceptions = async ({ throw new Error('lists plugin unavailable during rule execution'); } - if (lists != null) { + if (lists != null && lists.length > 0) { try { - // Gather all exception items of all exception lists linked to rule - const exceptions = await Promise.all( - lists - .map(async (list) => { - const { id, namespace_type: namespaceType } = list; - try { - // TODO update once exceptions client `findExceptionListItem` - // accepts an array of list ids - const foundList = await client.getExceptionList({ - id, - namespaceType, - listId: undefined, - }); - - if (foundList == null) { - return []; - } else { - const items = await client.findExceptionListItem({ - listId: foundList.list_id, - namespaceType, - page: 1, - perPage: 10000, - filter: undefined, - sortOrder: undefined, - sortField: undefined, - }); - return items != null ? items.data : []; - } - } catch { - throw new Error('unable to fetch exception list items'); - } - }) - .flat() - ); - return exceptions.flat(); + const listIds = lists.map(({ list_id: listId }) => listId); + const namespaceTypes = lists.map(({ namespace_type: namespaceType }) => namespaceType); + const items = await client.findExceptionListsItem({ + listId: listIds, + namespaceType: namespaceTypes, + page: 1, + perPage: MAX_EXCEPTION_LIST_SIZE, + filter: [], + sortOrder: undefined, + sortField: undefined, + }); + return items != null ? items.data : []; } catch { throw new Error('unable to fetch exception list items'); } diff --git a/x-pack/plugins/security_solution/server/plugin.ts b/x-pack/plugins/security_solution/server/plugin.ts index 06cd3138ca564..f2fad16d80414 100644 --- a/x-pack/plugins/security_solution/server/plugin.ts +++ b/x-pack/plugins/security_solution/server/plugin.ts @@ -174,12 +174,15 @@ export class Plugin implements IPlugin = ({ itemId }) => { iconType="copy" isDisabled={buttonDisabled} onClick={clickHandler} - size="s" + size="xs" > {buttonText} diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_delete/__snapshots__/delete_button.test.tsx.snap b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_delete/__snapshots__/delete_button.test.tsx.snap index 7e98fc90cfad4..8d4568c5ce20e 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_delete/__snapshots__/delete_button.test.tsx.snap +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_delete/__snapshots__/delete_button.test.tsx.snap @@ -14,7 +14,7 @@ exports[`Transform: Transform List Actions Minimal initializati iconType="trash" isDisabled={true} onClick={[Function]} - size="s" + size="xs" > Delete diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_delete/delete_button.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_delete/delete_button.tsx index 2ca48ed734c7f..dc6ddcfc45a11 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_delete/delete_button.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_delete/delete_button.tsx @@ -56,7 +56,7 @@ export const DeleteButton: FC = ({ items, forceDisable, onCli iconType="trash" isDisabled={buttonDisabled} onClick={() => onClick(items)} - size="s" + size="xs" > {buttonText} diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_edit/edit_button.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_edit/edit_button.tsx index 40c27cff1e398..7bae8807425fc 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_edit/edit_button.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_edit/edit_button.tsx @@ -36,7 +36,7 @@ export const EditButton: FC = ({ onClick }) => { iconType="pencil" isDisabled={buttonDisabled} onClick={onClick} - size="s" + size="xs" > {buttonText} diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_start/__snapshots__/start_button.test.tsx.snap b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_start/__snapshots__/start_button.test.tsx.snap index d8184773e16b5..543f8f9dfcffe 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_start/__snapshots__/start_button.test.tsx.snap +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_start/__snapshots__/start_button.test.tsx.snap @@ -14,7 +14,7 @@ exports[`Transform: Transform List Actions Minimal initializatio iconType="play" isDisabled={true} onClick={[Function]} - size="s" + size="xs" > Start diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_start/start_button.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_start/start_button.tsx index 60f899adc5fb2..7f5595043b775 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_start/start_button.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_start/start_button.tsx @@ -95,7 +95,7 @@ export const StartButton: FC = ({ items, forceDisable, onClick iconType="play" isDisabled={buttonDisabled} onClick={() => onClick(items)} - size="s" + size="xs" > {buttonText} diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_stop/__snapshots__/stop_button.test.tsx.snap b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_stop/__snapshots__/stop_button.test.tsx.snap index 0052dc6254789..646162d370ac6 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_stop/__snapshots__/stop_button.test.tsx.snap +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_stop/__snapshots__/stop_button.test.tsx.snap @@ -14,7 +14,7 @@ exports[`Transform: Transform List Actions Minimal initialization iconType="stop" isDisabled={true} onClick={[Function]} - size="s" + size="xs" > Stop diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_stop/stop_button.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_stop/stop_button.tsx index 3c5e4323cc69a..1c672193dd1ee 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/action_stop/stop_button.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/action_stop/stop_button.tsx @@ -68,7 +68,7 @@ export const StopButton: FC = ({ items, forceDisable }) => { iconType="stop" isDisabled={buttonDisabled} onClick={handleStop} - size="s" + size="xs" > {buttonText} diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index ee7d1e0298d00..a433cdace3710 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -7649,14 +7649,14 @@ "xpack.infra.metrics.alertFlyout.noDataHelpText": "有効にすると、メトリックが想定された期間内にデータを報告しない場合、またはアラートがElasticsearchをクエリできない場合に、アクションをトリガーします", "xpack.infra.metrics.alertFlyout.outsideRangeLabel": "is not between", "xpack.infra.metrics.alertFlyout.removeCondition": "条件を削除", - "xpack.infra.metrics.alerting.inventory.threshold.defaultActionMessage": "\\{\\{alertName\\}\\} - \\{\\{context.group\\}\\}\n\n\\{\\{context.metricOf.condition0\\}\\}はしきい値 \\{\\{context.thresholdOf.condition0\\}\\}を超えました\n現在の値は\\{\\{context.valueOf.condition0\\}\\}です\n", + "xpack.infra.metrics.alerting.inventory.threshold.defaultActionMessage": "\\{\\{alertName\\}\\} - \\{\\{context.group\\}\\}は状態\\{\\{context.alertState\\}\\}です\n\n理由:\n\\{\\{context.reason\\}\\}\n", "xpack.infra.metrics.alerting.inventory.threshold.fired": "実行", - "xpack.infra.metrics.alerting.threshold.alerting.alertStateActionVariableDescription": "現在のアラートの状態", - "xpack.infra.metrics.alerting.threshold.alerting.groupActionVariableDescription": "データを報告するグループの名前", - "xpack.infra.metrics.alerting.threshold.alerting.metricOfActionVariableDescription": "監視されたメトリックのレコード。条件でグループ化されます(metricOf.condition0、metricOf.condition1など)。", - "xpack.infra.metrics.alerting.threshold.alerting.reasonActionVariableDescription": "どのメトリックがどのしきい値を超えたのかを含む、アラートがこの状態である理由に関する説明", - "xpack.infra.metrics.alerting.threshold.alerting.thresholdOfActionVariableDescription": "アラートしきい値のレコード。条件でグループ化されます(thresholdOf.condition0、thresholdOf.condition1など)。", - "xpack.infra.metrics.alerting.threshold.alerting.valueOfActionVariableDescription": "監視されたメトリックの現在の値のレコード。条件でグループ化されます(valueOf.condition0、valueOf.condition1など)。", + "xpack.infra.metrics.alerting.alertStateActionVariableDescription": "現在のアラートの状態", + "xpack.infra.metrics.alerting.groupActionVariableDescription": "データを報告するグループの名前", + "xpack.infra.metrics.alerting.metricActionVariableDescription": "監視されたメトリックのレコード。条件でグループ化されます(metric.condition0、metric.condition1など)。", + "xpack.infra.metrics.alerting.reasonActionVariableDescription": "どのメトリックがどのしきい値を超えたのかを含む、アラートがこの状態である理由に関する説明", + "xpack.infra.metrics.alerting.thresholdActionVariableDescription": "アラートしきい値のレコード。条件でグループ化されます(threshold.condition0、threshold.condition1など)。", + "xpack.infra.metrics.alerting.valueActionVariableDescription": "監視されたメトリックの現在の値のレコード。条件でグループ化されます(value.condition0、value.condition1など)。", "xpack.infra.metrics.alerting.threshold.alertState": "アラート", "xpack.infra.metrics.alerting.threshold.betweenComparator": "の間", "xpack.infra.metrics.alerting.threshold.defaultActionMessage": "\\{\\{alertName\\}\\} - \\{\\{context.group\\}\\}は状態\\{\\{context.alertState\\}\\}です\n\n理由:\n\\{\\{context.reason\\}\\}\n", @@ -8177,8 +8177,6 @@ "xpack.ingestManager.editPackageConfig.updatedNotificationTitle": "正常に'{packageConfigName}'を更新しました", "xpack.ingestManager.enrollemntAPIKeyList.emptyMessage": "登録トークンが見つかりません。", "xpack.ingestManager.enrollemntAPIKeyList.loadingTokensMessage": "登録トークンを読み込んでいます...", - "xpack.ingestManager.enrollmentInstructions.copyButton": "コマンドをコピー", - "xpack.ingestManager.enrollmentInstructions.descriptionText": "エージェントのディレクトリから、これらのコマンドを実行して、Elasticエージェントを登録して起動します。{enrollCommand}はエージェントの構成ファイルに書き込み、正しい設定になるようにします。このコマンドを使用すると、複数のホストでエージェントを設定できます。", "xpack.ingestManager.enrollmentStepAgentConfig.configSelectAriaLabel": "エージェント構成", "xpack.ingestManager.enrollmentStepAgentConfig.configSelectLabel": "エージェント構成", "xpack.ingestManager.enrollmentStepAgentConfig.enrollmentTokenSelectLabel": "登録トークン", @@ -13574,7 +13572,7 @@ "xpack.securitySolution.detectionEngine.editRule.errorMsgDescription": "申し訳ありません", "xpack.securitySolution.detectionEngine.editRule.pageTitle": "ルール設定の編集", "xpack.securitySolution.detectionEngine.editRule.saveChangeTitle": "変更を保存", - "xpack.securitySolution.detectionEngine.emptyActionPrimary": "セットアップの手順を表示", + "xpack.securitySolution.detectionEngine.emptyActionBeats": "セットアップの手順を表示", "xpack.securitySolution.detectionEngine.emptyActionSecondary": "ドキュメントに移動", "xpack.securitySolution.detectionEngine.emptyTitle": "Securityアプリケーションの検出エンジンに関連したインデックスがないようです", "xpack.securitySolution.detectionEngine.goToDocumentationButton": "ドキュメンテーションを表示", @@ -13867,7 +13865,6 @@ "xpack.securitySolution.detectionEngine.mlUnavailableTitle": "{totalRules} {totalRules, plural, =1 {個のルール} other {個のルール}}で機械学習を有効にする必要があります。", "xpack.securitySolution.detectionEngine.noApiIntegrationKeyCallOutMsg": "Kibanaを起動するごとに保存されたオブジェクトの新しい暗号化キーを作成します。永続キーがないと、Kibanaの再起動後にルールを削除または修正することができません。永続キーを設定するには、kibana.ymlファイルに32文字以上のテキスト値を付けてxpack.encryptedSavedObjects.encryptionKey設定を追加してください。", "xpack.securitySolution.detectionEngine.noApiIntegrationKeyCallOutTitle": "API統合キーが必要です", - "xpack.securitySolution.detectionEngine.noIndexMsgBody": "検出エンジンを使用するには、必要なクラスターとインデックス権限のユーザーが最初にこのページにアクセスする必要があります。ヘルプについては、管理者にお問い合わせください。", "xpack.securitySolution.detectionEngine.noIndexTitle": "検出エンジンを設定しましょう", "xpack.securitySolution.detectionEngine.pageTitle": "検出エンジン", "xpack.securitySolution.detectionEngine.panelSubtitleShowing": "表示中", @@ -14351,7 +14348,7 @@ "xpack.securitySolution.overview.viewEventsButtonLabel": "イベントを表示", "xpack.securitySolution.overview.winlogbeatMWSysmonOperational": "Microsoft-Windows-Sysmon/Operational", "xpack.securitySolution.overview.winlogbeatSecurityTitle": "セキュリティ", - "xpack.securitySolution.pages.common.emptyActionPrimary": "Beatsでデータを表示", + "xpack.securitySolution.pages.common.emptyActionBeats": "Beatsでデータを表示", "xpack.securitySolution.pages.common.emptyActionSecondary": "入門ガイドを表示", "xpack.securitySolution.pages.common.emptyTitle": "SIEMへようこそ。始めましょう。", "xpack.securitySolution.pages.fourohfour.noContentFoundDescription": "コンテンツがありません", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 30c932c362a4f..c3833ba076824 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -7654,14 +7654,14 @@ "xpack.infra.metrics.alertFlyout.noDataHelpText": "启用此选项可在指标在预期的时间段中未报告任何数据时或告警无法查询 Elasticsearch 时触发操作", "xpack.infra.metrics.alertFlyout.outsideRangeLabel": "不介于", "xpack.infra.metrics.alertFlyout.removeCondition": "删除条件", - "xpack.infra.metrics.alerting.inventory.threshold.defaultActionMessage": "\\{\\{alertName\\}\\} - \\{\\{context.group\\}\\}\n\n\\{\\{context.metricOf.condition0\\}\\} 已超过阈值 \\{\\{context.thresholdOf.condition0\\}\\}\n当前值为 \\{\\{context.valueOf.condition0\\}\\}\n", + "xpack.infra.metrics.alerting.inventory.threshold.defaultActionMessage": "\\{\\{alertName\\}\\} - \\{\\{context.group\\}\\} 处于 \\{\\{context.alertState\\}\\} 状态\n\n原因:\n\\{\\{context.reason\\}\\}\n", "xpack.infra.metrics.alerting.inventory.threshold.fired": "已触发", - "xpack.infra.metrics.alerting.threshold.alerting.alertStateActionVariableDescription": "告警的当前状态", - "xpack.infra.metrics.alerting.threshold.alerting.groupActionVariableDescription": "报告数据的组名称", - "xpack.infra.metrics.alerting.threshold.alerting.metricOfActionVariableDescription": "受监视指标的记录;按条件分组,例如按 metricOf.condition0、metricOf.condition1 等。", - "xpack.infra.metrics.alerting.threshold.alerting.reasonActionVariableDescription": "告警处于此状态的原因描述,包括哪个指标超过哪个阈值", - "xpack.infra.metrics.alerting.threshold.alerting.thresholdOfActionVariableDescription": "告警阈值的记录;按条件分组,例如按thresholdOf.condition0、thresholdOf.condition1 等。", - "xpack.infra.metrics.alerting.threshold.alerting.valueOfActionVariableDescription": "受监视指标当前值的记录;按条件分组,例如按 valueOf.condition0、valueOf.condition1 等。", + "xpack.infra.metrics.alerting.alertStateActionVariableDescription": "告警的当前状态", + "xpack.infra.metrics.alerting.groupActionVariableDescription": "报告数据的组名称", + "xpack.infra.metrics.alerting.metricActionVariableDescription": "受监视指标的记录;按条件分组,例如按 metric.condition0、metric.condition1 等。", + "xpack.infra.metrics.alerting.reasonActionVariableDescription": "告警处于此状态的原因描述,包括哪个指标超过哪个阈值", + "xpack.infra.metrics.alerting.thresholdActionVariableDescription": "告警阈值的记录;按条件分组,例如按threshold.condition0、threshold.condition1 等。", + "xpack.infra.metrics.alerting.valueActionVariableDescription": "受监视指标当前值的记录;按条件分组,例如按 value.condition0、value.condition1 等。", "xpack.infra.metrics.alerting.threshold.alertState": "告警", "xpack.infra.metrics.alerting.threshold.betweenComparator": "介于", "xpack.infra.metrics.alerting.threshold.defaultActionMessage": "\\{\\{alertName\\}\\} - \\{\\{context.group\\}\\} 处于 \\{\\{context.alertState\\}\\} 状态\n\n原因:\n\\{\\{context.reason\\}\\}\n", @@ -8182,8 +8182,6 @@ "xpack.ingestManager.editPackageConfig.updatedNotificationTitle": "已成功更新“{packageConfigName}”", "xpack.ingestManager.enrollemntAPIKeyList.emptyMessage": "未找到任何注册令牌。", "xpack.ingestManager.enrollemntAPIKeyList.loadingTokensMessage": "正在加载注册令牌......", - "xpack.ingestManager.enrollmentInstructions.copyButton": "复制命令", - "xpack.ingestManager.enrollmentInstructions.descriptionText": "从代理的目录,运行这些命令以注册并启动 Elastic 代理。{enrollCommand} 将写入代理的配置文件,以便其具有正确的设置。可以使用此命令在多个主机上设置代理。", "xpack.ingestManager.enrollmentStepAgentConfig.configSelectAriaLabel": "代理配置", "xpack.ingestManager.enrollmentStepAgentConfig.configSelectLabel": "代理配置", "xpack.ingestManager.enrollmentStepAgentConfig.enrollmentTokenSelectLabel": "注册令牌", @@ -13580,7 +13578,7 @@ "xpack.securitySolution.detectionEngine.editRule.errorMsgDescription": "抱歉", "xpack.securitySolution.detectionEngine.editRule.pageTitle": "编辑规则设置", "xpack.securitySolution.detectionEngine.editRule.saveChangeTitle": "保存更改", - "xpack.securitySolution.detectionEngine.emptyActionPrimary": "查看设置说明", + "xpack.securitySolution.detectionEngine.emptyActionBeats": "查看设置说明", "xpack.securitySolution.detectionEngine.emptyActionSecondary": "前往文档", "xpack.securitySolution.detectionEngine.emptyTitle": "似乎您没有与 Security 应用程序的检测引擎相关的索引", "xpack.securitySolution.detectionEngine.goToDocumentationButton": "查看文档", @@ -13873,7 +13871,6 @@ "xpack.securitySolution.detectionEngine.mlUnavailableTitle": "{totalRules} 个 {totalRules, plural, =1 {规则需要} other {规则需要}}启用 Machine Learning。", "xpack.securitySolution.detectionEngine.noApiIntegrationKeyCallOutMsg": "每次启动 Kibana,都会为已保存对象生成新的加密密钥。没有持久性密钥,在 Kibana 重新启动后,将无法删除或修改规则。要设置持久性密钥,请将文本值为 32 个或更多任意字符的 xpack.encryptedSavedObjects.encryptionKey 设置添加到 kibana.yml 文件。", "xpack.securitySolution.detectionEngine.noApiIntegrationKeyCallOutTitle": "需要 API 集成密钥", - "xpack.securitySolution.detectionEngine.noIndexMsgBody": "要使用检测引擎,具有所需集群和索引权限的用户必须首先访问此页面。若需要更多帮助,请联系您的管理员。", "xpack.securitySolution.detectionEngine.noIndexTitle": "让我们来设置您的检测引擎", "xpack.securitySolution.detectionEngine.pageTitle": "检测引擎", "xpack.securitySolution.detectionEngine.panelSubtitleShowing": "正在显示", @@ -14357,7 +14354,7 @@ "xpack.securitySolution.overview.viewEventsButtonLabel": "查看事件", "xpack.securitySolution.overview.winlogbeatMWSysmonOperational": "Microsoft-Windows-Sysmon/Operational", "xpack.securitySolution.overview.winlogbeatSecurityTitle": "安全", - "xpack.securitySolution.pages.common.emptyActionPrimary": "使用 Beats 添加数据", + "xpack.securitySolution.pages.common.emptyActionBeats": "使用 Beats 添加数据", "xpack.securitySolution.pages.common.emptyActionSecondary": "查看入门指南", "xpack.securitySolution.pages.common.emptyTitle": "欢迎使用 SIEM。让我们教您如何入门。", "xpack.securitySolution.pages.fourohfour.noContentFoundDescription": "未找到任何内容", diff --git a/x-pack/plugins/triggers_actions_ui/public/application/app.tsx b/x-pack/plugins/triggers_actions_ui/public/application/app.tsx index 80f8e4a3a2c77..1f9352d8405d2 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/app.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/app.tsx @@ -17,8 +17,7 @@ import { ScopedHistory, } from 'kibana/public'; import { Section, routeToAlertDetails } from './constants'; -import { AppContextProvider, useAppDependencies } from './app_context'; -import { hasShowAlertsCapability } from './lib/capabilities'; +import { AppContextProvider } from './app_context'; import { ActionTypeModel, AlertTypeModel } from '../types'; import { TypeRegistry } from './type_registry'; import { ChartsPluginStart } from '../../../../../src/plugins/charts/public'; @@ -63,22 +62,17 @@ export const App = (appDeps: AppDeps) => { }; export const AppWithoutRouter = ({ sectionsRegex }: { sectionsRegex: string }) => { - const { capabilities } = useAppDependencies(); - const canShowAlerts = hasShowAlertsCapability(capabilities); - const DEFAULT_SECTION: Section = canShowAlerts ? 'alerts' : 'connectors'; return ( - {canShowAlerts && ( - - )} - + + ); }; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/home.tsx b/x-pack/plugins/triggers_actions_ui/public/application/home.tsx index eeb8a77717333..15099242b6e17 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/home.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/home.tsx @@ -25,7 +25,7 @@ import { Section, routeToConnectors, routeToAlerts } from './constants'; import { getCurrentBreadcrumb } from './lib/breadcrumb'; import { getCurrentDocTitle } from './lib/doc_title'; import { useAppDependencies } from './app_context'; -import { hasShowActionsCapability, hasShowAlertsCapability } from './lib/capabilities'; +import { hasShowActionsCapability } from './lib/capabilities'; import { ActionsConnectorsList } from './sections/actions_connectors_list/components/actions_connectors_list'; import { AlertsList } from './sections/alerts_list/components/alerts_list'; @@ -45,23 +45,17 @@ export const TriggersActionsUIHome: React.FunctionComponent = []; - if (canShowAlerts) { - tabs.push({ - id: 'alerts', - name: ( - - ), - }); - } + tabs.push({ + id: 'alerts', + name: ( + + ), + }); if (canShowActions) { tabs.push({ @@ -151,17 +145,15 @@ export const TriggersActionsUIHome: React.FunctionComponent )} - {canShowAlerts && ( - ( - - - - )} - /> - )} + ( + + + + )} + /> diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/capabilities.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/capabilities.ts index 065a782ee96a2..9e89a38377a4d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/capabilities.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/capabilities.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { BUILT_IN_ALERTS_FEATURE_ID } from '../../../../alerting_builtins/common'; import { Alert, AlertType } from '../../types'; /** @@ -15,18 +14,6 @@ import { Alert, AlertType } from '../../types'; type Capabilities = Record; -const apps = ['apm', 'siem', 'uptime', 'infrastructure', 'actions', BUILT_IN_ALERTS_FEATURE_ID]; - -function hasCapability(capabilities: Capabilities, capability: string) { - return apps.some((app) => capabilities[app]?.[capability]); -} - -function createCapabilityCheck(capability: string) { - return (capabilities: Capabilities) => hasCapability(capabilities, capability); -} - -export const hasShowAlertsCapability = createCapabilityCheck('alerting:show'); - export const hasShowActionsCapability = (capabilities: Capabilities) => capabilities?.actions?.show; export const hasSaveActionsCapability = (capabilities: Capabilities) => capabilities?.actions?.save; export const hasExecuteActionsCapability = (capabilities: Capabilities) => diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.test.tsx index a620a0db45408..16d1a5c7c9c65 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.test.tsx @@ -29,9 +29,6 @@ jest.mock('../../../app_context', () => ({ http: jest.fn(), capabilities: { get: jest.fn(() => ({})), - securitySolution: { - 'alerting:show': true, - }, }, actionTypeRegistry: jest.fn(), alertTypeRegistry: { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.tsx index 9d54baf359af5..c0674e6c4a5f7 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.tsx @@ -244,15 +244,7 @@ export const AlertForm = ({ ) : null} {AlertParamsExpressionComponent ? ( - - - - - - } - > + - ) : ( + ) : alertTypesIndex ? ( + ) : ( + )} ); }; +const CenterJustifiedSpinner = () => ( + + + + + +); + const NoAuthorizedAlertTypes = ({ operation }: { operation: string }) => ( { http: mockes.http, uiSettings: mockes.uiSettings, navigateToApp, - capabilities: { - ...capabilities, - securitySolution: { - 'alerting:show': true, - }, - }, + capabilities, history: scopedHistoryMock.create(), setBreadcrumbs: jest.fn(), actionTypeRegistry: actionTypeRegistry as any, @@ -223,12 +218,7 @@ describe('alerts_list component with items', () => { http: mockes.http, uiSettings: mockes.uiSettings, navigateToApp, - capabilities: { - ...capabilities, - securitySolution: { - 'alerting:show': true, - }, - }, + capabilities, history: scopedHistoryMock.create(), setBreadcrumbs: jest.fn(), actionTypeRegistry: actionTypeRegistry as any, @@ -303,12 +293,7 @@ describe('alerts_list component empty with show only capability', () => { http: mockes.http, uiSettings: mockes.uiSettings, navigateToApp, - capabilities: { - ...capabilities, - securitySolution: { - 'alerting:show': true, - }, - }, + capabilities, history: scopedHistoryMock.create(), setBreadcrumbs: jest.fn(), actionTypeRegistry: { @@ -417,12 +402,7 @@ describe('alerts_list with show only capability', () => { http: mockes.http, uiSettings: mockes.uiSettings, navigateToApp, - capabilities: { - ...capabilities, - securitySolution: { - 'alerting:show': true, - }, - }, + capabilities, history: scopedHistoryMock.create(), setBreadcrumbs: jest.fn(), actionTypeRegistry: actionTypeRegistry as any, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.tsx index 8cb7afbda0e70..2b2897a2181b1 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.tsx @@ -93,7 +93,7 @@ export const AlertsList: React.FunctionComponent = () => { useEffect(() => { loadAlertsData(); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [page, searchText, typesFilter, actionTypesFilter]); + }, [alertTypesState, page, searchText, typesFilter, actionTypesFilter]); useEffect(() => { (async () => { @@ -136,30 +136,33 @@ export const AlertsList: React.FunctionComponent = () => { }, []); async function loadAlertsData() { - setAlertsState({ ...alertsState, isLoading: true }); - try { - const alertsResponse = await loadAlerts({ - http, - page, - searchText, - typesFilter, - actionTypesFilter, - }); - setAlertsState({ - isLoading: false, - data: alertsResponse.data, - totalItemCount: alertsResponse.total, - }); - } catch (e) { - toastNotifications.addDanger({ - title: i18n.translate( - 'xpack.triggersActionsUI.sections.alertsList.unableToLoadAlertsMessage', - { - defaultMessage: 'Unable to load alerts', - } - ), - }); - setAlertsState({ ...alertsState, isLoading: false }); + const hasAnyAuthorizedAlertType = alertTypesState.data.size > 0; + if (hasAnyAuthorizedAlertType) { + setAlertsState({ ...alertsState, isLoading: true }); + try { + const alertsResponse = await loadAlerts({ + http, + page, + searchText, + typesFilter, + actionTypesFilter, + }); + setAlertsState({ + isLoading: false, + data: alertsResponse.data, + totalItemCount: alertsResponse.total, + }); + } catch (e) { + toastNotifications.addDanger({ + title: i18n.translate( + 'xpack.triggersActionsUI.sections.alertsList.unableToLoadAlertsMessage', + { + defaultMessage: 'Unable to load alerts', + } + ), + }); + setAlertsState({ ...alertsState, isLoading: false }); + } } } diff --git a/x-pack/plugins/triggers_actions_ui/public/index.ts b/x-pack/plugins/triggers_actions_ui/public/index.ts index 1048e15eb1184..7808e2a7f608d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/index.ts +++ b/x-pack/plugins/triggers_actions_ui/public/index.ts @@ -19,6 +19,7 @@ export { ActionType, ActionTypeRegistryContract, AlertTypeParamsExpressionProps, + ValidationResult, ActionVariable, } from './types'; export { diff --git a/x-pack/plugins/triggers_actions_ui/public/plugin.ts b/x-pack/plugins/triggers_actions_ui/public/plugin.ts index af4d2784cfa67..25a917c7a1a15 100644 --- a/x-pack/plugins/triggers_actions_ui/public/plugin.ts +++ b/x-pack/plugins/triggers_actions_ui/public/plugin.ts @@ -14,13 +14,11 @@ import { import { i18n } from '@kbn/i18n'; import { registerBuiltInActionTypes } from './application/components/builtin_action_types'; import { registerBuiltInAlertTypes } from './application/components/builtin_alert_types'; -import { hasShowActionsCapability, hasShowAlertsCapability } from './application/lib/capabilities'; import { ActionTypeModel, AlertTypeModel } from './types'; import { TypeRegistry } from './application/type_registry'; import { ManagementSetup, ManagementAppMountParams, - ManagementApp, } from '../../../../src/plugins/management/public'; import { boot } from './application/boot'; import { ChartsPluginStart } from '../../../../src/plugins/charts/public'; @@ -50,10 +48,14 @@ interface PluginsStart { export class Plugin implements - CorePlugin { + CorePlugin< + TriggersAndActionsUIPublicPluginSetup, + TriggersAndActionsUIPublicPluginStart, + PluginsSetup, + PluginsStart + > { private actionTypeRegistry: TypeRegistry; private alertTypeRegistry: TypeRegistry; - private managementApp?: ManagementApp; constructor(initializerContext: PluginInitializerContext) { const actionTypeRegistry = new TypeRegistry(); @@ -67,7 +69,7 @@ export class Plugin const actionTypeRegistry = this.actionTypeRegistry; const alertTypeRegistry = this.alertTypeRegistry; - this.managementApp = plugins.management.sections.section.insightsAndAlerting.registerApp({ + plugins.management.sections.section.insightsAndAlerting.registerApp({ id: 'triggersActions', title: i18n.translate('xpack.triggersActionsUI.managementSection.displayName', { defaultMessage: 'Alerts and Actions', @@ -116,19 +118,7 @@ export class Plugin }; } - public start(core: CoreStart): TriggersAndActionsUIPublicPluginStart { - const { capabilities } = core.application; - - const canShowActions = hasShowActionsCapability(capabilities); - const canShowAlerts = hasShowAlertsCapability(capabilities); - const managementApp = this.managementApp as ManagementApp; - - // Don't register routes when user doesn't have access to the application - if (canShowActions || canShowAlerts) { - managementApp.enable(); - } else { - managementApp.disable(); - } + public start(): TriggersAndActionsUIPublicPluginStart { return { actionTypeRegistry: this.actionTypeRegistry, alertTypeRegistry: this.alertTypeRegistry, diff --git a/x-pack/plugins/uptime/common/constants/index.ts b/x-pack/plugins/uptime/common/constants/index.ts index 0ddb995301266..29ae9e47dfb8a 100644 --- a/x-pack/plugins/uptime/common/constants/index.ts +++ b/x-pack/plugins/uptime/common/constants/index.ts @@ -4,13 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -export * from './alerts'; export { CHART_FORMAT_LIMITS } from './chart_format_limits'; export { CLIENT_DEFAULTS } from './client_defaults'; export { CONTEXT_DEFAULTS } from './context_defaults'; export * from './capabilities'; export * from './settings_defaults'; -export { PLUGIN } from './plugin'; export { QUERY } from './query'; export * from './ui'; export * from './rest_api'; diff --git a/x-pack/plugins/uptime/common/runtime_types/monitor/state.ts b/x-pack/plugins/uptime/common/runtime_types/monitor/state.ts index edbaacd725045..67b13d70fa3ee 100644 --- a/x-pack/plugins/uptime/common/runtime_types/monitor/state.ts +++ b/x-pack/plugins/uptime/common/runtime_types/monitor/state.ts @@ -37,6 +37,9 @@ export const StateType = t.intersection([ name: t.array(t.string), }), }), + service: t.partial({ + name: t.string, + }), }), ]); diff --git a/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts b/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts index d037b4da882a1..5ed71acaf7739 100644 --- a/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts +++ b/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts @@ -196,6 +196,9 @@ export const PingType = t.intersection([ port: t.number, scheme: t.string, }), + service: t.partial({ + name: t.string, + }), }), ]); diff --git a/x-pack/plugins/uptime/public/apps/plugin.ts b/x-pack/plugins/uptime/public/apps/plugin.ts index 9af4dea9dbb44..cf750434ab324 100644 --- a/x-pack/plugins/uptime/public/apps/plugin.ts +++ b/x-pack/plugins/uptime/public/apps/plugin.ts @@ -12,10 +12,11 @@ import { AppMountParameters, } from 'kibana/public'; import { DEFAULT_APP_CATEGORIES } from '../../../../../src/core/public'; -import { UMFrontendLibs } from '../lib/lib'; -import { PLUGIN } from '../../common/constants'; -import { FeatureCatalogueCategory } from '../../../../../src/plugins/home/public'; -import { HomePublicPluginSetup } from '../../../../../src/plugins/home/public'; + +import { + FeatureCatalogueCategory, + HomePublicPluginSetup, +} from '../../../../../src/plugins/home/public'; import { EmbeddableStart } from '../../../../../src/plugins/embeddable/public'; import { TriggersAndActionsUIPublicPluginSetup, @@ -26,10 +27,8 @@ import { DataPublicPluginStart, } from '../../../../../src/plugins/data/public'; import { alertTypeInitializers } from '../lib/alert_types'; -import { kibanaService } from '../state/kibana_service'; -import { fetchIndexStatus } from '../state/api'; -import { ObservabilityPluginSetup } from '../../../observability/public'; -import { fetchUptimeOverviewData } from './uptime_overview_fetcher'; +import { FetchDataParams, ObservabilityPluginSetup } from '../../../observability/public'; +import { PLUGIN } from '../../common/constants/plugin'; export interface ClientPluginsSetup { data: DataPublicPluginSetup; @@ -66,14 +65,23 @@ export class UptimePlugin category: FeatureCatalogueCategory.DATA, }); } + const getUptimeDataHelper = async () => { + const [coreStart] = await core.getStartServices(); + const { UptimeDataHelper } = await import('./uptime_overview_fetcher'); + return UptimeDataHelper(coreStart); + }; plugins.observability.dashboard.register({ appName: 'uptime', hasData: async () => { - const status = await fetchIndexStatus(); + const dataHelper = await getUptimeDataHelper(); + const status = await dataHelper.indexStatus(); return status.docCount > 0; }, - fetchData: fetchUptimeOverviewData, + fetchData: async (params: FetchDataParams) => { + const dataHelper = await getUptimeDataHelper(); + return await dataHelper.overviewData(params); + }, }); core.application.register({ @@ -85,22 +93,15 @@ export class UptimePlugin category: DEFAULT_APP_CATEGORIES.observability, mount: async (params: AppMountParameters) => { const [coreStart, corePlugins] = await core.getStartServices(); - const { getKibanaFrameworkAdapter } = await import( - '../lib/adapters/framework/new_platform_adapter' - ); - const { element } = params; + const { renderApp } = await import('./render_app'); - const libs: UMFrontendLibs = { - framework: getKibanaFrameworkAdapter(coreStart, plugins, corePlugins), - }; - return libs.framework.render(element); + return renderApp(coreStart, plugins, corePlugins, params); }, }); } public start(start: CoreStart, plugins: ClientPluginsStart): void { - kibanaService.core = start; alertTypeInitializers.forEach((init) => { const alertInitializer = init({ core: start, diff --git a/x-pack/plugins/uptime/public/lib/adapters/framework/new_platform_adapter.tsx b/x-pack/plugins/uptime/public/apps/render_app.tsx similarity index 72% rename from x-pack/plugins/uptime/public/lib/adapters/framework/new_platform_adapter.tsx rename to x-pack/plugins/uptime/public/apps/render_app.tsx index d6185f2c2589a..f834f8b5cdd3c 100644 --- a/x-pack/plugins/uptime/public/lib/adapters/framework/new_platform_adapter.tsx +++ b/x-pack/plugins/uptime/public/apps/render_app.tsx @@ -4,26 +4,26 @@ * you may not use this file except in compliance with the Elastic License. */ -import { CoreStart } from 'src/core/public'; import React from 'react'; import ReactDOM from 'react-dom'; import { i18n as i18nFormatter } from '@kbn/i18n'; -import { UptimeApp, UptimeAppProps } from '../../../uptime_app'; -import { getIntegratedAppAvailability } from './capabilities_adapter'; +import { AppMountParameters, CoreStart } from 'kibana/public'; +import { getIntegratedAppAvailability } from '../lib/adapters/framework/capabilities_adapter'; import { - INTEGRATED_SOLUTIONS, - PLUGIN, DEFAULT_DARK_MODE, DEFAULT_TIMEPICKER_QUICK_RANGES, -} from '../../../../common/constants'; -import { UMFrameworkAdapter } from '../../lib'; -import { ClientPluginsStart, ClientPluginsSetup } from '../../../apps/plugin'; + INTEGRATED_SOLUTIONS, +} from '../../common/constants'; +import { UptimeApp, UptimeAppProps } from './uptime_app'; +import { ClientPluginsSetup, ClientPluginsStart } from './plugin'; +import { PLUGIN } from '../../common/constants/plugin'; -export const getKibanaFrameworkAdapter = ( +export function renderApp( core: CoreStart, plugins: ClientPluginsSetup, - startPlugins: ClientPluginsStart -): UMFrameworkAdapter => { + startPlugins: ClientPluginsStart, + { element }: AppMountParameters +) { const { application: { capabilities }, chrome: { setBadge, setHelpExtension }, @@ -40,17 +40,17 @@ export const getKibanaFrameworkAdapter = ( const canSave = (capabilities.uptime.save ?? false) as boolean; const props: UptimeAppProps = { - basePath: basePath.get(), + plugins, canSave, core, + i18n, + startPlugins, + basePath: basePath.get(), darkMode: core.uiSettings.get(DEFAULT_DARK_MODE), commonlyUsedRanges: core.uiSettings.get(DEFAULT_TIMEPICKER_QUICK_RANGES), - i18n, isApmAvailable: apm, isInfraAvailable: infrastructure, isLogsAvailable: logs, - plugins, - startPlugins, renderGlobalHelpControls: () => setHelpExtension({ appName: i18nFormatter.translate('xpack.uptime.header.appName', { @@ -72,15 +72,9 @@ export const getKibanaFrameworkAdapter = ( setBreadcrumbs: core.chrome.setBreadcrumbs, }; - return { - render: async (element: any) => { - if (element) { - ReactDOM.render(, element); - } + ReactDOM.render(, element); - return () => { - ReactDOM.unmountComponentAtNode(element); - }; - }, + return () => { + ReactDOM.unmountComponentAtNode(element); }; -}; +} diff --git a/x-pack/plugins/uptime/public/apps/template.html b/x-pack/plugins/uptime/public/apps/template.html deleted file mode 100644 index a6fb47048a9b1..0000000000000 --- a/x-pack/plugins/uptime/public/apps/template.html +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/x-pack/plugins/uptime/public/uptime_app.tsx b/x-pack/plugins/uptime/public/apps/uptime_app.tsx similarity index 84% rename from x-pack/plugins/uptime/public/uptime_app.tsx rename to x-pack/plugins/uptime/public/apps/uptime_app.tsx index 4208d79e761ed..41370f9fff492 100644 --- a/x-pack/plugins/uptime/public/uptime_app.tsx +++ b/x-pack/plugins/uptime/public/apps/uptime_app.tsx @@ -9,24 +9,25 @@ import { i18n } from '@kbn/i18n'; import React, { useEffect } from 'react'; import { Provider as ReduxProvider } from 'react-redux'; import { BrowserRouter as Router } from 'react-router-dom'; -import { I18nStart, ChromeBreadcrumb, CoreStart } from 'src/core/public'; -import { KibanaContextProvider } from '../../../../src/plugins/kibana_react/public'; -import { ClientPluginsSetup, ClientPluginsStart } from './apps/plugin'; -import { UMUpdateBadge } from './lib/lib'; +import { I18nStart, ChromeBreadcrumb, CoreStart } from 'kibana/public'; +import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public'; +import { ClientPluginsSetup, ClientPluginsStart } from './plugin'; +import { UMUpdateBadge } from '../lib/lib'; import { UptimeRefreshContextProvider, UptimeSettingsContextProvider, UptimeThemeContextProvider, UptimeStartupPluginsContextProvider, -} from './contexts'; -import { CommonlyUsedRange } from './components/common/uptime_date_picker'; -import { setBasePath } from './state/actions'; -import { PageRouter } from './routes'; +} from '../contexts'; +import { CommonlyUsedRange } from '../components/common/uptime_date_picker'; +import { setBasePath } from '../state/actions'; +import { PageRouter } from '../routes'; import { UptimeAlertsContextProvider, UptimeAlertsFlyoutWrapper, -} from './components/overview/alerts'; -import { store } from './state'; +} from '../components/overview/alerts'; +import { store } from '../state'; +import { kibanaService } from '../state/kibana_service'; export interface UptimeAppColors { danger: string; @@ -86,6 +87,8 @@ const Application = (props: UptimeAppProps) => { ); }, [canSave, renderGlobalHelpControls, setBadge]); + kibanaService.core = core; + store.dispatch(setBasePath(basePath)); return ( diff --git a/x-pack/plugins/uptime/public/apps/uptime_overview_fetcher.ts b/x-pack/plugins/uptime/public/apps/uptime_overview_fetcher.ts index d1e394dd4da6b..7e5c18f13b29e 100644 --- a/x-pack/plugins/uptime/public/apps/uptime_overview_fetcher.ts +++ b/x-pack/plugins/uptime/public/apps/uptime_overview_fetcher.ts @@ -4,10 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { fetchPingHistogram, fetchSnapshotCount } from '../state/api'; +import { CoreStart } from 'kibana/public'; import { UptimeFetchDataResponse, FetchDataParams } from '../../../observability/public'; +import { fetchIndexStatus, fetchPingHistogram, fetchSnapshotCount } from '../state/api'; +import { kibanaService } from '../state/kibana_service'; -export async function fetchUptimeOverviewData({ +async function fetchUptimeOverviewData({ absoluteTime, relativeTime, bucketSize, @@ -52,3 +54,12 @@ export async function fetchUptimeOverviewData({ }; return response; } + +export function UptimeDataHelper(coreStart: CoreStart | null) { + kibanaService.core = coreStart!; + + return { + indexStatus: fetchIndexStatus, + overviewData: fetchUptimeOverviewData, + }; +} diff --git a/x-pack/plugins/uptime/public/components/common/charts/__tests__/ping_histogram.test.tsx b/x-pack/plugins/uptime/public/components/common/charts/__tests__/ping_histogram.test.tsx index 57a38f2a949e7..73c6ee43ccd07 100644 --- a/x-pack/plugins/uptime/public/components/common/charts/__tests__/ping_histogram.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/charts/__tests__/ping_histogram.test.tsx @@ -7,8 +7,13 @@ import React from 'react'; import { PingHistogramComponent, PingHistogramComponentProps } from '../ping_histogram'; import { renderWithRouter, shallowWithRouter, MountWithReduxProvider } from '../../../../lib'; +import moment from 'moment'; describe('PingHistogram component', () => { + beforeAll(() => { + moment.prototype.fromNow = jest.fn(() => 'a year ago'); + }); + const props: PingHistogramComponentProps = { absoluteStartDate: 1548697920000, absoluteEndDate: 1548700920000, diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/manage_ml_job.tsx b/x-pack/plugins/uptime/public/components/monitor/ml/manage_ml_job.tsx index 87496e91c906c..7a2899558891d 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ml/manage_ml_job.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ml/manage_ml_job.tsx @@ -8,7 +8,7 @@ import React, { useContext, useState } from 'react'; import { EuiButton, EuiContextMenu, EuiIcon, EuiPopover } from '@elastic/eui'; import { useSelector, useDispatch } from 'react-redux'; -import { CLIENT_ALERT_TYPES } from '../../../../common/constants'; +import { CLIENT_ALERT_TYPES } from '../../../../common/constants/alerts'; import { canDeleteMLJobSelector, hasMLJobSelector, diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/ml_flyout_container.tsx b/x-pack/plugins/uptime/public/components/monitor/ml/ml_flyout_container.tsx index 84634f328621f..e4fe1901729d3 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ml/ml_flyout_container.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ml/ml_flyout_container.tsx @@ -22,13 +22,14 @@ import { import { MLJobLink } from './ml_job_link'; import * as labels from './translations'; import { MLFlyoutView } from './ml_flyout'; -import { CLIENT_ALERT_TYPES, ML_JOB_ID } from '../../../../common/constants'; +import { ML_JOB_ID } from '../../../../common/constants'; import { UptimeRefreshContext, UptimeSettingsContext } from '../../../contexts'; import { useGetUrlParams } from '../../../hooks'; import { getDynamicSettings } from '../../../state/actions/dynamic_settings'; import { useMonitorId } from '../../../hooks'; import { kibanaService } from '../../../state/kibana_service'; import { toMountPoint } from '../../../../../../../src/plugins/kibana_react/public'; +import { CLIENT_ALERT_TYPES } from '../../../../common/constants/alerts'; interface Props { onClose: () => void; diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/__tests__/map_config.test.ts b/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/__tests__/map_config.test.ts index 09a41bd9eb4b9..18b43434da24b 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/__tests__/map_config.test.ts +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/__tests__/map_config.test.ts @@ -7,7 +7,7 @@ import { getLayerList } from '../map_config'; import { mockLayerList } from './__mocks__/mock'; import { LocationPoint } from '../embedded_map'; -import { UptimeAppColors } from '../../../../../../uptime_app'; +import { UptimeAppColors } from '../../../../../../apps/uptime_app'; jest.mock('uuid', () => { return { diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/map_config.ts b/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/map_config.ts index e766641102a24..6f9b7e4d39c16 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/map_config.ts +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/embeddables/map_config.ts @@ -6,7 +6,7 @@ import lowPolyLayerFeatures from './low_poly_layer.json'; import { LocationPoint } from './embedded_map'; -import { UptimeAppColors } from '../../../../../uptime_app'; +import { UptimeAppColors } from '../../../../../apps/uptime_app'; /** * Returns `Source/Destination Point-to-point` Map LayerList configuration, with a source, diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/alert_tls.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/alert_tls.tsx index c7657c34220fc..70adcdb563bce 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/alert_tls.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/alert_tls.tsx @@ -24,6 +24,3 @@ export const AlertTls: React.FC<{}> = () => { /> ); }; - -// eslint-disable-next-line import/no-default-export -export { AlertTls as default }; diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/anomaly_alert/anomaly_alert.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/anomaly_alert/anomaly_alert.tsx index 4b84012575ae9..1428a7f526fc2 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/anomaly_alert/anomaly_alert.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/anomaly_alert/anomaly_alert.tsx @@ -25,8 +25,7 @@ interface Props { setAlertParams: (key: string, value: any) => void; } -// eslint-disable-next-line import/no-default-export -export default function AnomalyAlertComponent({ setAlertParams, alertParams }: Props) { +export function AnomalyAlertComponent({ setAlertParams, alertParams }: Props) { const [severity, setSeverity] = useState(DEFAULT_SEVERITY); const monitorIdStore = useSelector(monitorIdSelector); diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/toggle_alert_flyout_button.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/toggle_alert_flyout_button.tsx index 18514bd92d7a0..067972a452f27 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/toggle_alert_flyout_button.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/toggle_alert_flyout_button.tsx @@ -15,7 +15,7 @@ import { import React, { useState } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; -import { CLIENT_ALERT_TYPES } from '../../../../common/constants'; +import { CLIENT_ALERT_TYPES } from '../../../../common/constants/alerts'; import { ToggleFlyoutTranslations } from './translations'; import { ToggleAlertFlyoutButtonProps } from './alerts_containers'; diff --git a/x-pack/plugins/uptime/public/components/overview/kuery_bar/kuery_bar.tsx b/x-pack/plugins/uptime/public/components/overview/kuery_bar/kuery_bar.tsx index 9c6a4e5d418a7..9e373949aea12 100644 --- a/x-pack/plugins/uptime/public/components/overview/kuery_bar/kuery_bar.tsx +++ b/x-pack/plugins/uptime/public/components/overview/kuery_bar/kuery_bar.tsx @@ -5,8 +5,7 @@ */ import React, { useState, useEffect } from 'react'; -import { uniqueId, startsWith } from 'lodash'; -import { EuiCallOut } from '@elastic/eui'; +import { EuiCallOut, htmlIdGenerator } from '@elastic/eui'; import styled from 'styled-components'; import { FormattedMessage } from '@kbn/i18n/react'; import { Typeahead } from './typeahead'; @@ -94,7 +93,7 @@ export function KueryBar({ setState({ ...state, suggestions: [] }); setSuggestionLimit(15); - const currentRequest = uniqueId(); + const currentRequest = htmlIdGenerator()(); currentRequestCheck = currentRequest; try { @@ -116,7 +115,7 @@ export function KueryBar({ }, ], })) || [] - ).filter((suggestion: QuerySuggestion) => !startsWith(suggestion.text, 'span.')); + ).filter((suggestion: QuerySuggestion) => !suggestion.text.startsWith('span.')); if (currentRequest !== currentRequestCheck) { return; } diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/integration_group.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/integration_group.test.tsx.snap index bb578d850ff7e..12c81fda08519 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/integration_group.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/integration_group.test.tsx.snap @@ -9,8 +9,8 @@ exports[`IntegrationGroup will not display APM links when APM is unavailable 1`] ariaLabel="Search APM for this monitor" href="/app/apm#/services?kuery=url.domain:%20%22undefined%22&rangeFrom=now-15m&rangeTo=now" iconType="apmApp" - message="Check APM for domain" - tooltipContent="Click here to check APM for the domain \\"\\"." + message="Show APM Data" + tooltipContent="Click here to check APM for the domain \\"\\" or explicitly defined \\"service name\\"." />
@@ -73,8 +73,8 @@ exports[`IntegrationGroup will not display infra links when infra is unavailable ariaLabel="Search APM for this monitor" href="/app/apm#/services?kuery=url.domain:%20%22undefined%22&rangeFrom=now-15m&rangeTo=now" iconType="apmApp" - message="Check APM for domain" - tooltipContent="Click here to check APM for the domain \\"\\"." + message="Show APM Data" + tooltipContent="Click here to check APM for the domain \\"\\" or explicitly defined \\"service name\\"." /> @@ -137,8 +137,8 @@ exports[`IntegrationGroup will not display logging links when logging is unavail ariaLabel="Search APM for this monitor" href="/app/apm#/services?kuery=url.domain:%20%22undefined%22&rangeFrom=now-15m&rangeTo=now" iconType="apmApp" - message="Check APM for domain" - tooltipContent="Click here to check APM for the domain \\"\\"." + message="Show APM Data" + tooltipContent="Click here to check APM for the domain \\"\\" or explicitly defined \\"service name\\"." /> diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx index 2070a374e75d0..9e96f0ca76535 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { get } from 'lodash'; import { i18n } from '@kbn/i18n'; import React from 'react'; import { EuiPopover, EuiButton } from '@elastic/eui'; @@ -25,7 +24,8 @@ export const ActionsPopoverComponent = ({ }: ActionsPopoverProps) => { const popoverId = `${summary.monitor_id}_popover`; - const monitorUrl: string | undefined = get(summary, 'state.url.full', undefined); + const monitorUrl: string | undefined = summary?.state?.url?.full; + const isPopoverOpen: boolean = !!popoverState && popoverState.open && popoverState.id === popoverId; return ( diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx index 38aa9287b0c47..df3966c7079dd 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx @@ -27,9 +27,12 @@ interface IntegrationGroupProps { export const extractSummaryValues = (summary: Pick) => { const domain = summary.state.url?.domain ?? ''; - const podUid = summary.state.summaryPings?.[0]?.kubernetes?.pod?.uid ?? undefined; - const containerId = summary.state.summaryPings?.[0]?.container?.id ?? undefined; - const ip = summary.state.summaryPings?.[0]?.monitor.ip ?? undefined; + + const firstCheck = summary.state.summaryPings?.[0]; + + const podUid = firstCheck?.kubernetes?.pod?.uid ?? undefined; + const containerId = firstCheck?.container?.id ?? undefined; + const ip = firstCheck?.monitor.ip ?? undefined; return { domain, @@ -64,16 +67,17 @@ export const IntegrationGroup = ({ summary }: IntegrationGroupProps) => { href={getApmHref(summary, basePath, dateRangeStart, dateRangeEnd)} iconType="apmApp" message={i18n.translate('xpack.uptime.apmIntegrationAction.text', { - defaultMessage: 'Check APM for domain', + defaultMessage: 'Show APM Data', description: - 'A message explaining that when the user clicks the associated link, it will navigate to the APM app and search for the selected domain', + 'A message explaining that when the user clicks the associated link, it will navigate to the APM app', })} tooltipContent={i18n.translate( 'xpack.uptime.monitorList.observabilityIntegrationsColumn.apmIntegrationLink.tooltip', { - defaultMessage: 'Click here to check APM for the domain "{domain}".', + defaultMessage: + 'Click here to check APM for the domain "{domain}" or explicitly defined "service name".', description: - 'A messsage shown in a tooltip explaining that the nested anchor tag will navigate to the APM app and search for the given URL domain.', + 'A messsage shown in a tooltip explaining that the nested anchor tag will navigate to the APM app and search for the given URL domain or explicitly defined service name.', values: { domain, }, diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx index 334de6e376074..96536a357a450 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx @@ -5,7 +5,6 @@ */ import React from 'react'; -import { upperFirst } from 'lodash'; import { EuiCallOut, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { LocationLink } from '../../../common/location_link'; @@ -29,9 +28,9 @@ export const MonitorStatusList = ({ summaryPings }: MonitorStatusListProps) => { const location = ping.observer?.geo?.name ?? UNNAMED_LOCATION; if (ping.monitor.status === STATUS.UP) { - upChecks.add(upperFirst(location)); + upChecks.add(location); } else if (ping.monitor.status === STATUS.DOWN) { - downChecks.add(upperFirst(location)); + downChecks.add(location); } }); diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_status_column.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_status_column.tsx index 68ddf512e4d3c..7140211d18807 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_status_column.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_status_column.tsx @@ -7,7 +7,6 @@ import React from 'react'; import moment from 'moment'; import { i18n } from '@kbn/i18n'; -import { upperFirst } from 'lodash'; import styled from 'styled-components'; import { EuiHealth, EuiFlexGroup, EuiFlexItem, EuiText, EuiToolTip } from '@elastic/eui'; import { parseTimestamp } from './parse_timestamp'; @@ -83,9 +82,9 @@ export const getLocationStatus = (summaryPings: Ping[], status: string) => { const location = summaryPing?.observer?.geo?.name ?? UNNAMED_LOCATION; if (summaryPing.monitor.status === STATUS.UP) { - upPings.add(upperFirst(location)); + upPings.add(location); } else if (summaryPing.monitor.status === STATUS.DOWN) { - downPings.add(upperFirst(location)); + downPings.add(location); } }); diff --git a/x-pack/plugins/uptime/public/contexts/uptime_settings_context.tsx b/x-pack/plugins/uptime/public/contexts/uptime_settings_context.tsx index 142c6e17c5fd9..4c08e76a11aae 100644 --- a/x-pack/plugins/uptime/public/contexts/uptime_settings_context.tsx +++ b/x-pack/plugins/uptime/public/contexts/uptime_settings_context.tsx @@ -5,7 +5,7 @@ */ import React, { createContext, useMemo } from 'react'; -import { UptimeAppProps } from '../uptime_app'; +import { UptimeAppProps } from '../apps/uptime_app'; import { CLIENT_DEFAULTS, CONTEXT_DEFAULTS } from '../../common/constants'; import { CommonlyUsedRange } from '../components/common/uptime_date_picker'; import { useGetUrlParams } from '../hooks'; diff --git a/x-pack/plugins/uptime/public/contexts/uptime_theme_context.tsx b/x-pack/plugins/uptime/public/contexts/uptime_theme_context.tsx index ca2fb50cdbc67..51e8bcaed986f 100644 --- a/x-pack/plugins/uptime/public/contexts/uptime_theme_context.tsx +++ b/x-pack/plugins/uptime/public/contexts/uptime_theme_context.tsx @@ -9,7 +9,7 @@ import React, { createContext, useMemo } from 'react'; import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { EUI_CHARTS_THEME_DARK, EUI_CHARTS_THEME_LIGHT } from '@elastic/eui/dist/eui_charts_theme'; import { DARK_THEME, LIGHT_THEME, PartialTheme, Theme } from '@elastic/charts'; -import { UptimeAppColors } from '../uptime_app'; +import { UptimeAppColors } from '../apps/uptime_app'; export interface UptimeThemeContextValues { colors: UptimeAppColors; diff --git a/x-pack/plugins/uptime/public/index.ts b/x-pack/plugins/uptime/public/index.ts index 48cf2c90ad07b..cd6efa9016830 100644 --- a/x-pack/plugins/uptime/public/index.ts +++ b/x-pack/plugins/uptime/public/index.ts @@ -5,7 +5,7 @@ */ import { PluginInitializerContext } from 'kibana/public'; -import { UptimePlugin } from './apps'; +import { UptimePlugin } from './apps/plugin'; export const plugin = (initializerContext: PluginInitializerContext) => new UptimePlugin(initializerContext); diff --git a/x-pack/plugins/uptime/public/lib/alert_types/__tests__/monitor_status.test.ts b/x-pack/plugins/uptime/public/lib/alert_types/__tests__/monitor_status.test.ts index cfcb414f4815d..e999768d4e55d 100644 --- a/x-pack/plugins/uptime/public/lib/alert_types/__tests__/monitor_status.test.ts +++ b/x-pack/plugins/uptime/public/lib/alert_types/__tests__/monitor_status.test.ts @@ -4,7 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { validate, initMonitorStatusAlertType } from '../monitor_status'; +import { initMonitorStatusAlertType } from '../monitor_status'; +import { validateMonitorStatusParams as validate } from '../lazy_wrapper/validate_monitor_status'; describe('monitor status alert type', () => { describe('validate', () => { @@ -206,19 +207,11 @@ describe('monitor status alert type', () => { ", "iconClass": "uptimeApp", "id": "xpack.uptime.alerts.monitorStatus", - "name": - - , + "name": , "requiresAppContext": false, "validate": [Function], } diff --git a/x-pack/plugins/uptime/public/lib/alert_types/duration_anomaly.tsx b/x-pack/plugins/uptime/public/lib/alert_types/duration_anomaly.tsx index f0eb305461582..c1f802c2d0c91 100644 --- a/x-pack/plugins/uptime/public/lib/alert_types/duration_anomaly.tsx +++ b/x-pack/plugins/uptime/public/lib/alert_types/duration_anomaly.tsx @@ -5,30 +5,22 @@ */ import React from 'react'; -import { Provider as ReduxProvider } from 'react-redux'; import { AlertTypeModel } from '../../../../triggers_actions_ui/public'; -import { CLIENT_ALERT_TYPES } from '../../../common/constants'; +import { CLIENT_ALERT_TYPES } from '../../../common/constants/alerts'; import { DurationAnomalyTranslations } from './translations'; import { AlertTypeInitializer } from '.'; -import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; -import { store } from '../../state'; const { name, defaultActionMessage } = DurationAnomalyTranslations; -const AnomalyAlertExpression = React.lazy(() => - import('../../components/overview/alerts/anomaly_alert/anomaly_alert') -); +const DurationAnomalyAlert = React.lazy(() => import('./lazy_wrapper/duration_anomaly')); + export const initDurationAnomalyAlertType: AlertTypeInitializer = ({ core, plugins, }): AlertTypeModel => ({ id: CLIENT_ALERT_TYPES.DURATION_ANOMALY, iconClass: 'uptimeApp', - alertParamsExpression: (params: any) => ( - - - - - + alertParamsExpression: (params: unknown) => ( + ), name, validate: () => ({ errors: {} }), diff --git a/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/duration_anomaly.tsx b/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/duration_anomaly.tsx new file mode 100644 index 0000000000000..60f2d2e803b7b --- /dev/null +++ b/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/duration_anomaly.tsx @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { Provider as ReduxProvider } from 'react-redux'; +import { CoreStart } from 'kibana/public'; +import { store } from '../../../state'; +import { AnomalyAlertComponent } from '../../../components/overview/alerts/anomaly_alert/anomaly_alert'; +import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public'; +import { ClientPluginsStart } from '../../../apps/plugin'; +import { kibanaService } from '../../../state/kibana_service'; + +interface Props { + core: CoreStart; + plugins: ClientPluginsStart; + params: any; +} + +// eslint-disable-next-line import/no-default-export +export default function DurationAnomalyAlert({ core, plugins, params }: Props) { + kibanaService.core = core; + return ( + + + + + + ); +} diff --git a/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/monitor_status.tsx b/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/monitor_status.tsx new file mode 100644 index 0000000000000..f6b10d0fbf968 --- /dev/null +++ b/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/monitor_status.tsx @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { Provider as ReduxProvider } from 'react-redux'; +import { CoreStart } from 'kibana/public'; +import { store } from '../../../state'; +import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public'; +import { ClientPluginsStart } from '../../../apps/plugin'; +import { AlertMonitorStatus } from '../../../components/overview/alerts/alerts_containers'; +import { kibanaService } from '../../../state/kibana_service'; + +interface Props { + core: CoreStart; + plugins: ClientPluginsStart; + params: any; +} + +// eslint-disable-next-line import/no-default-export +export default function MonitorStatusAlert({ core, plugins, params }: Props) { + kibanaService.core = core; + return ( + + + + + + ); +} diff --git a/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/tls_alert.tsx b/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/tls_alert.tsx new file mode 100644 index 0000000000000..413734b63ced5 --- /dev/null +++ b/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/tls_alert.tsx @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { Provider as ReduxProvider } from 'react-redux'; +import { CoreStart } from 'kibana/public'; +import { store } from '../../../state'; +import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public'; +import { ClientPluginsStart } from '../../../apps/plugin'; +import { AlertTls } from '../../../components/overview/alerts/alerts_containers/alert_tls'; +import { kibanaService } from '../../../state/kibana_service'; + +interface Props { + core: CoreStart; + plugins: ClientPluginsStart; + params: any; +} + +// eslint-disable-next-line import/no-default-export +export default function TLSAlert({ core, plugins, params: _params }: Props) { + kibanaService.core = core; + return ( + + + + + + ); +} diff --git a/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/validate_monitor_status.ts b/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/validate_monitor_status.ts new file mode 100644 index 0000000000000..709669c24ed0a --- /dev/null +++ b/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/validate_monitor_status.ts @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { PathReporter } from 'io-ts/lib/PathReporter'; +import { isRight } from 'fp-ts/lib/Either'; +import { + AtomicStatusCheckParamsType, + MonitorAvailabilityType, + StatusCheckParamsType, +} from '../../../../common/runtime_types/alerts'; +import { ValidationResult } from '../../../../../triggers_actions_ui/public'; + +export function validateMonitorStatusParams(alertParams: any): ValidationResult { + const errors: Record = {}; + const decoded = AtomicStatusCheckParamsType.decode(alertParams); + const oldDecoded = StatusCheckParamsType.decode(alertParams); + const availabilityDecoded = MonitorAvailabilityType.decode(alertParams); + + if (!isRight(decoded) && !isRight(oldDecoded) && !isRight(availabilityDecoded)) { + return { + errors: { + typeCheckFailure: 'Provided parameters do not conform to the expected type.', + typeCheckParsingMessage: PathReporter.report(decoded), + }, + }; + } + + if ( + !(alertParams.shouldCheckAvailability ?? false) && + !(alertParams.shouldCheckStatus ?? false) + ) { + return { + errors: { + noAlertSelected: 'Alert must check for monitor status or monitor availability.', + }, + }; + } + + if (isRight(decoded) && decoded.right.shouldCheckStatus) { + const { numTimes, timerangeCount } = decoded.right; + if (numTimes < 1) { + errors.invalidNumTimes = 'Number of alert check down times must be an integer greater than 0'; + } + if (isNaN(timerangeCount)) { + errors.timeRangeStartValueNaN = 'Specified time range value must be a number'; + } + if (timerangeCount <= 0) { + errors.invalidTimeRangeValue = 'Time range value must be greater than 0'; + } + } + + return { errors }; +} diff --git a/x-pack/plugins/uptime/public/lib/alert_types/monitor_status.tsx b/x-pack/plugins/uptime/public/lib/alert_types/monitor_status.tsx index cb24df2357d01..e4da3eb9ef7ae 100644 --- a/x-pack/plugins/uptime/public/lib/alert_types/monitor_status.tsx +++ b/x-pack/plugins/uptime/public/lib/alert_types/monitor_status.tsx @@ -4,70 +4,19 @@ * you may not use this file except in compliance with the Elastic License. */ -import { Provider as ReduxProvider } from 'react-redux'; import React from 'react'; -import { isRight } from 'fp-ts/lib/Either'; -import { PathReporter } from 'io-ts/lib/PathReporter'; -import { AlertTypeModel } from '../../../../triggers_actions_ui/public'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { AlertTypeModel, ValidationResult } from '../../../../triggers_actions_ui/public'; import { AlertTypeInitializer } from '.'; -import { - AtomicStatusCheckParamsType, - StatusCheckParamsType, - MonitorAvailabilityType, -} from '../../../common/runtime_types'; -import { MonitorStatusTitle } from './monitor_status_title'; -import { CLIENT_ALERT_TYPES } from '../../../common/constants'; -import { MonitorStatusTranslations } from './translations'; -import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; -import { store } from '../../state'; - -export const validate = (alertParams: any) => { - const errors: Record = {}; - const decoded = AtomicStatusCheckParamsType.decode(alertParams); - const oldDecoded = StatusCheckParamsType.decode(alertParams); - const availabilityDecoded = MonitorAvailabilityType.decode(alertParams); - - if (!isRight(decoded) && !isRight(oldDecoded) && !isRight(availabilityDecoded)) { - return { - errors: { - typeCheckFailure: 'Provided parameters do not conform to the expected type.', - typeCheckParsingMessage: PathReporter.report(decoded), - }, - }; - } - - if ( - !(alertParams.shouldCheckAvailability ?? false) && - !(alertParams.shouldCheckStatus ?? false) - ) { - return { - errors: { - noAlertSelected: 'Alert must check for monitor status or monitor availability.', - }, - }; - } - - if (isRight(decoded) && decoded.right.shouldCheckStatus) { - const { numTimes, timerangeCount } = decoded.right; - if (numTimes < 1) { - errors.invalidNumTimes = 'Number of alert check down times must be an integer greater than 0'; - } - if (isNaN(timerangeCount)) { - errors.timeRangeStartValueNaN = 'Specified time range value must be a number'; - } - if (timerangeCount <= 0) { - errors.invalidTimeRangeValue = 'Time range value must be greater than 0'; - } - } - return { errors }; -}; +import { CLIENT_ALERT_TYPES } from '../../../common/constants/alerts'; +import { MonitorStatusTranslations } from './translations'; const { defaultActionMessage } = MonitorStatusTranslations; -const AlertMonitorStatus = React.lazy(() => - import('../../components/overview/alerts/alerts_containers/alert_monitor_status') -); +const MonitorStatusAlert = React.lazy(() => import('./lazy_wrapper/monitor_status')); + +let validateFunc: (alertParams: any) => ValidationResult; export const initMonitorStatusAlertType: AlertTypeInitializer = ({ core, @@ -75,21 +24,26 @@ export const initMonitorStatusAlertType: AlertTypeInitializer = ({ }): AlertTypeModel => ({ id: CLIENT_ALERT_TYPES.MONITOR_STATUS, name: ( - - - + ), iconClass: 'uptimeApp', - alertParamsExpression: (params: any) => { - return ( - - - - - - ); + alertParamsExpression: (params: any) => ( + + ), + validate: (alertParams: any) => { + if (!validateFunc) { + (async function loadValidate() { + const { validateMonitorStatusParams } = await import( + './lazy_wrapper/validate_monitor_status' + ); + validateFunc = validateMonitorStatusParams; + })(); + } + return validateFunc && validateFunc(alertParams); }, - validate, defaultActionMessage, requiresAppContext: false, }); diff --git a/x-pack/plugins/uptime/public/lib/alert_types/monitor_status_title.tsx b/x-pack/plugins/uptime/public/lib/alert_types/monitor_status_title.tsx deleted file mode 100644 index 1e2751a4ac388..0000000000000 --- a/x-pack/plugins/uptime/public/lib/alert_types/monitor_status_title.tsx +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import { FormattedMessage } from '@kbn/i18n/react'; - -export const MonitorStatusTitle = () => { - return ( - - ); -}; diff --git a/x-pack/plugins/uptime/public/lib/alert_types/tls.tsx b/x-pack/plugins/uptime/public/lib/alert_types/tls.tsx index c541ea4ae1331..9019fc216192c 100644 --- a/x-pack/plugins/uptime/public/lib/alert_types/tls.tsx +++ b/x-pack/plugins/uptime/public/lib/alert_types/tls.tsx @@ -5,27 +5,18 @@ */ import React from 'react'; -import { Provider as ReduxProvider } from 'react-redux'; import { AlertTypeModel } from '../../../../triggers_actions_ui/public'; -import { CLIENT_ALERT_TYPES } from '../../../common/constants'; +import { CLIENT_ALERT_TYPES } from '../../../common/constants/alerts'; import { TlsTranslations } from './translations'; import { AlertTypeInitializer } from '.'; -import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; -import { store } from '../../state'; const { name, defaultActionMessage } = TlsTranslations; -const TlsAlertExpression = React.lazy(() => - import('../../components/overview/alerts/alerts_containers/alert_tls') -); +const TLSAlert = React.lazy(() => import('./lazy_wrapper/tls_alert')); export const initTlsAlertType: AlertTypeInitializer = ({ core, plugins }): AlertTypeModel => ({ id: CLIENT_ALERT_TYPES.TLS, iconClass: 'uptimeApp', - alertParamsExpression: (_params: any) => ( - - - - - + alertParamsExpression: (params: any) => ( + ), name, validate: () => ({ errors: {} }), diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_apm_href.test.ts b/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_apm_href.test.ts index 8e320a8d9533a..2444cfbee63d5 100644 --- a/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_apm_href.test.ts +++ b/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_apm_href.test.ts @@ -9,7 +9,6 @@ import { MonitorSummary, makePing } from '../../../../../common/runtime_types'; describe('getApmHref', () => { let summary: MonitorSummary; - beforeEach(() => { summary = { monitor_id: 'foo', @@ -49,4 +48,18 @@ describe('getApmHref', () => { `"/app/apm#/services?kuery=url.domain:%20%22www.elastic.co%22&rangeFrom=now-15m&rangeTo=now"` ); }); + + describe('with service.name', () => { + const serviceName = 'MyServiceName'; + beforeEach(() => { + summary.state.service = { name: serviceName }; + }); + + it('links to the named service', () => { + const result = getApmHref(summary, 'foo', 'now-15m', 'now'); + expect(result).toMatchInlineSnapshot( + `"foo/app/apm#/services?kuery=service.name:%20%22${serviceName}%22&rangeFrom=now-15m&rangeTo=now"` + ); + }); + }); }); diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/build_href.ts b/x-pack/plugins/uptime/public/lib/helper/observability_integration/build_href.ts index 94383262b0acd..8c96a469da492 100644 --- a/x-pack/plugins/uptime/public/lib/helper/observability_integration/build_href.ts +++ b/x-pack/plugins/uptime/public/lib/helper/observability_integration/build_href.ts @@ -4,24 +4,23 @@ * you may not use this file except in compliance with the Elastic License. */ -import { get } from 'lodash'; import { Ping } from '../../../../common/runtime_types'; /** * Builds URLs to the designated features by extracting values from the provided * monitor object on a given path. Then returns the result of a provided function * to place the value in its rightful place on the URI string. - * @param checks array of summary checks containing the data to extract - * @param path the location on the object of the desired data + * @param summaryPings array of summary checks containing the data to extract + * @param getData the location on the object of the desired data * @param getHref a function that returns the full URL */ export const buildHref = ( summaryPings: Ping[], - path: string, + getData: (ping: Ping) => string | undefined, getHref: (value: string | string[] | undefined) => string | undefined ): string | undefined => { const queryValue = summaryPings - .map((ping) => get(ping, path, undefined)) + .map((ping) => getData(ping)) .filter((value: string | undefined) => value !== undefined); if (queryValue.length === 0) { return getHref(undefined); diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_apm_href.ts b/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_apm_href.ts index 0ff5a8acb3367..655d7a1407750 100644 --- a/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_apm_href.ts +++ b/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_apm_href.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { get } from 'lodash'; import { addBasePath } from './add_base_path'; import { MonitorSummary } from '../../../../common/runtime_types'; @@ -13,10 +12,15 @@ export const getApmHref = ( basePath: string, dateRangeStart: string, dateRangeEnd: string -) => - addBasePath( +) => { + const clause = summary?.state?.service?.name + ? `service.name: "${summary.state.service.name}"` + : `url.domain: "${summary.state.url?.domain}"`; + + return addBasePath( basePath, `/app/apm#/services?kuery=${encodeURI( - `url.domain: "${get(summary, 'state.url.domain')}"` + clause )}&rangeFrom=${dateRangeStart}&rangeTo=${dateRangeEnd}` ); +}; diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_infra_href.ts b/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_infra_href.ts index 33d24a0f081b4..c225382350eac 100644 --- a/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_infra_href.ts +++ b/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_infra_href.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { MonitorSummary } from '../../../../common/runtime_types'; +import { MonitorSummary, Ping } from '../../../../common/runtime_types'; import { addBasePath } from './add_base_path'; import { buildHref } from './build_href'; @@ -22,7 +22,7 @@ export const getInfraContainerHref = ( `/app/metrics/link-to/container-detail/${encodeURIComponent(ret)}` ); }; - return buildHref(summary.state.summaryPings || [], 'container.id', getHref); + return buildHref(summary.state.summaryPings || [], (ping: Ping) => ping?.container?.id, getHref); }; export const getInfraKubernetesHref = ( @@ -37,7 +37,11 @@ export const getInfraKubernetesHref = ( return addBasePath(basePath, `/app/metrics/link-to/pod-detail/${encodeURIComponent(ret)}`); }; - return buildHref(summary.state.summaryPings || [], 'kubernetes.pod.uid', getHref); + return buildHref( + summary.state.summaryPings || [], + (ping: Ping) => ping?.kubernetes?.pod?.uid, + getHref + ); }; export const getInfraIpHref = (summary: MonitorSummary, basePath: string) => { @@ -63,5 +67,5 @@ export const getInfraIpHref = (summary: MonitorSummary, basePath: string) => { `/app/metrics/inventory?waffleFilter=(expression:'${encodeURIComponent(ips)}',kind:kuery)` ); }; - return buildHref(summary.state.summaryPings || [], 'monitor.ip', getHref); + return buildHref(summary.state.summaryPings || [], (ping: Ping) => ping?.monitor?.ip, getHref); }; diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_logging_href.ts b/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_logging_href.ts index c4fee330e9763..32709882d1d21 100644 --- a/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_logging_href.ts +++ b/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_logging_href.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { MonitorSummary } from '../../../../common/runtime_types'; +import { MonitorSummary, Ping } from '../../../../common/runtime_types'; import { addBasePath } from './add_base_path'; import { buildHref } from './build_href'; @@ -22,7 +22,7 @@ export const getLoggingContainerHref = ( `/app/logs?logFilter=${encodeURI(`(expression:'container.id : ${ret}',kind:kuery)`)}` ); }; - return buildHref(summary.state.summaryPings || [], 'container.id', getHref); + return buildHref(summary.state.summaryPings || [], (ping: Ping) => ping?.container?.id, getHref); }; export const getLoggingKubernetesHref = (summary: MonitorSummary, basePath: string) => { @@ -36,7 +36,11 @@ export const getLoggingKubernetesHref = (summary: MonitorSummary, basePath: stri `/app/logs?logFilter=${encodeURI(`(expression:'pod.uid : ${ret}',kind:kuery)`)}` ); }; - return buildHref(summary.state.summaryPings || [], 'kubernetes.pod.uid', getHref); + return buildHref( + summary.state.summaryPings || [], + (ping: Ping) => ping?.kubernetes?.pod?.uid, + getHref + ); }; export const getLoggingIpHref = (summary: MonitorSummary, basePath: string) => { @@ -50,5 +54,5 @@ export const getLoggingIpHref = (summary: MonitorSummary, basePath: string) => { `/app/logs?logFilter=(expression:'${encodeURIComponent(`host.ip : ${ret}`)}',kind:kuery)` ); }; - return buildHref(summary.state.summaryPings || [], 'monitor.ip', getHref); + return buildHref(summary.state.summaryPings || [], (ping: Ping) => ping?.monitor?.ip, getHref); }; diff --git a/x-pack/plugins/uptime/public/lib/lib.ts b/x-pack/plugins/uptime/public/lib/lib.ts index 187dcee7adb1a..ac95f018a80a2 100644 --- a/x-pack/plugins/uptime/public/lib/lib.ts +++ b/x-pack/plugins/uptime/public/lib/lib.ts @@ -4,19 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ReactElement } from 'react'; -import { AppUnmount } from 'kibana/public'; import { UMBadge } from '../badge'; -import { UptimeAppProps } from '../uptime_app'; - -export interface UMFrontendLibs { - framework: UMFrameworkAdapter; -} export type UMUpdateBadge = (badge: UMBadge) => void; - -export type BootstrapUptimeApp = (props: UptimeAppProps) => ReactElement; - -export interface UMFrameworkAdapter { - render(element: any): Promise; -} diff --git a/x-pack/plugins/uptime/public/pages/certificates.tsx b/x-pack/plugins/uptime/public/pages/certificates.tsx index 58a56a5555323..e46d228c6d21f 100644 --- a/x-pack/plugins/uptime/public/pages/certificates.tsx +++ b/x-pack/plugins/uptime/public/pages/certificates.tsx @@ -21,13 +21,14 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { useTrackPageview } from '../../../observability/public'; import { PageHeader } from './page_header'; import { useBreadcrumbs } from '../hooks/use_breadcrumbs'; -import { OVERVIEW_ROUTE, SETTINGS_ROUTE, CLIENT_ALERT_TYPES } from '../../common/constants'; +import { OVERVIEW_ROUTE, SETTINGS_ROUTE } from '../../common/constants'; import { getDynamicSettings } from '../state/actions/dynamic_settings'; import { UptimeRefreshContext } from '../contexts'; import * as labels from './translations'; import { certificatesSelector, getCertificatesAction } from '../state/certificates/certificates'; import { CertificateList, CertificateSearch, CertSort } from '../components/certificates'; import { ToggleAlertFlyoutButton } from '../components/overview/alerts/alerts_containers'; +import { CLIENT_ALERT_TYPES } from '../../common/constants/alerts'; const DEFAULT_PAGE_SIZE = 10; const LOCAL_STORAGE_KEY = 'xpack.uptime.certList.pageSize'; diff --git a/x-pack/plugins/uptime/public/pages/settings.tsx b/x-pack/plugins/uptime/public/pages/settings.tsx index 602911cd41aab..89c12d0efdac1 100644 --- a/x-pack/plugins/uptime/public/pages/settings.tsx +++ b/x-pack/plugins/uptime/public/pages/settings.tsx @@ -17,7 +17,6 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { useDispatch, useSelector } from 'react-redux'; -import { isEqual } from 'lodash'; import { useHistory } from 'react-router-dom'; import { selectDynamicSettings } from '../state/selectors'; import { getDynamicSettings, setDynamicSettings } from '../state/actions/dynamic_settings'; @@ -80,6 +79,14 @@ const getFieldErrors = (formFields: DynamicSettings | null): SettingsPageFieldEr return null; }; +const isDirtyForm = (formFields: DynamicSettings | null, settings?: DynamicSettings) => { + return ( + settings?.certAgeThreshold !== formFields?.certAgeThreshold || + settings?.certExpirationThreshold !== formFields?.certExpirationThreshold || + settings?.heartbeatIndices !== formFields?.heartbeatIndices + ); +}; + export const SettingsPage: React.FC = () => { const dss = useSelector(selectDynamicSettings); @@ -121,7 +128,8 @@ export const SettingsPage: React.FC = () => { const resetForm = () => setFormFields(dss.settings ? { ...dss.settings } : null); - const isFormDirty = !isEqual(dss.settings, formFields); + const isFormDirty = isDirtyForm(formFields, dss.settings); + const canEdit: boolean = !!useKibana().services?.application?.capabilities.uptime.configureSettings || false; const isFormDisabled = dss.loading || !canEdit; diff --git a/x-pack/plugins/uptime/public/state/api/utils.ts b/x-pack/plugins/uptime/public/state/api/utils.ts index 4f3765275c49a..e0cec56dd52cd 100644 --- a/x-pack/plugins/uptime/public/state/api/utils.ts +++ b/x-pack/plugins/uptime/public/state/api/utils.ts @@ -8,7 +8,11 @@ import { PathReporter } from 'io-ts/lib/PathReporter'; import { isRight } from 'fp-ts/lib/Either'; import { HttpFetchQuery, HttpSetup } from 'src/core/public'; import * as t from 'io-ts'; -import { isObject } from 'lodash'; + +function isObject(value: unknown) { + const type = typeof value; + return value != null && (type === 'object' || type === 'function'); +} // TODO: Copied from https://github.com/elastic/kibana/blob/master/x-pack/plugins/security_solution/common/format_errors.ts // We should figure out a better way to share this diff --git a/x-pack/plugins/uptime/public/state/effects/index_status.ts b/x-pack/plugins/uptime/public/state/effects/index_status.ts index a4b85312849a2..3917159381eb5 100644 --- a/x-pack/plugins/uptime/public/state/effects/index_status.ts +++ b/x-pack/plugins/uptime/public/state/effects/index_status.ts @@ -6,8 +6,8 @@ import { takeLeading } from 'redux-saga/effects'; import { indexStatusAction } from '../actions'; -import { fetchIndexStatus } from '../api'; import { fetchEffectFactory } from './fetch_effect'; +import { fetchIndexStatus } from '../api/index_status'; export function* fetchIndexStatusEffect() { yield takeLeading( diff --git a/x-pack/plugins/uptime/server/kibana.index.ts b/x-pack/plugins/uptime/server/kibana.index.ts index a2d5f58bbec14..ab8d7a068b19d 100644 --- a/x-pack/plugins/uptime/server/kibana.index.ts +++ b/x-pack/plugins/uptime/server/kibana.index.ts @@ -5,7 +5,7 @@ */ import { Request, Server } from 'hapi'; -import { PLUGIN } from '../common/constants'; +import { PLUGIN } from '../common/constants/plugin'; import { compose } from './lib/compose/kibana'; import { initUptimeServer } from './uptime_server'; import { UptimeCorePlugins, UptimeCoreSetup } from './lib/adapters/framework'; @@ -35,6 +35,9 @@ export const initServerWithKibana = (server: UptimeCoreSetup, plugins: UptimeCor icon: 'uptimeApp', app: ['uptime', 'kibana'], catalogue: ['uptime'], + management: { + insightsAndAlerting: ['triggersActions'], + }, alerting: ['xpack.uptime.alerts.tls', 'xpack.uptime.alerts.monitorStatus'], privileges: { all: { @@ -48,7 +51,10 @@ export const initServerWithKibana = (server: UptimeCoreSetup, plugins: UptimeCor alerting: { all: ['xpack.uptime.alerts.tls', 'xpack.uptime.alerts.monitorStatus'], }, - ui: ['save', 'configureSettings', 'show', 'alerting:show'], + management: { + insightsAndAlerting: ['triggersActions'], + }, + ui: ['save', 'configureSettings', 'show'], }, read: { app: ['uptime', 'kibana'], @@ -61,7 +67,10 @@ export const initServerWithKibana = (server: UptimeCoreSetup, plugins: UptimeCor alerting: { all: ['xpack.uptime.alerts.tls', 'xpack.uptime.alerts.monitorStatus'], }, - ui: ['show', 'alerting:show'], + management: { + insightsAndAlerting: ['triggersActions'], + }, + ui: ['show'], }, }, }); diff --git a/x-pack/plugins/uptime/server/lib/alerts/duration_anomaly.ts b/x-pack/plugins/uptime/server/lib/alerts/duration_anomaly.ts index 7dd357e99b83d..a71913d0eea9a 100644 --- a/x-pack/plugins/uptime/server/lib/alerts/duration_anomaly.ts +++ b/x-pack/plugins/uptime/server/lib/alerts/duration_anomaly.ts @@ -8,7 +8,7 @@ import moment from 'moment'; import { schema } from '@kbn/config-schema'; import { ILegacyScopedClusterClient } from 'kibana/server'; import { updateState } from './common'; -import { ACTION_GROUP_DEFINITIONS } from '../../../common/constants'; +import { ACTION_GROUP_DEFINITIONS } from '../../../common/constants/alerts'; import { commonStateTranslations, durationAnomalyTranslations } from './translations'; import { AnomaliesTableRecord } from '../../../../ml/common/types/anomalies'; import { getSeverityType } from '../../../../ml/common/util/anomaly_utils'; diff --git a/x-pack/plugins/uptime/server/lib/alerts/status_check.ts b/x-pack/plugins/uptime/server/lib/alerts/status_check.ts index 2117ac4b7ed4e..a34d7eb292eef 100644 --- a/x-pack/plugins/uptime/server/lib/alerts/status_check.ts +++ b/x-pack/plugins/uptime/server/lib/alerts/status_check.ts @@ -21,7 +21,7 @@ import { MonitorAvailabilityType, DynamicSettings, } from '../../../common/runtime_types'; -import { ACTION_GROUP_DEFINITIONS } from '../../../common/constants'; +import { ACTION_GROUP_DEFINITIONS } from '../../../common/constants/alerts'; import { savedObjectsAdapter } from '../saved_objects'; import { updateState } from './common'; import { commonStateTranslations } from './translations'; diff --git a/x-pack/plugins/uptime/server/lib/alerts/tls.ts b/x-pack/plugins/uptime/server/lib/alerts/tls.ts index 61e738b088d50..d4853ad7a9cb0 100644 --- a/x-pack/plugins/uptime/server/lib/alerts/tls.ts +++ b/x-pack/plugins/uptime/server/lib/alerts/tls.ts @@ -9,7 +9,8 @@ import { schema } from '@kbn/config-schema'; import { UptimeAlertTypeFactory } from './types'; import { savedObjectsAdapter } from '../saved_objects'; import { updateState } from './common'; -import { ACTION_GROUP_DEFINITIONS, DYNAMIC_SETTINGS_DEFAULTS } from '../../../common/constants'; +import { ACTION_GROUP_DEFINITIONS } from '../../../common/constants/alerts'; +import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../common/constants'; import { Cert, CertResult } from '../../../common/runtime_types'; import { commonStateTranslations, tlsTranslations } from './translations'; import { DEFAULT_FROM, DEFAULT_TO } from '../../rest_api/certs/certs'; diff --git a/x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts b/x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts index f631d5c963ca5..98db43c5b2623 100644 --- a/x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts +++ b/x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts @@ -93,6 +93,7 @@ export const summaryPingsToSummary = (summaryPings: Ping[]): MonitorSummary => { observer: { geo: { name: summaryPings.map((p) => p.observer?.geo?.name ?? '').filter((n) => n !== '') }, }, + service: summaryPings.find((p) => p.service?.name)?.service, }, }; }; diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts index 0970738b630c4..a23f0fa835313 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts @@ -27,8 +27,5 @@ export default function alertingTests({ loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./alerts_space1')); loadTestFile(require.resolve('./alerts_default_space')); loadTestFile(require.resolve('./builtin_alert_types')); - - // note that this test will destroy existing spaces - loadTestFile(require.resolve('./migrations')); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/migrations.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/migrations.ts deleted file mode 100644 index d0e1be12e762f..0000000000000 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/migrations.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import expect from '@kbn/expect'; -import { getUrlPrefix } from '../../../common/lib'; -import { FtrProviderContext } from '../../../common/ftr_provider_context'; - -// eslint-disable-next-line import/no-default-export -export default function createGetTests({ getService }: FtrProviderContext) { - const supertest = getService('supertest'); - const esArchiver = getService('esArchiver'); - - describe('migrations', () => { - before(async () => { - await esArchiver.load('alerts'); - }); - - after(async () => { - await esArchiver.unload('alerts'); - }); - - it('7.9.0 migrates the `alerting` consumer to be the `alerts`', async () => { - const response = await supertest.get( - `${getUrlPrefix(``)}/api/alerts/alert/74f3e6d7-b7bb-477d-ac28-92ee22728e6e` - ); - - expect(response.status).to.eql(200); - expect(response.body.consumer).to.equal('alerts'); - }); - - it('7.10.0 migrates the `metrics` consumer to be the `infrastructure`', async () => { - const response = await supertest.get( - `${getUrlPrefix(``)}/api/alerts/alert/74f3e6d7-b7bb-477d-ac28-fdf248d5f2a4` - ); - - expect(response.status).to.eql(200); - expect(response.body.consumer).to.equal('infrastructure'); - }); - }); -} diff --git a/x-pack/test/apm_api_integration/basic/tests/traces/expectation/top_traces.expectation.json b/x-pack/test/apm_api_integration/basic/tests/traces/expectation/top_traces.expectation.json index bacb340292f93..4db040e92e7fa 100644 --- a/x-pack/test/apm_api_integration/basic/tests/traces/expectation/top_traces.expectation.json +++ b/x-pack/test/apm_api_integration/basic/tests/traces/expectation/top_traces.expectation.json @@ -1,20 +1,35 @@ [ { - "name": "Process payment", + "key": { + "service.name": "opbeans-node", + "transaction.name": "Process payment" + }, + "averageResponseTime": 1745009, + "transactionsPerMinute": 0.25, + "impact": 100, "sample": { "@timestamp": "2020-06-29T06:48:29.892Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:39.379730Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:39.379730Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "observer": { "ephemeral_id": "99908b73-9813-4a73-baa6-993db405523a", @@ -34,59 +49,97 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "timestamp": { "us": 1593413309892019 }, - "trace": { "id": "bc393b659bef63291b6fa08e6f1d3f14" }, + "timestamp": { + "us": 1593413309892019 + }, + "trace": { + "id": "bc393b659bef63291b6fa08e6f1d3f14" + }, "transaction": { - "duration": { "us": 1745009 }, + "duration": { + "us": 1745009 + }, "id": "a58333df6d851cf1", "name": "Process payment", "result": "success", "sampled": true, - "span_count": { "started": 2 }, + "span_count": { + "started": 2 + }, "type": "Worker" } - }, - "p95": 1744896, - "averageResponseTime": 1745009, - "transactionsPerMinute": 0.25, - "impact": 100 + } }, { - "name": "GET /api", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /api" + }, + "averageResponseTime": 49816.15625, + "transactionsPerMinute": 8, + "impact": 91.32732325394932, "sample": { - "@timestamp": "2020-06-29T06:48:41.454Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "@timestamp": "2020-06-29T06:48:06.969Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.992834Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:08.306961Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -96,11 +149,18 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Type": ["application/json;charset=UTF-8"], - "Date": ["Mon, 29 Jun 2020 06:48:41 GMT"], - "Transfer-Encoding": ["chunked"], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "0" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:06 GMT" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -130,61 +190,103 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413321454009 }, - "trace": { "id": "0507830eeff93f7bf1a354e4031097b3" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413286969018 + }, + "trace": { + "id": "87a828bcedd44d9e872d8f552fb04aa6" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 8334 }, - "id": "878250a8b937445d", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 25229 + }, + "id": "b1843afd04271423", "name": "GET /api", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 1 }, + "span_count": { + "started": 1 + }, "type": "request" }, "url": { "domain": "opbeans-node", - "full": "http://opbeans-node:3000/api/products/6", - "original": "/api/products/6", - "path": "/api/products/6", + "full": "http://opbeans-node:3000/api/orders/474", + "original": "/api/orders/474", + "path": "/api/orders/474", "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 81888, - "averageResponseTime": 49816.15625, - "transactionsPerMinute": 8, - "impact": 91.32732325394932 + } }, { - "name": "/dashboard", + "key": { + "service.name": "client", + "transaction.name": "/dashboard" + }, + "averageResponseTime": 208000, + "transactionsPerMinute": 0.75, + "impact": 35.56882613781033, "sample": { - "@timestamp": "2020-06-29T06:48:21.621Z", - "agent": { "name": "rum-js", "version": "5.2.0" }, - "client": { "ip": "172.18.0.8" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:22.625275Z" }, + "@timestamp": "2020-06-29T06:48:07.275Z", + "agent": { + "name": "rum-js", + "version": "5.2.0" + }, + "client": { + "ip": "172.18.0.8" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:08.291261Z" + }, "http": { - "request": { "referrer": "" }, + "request": { + "referrer": "" + }, "response": { "decoded_body_size": 813, "encoded_body_size": 813, @@ -199,52 +301,73 @@ "version": "8.0.0", "version_major": 8 }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { - "language": { "name": "javascript" }, + "language": { + "name": "javascript" + }, "name": "client", "version": "1.0.0" }, - "source": { "ip": "172.18.0.8" }, - "timestamp": { "us": 1593413301621808 }, - "trace": { "id": "ee0ce8b38b8d5945829fc1c9432538bf" }, + "source": { + "ip": "172.18.0.8" + }, + "timestamp": { + "us": 1593413287275113 + }, + "trace": { + "id": "ca86ffcac7753ec8733933bd8fd45d11" + }, "transaction": { "custom": { "userConfig": { - "featureFlags": ["double-trouble", "4423-hotfix"], + "featureFlags": [ + "double-trouble", + "4423-hotfix" + ], "showDashboard": true } }, - "duration": { "us": 109000 }, - "id": "c546a6716b681bf2", + "duration": { + "us": 342000 + }, + "id": "c40f735132c8e864", "marks": { "agent": { - "domComplete": 98, - "domInteractive": 87, - "timeToFirstByte": 3 + "domComplete": 335, + "domInteractive": 327, + "timeToFirstByte": 16 }, "navigationTiming": { - "connectEnd": 0, - "connectStart": 0, - "domComplete": 98, - "domContentLoadedEventEnd": 87, - "domContentLoadedEventStart": 87, - "domInteractive": 87, - "domLoading": 8, - "domainLookupEnd": 0, - "domainLookupStart": 0, + "connectEnd": 12, + "connectStart": 12, + "domComplete": 335, + "domContentLoadedEventEnd": 327, + "domContentLoadedEventStart": 327, + "domInteractive": 327, + "domLoading": 21, + "domainLookupEnd": 12, + "domainLookupStart": 10, "fetchStart": 0, - "loadEventEnd": 98, - "loadEventStart": 98, - "requestStart": 1, - "responseEnd": 8, - "responseStart": 3 + "loadEventEnd": 335, + "loadEventStart": 335, + "requestStart": 12, + "responseEnd": 17, + "responseStart": 16 } }, "name": "/dashboard", - "page": { "referer": "", "url": "http://opbeans-node:3000/dashboard" }, + "page": { + "referer": "", + "url": "http://opbeans-node:3000/dashboard" + }, "sampled": true, - "span_count": { "started": 8 }, + "span_count": { + "started": 9 + }, "type": "page-load" }, "url": { @@ -261,50 +384,75 @@ "name": "arthurdent" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "HeadlessChrome", "original": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/79.0.3945.0 Safari/537.36", - "os": { "name": "Linux" }, + "os": { + "name": "Linux" + }, "version": "79.0.3945" } - }, - "p95": 341504, - "averageResponseTime": 208000, - "transactionsPerMinute": 0.75, - "impact": 35.56882613781033 + } }, { - "name": "DispatcherServlet#doGet", + "key": { + "service.name": "opbeans-java", + "transaction.name": "DispatcherServlet#doGet" + }, + "averageResponseTime": 36010.53846153846, + "transactionsPerMinute": 3.25, + "impact": 26.61043592713186, "sample": { - "@timestamp": "2020-06-29T06:48:40.104Z", + "@timestamp": "2020-06-29T06:48:10.529Z", "agent": { "ephemeral_id": "222af346-6dd9-45ef-ac85-d86b67edd2de", "name": "java", "version": "1.17.1-SNAPSHOT" }, - "client": { "ip": "172.18.0.9" }, + "client": { + "ip": "172.18.0.9" + }, "container": { "id": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:46.706956Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:15.757591Z" + }, "host": { "architecture": "amd64", "hostname": "918ebbd99b4f", "ip": "172.18.0.6", "name": "918ebbd99b4f", - "os": { "platform": "Linux" } + "os": { + "platform": "Linux" + } }, "http": { "request": { "headers": { - "Accept": ["*/*"], - "Accept-Encoding": ["gzip, deflate"], - "Host": ["172.18.0.6:3000"], - "User-Agent": ["Python/3.7 aiohttp/3.3.2"] + "Accept": [ + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Host": [ + "172.18.0.6:3000" + ], + "User-Agent": [ + "Python/3.7 aiohttp/3.3.2" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "172.18.0.9" } + "socket": { + "encrypted": false, + "remote_address": "172.18.0.9" + } }, "response": { "finished": true, @@ -321,77 +469,132 @@ "version": "8.0.0", "version_major": 8 }, - "process": { "pid": 6, "ppid": 1, "title": "/opt/java/openjdk/bin/java" }, - "processor": { "event": "transaction", "name": "transaction" }, + "process": { + "pid": 6, + "ppid": 1, + "title": "/opt/java/openjdk/bin/java" + }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "Servlet API" }, - "language": { "name": "Java", "version": "11.0.7" }, + "framework": { + "name": "Servlet API" + }, + "language": { + "name": "Java", + "version": "11.0.7" + }, "name": "opbeans-java", "node": { "name": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "runtime": { "name": "Java", "version": "11.0.7" }, + "runtime": { + "name": "Java", + "version": "11.0.7" + }, "version": "None" }, - "source": { "ip": "172.18.0.9" }, - "timestamp": { "us": 1593413320104008 }, - "trace": { "id": "90bd7780b32cc51a7f4c200b1e0c170f" }, + "source": { + "ip": "172.18.0.9" + }, + "timestamp": { + "us": 1593413290529006 + }, + "trace": { + "id": "66e3db4cf016b138a43d319d15174891" + }, "transaction": { - "duration": { "us": 8896 }, - "id": "40b22b21e92bbb20", + "duration": { + "us": 34366 + }, + "id": "7ea720a0175e7ffa", "name": "DispatcherServlet#doGet", "result": "HTTP 2xx", "sampled": true, - "span_count": { "dropped": 0, "started": 1 }, + "span_count": { + "dropped": 0, + "started": 1 + }, "type": "request" }, "url": { "domain": "172.18.0.6", - "full": "http://172.18.0.6:3000/api/orders", - "path": "/api/orders", + "full": "http://172.18.0.6:3000/api/products", + "path": "/api/products", "port": 3000, "scheme": "http" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "Python/3.7 aiohttp/3.3.2" } - }, - "p95": 34528, - "averageResponseTime": 36010.53846153846, - "transactionsPerMinute": 3.25, - "impact": 26.61043592713186 + } }, { - "name": "POST /api/orders", + "key": { + "service.name": "opbeans-node", + "transaction.name": "POST /api/orders" + }, + "averageResponseTime": 270684, + "transactionsPerMinute": 0.25, + "impact": 15.261616628971955, "sample": { "@timestamp": "2020-06-29T06:48:39.953Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.991549Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:43.991549Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { - "body": { "original": "[REDACTED]" }, + "body": { + "original": "[REDACTED]" + }, "headers": { - "Accept": ["application/json"], - "Connection": ["close"], - "Content-Length": ["129"], - "Content-Type": ["application/json"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Accept": [ + "application/json" + ], + "Connection": [ + "close" + ], + "Content-Length": [ + "129" + ], + "Content-Type": [ + "application/json" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "post", "socket": { @@ -401,12 +604,24 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["13"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:40 GMT"], - "Etag": ["W/\"d-eEOWU4Cnr5DZ23ErRUeYu9oOIks\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "13" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:40 GMT" + ], + "Etag": [ + "W/\"d-eEOWU4Cnr5DZ23ErRUeYu9oOIks\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -436,29 +651,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413319953033 }, - "trace": { "id": "52b8fda5f6df745b990740ba18378620" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413319953033 + }, + "trace": { + "id": "52b8fda5f6df745b990740ba18378620" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 270684 }, + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 270684 + }, "id": "a3afc2a112e9c893", "name": "POST /api/orders", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 16 }, + "span_count": { + "started": 16 + }, "type": "request" }, "url": { @@ -469,50 +707,77 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 270336, - "averageResponseTime": 270684, - "transactionsPerMinute": 0.25, - "impact": 15.261616628971955 + } }, { - "name": "ResourceHttpRequestHandler", + "key": { + "service.name": "opbeans-java", + "transaction.name": "ResourceHttpRequestHandler" + }, + "averageResponseTime": 14419.42857142857, + "transactionsPerMinute": 3.5, + "impact": 11.30657439844125, "sample": { - "@timestamp": "2020-06-29T06:48:44.376Z", + "@timestamp": "2020-06-29T06:48:06.640Z", "agent": { "ephemeral_id": "222af346-6dd9-45ef-ac85-d86b67edd2de", "name": "java", "version": "1.17.1-SNAPSHOT" }, - "client": { "ip": "172.18.0.9" }, + "client": { + "ip": "172.18.0.9" + }, "container": { "id": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:46.720380Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:15.517678Z" + }, "host": { "architecture": "amd64", "hostname": "918ebbd99b4f", "ip": "172.18.0.6", "name": "918ebbd99b4f", - "os": { "platform": "Linux" } + "os": { + "platform": "Linux" + } }, "http": { "request": { "headers": { - "Accept": ["*/*"], - "Accept-Encoding": ["gzip, deflate"], - "Host": ["172.18.0.6:3000"], - "User-Agent": ["Python/3.7 aiohttp/3.3.2"] + "Accept": [ + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Host": [ + "172.18.0.6:3000" + ], + "User-Agent": [ + "Python/3.7 aiohttp/3.3.2" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "172.18.0.9" } + "socket": { + "encrypted": false, + "remote_address": "172.18.0.9" + } }, "response": { "finished": true, @@ -529,63 +794,100 @@ "version": "8.0.0", "version_major": 8 }, - "process": { "pid": 6, "ppid": 1, "title": "/opt/java/openjdk/bin/java" }, - "processor": { "event": "transaction", "name": "transaction" }, + "process": { + "pid": 6, + "ppid": 1, + "title": "/opt/java/openjdk/bin/java" + }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "Spring Web MVC", "version": "5.0.6.RELEASE" }, - "language": { "name": "Java", "version": "11.0.7" }, + "framework": { + "name": "Spring Web MVC", + "version": "5.0.6.RELEASE" + }, + "language": { + "name": "Java", + "version": "11.0.7" + }, "name": "opbeans-java", "node": { "name": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "runtime": { "name": "Java", "version": "11.0.7" }, + "runtime": { + "name": "Java", + "version": "11.0.7" + }, "version": "None" }, - "source": { "ip": "172.18.0.9" }, - "timestamp": { "us": 1593413324376010 }, - "trace": { "id": "7e70dc471913473e7d3bffda9b27d720" }, + "source": { + "ip": "172.18.0.9" + }, + "timestamp": { + "us": 1593413286640008 + }, + "trace": { + "id": "81d8ffb0a39e755eed400f6486e15672" + }, "transaction": { - "duration": { "us": 1420 }, - "id": "5c4e9f4b0846c2f8", + "duration": { + "us": 2953 + }, + "id": "353d42a2f9046e99", "name": "ResourceHttpRequestHandler", "result": "HTTP 4xx", "sampled": true, - "span_count": { "dropped": 0, "started": 0 }, + "span_count": { + "dropped": 0, + "started": 0 + }, "type": "request" }, "url": { "domain": "172.18.0.6", - "full": "http://172.18.0.6:3000/api/types", - "path": "/api/types", + "full": "http://172.18.0.6:3000/api/types/3", + "path": "/api/types/3", "port": 3000, "scheme": "http" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "Python/3.7 aiohttp/3.3.2" } - }, - "p95": 4120, - "averageResponseTime": 14419.42857142857, - "transactionsPerMinute": 3.5, - "impact": 11.30657439844125 + } }, { - "name": "/orders", + "key": { + "service.name": "client", + "transaction.name": "/orders" + }, + "averageResponseTime": 81500, + "transactionsPerMinute": 0.5, + "impact": 9.072365225837785, "sample": { - "@timestamp": "2020-06-29T06:48:38.358Z", - "agent": { "name": "rum-js", "version": "5.2.0" }, - "client": { "ip": "172.18.0.8" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:39.365914Z" }, + "@timestamp": "2020-06-29T06:48:29.296Z", + "agent": { + "name": "rum-js", + "version": "5.2.0" + }, + "client": { + "ip": "172.18.0.8" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:29.986555Z" + }, "http": { - "request": { "referrer": "" }, - "response": { - "decoded_body_size": 813, - "encoded_body_size": 813, - "transfer_size": 962 + "request": { + "referrer": "" } }, "observer": { @@ -596,53 +898,50 @@ "version": "8.0.0", "version_major": 8 }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { - "language": { "name": "javascript" }, + "language": { + "name": "javascript" + }, "name": "client", "version": "1.0.0" }, - "source": { "ip": "172.18.0.8" }, - "timestamp": { "us": 1593413318358392 }, - "trace": { "id": "c1dea08a4128e776fd9965ccf8c8da99" }, + "source": { + "ip": "172.18.0.8" + }, + "timestamp": { + "us": 1593413309296660 + }, + "trace": { + "id": "978b56807e0b7a27cbc41a0dfb665f47" + }, "transaction": { "custom": { "userConfig": { - "featureFlags": ["double-trouble", "4423-hotfix"], + "featureFlags": [ + "double-trouble", + "4423-hotfix" + ], "showDashboard": true } }, - "duration": { "us": 140000 }, - "id": "4f2ea2796645d6e5", - "marks": { - "agent": { - "domComplete": 126, - "domInteractive": 116, - "timeToFirstByte": 3 - }, - "navigationTiming": { - "connectEnd": 0, - "connectStart": 0, - "domComplete": 126, - "domContentLoadedEventEnd": 116, - "domContentLoadedEventStart": 116, - "domInteractive": 116, - "domLoading": 20, - "domainLookupEnd": 0, - "domainLookupStart": 0, - "fetchStart": 0, - "loadEventEnd": 126, - "loadEventStart": 126, - "requestStart": 1, - "responseEnd": 3, - "responseStart": 3 - } + "duration": { + "us": 23000 }, + "id": "c3801eadbdef5c7c", "name": "/orders", - "page": { "referer": "", "url": "http://opbeans-node:3000/orders" }, + "page": { + "referer": "", + "url": "http://opbeans-node:3000/orders" + }, "sampled": true, - "span_count": { "started": 7 }, - "type": "page-load" + "span_count": { + "started": 1 + }, + "type": "route-change" }, "url": { "domain": "opbeans-node", @@ -652,59 +951,94 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "adastra@example.com", "id": "3", "name": "trillian" }, + "user": { + "email": "arthur.dent@example.com", + "id": "1", + "name": "arthurdent" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "HeadlessChrome", "original": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/79.0.3945.0 Safari/537.36", - "os": { "name": "Linux" }, + "os": { + "name": "Linux" + }, "version": "79.0.3945" } - }, - "p95": 140160, - "averageResponseTime": 81500, - "transactionsPerMinute": 0.5, - "impact": 9.072365225837785 + } }, { - "name": "APIRestController#customer", + "key": { + "service.name": "opbeans-java", + "transaction.name": "APIRestController#customer" + }, + "averageResponseTime": 19370.6, + "transactionsPerMinute": 1.25, + "impact": 5.270496679320978, "sample": { - "@timestamp": "2020-06-29T06:48:38.893Z", + "@timestamp": "2020-06-29T06:48:08.631Z", "agent": { "ephemeral_id": "222af346-6dd9-45ef-ac85-d86b67edd2de", "name": "java", "version": "1.17.1-SNAPSHOT" }, - "client": { "ip": "172.18.0.9" }, + "client": { + "ip": "172.18.0.9" + }, "container": { "id": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:46.680126Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:15.536897Z" + }, "host": { "architecture": "amd64", "hostname": "918ebbd99b4f", "ip": "172.18.0.6", "name": "918ebbd99b4f", - "os": { "platform": "Linux" } + "os": { + "platform": "Linux" + } }, "http": { "request": { "headers": { - "Accept": ["*/*"], - "Accept-Encoding": ["gzip, deflate"], - "Host": ["172.18.0.6:3000"], - "User-Agent": ["Python/3.7 aiohttp/3.3.2"] + "Accept": [ + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Host": [ + "172.18.0.6:3000" + ], + "User-Agent": [ + "Python/3.7 aiohttp/3.3.2" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "172.18.0.9" } + "socket": { + "encrypted": false, + "remote_address": "172.18.0.9" + } }, "response": { "finished": true, "headers": { - "Content-Type": ["application/json;charset=UTF-8"], - "Date": ["Mon, 29 Jun 2020 06:48:38 GMT"], - "Transfer-Encoding": ["chunked"] + "Content-Type": [ + "application/json;charset=UTF-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:08 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ] }, "headers_sent": true, "status_code": 200 @@ -719,59 +1053,101 @@ "version": "8.0.0", "version_major": 8 }, - "process": { "pid": 6, "ppid": 1, "title": "/opt/java/openjdk/bin/java" }, - "processor": { "event": "transaction", "name": "transaction" }, + "process": { + "pid": 6, + "ppid": 1, + "title": "/opt/java/openjdk/bin/java" + }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "Spring Web MVC", "version": "5.0.6.RELEASE" }, - "language": { "name": "Java", "version": "11.0.7" }, + "framework": { + "name": "Spring Web MVC", + "version": "5.0.6.RELEASE" + }, + "language": { + "name": "Java", + "version": "11.0.7" + }, "name": "opbeans-java", "node": { "name": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "runtime": { "name": "Java", "version": "11.0.7" }, + "runtime": { + "name": "Java", + "version": "11.0.7" + }, "version": "None" }, - "source": { "ip": "172.18.0.9" }, - "timestamp": { "us": 1593413318893006 }, - "trace": { "id": "efcf3446b51d080dbde1339969cf79a0" }, + "source": { + "ip": "172.18.0.9" + }, + "timestamp": { + "us": 1593413288631008 + }, + "trace": { + "id": "c00da24c5c793cd679ce3df47cee8f37" + }, "transaction": { - "duration": { "us": 4594 }, - "id": "31ef64d71933e846", + "duration": { + "us": 76826 + }, + "id": "3c8403055ff75866", "name": "APIRestController#customer", "result": "HTTP 2xx", "sampled": true, - "span_count": { "dropped": 0, "started": 2 }, + "span_count": { + "dropped": 0, + "started": 2 + }, "type": "request" }, "url": { "domain": "172.18.0.6", - "full": "http://172.18.0.6:3000/api/customers/235", - "path": "/api/customers/235", + "full": "http://172.18.0.6:3000/api/customers/56", + "path": "/api/customers/56", "port": 3000, "scheme": "http" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "Python/3.7 aiohttp/3.3.2" } - }, - "p95": 77280, - "averageResponseTime": 19370.6, - "transactionsPerMinute": 1.25, - "impact": 5.270496679320978 + } }, { - "name": "/products", + "key": { + "service.name": "client", + "transaction.name": "/products" + }, + "averageResponseTime": 77000, + "transactionsPerMinute": 0.25, + "impact": 4.129424578484989, "sample": { "@timestamp": "2020-06-29T06:48:48.824Z", - "agent": { "name": "rum-js", "version": "5.2.0" }, - "client": { "ip": "172.18.0.8" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:49.293664Z" }, + "agent": { + "name": "rum-js", + "version": "5.2.0" + }, + "client": { + "ip": "172.18.0.8" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:49.293664Z" + }, "http": { - "request": { "referrer": "" }, + "request": { + "referrer": "" + }, "response": { "decoded_body_size": 813, "encoded_body_size": 813, @@ -786,23 +1162,39 @@ "version": "8.0.0", "version_major": 8 }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { - "language": { "name": "javascript" }, + "language": { + "name": "javascript" + }, "name": "client", "version": "1.0.0" }, - "source": { "ip": "172.18.0.8" }, - "timestamp": { "us": 1593413328824656 }, - "trace": { "id": "f6c4a9197bbd080bd45072970f251525" }, + "source": { + "ip": "172.18.0.8" + }, + "timestamp": { + "us": 1593413328824656 + }, + "trace": { + "id": "f6c4a9197bbd080bd45072970f251525" + }, "transaction": { "custom": { "userConfig": { - "featureFlags": ["double-trouble", "4423-hotfix"], + "featureFlags": [ + "double-trouble", + "4423-hotfix" + ], "showDashboard": true } }, - "duration": { "us": 77000 }, + "duration": { + "us": 77000 + }, "id": "a11ede1968973bc5", "marks": { "agent": { @@ -829,9 +1221,14 @@ } }, "name": "/products", - "page": { "referer": "", "url": "http://opbeans-node:3000/products" }, + "page": { + "referer": "", + "url": "http://opbeans-node:3000/products" + }, "sampled": true, - "span_count": { "started": 5 }, + "span_count": { + "started": 5 + }, "type": "page-load" }, "url": { @@ -842,29 +1239,52 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "z@example.com", "id": "4", "name": "zaphod" }, + "user": { + "email": "z@example.com", + "id": "4", + "name": "zaphod" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "HeadlessChrome", "original": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/79.0.3945.0 Safari/537.36", - "os": { "name": "Linux" }, + "os": { + "name": "Linux" + }, "version": "79.0.3945" } - }, - "p95": 76800, - "averageResponseTime": 77000, - "transactionsPerMinute": 0.25, - "impact": 4.129424578484989 + } }, { - "name": "/customers", + "key": { + "service.name": "client", + "transaction.name": "/customers" + }, + "averageResponseTime": 33500, + "transactionsPerMinute": 0.5, + "impact": 3.5546640380951287, "sample": { - "@timestamp": "2020-06-29T06:48:48.287Z", - "agent": { "name": "rum-js", "version": "5.2.0" }, - "client": { "ip": "172.18.0.8" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:49.292535Z" }, - "http": { "request": { "referrer": "" } }, + "@timestamp": "2020-06-29T06:48:35.071Z", + "agent": { + "name": "rum-js", + "version": "5.2.0" + }, + "client": { + "ip": "172.18.0.8" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:36.077184Z" + }, + "http": { + "request": { + "referrer": "" + } + }, "observer": { "ephemeral_id": "99908b73-9813-4a73-baa6-993db405523a", "hostname": "aa0bd613aa4c", @@ -873,28 +1293,49 @@ "version": "8.0.0", "version_major": 8 }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { - "language": { "name": "javascript" }, + "language": { + "name": "javascript" + }, "name": "client", "version": "1.0.0" }, - "source": { "ip": "172.18.0.8" }, - "timestamp": { "us": 1593413328287946 }, - "trace": { "id": "48d130530a1fc0b2b99d138d3461bad4" }, + "source": { + "ip": "172.18.0.8" + }, + "timestamp": { + "us": 1593413315071116 + }, + "trace": { + "id": "547a92e82a25387321d1b967f2dd0f48" + }, "transaction": { "custom": { "userConfig": { - "featureFlags": ["double-trouble", "4423-hotfix"], + "featureFlags": [ + "double-trouble", + "4423-hotfix" + ], "showDashboard": true } }, - "duration": { "us": 39000 }, - "id": "2f3a2b0fd3016d3e", + "duration": { + "us": 28000 + }, + "id": "d24f9b9dacb83450", "name": "/customers", - "page": { "referer": "", "url": "http://opbeans-node:3000/customers" }, + "page": { + "referer": "", + "url": "http://opbeans-node:3000/customers" + }, "sampled": true, - "span_count": { "started": 1 }, + "span_count": { + "started": 1 + }, "type": "route-change" }, "url": { @@ -905,59 +1346,94 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "adastra@example.com", "id": "3", "name": "trillian" }, + "user": { + "email": "arthur.dent@example.com", + "id": "1", + "name": "arthurdent" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "HeadlessChrome", "original": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/79.0.3945.0 Safari/537.36", - "os": { "name": "Linux" }, + "os": { + "name": "Linux" + }, "version": "79.0.3945" } - }, - "p95": 39040, - "averageResponseTime": 33500, - "transactionsPerMinute": 0.5, - "impact": 3.5546640380951287 + } }, { - "name": "APIRestController#customers", + "key": { + "service.name": "opbeans-java", + "transaction.name": "APIRestController#customers" + }, + "averageResponseTime": 16690.75, + "transactionsPerMinute": 1, + "impact": 3.541042213287889, "sample": { - "@timestamp": "2020-06-29T06:48:43.765Z", + "@timestamp": "2020-06-29T06:48:22.372Z", "agent": { "ephemeral_id": "222af346-6dd9-45ef-ac85-d86b67edd2de", "name": "java", "version": "1.17.1-SNAPSHOT" }, - "client": { "ip": "172.18.0.9" }, + "client": { + "ip": "172.18.0.9" + }, "container": { "id": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:46.716850Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:25.888154Z" + }, "host": { "architecture": "amd64", "hostname": "918ebbd99b4f", "ip": "172.18.0.6", "name": "918ebbd99b4f", - "os": { "platform": "Linux" } + "os": { + "platform": "Linux" + } }, "http": { "request": { "headers": { - "Accept": ["*/*"], - "Accept-Encoding": ["gzip, deflate"], - "Host": ["172.18.0.6:3000"], - "User-Agent": ["Python/3.7 aiohttp/3.3.2"] + "Accept": [ + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Host": [ + "172.18.0.6:3000" + ], + "User-Agent": [ + "Python/3.7 aiohttp/3.3.2" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "172.18.0.9" } + "socket": { + "encrypted": false, + "remote_address": "172.18.0.9" + } }, "response": { "finished": true, "headers": { - "Content-Type": ["application/json;charset=UTF-8"], - "Date": ["Mon, 29 Jun 2020 06:48:43 GMT"], - "Transfer-Encoding": ["chunked"] + "Content-Type": [ + "application/json;charset=UTF-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:21 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ] }, "headers_sent": true, "status_code": 500 @@ -972,29 +1448,56 @@ "version": "8.0.0", "version_major": 8 }, - "process": { "pid": 6, "ppid": 1, "title": "/opt/java/openjdk/bin/java" }, - "processor": { "event": "transaction", "name": "transaction" }, + "process": { + "pid": 6, + "ppid": 1, + "title": "/opt/java/openjdk/bin/java" + }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "Spring Web MVC", "version": "5.0.6.RELEASE" }, - "language": { "name": "Java", "version": "11.0.7" }, + "framework": { + "name": "Spring Web MVC", + "version": "5.0.6.RELEASE" + }, + "language": { + "name": "Java", + "version": "11.0.7" + }, "name": "opbeans-java", "node": { "name": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "runtime": { "name": "Java", "version": "11.0.7" }, + "runtime": { + "name": "Java", + "version": "11.0.7" + }, "version": "None" }, - "source": { "ip": "172.18.0.9" }, - "timestamp": { "us": 1593413323765008 }, - "trace": { "id": "affce4cea9b60bd5b635dc1bd2e4ce79" }, + "source": { + "ip": "172.18.0.9" + }, + "timestamp": { + "us": 1593413302372009 + }, + "trace": { + "id": "21dd795dc3a260b1bf7ebbbac1e86fb8" + }, "transaction": { - "duration": { "us": 10880 }, - "id": "cfe0a84b49b4a340", + "duration": { + "us": 14795 + }, + "id": "0157fc513282138f", "name": "APIRestController#customers", "result": "HTTP 5xx", "sampled": true, - "span_count": { "dropped": 0, "started": 2 }, + "span_count": { + "dropped": 0, + "started": 2 + }, "type": "request" }, "url": { @@ -1005,40 +1508,61 @@ "scheme": "http" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "Python/3.7 aiohttp/3.3.2" } - }, - "p95": 26432, - "averageResponseTime": 16690.75, - "transactionsPerMinute": 1, - "impact": 3.541042213287889 + } }, { - "name": "GET /log-message", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /log-message" + }, + "averageResponseTime": 32667.5, + "transactionsPerMinute": 0.5, + "impact": 3.458966408120217, "sample": { - "@timestamp": "2020-06-29T06:48:28.944Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "@timestamp": "2020-06-29T06:48:25.944Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:39.370695Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:29.976822Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -1048,12 +1572,24 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["24"], - "Content-Type": ["text/html; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:28 GMT"], - "Etag": ["W/\"18-MS3VbhH7auHMzO0fUuNF6v14N/M\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "24" + ], + "Content-Type": [ + "text/html; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:25 GMT" + ], + "Etag": [ + "W/\"18-MS3VbhH7auHMzO0fUuNF6v14N/M\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 500 }, @@ -1083,29 +1619,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413308944016 }, - "trace": { "id": "afabe4cb397616f5ec35a2f3da49ba62" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413305944023 + }, + "trace": { + "id": "cd2ad726ad164d701c5d3103cbab0c81" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 26788 }, - "id": "cc8c4261387507cf", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 38547 + }, + "id": "9e41667eb64dea55", "name": "GET /log-message", "result": "HTTP 5xx", "sampled": true, - "span_count": { "started": 0 }, + "span_count": { + "started": 0 + }, "type": "request" }, "url": { @@ -1116,60 +1675,82 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 38528, - "averageResponseTime": 32667.5, - "transactionsPerMinute": 0.5, - "impact": 3.458966408120217 + } }, { - "name": "APIRestController#stats", + "key": { + "service.name": "opbeans-java", + "transaction.name": "APIRestController#stats" + }, + "averageResponseTime": 15535, + "transactionsPerMinute": 1, + "impact": 3.275330415465657, "sample": { - "@timestamp": "2020-06-29T06:48:42.549Z", + "@timestamp": "2020-06-29T06:48:09.912Z", "agent": { "ephemeral_id": "222af346-6dd9-45ef-ac85-d86b67edd2de", "name": "java", "version": "1.17.1-SNAPSHOT" }, - "client": { "ip": "172.18.0.9" }, + "client": { + "ip": "172.18.0.9" + }, "container": { "id": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:46.715898Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:15.543824Z" + }, "host": { "architecture": "amd64", "hostname": "918ebbd99b4f", "ip": "172.18.0.6", "name": "918ebbd99b4f", - "os": { "platform": "Linux" } + "os": { + "platform": "Linux" + } }, "http": { "request": { "headers": { - "Accept": ["*/*"], - "Accept-Encoding": ["gzip, deflate"], - "Host": ["172.18.0.6:3000"], - "User-Agent": ["Python/3.7 aiohttp/3.3.2"] + "Accept": [ + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Host": [ + "172.18.0.6:3000" + ], + "User-Agent": [ + "Python/3.7 aiohttp/3.3.2" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "172.18.0.9" } + "socket": { + "encrypted": false, + "remote_address": "172.18.0.9" + } }, "response": { "finished": true, - "headers": { - "Content-Type": ["application/json;charset=UTF-8"], - "Date": ["Mon, 29 Jun 2020 06:48:42 GMT"], - "Transfer-Encoding": ["chunked"] - }, "headers_sent": true, - "status_code": 200 + "status_code": 500 }, "version": "1.1" }, @@ -1181,29 +1762,56 @@ "version": "8.0.0", "version_major": 8 }, - "process": { "pid": 6, "ppid": 1, "title": "/opt/java/openjdk/bin/java" }, - "processor": { "event": "transaction", "name": "transaction" }, + "process": { + "pid": 6, + "ppid": 1, + "title": "/opt/java/openjdk/bin/java" + }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "Spring Web MVC", "version": "5.0.6.RELEASE" }, - "language": { "name": "Java", "version": "11.0.7" }, + "framework": { + "name": "Spring Web MVC", + "version": "5.0.6.RELEASE" + }, + "language": { + "name": "Java", + "version": "11.0.7" + }, "name": "opbeans-java", "node": { "name": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "runtime": { "name": "Java", "version": "11.0.7" }, + "runtime": { + "name": "Java", + "version": "11.0.7" + }, "version": "None" }, - "source": { "ip": "172.18.0.9" }, - "timestamp": { "us": 1593413322549008 }, - "trace": { "id": "c3556e143784f94d4b4220dd40687fae" }, + "source": { + "ip": "172.18.0.9" + }, + "timestamp": { + "us": 1593413289912007 + }, + "trace": { + "id": "a17ceae4e18d50430ca15ecca5a3e69f" + }, "transaction": { - "duration": { "us": 9166 }, - "id": "ac40e567f63c3eef", + "duration": { + "us": 10930 + }, + "id": "9fb330060bb73271", "name": "APIRestController#stats", - "result": "HTTP 2xx", + "result": "HTTP 5xx", "sampled": true, - "span_count": { "dropped": 0, "started": 5 }, + "span_count": { + "dropped": 0, + "started": 5 + }, "type": "request" }, "url": { @@ -1214,40 +1822,61 @@ "scheme": "http" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "Python/3.7 aiohttp/3.3.2" } - }, - "p95": 32064, - "averageResponseTime": 15535, - "transactionsPerMinute": 1, - "impact": 3.275330415465657 + } }, { - "name": "GET /api/customers", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /api/customers" + }, + "averageResponseTime": 20092, + "transactionsPerMinute": 0.75, + "impact": 3.168195050736987, "sample": { - "@timestamp": "2020-06-29T06:48:37.952Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "@timestamp": "2020-06-29T06:48:28.444Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:39.492402Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:29.982737Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -1257,12 +1886,24 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["186769"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:37 GMT"], - "Etag": ["W/\"2d991-yG3J8W/roH7fSxXTudZrO27Ax9s\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "186769" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:28 GMT" + ], + "Etag": [ + "W/\"2d991-yG3J8W/roH7fSxXTudZrO27Ax9s\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -1292,29 +1933,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413317952016 }, - "trace": { "id": "5d99327edae38ed735e8d7a6028cf719" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413308444015 + }, + "trace": { + "id": "792fb0b00256164e88b277ec40b65e14" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 16824 }, - "id": "071808429ec9d00b", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 26471 + }, + "id": "6c1f848752563d2b", "name": "GET /api/customers", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 2 }, + "span_count": { + "started": 2 + }, "type": "request" }, "url": { @@ -1325,42 +1989,67 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 26368, - "averageResponseTime": 20092, - "transactionsPerMinute": 0.75, - "impact": 3.168195050736987 + } }, { - "name": "GET /api/products/:id", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /api/products/:id" + }, + "averageResponseTime": 13516.5, + "transactionsPerMinute": 1, + "impact": 2.8112687551548836, "sample": { - "@timestamp": "2020-06-29T06:48:24.977Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "@timestamp": "2020-06-29T06:47:57.555Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:27.004717Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:47:59.085077Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -1370,12 +2059,24 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["231"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:24 GMT"], - "Etag": ["W/\"e7-kkuzj37GZDzXDh0CWqh5Gan0VO4\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "231" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:47:57 GMT" + ], + "Etag": [ + "W/\"e7-6JlJegaJ+ir0C8I8EmmOjms1dnc\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -1401,79 +2102,127 @@ "/usr/local/lib/node_modules/pm2/lib/ProcessContainer.js", "ecosystem-workload.config.js" ], - "pid": 137, + "pid": 87, "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413304977014 }, - "trace": { "id": "b9b290bca14c99962fa9a1c509401630" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413277555176 + }, + "trace": { + "id": "8365e1763f19e4067b88521d4d9247a0" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 4482 }, - "id": "b8d8284ff1fc25d6", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 37709 + }, + "id": "be2722a418272f10", "name": "GET /api/products/:id", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 1 }, + "span_count": { + "started": 1 + }, "type": "request" }, "url": { "domain": "opbeans-node", - "full": "http://opbeans-node:3000/api/products/3", - "original": "/api/products/3", - "path": "/api/products/3", + "full": "http://opbeans-node:3000/api/products/1", + "original": "/api/products/1", + "path": "/api/products/1", "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 37856, - "averageResponseTime": 13516.5, - "transactionsPerMinute": 1, - "impact": 2.8112687551548836 + } }, { - "name": "GET /api/types", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /api/types" + }, + "averageResponseTime": 26992.5, + "transactionsPerMinute": 0.5, + "impact": 2.8066131947777255, "sample": { - "@timestamp": "2020-06-29T06:48:26.443Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "@timestamp": "2020-06-29T06:47:52.935Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:29.977518Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:47:55.471071Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -1483,12 +2232,24 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["112"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:26 GMT"], - "Etag": ["W/\"70-1z6hT7P1WHgBgS/BeUEVeHhOCQU\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "112" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:47:52 GMT" + ], + "Etag": [ + "W/\"70-1z6hT7P1WHgBgS/BeUEVeHhOCQU\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -1514,33 +2275,56 @@ "/usr/local/lib/node_modules/pm2/lib/ProcessContainer.js", "ecosystem-workload.config.js" ], - "pid": 137, + "pid": 63, "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413306443014 }, - "trace": { "id": "be3f4eb50d253afc032c90eacaa85072" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413272935117 + }, + "trace": { + "id": "2946c536a33d163d0c984d00d1f3839a" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 8892 }, - "id": "ccce129bb8c6b125", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 45093 + }, + "id": "103482fda88b9400", "name": "GET /api/types", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 2 }, + "span_count": { + "started": 2 + }, "type": "request" }, "url": { @@ -1551,42 +2335,67 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 45248, - "averageResponseTime": 26992.5, - "transactionsPerMinute": 0.5, - "impact": 2.8066131947777255 + } }, { - "name": "GET static file", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET static file" + }, + "averageResponseTime": 3492.9285714285716, + "transactionsPerMinute": 3.5, + "impact": 2.5144049360435208, "sample": { - "@timestamp": "2020-06-29T06:48:40.953Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "@timestamp": "2020-06-29T06:47:53.427Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.992454Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:47:55.472070Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -1596,15 +2405,33 @@ }, "response": { "headers": { - "Accept-Ranges": ["bytes"], - "Cache-Control": ["public, max-age=0"], - "Connection": ["close"], - "Content-Length": ["15086"], - "Content-Type": ["image/x-icon"], - "Date": ["Mon, 29 Jun 2020 06:48:40 GMT"], - "Etag": ["W/\"3aee-1725aff14f0\""], - "Last-Modified": ["Thu, 28 May 2020 11:16:06 GMT"], - "X-Powered-By": ["Express"] + "Accept-Ranges": [ + "bytes" + ], + "Cache-Control": [ + "public, max-age=0" + ], + "Connection": [ + "close" + ], + "Content-Length": [ + "15086" + ], + "Content-Type": [ + "image/x-icon" + ], + "Date": [ + "Mon, 29 Jun 2020 06:47:53 GMT" + ], + "Etag": [ + "W/\"3aee-1725aff14f0\"" + ], + "Last-Modified": [ + "Thu, 28 May 2020 11:16:06 GMT" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -1624,32 +2451,53 @@ "/usr/local/lib/node_modules/pm2/lib/ProcessContainer.js", "ecosystem-workload.config.js" ], - "pid": 137, + "pid": 63, "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413320953016 }, - "trace": { "id": "292393440bbe04385f3c2e3715ac35fe" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413273427016 + }, + "trace": { + "id": "ec8a804fedf28fcf81d5682d69a16970" + }, "transaction": { - "duration": { "us": 1671 }, - "id": "d1d964ca1865dce3", + "duration": { + "us": 4934 + }, + "id": "ab90a62901b770e6", "name": "GET static file", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 0 }, + "span_count": { + "started": 0 + }, "type": "request" }, "url": { @@ -1661,55 +2509,84 @@ "scheme": "http" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 11900, - "averageResponseTime": 3492.9285714285716, - "transactionsPerMinute": 3.5, - "impact": 2.5144049360435208 + } }, { - "name": "APIRestController#customerWhoBought", + "key": { + "service.name": "opbeans-java", + "transaction.name": "APIRestController#customerWhoBought" + }, + "averageResponseTime": 3742.153846153846, + "transactionsPerMinute": 3.25, + "impact": 2.4998634943716573, "sample": { - "@timestamp": "2020-06-29T06:48:44.982Z", + "@timestamp": "2020-06-29T06:48:11.166Z", "agent": { "ephemeral_id": "222af346-6dd9-45ef-ac85-d86b67edd2de", "name": "java", "version": "1.17.1-SNAPSHOT" }, - "client": { "ip": "172.18.0.9" }, + "client": { + "ip": "172.18.0.9" + }, "container": { "id": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:46.721114Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:15.763228Z" + }, "host": { "architecture": "amd64", "hostname": "918ebbd99b4f", "ip": "172.18.0.6", "name": "918ebbd99b4f", - "os": { "platform": "Linux" } + "os": { + "platform": "Linux" + } }, "http": { "request": { "headers": { - "Accept": ["*/*"], - "Accept-Encoding": ["gzip, deflate"], - "Host": ["172.18.0.6:3000"], - "User-Agent": ["Python/3.7 aiohttp/3.3.2"] + "Accept": [ + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Host": [ + "172.18.0.6:3000" + ], + "User-Agent": [ + "Python/3.7 aiohttp/3.3.2" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "172.18.0.9" } + "socket": { + "encrypted": false, + "remote_address": "172.18.0.9" + } }, "response": { "finished": true, "headers": { - "Content-Type": ["application/json;charset=UTF-8"], - "Date": ["Mon, 29 Jun 2020 06:48:44 GMT"], - "Transfer-Encoding": ["chunked"] + "Content-Type": [ + "application/json;charset=UTF-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:10 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ] }, "headers_sent": true, "status_code": 200 @@ -1724,73 +2601,121 @@ "version": "8.0.0", "version_major": 8 }, - "process": { "pid": 6, "ppid": 1, "title": "/opt/java/openjdk/bin/java" }, - "processor": { "event": "transaction", "name": "transaction" }, + "process": { + "pid": 6, + "ppid": 1, + "title": "/opt/java/openjdk/bin/java" + }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "Spring Web MVC", "version": "5.0.6.RELEASE" }, - "language": { "name": "Java", "version": "11.0.7" }, + "framework": { + "name": "Spring Web MVC", + "version": "5.0.6.RELEASE" + }, + "language": { + "name": "Java", + "version": "11.0.7" + }, "name": "opbeans-java", "node": { "name": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "runtime": { "name": "Java", "version": "11.0.7" }, + "runtime": { + "name": "Java", + "version": "11.0.7" + }, "version": "None" }, - "source": { "ip": "172.18.0.9" }, - "timestamp": { "us": 1593413324982008 }, - "trace": { "id": "e5ce8ba877f69510e7abc3f0d11c1e4f" }, + "source": { + "ip": "172.18.0.9" + }, + "timestamp": { + "us": 1593413291166005 + }, + "trace": { + "id": "fa0d353eb7967b344ed37674f40b2884" + }, "transaction": { - "duration": { "us": 2797 }, - "id": "b8c1bd3b31b197d3", + "duration": { + "us": 4453 + }, + "id": "bce4ce4b09ded6ca", "name": "APIRestController#customerWhoBought", "result": "HTTP 2xx", "sampled": true, - "span_count": { "dropped": 0, "started": 1 }, + "span_count": { + "dropped": 0, + "started": 2 + }, "type": "request" }, "url": { "domain": "172.18.0.6", - "full": "http://172.18.0.6:3000/api/products/5/customers", - "path": "/api/products/5/customers", + "full": "http://172.18.0.6:3000/api/products/3/customers", + "path": "/api/products/3/customers", "port": 3000, "scheme": "http" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "Python/3.7 aiohttp/3.3.2" } - }, - "p95": 4464, - "averageResponseTime": 3742.153846153846, - "transactionsPerMinute": 3.25, - "impact": 2.4998634943716573 + } }, { - "name": "GET /log-error", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /log-error" + }, + "averageResponseTime": 35846, + "transactionsPerMinute": 0.25, + "impact": 1.7640550505645587, "sample": { "@timestamp": "2020-06-29T06:48:07.467Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:18.533253Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:18.533253Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -1800,12 +2725,24 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["24"], - "Content-Type": ["text/html; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:07 GMT"], - "Etag": ["W/\"18-MS3VbhH7auHMzO0fUuNF6v14N/M\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "24" + ], + "Content-Type": [ + "text/html; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:07 GMT" + ], + "Etag": [ + "W/\"18-MS3VbhH7auHMzO0fUuNF6v14N/M\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 500 }, @@ -1835,29 +2772,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413287467017 }, - "trace": { "id": "d518b2c4d72cd2aaf1e39bad7ebcbdbb" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413287467017 + }, + "trace": { + "id": "d518b2c4d72cd2aaf1e39bad7ebcbdbb" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 35846 }, + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 35846 + }, "id": "c7a30c1b076907ec", "name": "GET /log-error", "result": "HTTP 5xx", "sampled": true, - "span_count": { "started": 0 }, + "span_count": { + "started": 0 + }, "type": "request" }, "url": { @@ -1868,57 +2828,90 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 35840, - "averageResponseTime": 35846, - "transactionsPerMinute": 0.25, - "impact": 1.7640550505645587 + } }, { - "name": "APIRestController#topProducts", + "key": { + "service.name": "opbeans-java", + "transaction.name": "APIRestController#topProducts" + }, + "averageResponseTime": 4825, + "transactionsPerMinute": 1.75, + "impact": 1.6450221426498186, "sample": { - "@timestamp": "2020-06-29T06:48:45.587Z", + "@timestamp": "2020-06-29T06:48:11.778Z", "agent": { "ephemeral_id": "222af346-6dd9-45ef-ac85-d86b67edd2de", "name": "java", "version": "1.17.1-SNAPSHOT" }, - "client": { "ip": "172.18.0.9" }, + "client": { + "ip": "172.18.0.9" + }, "container": { "id": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:46.770758Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:15.764351Z" + }, "host": { "architecture": "amd64", "hostname": "918ebbd99b4f", "ip": "172.18.0.6", "name": "918ebbd99b4f", - "os": { "platform": "Linux" } + "os": { + "platform": "Linux" + } }, "http": { "request": { "headers": { - "Accept": ["*/*"], - "Accept-Encoding": ["gzip, deflate"], - "Host": ["172.18.0.6:3000"], - "User-Agent": ["Python/3.7 aiohttp/3.3.2"] + "Accept": [ + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Host": [ + "172.18.0.6:3000" + ], + "User-Agent": [ + "Python/3.7 aiohttp/3.3.2" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "172.18.0.9" } + "socket": { + "encrypted": false, + "remote_address": "172.18.0.9" + } }, "response": { "finished": true, "headers": { - "Content-Type": ["application/json;charset=UTF-8"], - "Date": ["Mon, 29 Jun 2020 06:48:44 GMT"], - "Transfer-Encoding": ["chunked"] + "Content-Type": [ + "application/json;charset=UTF-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:11 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ] }, "headers_sent": true, "status_code": 200 @@ -1933,29 +2926,56 @@ "version": "8.0.0", "version_major": 8 }, - "process": { "pid": 6, "ppid": 1, "title": "/opt/java/openjdk/bin/java" }, - "processor": { "event": "transaction", "name": "transaction" }, + "process": { + "pid": 6, + "ppid": 1, + "title": "/opt/java/openjdk/bin/java" + }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "Spring Web MVC", "version": "5.0.6.RELEASE" }, - "language": { "name": "Java", "version": "11.0.7" }, + "framework": { + "name": "Spring Web MVC", + "version": "5.0.6.RELEASE" + }, + "language": { + "name": "Java", + "version": "11.0.7" + }, "name": "opbeans-java", "node": { "name": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "runtime": { "name": "Java", "version": "11.0.7" }, + "runtime": { + "name": "Java", + "version": "11.0.7" + }, "version": "None" }, - "source": { "ip": "172.18.0.9" }, - "timestamp": { "us": 1593413325587007 }, - "trace": { "id": "4470d0cc076e22018e2dd258a25c8812" }, + "source": { + "ip": "172.18.0.9" + }, + "timestamp": { + "us": 1593413291778008 + }, + "trace": { + "id": "d65e9816f1f6db3961867f7b6d1d4e6a" + }, "transaction": { - "duration": { "us": 4070 }, - "id": "cb860b712121d0d8", + "duration": { + "us": 4168 + }, + "id": "a72f4bb8149ecdc5", "name": "APIRestController#topProducts", "result": "HTTP 2xx", "sampled": true, - "span_count": { "dropped": 0, "started": 1 }, + "span_count": { + "dropped": 0, + "started": 2 + }, "type": "request" }, "url": { @@ -1966,40 +2986,61 @@ "scheme": "http" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "Python/3.7 aiohttp/3.3.2" } - }, - "p95": 7344, - "averageResponseTime": 4825, - "transactionsPerMinute": 1.75, - "impact": 1.6450221426498186 + } }, { - "name": "GET /api/products/top", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /api/products/top" + }, + "averageResponseTime": 33097, + "transactionsPerMinute": 0.25, + "impact": 1.6060533780113861, "sample": { "@timestamp": "2020-06-29T06:48:01.200Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:02.734903Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:02.734903Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -2009,12 +3050,24 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["2"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:01 GMT"], - "Etag": ["W/\"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "2" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:01 GMT" + ], + "Etag": [ + "W/\"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -2044,29 +3097,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413281200133 }, - "trace": { "id": "195f32efeb6f91e2f71b6bc8bb74ae3a" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413281200133 + }, + "trace": { + "id": "195f32efeb6f91e2f71b6bc8bb74ae3a" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 33097 }, + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 33097 + }, "id": "22e72956dfc8967a", "name": "GET /api/products/top", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 1 }, + "span_count": { + "started": 1 + }, "type": "request" }, "url": { @@ -2077,42 +3153,67 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 33024, - "averageResponseTime": 33097, - "transactionsPerMinute": 0.25, - "impact": 1.6060533780113861 + } }, { - "name": "GET /api/products", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /api/products" + }, + "averageResponseTime": 6583, + "transactionsPerMinute": 1, + "impact": 1.2172278724376455, "sample": { - "@timestamp": "2020-06-29T06:48:23.477Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "@timestamp": "2020-06-29T06:48:21.475Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:27.001228Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:26.996210Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -2122,12 +3223,24 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["1023"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:23 GMT"], - "Etag": ["W/\"3ff-VyOxcDApb+a/lnjkm9FeTOGSDrs\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "1023" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:21 GMT" + ], + "Etag": [ + "W/\"3ff-VyOxcDApb+a/lnjkm9FeTOGSDrs\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -2157,29 +3270,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413303477028 }, - "trace": { "id": "9f26158b9a3915577b3cccc17636ea01" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413301475015 + }, + "trace": { + "id": "389b26b16949c7f783223de4f14b788c" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 7150 }, - "id": "27ff4add22ac2e1b", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 6775 + }, + "id": "d2d4088a0b104fb4", "name": "GET /api/products", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 2 }, + "span_count": { + "started": 2 + }, "type": "request" }, "url": { @@ -2190,46 +3326,79 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 8160, - "averageResponseTime": 6583, - "transactionsPerMinute": 1, - "impact": 1.2172278724376455 + } }, { - "name": "POST /api", + "key": { + "service.name": "opbeans-node", + "transaction.name": "POST /api" + }, + "averageResponseTime": 20011, + "transactionsPerMinute": 0.25, + "impact": 0.853921734857215, "sample": { "@timestamp": "2020-06-29T06:48:25.478Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:27.005671Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:27.005671Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { - "body": { "original": "[REDACTED]" }, + "body": { + "original": "[REDACTED]" + }, "headers": { - "Accept": ["application/json"], - "Connection": ["close"], - "Content-Length": ["129"], - "Content-Type": ["application/json"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Accept": [ + "application/json" + ], + "Connection": [ + "close" + ], + "Content-Length": [ + "129" + ], + "Content-Type": [ + "application/json" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "post", "socket": { @@ -2239,12 +3408,24 @@ }, "response": { "headers": { - "Allow": ["GET"], - "Connection": ["close"], - "Content-Type": ["application/json;charset=UTF-8"], - "Date": ["Mon, 29 Jun 2020 06:48:25 GMT"], - "Transfer-Encoding": ["chunked"], - "X-Powered-By": ["Express"] + "Allow": [ + "GET" + ], + "Connection": [ + "close" + ], + "Content-Type": [ + "application/json;charset=UTF-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:25 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 405 }, @@ -2274,29 +3455,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413305478010 }, - "trace": { "id": "4bd9027dd1e355ec742970e2d6333124" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413305478010 + }, + "trace": { + "id": "4bd9027dd1e355ec742970e2d6333124" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 20011 }, + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 20011 + }, "id": "94104435cf151478", "name": "POST /api", "result": "HTTP 4xx", "sampled": true, - "span_count": { "started": 1 }, + "span_count": { + "started": 1 + }, "type": "request" }, "url": { @@ -2307,42 +3511,67 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 19968, - "averageResponseTime": 20011, - "transactionsPerMinute": 0.25, - "impact": 0.853921734857215 + } }, { - "name": "GET /api/types/:id", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /api/types/:id" + }, + "averageResponseTime": 8181, + "transactionsPerMinute": 0.5, + "impact": 0.6441916136689552, "sample": { - "@timestamp": "2020-06-29T06:48:12.972Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "@timestamp": "2020-06-29T06:47:53.928Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:18.543436Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:47:55.472718Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -2352,12 +3581,24 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["205"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:12 GMT"], - "Etag": ["W/\"cd-pFMi1QOVY6YqWe+nwcbZVviCths\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "205" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:47:53 GMT" + ], + "Etag": [ + "W/\"cd-pFMi1QOVY6YqWe+nwcbZVviCths\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -2383,33 +3624,56 @@ "/usr/local/lib/node_modules/pm2/lib/ProcessContainer.js", "ecosystem-workload.config.js" ], - "pid": 137, + "pid": 63, "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413292972011 }, - "trace": { "id": "aea65cef5f902dda5d8e38f9fb38864d" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413273928016 + }, + "trace": { + "id": "0becaafb422bfeb69e047bf7153aa469" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 6300 }, - "id": "a5bdbe43ac05fae2", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 10062 + }, + "id": "0cee4574091bda3b", "name": "GET /api/types/:id", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 2 }, + "span_count": { + "started": 2 + }, "type": "request" }, "url": { @@ -2420,42 +3684,67 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 10080, - "averageResponseTime": 8181, - "transactionsPerMinute": 0.5, - "impact": 0.6441916136689552 + } }, { - "name": "GET /api/stats", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /api/stats" + }, + "averageResponseTime": 5098, + "transactionsPerMinute": 0.75, + "impact": 0.582807187955318, "sample": { - "@timestamp": "2020-06-29T06:48:39.451Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "@timestamp": "2020-06-29T06:48:34.949Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.984824Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:39.479316Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -2465,12 +3754,24 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["92"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:39 GMT"], - "Etag": ["W/\"5c-6I+bqIiLxvkWuwBUnTxhBoK4lBk\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "92" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:34 GMT" + ], + "Etag": [ + "W/\"5c-6I+bqIiLxvkWuwBUnTxhBoK4lBk\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -2500,29 +3801,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413319451016 }, - "trace": { "id": "a05787cb03a0af0863fab5e05de942f1" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413314949017 + }, + "trace": { + "id": "616b3b77abd5534c61d6c0438469aee2" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 5050 }, - "id": "a7e004eba8f021ce", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 5459 + }, + "id": "5b4971de59d2099d", "name": "GET /api/stats", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 4 }, + "span_count": { + "started": 4 + }, "type": "request" }, "url": { @@ -2533,42 +3857,67 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 5440, - "averageResponseTime": 5098, - "transactionsPerMinute": 0.75, - "impact": 0.582807187955318 + } }, { - "name": "GET /api/orders", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /api/orders" + }, + "averageResponseTime": 7624.5, + "transactionsPerMinute": 0.5, + "impact": 0.5802207655235637, "sample": { "@timestamp": "2020-06-29T06:48:35.450Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:39.483715Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:39.483715Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -2578,12 +3927,24 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["2"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:35 GMT"], - "Etag": ["W/\"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "2" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:35 GMT" + ], + "Etag": [ + "W/\"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -2613,29 +3974,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413315450014 }, - "trace": { "id": "2da70ccf10599b271f65273d169cde9f" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413315450014 + }, + "trace": { + "id": "2da70ccf10599b271f65273d169cde9f" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 8784 }, + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 8784 + }, "id": "a3f4a4f339758440", "name": "GET /api/orders", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 2 }, + "span_count": { + "started": 2 + }, "type": "request" }, "url": { @@ -2646,42 +4030,67 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 8800, - "averageResponseTime": 7624.5, - "transactionsPerMinute": 0.5, - "impact": 0.5802207655235637 + } }, { - "name": "GET /api/orders/:id", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /api/orders/:id" + }, + "averageResponseTime": 4749.666666666667, + "transactionsPerMinute": 0.75, + "impact": 0.5227447114845778, "sample": { "@timestamp": "2020-06-29T06:48:35.951Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:39.484133Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:39.484133Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -2691,10 +4100,18 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["0"], - "Date": ["Mon, 29 Jun 2020 06:48:35 GMT"], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "0" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:35 GMT" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 404 }, @@ -2724,29 +4141,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413315951017 }, - "trace": { "id": "95979caa80e6622cbbb2d308800c3016" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413315951017 + }, + "trace": { + "id": "95979caa80e6622cbbb2d308800c3016" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 3210 }, + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 3210 + }, "id": "30344988dace0b43", "name": "GET /api/orders/:id", "result": "HTTP 4xx", "sampled": true, - "span_count": { "started": 1 }, + "span_count": { + "started": 1 + }, "type": "request" }, "url": { @@ -2757,57 +4197,90 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 7184, - "averageResponseTime": 4749.666666666667, - "transactionsPerMinute": 0.75, - "impact": 0.5227447114845778 + } }, { - "name": "APIRestController#products", + "key": { + "service.name": "opbeans-java", + "transaction.name": "APIRestController#products" + }, + "averageResponseTime": 6787, + "transactionsPerMinute": 0.5, + "impact": 0.4839483750082622, "sample": { - "@timestamp": "2020-06-29T06:48:27.824Z", + "@timestamp": "2020-06-29T06:48:13.595Z", "agent": { "ephemeral_id": "222af346-6dd9-45ef-ac85-d86b67edd2de", "name": "java", "version": "1.17.1-SNAPSHOT" }, - "client": { "ip": "172.18.0.9" }, + "client": { + "ip": "172.18.0.9" + }, "container": { "id": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:36.087688Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:15.755614Z" + }, "host": { "architecture": "amd64", "hostname": "918ebbd99b4f", "ip": "172.18.0.6", "name": "918ebbd99b4f", - "os": { "platform": "Linux" } + "os": { + "platform": "Linux" + } }, "http": { "request": { "headers": { - "Accept": ["*/*"], - "Accept-Encoding": ["gzip, deflate"], - "Host": ["172.18.0.6:3000"], - "User-Agent": ["Python/3.7 aiohttp/3.3.2"] + "Accept": [ + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Host": [ + "172.18.0.6:3000" + ], + "User-Agent": [ + "Python/3.7 aiohttp/3.3.2" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "172.18.0.9" } + "socket": { + "encrypted": false, + "remote_address": "172.18.0.9" + } }, "response": { "finished": true, "headers": { - "Content-Type": ["application/json;charset=UTF-8"], - "Date": ["Mon, 29 Jun 2020 06:48:27 GMT"], - "Transfer-Encoding": ["chunked"] + "Content-Type": [ + "application/json;charset=UTF-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:12 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ] }, "headers_sent": true, "status_code": 200 @@ -2822,29 +4295,56 @@ "version": "8.0.0", "version_major": 8 }, - "process": { "pid": 6, "ppid": 1, "title": "/opt/java/openjdk/bin/java" }, - "processor": { "event": "transaction", "name": "transaction" }, + "process": { + "pid": 6, + "ppid": 1, + "title": "/opt/java/openjdk/bin/java" + }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "Spring Web MVC", "version": "5.0.6.RELEASE" }, - "language": { "name": "Java", "version": "11.0.7" }, + "framework": { + "name": "Spring Web MVC", + "version": "5.0.6.RELEASE" + }, + "language": { + "name": "Java", + "version": "11.0.7" + }, "name": "opbeans-java", "node": { "name": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "runtime": { "name": "Java", "version": "11.0.7" }, + "runtime": { + "name": "Java", + "version": "11.0.7" + }, "version": "None" }, - "source": { "ip": "172.18.0.9" }, - "timestamp": { "us": 1593413307824008 }, - "trace": { "id": "a6adb17bd5a5d1c0eabb9f36cb626dd5" }, + "source": { + "ip": "172.18.0.9" + }, + "timestamp": { + "us": 1593413293595007 + }, + "trace": { + "id": "8519b6c3dbc32a0582228506526e1d74" + }, "transaction": { - "duration": { "us": 5645 }, - "id": "df3e726eaa003d96", + "duration": { + "us": 7929 + }, + "id": "b0354de660cd3698", "name": "APIRestController#products", "result": "HTTP 2xx", "sampled": true, - "span_count": { "dropped": 0, "started": 3 }, + "span_count": { + "dropped": 0, + "started": 3 + }, "type": "request" }, "url": { @@ -2855,40 +4355,61 @@ "scheme": "http" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "Python/3.7 aiohttp/3.3.2" } - }, - "p95": 7904, - "averageResponseTime": 6787, - "transactionsPerMinute": 0.5, - "impact": 0.4839483750082622 + } }, { - "name": "GET /api/products/:id/customers", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /api/products/:id/customers" + }, + "averageResponseTime": 4757, + "transactionsPerMinute": 0.5, + "impact": 0.25059559560997896, "sample": { - "@timestamp": "2020-06-29T06:48:41.956Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "@timestamp": "2020-06-29T06:48:22.977Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.994692Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:27.000765Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -2898,12 +4419,24 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["2"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:41 GMT"], - "Etag": ["W/\"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "2" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:22 GMT" + ], + "Etag": [ + "W/\"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -2933,90 +4466,146 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413321956016 }, - "trace": { "id": "f735ac5fca8f83eebc748f4a2e009e61" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413302977008 + }, + "trace": { + "id": "da8f22fe652ccb6680b3029ab6efd284" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 3896 }, - "id": "b24ce95c855f83a4", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 5618 + }, + "id": "bc51c1523afaf57a", "name": "GET /api/products/:id/customers", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 1 }, + "span_count": { + "started": 1 + }, "type": "request" }, "url": { "domain": "opbeans-node", - "full": "http://opbeans-node:3000/api/products/5/customers", - "original": "/api/products/5/customers", - "path": "/api/products/5/customers", + "full": "http://opbeans-node:3000/api/products/3/customers", + "original": "/api/products/3/customers", + "path": "/api/products/3/customers", "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 5616, - "averageResponseTime": 4757, - "transactionsPerMinute": 0.5, - "impact": 0.25059559560997896 + } }, { - "name": "APIRestController#product", + "key": { + "service.name": "opbeans-java", + "transaction.name": "APIRestController#product" + }, + "averageResponseTime": 4713.5, + "transactionsPerMinute": 0.5, + "impact": 0.24559517890858723, "sample": { - "@timestamp": "2020-06-29T06:48:41.941Z", + "@timestamp": "2020-06-29T06:48:36.383Z", "agent": { "ephemeral_id": "222af346-6dd9-45ef-ac85-d86b67edd2de", "name": "java", "version": "1.17.1-SNAPSHOT" }, - "client": { "ip": "172.18.0.9" }, + "client": { + "ip": "172.18.0.9" + }, "container": { "id": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:46.709268Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:46.666467Z" + }, "host": { "architecture": "amd64", "hostname": "918ebbd99b4f", "ip": "172.18.0.6", "name": "918ebbd99b4f", - "os": { "platform": "Linux" } + "os": { + "platform": "Linux" + } }, "http": { "request": { "headers": { - "Accept": ["*/*"], - "Accept-Encoding": ["gzip, deflate"], - "Host": ["172.18.0.6:3000"], - "User-Agent": ["Python/3.7 aiohttp/3.3.2"] + "Accept": [ + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Host": [ + "172.18.0.6:3000" + ], + "User-Agent": [ + "Python/3.7 aiohttp/3.3.2" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "172.18.0.9" } + "socket": { + "encrypted": false, + "remote_address": "172.18.0.9" + } }, "response": { "finished": true, "headers": { - "Content-Type": ["application/json;charset=UTF-8"], - "Date": ["Mon, 29 Jun 2020 06:48:41 GMT"], - "Transfer-Encoding": ["chunked"] + "Content-Type": [ + "application/json;charset=UTF-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:36 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ] }, "headers_sent": true, "status_code": 200 @@ -3031,81 +4620,131 @@ "version": "8.0.0", "version_major": 8 }, - "process": { "pid": 6, "ppid": 1, "title": "/opt/java/openjdk/bin/java" }, - "processor": { "event": "transaction", "name": "transaction" }, + "process": { + "pid": 6, + "ppid": 1, + "title": "/opt/java/openjdk/bin/java" + }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "Spring Web MVC", "version": "5.0.6.RELEASE" }, - "language": { "name": "Java", "version": "11.0.7" }, + "framework": { + "name": "Spring Web MVC", + "version": "5.0.6.RELEASE" + }, + "language": { + "name": "Java", + "version": "11.0.7" + }, "name": "opbeans-java", "node": { "name": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "runtime": { "name": "Java", "version": "11.0.7" }, + "runtime": { + "name": "Java", + "version": "11.0.7" + }, "version": "None" }, - "source": { "ip": "172.18.0.9" }, - "timestamp": { "us": 1593413321941007 }, - "trace": { "id": "88a2b9ca970cdd38dfa1b5646d26b897" }, + "source": { + "ip": "172.18.0.9" + }, + "timestamp": { + "us": 1593413316383008 + }, + "trace": { + "id": "386b450aef87fc079b20136eda542af1" + }, "transaction": { - "duration": { "us": 4539 }, - "id": "24ee0e4812cfed62", + "duration": { + "us": 4888 + }, + "id": "5a4aa02158b5658c", "name": "APIRestController#product", "result": "HTTP 2xx", "sampled": true, - "span_count": { "dropped": 0, "started": 2 }, + "span_count": { + "dropped": 0, + "started": 3 + }, "type": "request" }, "url": { "domain": "172.18.0.6", - "full": "http://172.18.0.6:3000/api/products/4", - "path": "/api/products/4", + "full": "http://172.18.0.6:3000/api/products/1", + "path": "/api/products/1", "port": 3000, "scheme": "http" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "Python/3.7 aiohttp/3.3.2" } - }, - "p95": 4864, - "averageResponseTime": 4713.5, - "transactionsPerMinute": 0.5, - "impact": 0.24559517890858723 + } }, { - "name": "APIRestController#order", + "key": { + "service.name": "opbeans-java", + "transaction.name": "APIRestController#order" + }, + "averageResponseTime": 3392.5, + "transactionsPerMinute": 0.5, + "impact": 0.09374344413758617, "sample": { - "@timestamp": "2020-06-29T06:48:33.314Z", + "@timestamp": "2020-06-29T06:48:07.416Z", "agent": { "ephemeral_id": "222af346-6dd9-45ef-ac85-d86b67edd2de", "name": "java", "version": "1.17.1-SNAPSHOT" }, - "client": { "ip": "172.18.0.9" }, + "client": { + "ip": "172.18.0.9" + }, "container": { "id": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:36.137777Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:15.534378Z" + }, "host": { "architecture": "amd64", "hostname": "918ebbd99b4f", "ip": "172.18.0.6", "name": "918ebbd99b4f", - "os": { "platform": "Linux" } + "os": { + "platform": "Linux" + } }, "http": { "request": { "headers": { - "Accept": ["*/*"], - "Accept-Encoding": ["gzip, deflate"], - "Host": ["172.18.0.6:3000"], - "User-Agent": ["Python/3.7 aiohttp/3.3.2"] + "Accept": [ + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Host": [ + "172.18.0.6:3000" + ], + "User-Agent": [ + "Python/3.7 aiohttp/3.3.2" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "172.18.0.9" } + "socket": { + "encrypted": false, + "remote_address": "172.18.0.9" + } }, "response": { "finished": true, @@ -3122,88 +4761,144 @@ "version": "8.0.0", "version_major": 8 }, - "process": { "pid": 6, "ppid": 1, "title": "/opt/java/openjdk/bin/java" }, - "processor": { "event": "transaction", "name": "transaction" }, + "process": { + "pid": 6, + "ppid": 1, + "title": "/opt/java/openjdk/bin/java" + }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "Spring Web MVC", "version": "5.0.6.RELEASE" }, - "language": { "name": "Java", "version": "11.0.7" }, + "framework": { + "name": "Spring Web MVC", + "version": "5.0.6.RELEASE" + }, + "language": { + "name": "Java", + "version": "11.0.7" + }, "name": "opbeans-java", "node": { "name": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "runtime": { "name": "Java", "version": "11.0.7" }, + "runtime": { + "name": "Java", + "version": "11.0.7" + }, "version": "None" }, - "source": { "ip": "172.18.0.9" }, - "timestamp": { "us": 1593413313314007 }, - "trace": { "id": "aaf67f944393124080d1e4de804dc6eb" }, + "source": { + "ip": "172.18.0.9" + }, + "timestamp": { + "us": 1593413287416007 + }, + "trace": { + "id": "25c46380df3d44a192ed07279a08b329" + }, "transaction": { - "duration": { "us": 2503 }, - "id": "f7f9f5e0f8a3a0d4", + "duration": { + "us": 4282 + }, + "id": "d4d5b23c685d2ee5", "name": "APIRestController#order", "result": "HTTP 2xx", "sampled": true, - "span_count": { "dropped": 0, "started": 1 }, + "span_count": { + "dropped": 0, + "started": 1 + }, "type": "request" }, "url": { "domain": "172.18.0.6", - "full": "http://172.18.0.6:3000/api/orders/906", - "path": "/api/orders/906", + "full": "http://172.18.0.6:3000/api/orders/391", + "path": "/api/orders/391", "port": 3000, "scheme": "http" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "Python/3.7 aiohttp/3.3.2" } - }, - "p95": 4272, - "averageResponseTime": 3392.5, - "transactionsPerMinute": 0.5, - "impact": 0.09374344413758617 + } }, { - "name": "APIRestController#orders", + "key": { + "service.name": "opbeans-java", + "transaction.name": "APIRestController#orders" + }, + "averageResponseTime": 3147, + "transactionsPerMinute": 0.5, + "impact": 0.06552270160444405, "sample": { - "@timestamp": "2020-06-29T06:48:39.500Z", + "@timestamp": "2020-06-29T06:48:16.028Z", "agent": { "ephemeral_id": "222af346-6dd9-45ef-ac85-d86b67edd2de", "name": "java", "version": "1.17.1-SNAPSHOT" }, - "client": { "ip": "172.18.0.9" }, + "client": { + "ip": "172.18.0.9" + }, "container": { "id": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:46.706280Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:25.800962Z" + }, "host": { "architecture": "amd64", "hostname": "918ebbd99b4f", "ip": "172.18.0.6", "name": "918ebbd99b4f", - "os": { "platform": "Linux" } + "os": { + "platform": "Linux" + } }, "http": { "request": { "headers": { - "Accept": ["*/*"], - "Accept-Encoding": ["gzip, deflate"], - "Host": ["172.18.0.6:3000"], - "User-Agent": ["Python/3.7 aiohttp/3.3.2"] + "Accept": [ + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Host": [ + "172.18.0.6:3000" + ], + "User-Agent": [ + "Python/3.7 aiohttp/3.3.2" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "172.18.0.9" } + "socket": { + "encrypted": false, + "remote_address": "172.18.0.9" + } }, "response": { "finished": true, "headers": { - "Content-Type": ["application/json;charset=UTF-8"], - "Date": ["Mon, 29 Jun 2020 06:48:38 GMT"], - "Transfer-Encoding": ["chunked"] + "Content-Type": [ + "application/json;charset=UTF-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:15 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ] }, "headers_sent": true, "status_code": 200 @@ -3218,29 +4913,56 @@ "version": "8.0.0", "version_major": 8 }, - "process": { "pid": 6, "ppid": 1, "title": "/opt/java/openjdk/bin/java" }, - "processor": { "event": "transaction", "name": "transaction" }, + "process": { + "pid": 6, + "ppid": 1, + "title": "/opt/java/openjdk/bin/java" + }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "Spring Web MVC", "version": "5.0.6.RELEASE" }, - "language": { "name": "Java", "version": "11.0.7" }, + "framework": { + "name": "Spring Web MVC", + "version": "5.0.6.RELEASE" + }, + "language": { + "name": "Java", + "version": "11.0.7" + }, "name": "opbeans-java", "node": { "name": "918ebbd99b4f40003cf5713c080bb8120fa3bbe7ac4a96acb3aec558ced91ec0" }, - "runtime": { "name": "Java", "version": "11.0.7" }, + "runtime": { + "name": "Java", + "version": "11.0.7" + }, "version": "None" }, - "source": { "ip": "172.18.0.9" }, - "timestamp": { "us": 1593413319500008 }, - "trace": { "id": "f89b02f09a2e7a7f2cc3478f53d4a495" }, + "source": { + "ip": "172.18.0.9" + }, + "timestamp": { + "us": 1593413296028008 + }, + "trace": { + "id": "4110227ecacbccf79894165ae5df932d" + }, "transaction": { - "duration": { "us": 3391 }, - "id": "41c8c4300ee2ccda", + "duration": { + "us": 2903 + }, + "id": "8e3732f0f0da942b", "name": "APIRestController#orders", "result": "HTTP 2xx", "sampled": true, - "span_count": { "dropped": 0, "started": 2 }, + "span_count": { + "dropped": 0, + "started": 1 + }, "type": "request" }, "url": { @@ -3251,40 +4973,61 @@ "scheme": "http" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "Python/3.7 aiohttp/3.3.2" } - }, - "p95": 3376, - "averageResponseTime": 3147, - "transactionsPerMinute": 0.5, - "impact": 0.06552270160444405 + } }, { - "name": "GET /throw-error", + "key": { + "service.name": "opbeans-node", + "transaction.name": "GET /throw-error" + }, + "averageResponseTime": 2577, + "transactionsPerMinute": 0.5, + "impact": 0, "sample": { - "@timestamp": "2020-06-29T06:48:42.954Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, + "@timestamp": "2020-06-29T06:48:19.975Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.996435Z" }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:21.012520Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", "socket": { @@ -3294,13 +5037,27 @@ }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["148"], - "Content-Security-Policy": ["default-src 'none'"], - "Content-Type": ["text/html; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:42 GMT"], - "X-Content-Type-Options": ["nosniff"], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "148" + ], + "Content-Security-Policy": [ + "default-src 'none'" + ], + "Content-Type": [ + "text/html; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:19 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 500 }, @@ -3330,29 +5087,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413322954016 }, - "trace": { "id": "9d5aee7443a43db9820f622a10dfac6e" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413299975019 + }, + "trace": { + "id": "106f3a55b0b0ea327d1bbe4be66c3bcc" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 1928 }, - "id": "8e6fc8c3f99e8fc9", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 3226 + }, + "id": "247b9141552a9e73", "name": "GET /throw-error", "result": "HTTP 5xx", "sampled": true, - "span_count": { "started": 0 }, + "span_count": { + "started": 0 + }, "type": "request" }, "url": { @@ -3363,16 +5143,18 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 3224, - "averageResponseTime": 2577, - "transactionsPerMinute": 0.5, - "impact": 0 + } } ] diff --git a/x-pack/test/apm_api_integration/basic/tests/traces/top_traces.ts b/x-pack/test/apm_api_integration/basic/tests/traces/top_traces.ts index e96cb20a68fda..b4a037436adb8 100644 --- a/x-pack/test/apm_api_integration/basic/tests/traces/top_traces.ts +++ b/x-pack/test/apm_api_integration/basic/tests/traces/top_traces.ts @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import expect from '@kbn/expect'; +import { sortBy, omit } from 'lodash'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; import expectTopTraces from './expectation/top_traces.expectation.json'; @@ -46,8 +47,28 @@ export default function ApiTest({ getService }: FtrProviderContext) { expect(response.body.items.length).to.be(33); }); - it('returns the correct buckets and samples', async () => { - expect(response.body.items).to.eql(expectTopTraces); + it('returns the correct buckets', async () => { + const responseWithoutSamples = sortBy( + response.body.items.map((item: any) => omit(item, 'sample')), + 'impact' + ); + + const expectedTracesWithoutSamples = sortBy( + expectTopTraces.map((item: any) => omit(item, 'sample')), + 'impact' + ); + + expect(responseWithoutSamples).to.eql(expectedTracesWithoutSamples); + }); + + it('returns a sample', async () => { + // sample should provide enough information to deeplink to a transaction detail page + response.body.items.forEach((item: any) => { + expect(item.sample.trace.id).to.be.an('string'); + expect(item.sample.transaction.id).to.be.an('string'); + expect(item.sample.service.name).to.be(item.key['service.name']); + expect(item.sample.transaction.name).to.be(item.key['transaction.name']); + }); }); }); }); diff --git a/x-pack/test/apm_api_integration/basic/tests/transaction_groups/expectation/top_transaction_groups.json b/x-pack/test/apm_api_integration/basic/tests/transaction_groups/expectation/top_transaction_groups.json index 7d314e75e4d1d..29c55d4ef1b5c 100644 --- a/x-pack/test/apm_api_integration/basic/tests/transaction_groups/expectation/top_transaction_groups.json +++ b/x-pack/test/apm_api_integration/basic/tests/transaction_groups/expectation/top_transaction_groups.json @@ -1,38 +1,86 @@ { "items": [ { - "name": "GET /api", + "key": "GET /api", + "averageResponseTime": 51175.73170731707, + "transactionsPerMinute": 10.25, + "impact": 100, + "p95": 259040, "sample": { - "@timestamp": "2020-06-29T06:48:41.454Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.992834Z" }, + "@timestamp": "2020-06-29T06:48:06.862Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.8" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:08.305742Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Accept": [ + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "Host": [ + "opbeans-node:3000" + ], + "Referer": [ + "http://opbeans-node:3000/dashboard" + ], + "Traceparent": [ + "00-ca86ffcac7753ec8733933bd8fd45d11-5dcb98c9c9021cfc-01" + ], + "User-Agent": [ + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/79.0.3945.0 Safari/537.36" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.8" + } }, "response": { "headers": { - "Connection": ["close"], - "Content-Type": ["application/json;charset=UTF-8"], - "Date": ["Mon, 29 Jun 2020 06:48:41 GMT"], - "Transfer-Encoding": ["chunked"], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Type": [ + "application/json;charset=UTF-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:06 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -52,6 +100,9 @@ "version": "8.0.0", "version_major": 8 }, + "parent": { + "id": "5dcb98c9c9021cfc" + }, "process": { "args": [ "/usr/local/bin/node", @@ -62,87 +113,164 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413321454009 }, - "trace": { "id": "0507830eeff93f7bf1a354e4031097b3" }, + "source": { + "ip": "172.18.0.8" + }, + "timestamp": { + "us": 1593413286862021 + }, + "trace": { + "id": "ca86ffcac7753ec8733933bd8fd45d11" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 8334 }, - "id": "878250a8b937445d", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 15738 + }, + "id": "c95371db21c6f407", "name": "GET /api", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 1 }, + "span_count": { + "started": 1 + }, "type": "request" }, "url": { "domain": "opbeans-node", - "full": "http://opbeans-node:3000/api/products/6", - "original": "/api/products/6", - "path": "/api/products/6", + "full": "http://opbeans-node:3000/api/products/top", + "original": "/api/products/top", + "path": "/api/products/top", "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, - "name": "Other", - "original": "workload/2.4.3" + "device": { + "name": "Other" + }, + "name": "HeadlessChrome", + "original": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/79.0.3945.0 Safari/537.36", + "os": { + "name": "Linux" + }, + "version": "79.0.3945" } - }, - "p95": 259040, - "averageResponseTime": 51175.73170731707, - "transactionsPerMinute": 10.25, - "impact": 100 + } }, { - "name": "POST /api/orders", + "key": "POST /api/orders", + "averageResponseTime": 270684, + "transactionsPerMinute": 0.25, + "impact": 12.686265169840583, + "p95": 270336, "sample": { "@timestamp": "2020-06-29T06:48:39.953Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.991549Z" }, + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:43.991549Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { - "body": { "original": "[REDACTED]" }, + "body": { + "original": "[REDACTED]" + }, "headers": { - "Accept": ["application/json"], - "Connection": ["close"], - "Content-Length": ["129"], - "Content-Type": ["application/json"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Accept": [ + "application/json" + ], + "Connection": [ + "close" + ], + "Content-Length": [ + "129" + ], + "Content-Type": [ + "application/json" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "post", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["13"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:40 GMT"], - "Etag": ["W/\"d-eEOWU4Cnr5DZ23ErRUeYu9oOIks\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "13" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:40 GMT" + ], + "Etag": [ + "W/\"d-eEOWU4Cnr5DZ23ErRUeYu9oOIks\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -172,27 +300,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413319953033 }, - "trace": { "id": "52b8fda5f6df745b990740ba18378620" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413319953033 + }, + "trace": { + "id": "52b8fda5f6df745b990740ba18378620" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 270684 }, + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 270684 + }, "id": "a3afc2a112e9c893", "name": "POST /api/orders", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 16 }, + "span_count": { + "started": 16 + }, "type": "request" }, "url": { @@ -203,52 +356,92 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 270336, - "averageResponseTime": 270684, - "transactionsPerMinute": 0.25, - "impact": 12.686265169840583 + } }, { - "name": "GET /api/customers", + "key": "GET /api/customers", + "averageResponseTime": 16896.8, + "transactionsPerMinute": 1.25, + "impact": 3.790160870423129, + "p95": 26432, "sample": { - "@timestamp": "2020-06-29T06:48:37.952Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:39.492402Z" }, + "@timestamp": "2020-06-29T06:48:28.444Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:29.982737Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["186769"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:37 GMT"], - "Etag": ["W/\"2d991-yG3J8W/roH7fSxXTudZrO27Ax9s\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "186769" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:28 GMT" + ], + "Etag": [ + "W/\"2d991-yG3J8W/roH7fSxXTudZrO27Ax9s\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -278,27 +471,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413317952016 }, - "trace": { "id": "5d99327edae38ed735e8d7a6028cf719" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413308444015 + }, + "trace": { + "id": "792fb0b00256164e88b277ec40b65e14" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 16824 }, - "id": "071808429ec9d00b", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 26471 + }, + "id": "6c1f848752563d2b", "name": "GET /api/customers", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 2 }, + "span_count": { + "started": 2 + }, "type": "request" }, "url": { @@ -309,52 +527,92 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 26432, - "averageResponseTime": 16896.8, - "transactionsPerMinute": 1.25, - "impact": 3.790160870423129 + } }, { - "name": "GET /log-message", + "key": "GET /log-message", + "averageResponseTime": 32667.5, + "transactionsPerMinute": 0.5, + "impact": 2.875276331059301, + "p95": 38528, "sample": { - "@timestamp": "2020-06-29T06:48:28.944Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:39.370695Z" }, + "@timestamp": "2020-06-29T06:48:25.944Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:29.976822Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["24"], - "Content-Type": ["text/html; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:28 GMT"], - "Etag": ["W/\"18-MS3VbhH7auHMzO0fUuNF6v14N/M\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "24" + ], + "Content-Type": [ + "text/html; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:25 GMT" + ], + "Etag": [ + "W/\"18-MS3VbhH7auHMzO0fUuNF6v14N/M\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 500 }, @@ -384,27 +642,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413308944016 }, - "trace": { "id": "afabe4cb397616f5ec35a2f3da49ba62" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413305944023 + }, + "trace": { + "id": "cd2ad726ad164d701c5d3103cbab0c81" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 26788 }, - "id": "cc8c4261387507cf", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 38547 + }, + "id": "9e41667eb64dea55", "name": "GET /log-message", "result": "HTTP 5xx", "sampled": true, - "span_count": { "started": 0 }, + "span_count": { + "started": 0 + }, "type": "request" }, "url": { @@ -415,51 +698,89 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 38528, - "averageResponseTime": 32667.5, - "transactionsPerMinute": 0.5, - "impact": 2.875276331059301 + } }, { - "name": "GET /*", + "key": "GET /*", + "averageResponseTime": 3262.95, + "transactionsPerMinute": 5, + "impact": 2.8716452680799467, + "p95": 4472, "sample": { - "@timestamp": "2020-06-29T06:48:42.454Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.995202Z" }, + "@timestamp": "2020-06-29T06:48:25.064Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:27.005197Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "Wget" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["813"], - "Content-Type": ["text/html"], - "Date": ["Mon, 29 Jun 2020 06:48:42 GMT"], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "813" + ], + "Content-Type": [ + "text/html" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:25 GMT" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -479,7 +800,9 @@ "version": "8.0.0", "version_major": 8 }, - "parent": { "id": "5baa6c3bedc93f9d" }, + "parent": { + "id": "f673ceaf4583f0f2" + }, "process": { "args": [ "/usr/local/bin/node", @@ -490,27 +813,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413322454015 }, - "trace": { "id": "022b01256b291a4c417199d91ec8755f" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413305064023 + }, + "trace": { + "id": "30c12f4d8ef77a5be1b4464e5d2235bc" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 1737 }, - "id": "eff3e45e0d9529d9", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 3004 + }, + "id": "18a00dfdb919a978", "name": "GET /*", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 0 }, + "span_count": { + "started": 0 + }, "type": "request" }, "url": { @@ -521,59 +869,104 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, - "name": "Other", - "original": "workload/2.4.3" + "device": { + "name": "Other" + }, + "name": "Wget", + "original": "Wget" } - }, - "p95": 4472, - "averageResponseTime": 3262.95, - "transactionsPerMinute": 5, - "impact": 2.8716452680799467 + } }, { - "name": "GET /api/orders", + "key": "GET /api/orders", + "averageResponseTime": 7615.625, + "transactionsPerMinute": 2, + "impact": 2.6645791239678345, + "p95": 11616, "sample": { - "@timestamp": "2020-06-29T06:48:40.106Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.6" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.988104Z" }, + "@timestamp": "2020-06-29T06:48:28.782Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.8" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:29.983252Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { "Accept": [ - "text/plain, application/json, application/x-jackson-smile, application/cbor, application/*+json, */*" + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" ], - "Connection": ["keep-alive"], - "Elastic-Apm-Traceparent": [ - "00-90bd7780b32cc51a7f4c200b1e0c170f-5ff346d602ce27b0-01" + "Host": [ + "opbeans-node:3000" ], - "Host": ["opbeans-node:3000"], - "Traceparent": ["00-90bd7780b32cc51a7f4c200b1e0c170f-5ff346d602ce27b0-01"], - "User-Agent": ["Java/11.0.7"] + "Referer": [ + "http://opbeans-node:3000/orders" + ], + "Traceparent": [ + "00-978b56807e0b7a27cbc41a0dfb665f47-3358a24e09e23561-01" + ], + "User-Agent": [ + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/79.0.3945.0 Safari/537.36" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.6" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.8" + } }, "response": { "headers": { - "Connection": ["keep-alive"], - "Content-Length": ["2"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:40 GMT"], - "Etag": ["W/\"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w\""], - "X-Powered-By": ["Express"] + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "2" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:28 GMT" + ], + "Etag": [ + "W/\"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -593,7 +986,9 @@ "version": "8.0.0", "version_major": 8 }, - "parent": { "id": "5ff346d602ce27b0" }, + "parent": { + "id": "3358a24e09e23561" + }, "process": { "args": [ "/usr/local/bin/node", @@ -604,27 +999,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.6" }, - "timestamp": { "us": 1593413320106015 }, - "trace": { "id": "90bd7780b32cc51a7f4c200b1e0c170f" }, + "source": { + "ip": "172.18.0.8" + }, + "timestamp": { + "us": 1593413308782015 + }, + "trace": { + "id": "978b56807e0b7a27cbc41a0dfb665f47" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 7424 }, - "id": "f3dd00d12c594cba", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 7134 + }, + "id": "a6d8f3c5c98903e1", "name": "GET /api/orders", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 2 }, + "span_count": { + "started": 2 + }, "type": "request" }, "url": { @@ -635,60 +1055,96 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Spider" }, - "name": "Java", - "original": "Java/11.0.7", - "version": "0.7." + "device": { + "name": "Other" + }, + "name": "HeadlessChrome", + "original": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/79.0.3945.0 Safari/537.36", + "os": { + "name": "Linux" + }, + "version": "79.0.3945" } - }, - "p95": 11616, - "averageResponseTime": 7615.625, - "transactionsPerMinute": 2, - "impact": 2.6645791239678345 + } }, { - "name": "GET /api/products", + "key": "GET /api/products", + "averageResponseTime": 8585, + "transactionsPerMinute": 1.75, + "impact": 2.624924094061731, + "p95": 22112, "sample": { - "@timestamp": "2020-06-29T06:48:27.452Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.6" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:29.978463Z" }, + "@timestamp": "2020-06-29T06:48:21.475Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:26.996210Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Accept": [ - "text/plain, application/json, application/x-jackson-smile, application/cbor, application/*+json, */*" + "Connection": [ + "close" ], - "Connection": ["keep-alive"], - "Elastic-Apm-Traceparent": [ - "00-27b168a328e0fd442377de8eaa0bf582-2c86873dedb66c2c-01" + "Host": [ + "opbeans-node:3000" ], - "Host": ["opbeans-node:3000"], - "Traceparent": ["00-27b168a328e0fd442377de8eaa0bf582-2c86873dedb66c2c-01"], - "User-Agent": ["Java/11.0.7"] + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.6" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Connection": ["keep-alive"], - "Content-Length": ["1023"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:27 GMT"], - "Etag": ["W/\"3ff-VyOxcDApb+a/lnjkm9FeTOGSDrs\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "1023" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:21 GMT" + ], + "Etag": [ + "W/\"3ff-VyOxcDApb+a/lnjkm9FeTOGSDrs\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -708,7 +1164,6 @@ "version": "8.0.0", "version_major": 8 }, - "parent": { "id": "2c86873dedb66c2c" }, "process": { "args": [ "/usr/local/bin/node", @@ -719,27 +1174,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.6" }, - "timestamp": { "us": 1593413307452013 }, - "trace": { "id": "27b168a328e0fd442377de8eaa0bf582" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413301475015 + }, + "trace": { + "id": "389b26b16949c7f783223de4f14b788c" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 4292 }, - "id": "141ecc2dfd55eeea", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 6775 + }, + "id": "d2d4088a0b104fb4", "name": "GET /api/products", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 2 }, + "span_count": { + "started": 2 + }, "type": "request" }, "url": { @@ -750,53 +1230,92 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Spider" }, - "name": "Java", - "original": "Java/11.0.7", - "version": "0.7." + "device": { + "name": "Other" + }, + "name": "Other", + "original": "workload/2.4.3" } - }, - "p95": 22112, - "averageResponseTime": 8585, - "transactionsPerMinute": 1.75, - "impact": 2.624924094061731 + } }, { - "name": "GET /api/products/:id", + "key": "GET /api/products/:id", + "averageResponseTime": 13516.5, + "transactionsPerMinute": 1, + "impact": 2.3368756900811305, + "p95": 37856, "sample": { - "@timestamp": "2020-06-29T06:48:24.977Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:27.004717Z" }, + "@timestamp": "2020-06-29T06:47:57.555Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:47:59.085077Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["231"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:24 GMT"], - "Etag": ["W/\"e7-kkuzj37GZDzXDh0CWqh5Gan0VO4\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "231" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:47:57 GMT" + ], + "Etag": [ + "W/\"e7-6JlJegaJ+ir0C8I8EmmOjms1dnc\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -822,87 +1341,152 @@ "/usr/local/lib/node_modules/pm2/lib/ProcessContainer.js", "ecosystem-workload.config.js" ], - "pid": 137, + "pid": 87, "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413304977014 }, - "trace": { "id": "b9b290bca14c99962fa9a1c509401630" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413277555176 + }, + "trace": { + "id": "8365e1763f19e4067b88521d4d9247a0" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 4482 }, - "id": "b8d8284ff1fc25d6", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 37709 + }, + "id": "be2722a418272f10", "name": "GET /api/products/:id", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 1 }, + "span_count": { + "started": 1 + }, "type": "request" }, "url": { "domain": "opbeans-node", - "full": "http://opbeans-node:3000/api/products/3", - "original": "/api/products/3", - "path": "/api/products/3", + "full": "http://opbeans-node:3000/api/products/1", + "original": "/api/products/1", + "path": "/api/products/1", "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 37856, - "averageResponseTime": 13516.5, - "transactionsPerMinute": 1, - "impact": 2.3368756900811305 + } }, { - "name": "GET /api/types", + "key": "GET /api/types", + "averageResponseTime": 26992.5, + "transactionsPerMinute": 0.5, + "impact": 2.3330057413794503, + "p95": 45248, "sample": { - "@timestamp": "2020-06-29T06:48:26.443Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:29.977518Z" }, + "@timestamp": "2020-06-29T06:47:52.935Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:47:55.471071Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["112"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:26 GMT"], - "Etag": ["W/\"70-1z6hT7P1WHgBgS/BeUEVeHhOCQU\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "112" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:47:52 GMT" + ], + "Etag": [ + "W/\"70-1z6hT7P1WHgBgS/BeUEVeHhOCQU\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -928,31 +1512,56 @@ "/usr/local/lib/node_modules/pm2/lib/ProcessContainer.js", "ecosystem-workload.config.js" ], - "pid": 137, + "pid": 63, "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413306443014 }, - "trace": { "id": "be3f4eb50d253afc032c90eacaa85072" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413272935117 + }, + "trace": { + "id": "2946c536a33d163d0c984d00d1f3839a" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 8892 }, - "id": "ccce129bb8c6b125", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 45093 + }, + "id": "103482fda88b9400", "name": "GET /api/types", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 2 }, + "span_count": { + "started": 2 + }, "type": "request" }, "url": { @@ -963,55 +1572,101 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 45248, - "averageResponseTime": 26992.5, - "transactionsPerMinute": 0.5, - "impact": 2.3330057413794503 + } }, { - "name": "GET static file", + "key": "GET static file", + "averageResponseTime": 3492.9285714285716, + "transactionsPerMinute": 3.5, + "impact": 2.0901067389184496, + "p95": 11900, "sample": { - "@timestamp": "2020-06-29T06:48:40.953Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.992454Z" }, + "@timestamp": "2020-06-29T06:47:53.427Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:47:55.472070Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Accept-Ranges": ["bytes"], - "Cache-Control": ["public, max-age=0"], - "Connection": ["close"], - "Content-Length": ["15086"], - "Content-Type": ["image/x-icon"], - "Date": ["Mon, 29 Jun 2020 06:48:40 GMT"], - "Etag": ["W/\"3aee-1725aff14f0\""], - "Last-Modified": ["Thu, 28 May 2020 11:16:06 GMT"], - "X-Powered-By": ["Express"] + "Accept-Ranges": [ + "bytes" + ], + "Cache-Control": [ + "public, max-age=0" + ], + "Connection": [ + "close" + ], + "Content-Length": [ + "15086" + ], + "Content-Type": [ + "image/x-icon" + ], + "Date": [ + "Mon, 29 Jun 2020 06:47:53 GMT" + ], + "Etag": [ + "W/\"3aee-1725aff14f0\"" + ], + "Last-Modified": [ + "Thu, 28 May 2020 11:16:06 GMT" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -1031,30 +1686,53 @@ "/usr/local/lib/node_modules/pm2/lib/ProcessContainer.js", "ecosystem-workload.config.js" ], - "pid": 137, + "pid": 63, "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413320953016 }, - "trace": { "id": "292393440bbe04385f3c2e3715ac35fe" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413273427016 + }, + "trace": { + "id": "ec8a804fedf28fcf81d5682d69a16970" + }, "transaction": { - "duration": { "us": 1671 }, - "id": "d1d964ca1865dce3", + "duration": { + "us": 4934 + }, + "id": "ab90a62901b770e6", "name": "GET static file", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 0 }, + "span_count": { + "started": 0 + }, "type": "request" }, "url": { @@ -1066,56 +1744,86 @@ "scheme": "http" }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 11900, - "averageResponseTime": 3492.9285714285716, - "transactionsPerMinute": 3.5, - "impact": 2.0901067389184496 + } }, { - "name": "GET /api/products/top", + "key": "GET /api/products/top", + "averageResponseTime": 22958.5, + "transactionsPerMinute": 0.5, + "impact": 1.9475397398343375, + "p95": 33216, "sample": { - "@timestamp": "2020-06-29T06:48:18.211Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.8" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:21.007197Z" }, + "@timestamp": "2020-06-29T06:48:01.200Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:02.734903Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Accept": ["*/*"], - "Accept-Encoding": ["gzip, deflate"], - "Connection": ["keep-alive"], - "Host": ["opbeans-node:3000"], - "Referer": ["http://opbeans-node:3000/dashboard"], - "Traceparent": ["00-4879105b2de793ca54ce7299aff0f5ce-0d67fab9c9dec84d-01"], + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/79.0.3945.0 Safari/537.36" + "workload/2.4.3" ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.8" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Connection": ["keep-alive"], - "Content-Length": ["2"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:18 GMT"], - "Etag": ["W/\"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "2" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:01 GMT" + ], + "Etag": [ + "W/\"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -1135,38 +1843,62 @@ "version": "8.0.0", "version_major": 8 }, - "parent": { "id": "0d67fab9c9dec84d" }, "process": { "args": [ "/usr/local/bin/node", "/usr/local/lib/node_modules/pm2/lib/ProcessContainer.js", "ecosystem-workload.config.js" ], - "pid": 137, + "pid": 115, "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.8" }, - "timestamp": { "us": 1593413298211013 }, - "trace": { "id": "4879105b2de793ca54ce7299aff0f5ce" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413281200133 + }, + "trace": { + "id": "195f32efeb6f91e2f71b6bc8bb74ae3a" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 12820 }, - "id": "b15b12c837ab8b89", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 33097 + }, + "id": "22e72956dfc8967a", "name": "GET /api/products/top", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 1 }, + "span_count": { + "started": 1 + }, "type": "request" }, "url": { @@ -1177,56 +1909,103 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, - "name": "HeadlessChrome", - "original": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/79.0.3945.0 Safari/537.36", - "os": { "name": "Linux" }, - "version": "79.0.3945" + "device": { + "name": "Other" + }, + "name": "Other", + "original": "workload/2.4.3" } - }, - "p95": 33216, - "averageResponseTime": 22958.5, - "transactionsPerMinute": 0.5, - "impact": 1.9475397398343375 + } }, { - "name": "GET /api/stats", + "key": "GET /api/stats", + "averageResponseTime": 7105.333333333333, + "transactionsPerMinute": 1.5, + "impact": 1.7905918202662048, + "p95": 15136, "sample": { - "@timestamp": "2020-06-29T06:48:39.451Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.984824Z" }, + "@timestamp": "2020-06-29T06:48:21.150Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.8" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:26.993832Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Accept": [ + "*/*" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Connection": [ + "keep-alive" + ], + "Host": [ + "opbeans-node:3000" + ], + "If-None-Match": [ + "W/\"5c-6I+bqIiLxvkWuwBUnTxhBoK4lBk\"" + ], + "Referer": [ + "http://opbeans-node:3000/dashboard" + ], + "Traceparent": [ + "00-ee0ce8b38b8d5945829fc1c9432538bf-39d52cd5f528d363-01" + ], + "User-Agent": [ + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/79.0.3945.0 Safari/537.36" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.8" + } }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["92"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:39 GMT"], - "Etag": ["W/\"5c-6I+bqIiLxvkWuwBUnTxhBoK4lBk\""], - "X-Powered-By": ["Express"] + "Connection": [ + "keep-alive" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:21 GMT" + ], + "Etag": [ + "W/\"5c-6I+bqIiLxvkWuwBUnTxhBoK4lBk\"" + ], + "X-Powered-By": [ + "Express" + ] }, - "status_code": 200 + "status_code": 304 }, "version": "1.1" }, @@ -1244,6 +2023,9 @@ "version": "8.0.0", "version_major": 8 }, + "parent": { + "id": "39d52cd5f528d363" + }, "process": { "args": [ "/usr/local/bin/node", @@ -1254,27 +2036,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413319451016 }, - "trace": { "id": "a05787cb03a0af0863fab5e05de942f1" }, + "source": { + "ip": "172.18.0.8" + }, + "timestamp": { + "us": 1593413301150014 + }, + "trace": { + "id": "ee0ce8b38b8d5945829fc1c9432538bf" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 5050 }, - "id": "a7e004eba8f021ce", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 7273 + }, + "id": "05d5b62182c59a54", "name": "GET /api/stats", - "result": "HTTP 2xx", + "result": "HTTP 3xx", "sampled": true, - "span_count": { "started": 4 }, + "span_count": { + "started": 4 + }, "type": "request" }, "url": { @@ -1285,52 +2092,96 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, - "name": "Other", - "original": "workload/2.4.3" + "device": { + "name": "Other" + }, + "name": "HeadlessChrome", + "original": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/79.0.3945.0 Safari/537.36", + "os": { + "name": "Linux" + }, + "version": "79.0.3945" } - }, - "p95": 15136, - "averageResponseTime": 7105.333333333333, - "transactionsPerMinute": 1.5, - "impact": 1.7905918202662048 + } }, { - "name": "GET /log-error", + "key": "GET /log-error", + "averageResponseTime": 35846, + "transactionsPerMinute": 0.25, + "impact": 1.466376117925459, + "p95": 35840, "sample": { "@timestamp": "2020-06-29T06:48:07.467Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:18.533253Z" }, + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:18.533253Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["24"], - "Content-Type": ["text/html; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:07 GMT"], - "Etag": ["W/\"18-MS3VbhH7auHMzO0fUuNF6v14N/M\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "24" + ], + "Content-Type": [ + "text/html; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:07 GMT" + ], + "Etag": [ + "W/\"18-MS3VbhH7auHMzO0fUuNF6v14N/M\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 500 }, @@ -1360,27 +2211,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413287467017 }, - "trace": { "id": "d518b2c4d72cd2aaf1e39bad7ebcbdbb" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413287467017 + }, + "trace": { + "id": "d518b2c4d72cd2aaf1e39bad7ebcbdbb" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 35846 }, + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 35846 + }, "id": "c7a30c1b076907ec", "name": "GET /log-error", "result": "HTTP 5xx", "sampled": true, - "span_count": { "started": 0 }, + "span_count": { + "started": 0 + }, "type": "request" }, "url": { @@ -1391,56 +2267,104 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 35840, - "averageResponseTime": 35846, - "transactionsPerMinute": 0.25, - "impact": 1.466376117925459 + } }, { - "name": "POST /api", + "key": "POST /api", + "averageResponseTime": 20011, + "transactionsPerMinute": 0.25, + "impact": 0.7098250353192541, + "p95": 19968, "sample": { "@timestamp": "2020-06-29T06:48:25.478Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:27.005671Z" }, + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:27.005671Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { - "body": { "original": "[REDACTED]" }, + "body": { + "original": "[REDACTED]" + }, "headers": { - "Accept": ["application/json"], - "Connection": ["close"], - "Content-Length": ["129"], - "Content-Type": ["application/json"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Accept": [ + "application/json" + ], + "Connection": [ + "close" + ], + "Content-Length": [ + "129" + ], + "Content-Type": [ + "application/json" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "post", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Allow": ["GET"], - "Connection": ["close"], - "Content-Type": ["application/json;charset=UTF-8"], - "Date": ["Mon, 29 Jun 2020 06:48:25 GMT"], - "Transfer-Encoding": ["chunked"], - "X-Powered-By": ["Express"] + "Allow": [ + "GET" + ], + "Connection": [ + "close" + ], + "Content-Type": [ + "application/json;charset=UTF-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:25 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 405 }, @@ -1470,27 +2394,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413305478010 }, - "trace": { "id": "4bd9027dd1e355ec742970e2d6333124" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413305478010 + }, + "trace": { + "id": "4bd9027dd1e355ec742970e2d6333124" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 20011 }, + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 20011 + }, "id": "94104435cf151478", "name": "POST /api", "result": "HTTP 4xx", "sampled": true, - "span_count": { "started": 1 }, + "span_count": { + "started": 1 + }, "type": "request" }, "url": { @@ -1501,52 +2450,92 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 19968, - "averageResponseTime": 20011, - "transactionsPerMinute": 0.25, - "impact": 0.7098250353192541 + } }, { - "name": "GET /api/types/:id", + "key": "GET /api/types/:id", + "averageResponseTime": 8181, + "transactionsPerMinute": 0.5, + "impact": 0.5354862351657939, + "p95": 10080, "sample": { - "@timestamp": "2020-06-29T06:48:12.972Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:18.543436Z" }, + "@timestamp": "2020-06-29T06:47:53.928Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:47:55.472718Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["205"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:12 GMT"], - "Etag": ["W/\"cd-pFMi1QOVY6YqWe+nwcbZVviCths\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "205" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:47:53 GMT" + ], + "Etag": [ + "W/\"cd-pFMi1QOVY6YqWe+nwcbZVviCths\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -1572,31 +2561,56 @@ "/usr/local/lib/node_modules/pm2/lib/ProcessContainer.js", "ecosystem-workload.config.js" ], - "pid": 137, + "pid": 63, "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413292972011 }, - "trace": { "id": "aea65cef5f902dda5d8e38f9fb38864d" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413273928016 + }, + "trace": { + "id": "0becaafb422bfeb69e047bf7153aa469" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 6300 }, - "id": "a5bdbe43ac05fae2", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 10062 + }, + "id": "0cee4574091bda3b", "name": "GET /api/types/:id", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 2 }, + "span_count": { + "started": 2 + }, "type": "request" }, "url": { @@ -1607,50 +2621,86 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 10080, - "averageResponseTime": 8181, - "transactionsPerMinute": 0.5, - "impact": 0.5354862351657939 + } }, { - "name": "GET /api/orders/:id", + "key": "GET /api/orders/:id", + "averageResponseTime": 4749.666666666667, + "transactionsPerMinute": 0.75, + "impact": 0.43453312891085794, + "p95": 7184, "sample": { "@timestamp": "2020-06-29T06:48:35.951Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:39.484133Z" }, + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:39.484133Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["0"], - "Date": ["Mon, 29 Jun 2020 06:48:35 GMT"], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "0" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:35 GMT" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 404 }, @@ -1680,27 +2730,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413315951017 }, - "trace": { "id": "95979caa80e6622cbbb2d308800c3016" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413315951017 + }, + "trace": { + "id": "95979caa80e6622cbbb2d308800c3016" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 3210 }, + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 3210 + }, "id": "30344988dace0b43", "name": "GET /api/orders/:id", "result": "HTTP 4xx", "sampled": true, - "span_count": { "started": 1 }, + "span_count": { + "started": 1 + }, "type": "request" }, "url": { @@ -1711,52 +2786,92 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 7184, - "averageResponseTime": 4749.666666666667, - "transactionsPerMinute": 0.75, - "impact": 0.43453312891085794 + } }, { - "name": "GET /api/products/:id/customers", + "key": "GET /api/products/:id/customers", + "averageResponseTime": 4757, + "transactionsPerMinute": 0.5, + "impact": 0.20830834986820673, + "p95": 5616, "sample": { - "@timestamp": "2020-06-29T06:48:41.956Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.994692Z" }, + "@timestamp": "2020-06-29T06:48:22.977Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:27.000765Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["2"], - "Content-Type": ["application/json; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:41 GMT"], - "Etag": ["W/\"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w\""], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "2" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:22 GMT" + ], + "Etag": [ + "W/\"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w\"" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 200 }, @@ -1786,84 +2901,151 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413321956016 }, - "trace": { "id": "f735ac5fca8f83eebc748f4a2e009e61" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413302977008 + }, + "trace": { + "id": "da8f22fe652ccb6680b3029ab6efd284" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 3896 }, - "id": "b24ce95c855f83a4", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 5618 + }, + "id": "bc51c1523afaf57a", "name": "GET /api/products/:id/customers", "result": "HTTP 2xx", "sampled": true, - "span_count": { "started": 1 }, + "span_count": { + "started": 1 + }, "type": "request" }, "url": { "domain": "opbeans-node", - "full": "http://opbeans-node:3000/api/products/5/customers", - "original": "/api/products/5/customers", - "path": "/api/products/5/customers", + "full": "http://opbeans-node:3000/api/products/3/customers", + "original": "/api/products/3/customers", + "path": "/api/products/3/customers", "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 5616, - "averageResponseTime": 4757, - "transactionsPerMinute": 0.5, - "impact": 0.20830834986820673 + } }, { - "name": "GET /throw-error", + "key": "GET /throw-error", + "averageResponseTime": 2577, + "transactionsPerMinute": 0.5, + "impact": 0, + "p95": 3224, "sample": { - "@timestamp": "2020-06-29T06:48:42.954Z", - "agent": { "name": "nodejs", "version": "3.6.1" }, - "client": { "ip": "172.18.0.7" }, - "container": { "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "ecs": { "version": "1.5.0" }, - "event": { "ingested": "2020-06-29T06:48:43.996435Z" }, + "@timestamp": "2020-06-29T06:48:19.975Z", + "agent": { + "name": "nodejs", + "version": "3.6.1" + }, + "client": { + "ip": "172.18.0.7" + }, + "container": { + "id": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "ecs": { + "version": "1.5.0" + }, + "event": { + "ingested": "2020-06-29T06:48:21.012520Z" + }, "host": { "architecture": "x64", "hostname": "41712ded148f", "ip": "172.18.0.7", "name": "41712ded148f", - "os": { "platform": "linux" } + "os": { + "platform": "linux" + } }, "http": { "request": { "headers": { - "Connection": ["close"], - "Host": ["opbeans-node:3000"], - "User-Agent": ["workload/2.4.3"] + "Connection": [ + "close" + ], + "Host": [ + "opbeans-node:3000" + ], + "User-Agent": [ + "workload/2.4.3" + ] }, "method": "get", - "socket": { "encrypted": false, "remote_address": "::ffff:172.18.0.7" } + "socket": { + "encrypted": false, + "remote_address": "::ffff:172.18.0.7" + } }, "response": { "headers": { - "Connection": ["close"], - "Content-Length": ["148"], - "Content-Security-Policy": ["default-src 'none'"], - "Content-Type": ["text/html; charset=utf-8"], - "Date": ["Mon, 29 Jun 2020 06:48:42 GMT"], - "X-Content-Type-Options": ["nosniff"], - "X-Powered-By": ["Express"] + "Connection": [ + "close" + ], + "Content-Length": [ + "148" + ], + "Content-Security-Policy": [ + "default-src 'none'" + ], + "Content-Type": [ + "text/html; charset=utf-8" + ], + "Date": [ + "Mon, 29 Jun 2020 06:48:19 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Powered-By": [ + "Express" + ] }, "status_code": 500 }, @@ -1893,27 +3075,52 @@ "ppid": 1, "title": "node /app/server.js" }, - "processor": { "event": "transaction", "name": "transaction" }, + "processor": { + "event": "transaction", + "name": "transaction" + }, "service": { "environment": "production", - "framework": { "name": "express", "version": "4.17.1" }, - "language": { "name": "javascript" }, + "framework": { + "name": "express", + "version": "4.17.1" + }, + "language": { + "name": "javascript" + }, "name": "opbeans-node", - "node": { "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" }, - "runtime": { "name": "node", "version": "12.18.1" }, + "node": { + "name": "41712ded148f30ee09a13421780eec4304bf5049b82a0d8dbc877893be6799e4" + }, + "runtime": { + "name": "node", + "version": "12.18.1" + }, "version": "1.0.0" }, - "source": { "ip": "172.18.0.7" }, - "timestamp": { "us": 1593413322954016 }, - "trace": { "id": "9d5aee7443a43db9820f622a10dfac6e" }, + "source": { + "ip": "172.18.0.7" + }, + "timestamp": { + "us": 1593413299975019 + }, + "trace": { + "id": "106f3a55b0b0ea327d1bbe4be66c3bcc" + }, "transaction": { - "custom": { "shoppingBasketCount": 42 }, - "duration": { "us": 1928 }, - "id": "8e6fc8c3f99e8fc9", + "custom": { + "shoppingBasketCount": 42 + }, + "duration": { + "us": 3226 + }, + "id": "247b9141552a9e73", "name": "GET /throw-error", "result": "HTTP 5xx", "sampled": true, - "span_count": { "started": 0 }, + "span_count": { + "started": 0 + }, "type": "request" }, "url": { @@ -1924,19 +3131,21 @@ "port": 3000, "scheme": "http" }, - "user": { "email": "kimchy@elastic.co", "id": "42", "name": "kimchy" }, + "user": { + "email": "kimchy@elastic.co", + "id": "42", + "name": "kimchy" + }, "user_agent": { - "device": { "name": "Other" }, + "device": { + "name": "Other" + }, "name": "Other", "original": "workload/2.4.3" } - }, - "p95": 3224, - "averageResponseTime": 2577, - "transactionsPerMinute": 0.5, - "impact": 0 + } } ], "isAggregationAccurate": true, - "bucketSize": 100 -} + "bucketSize": 1000 +} \ No newline at end of file diff --git a/x-pack/test/apm_api_integration/basic/tests/transaction_groups/top_transaction_groups.ts b/x-pack/test/apm_api_integration/basic/tests/transaction_groups/top_transaction_groups.ts index 43b2ad5414c7a..94559a3e4aa54 100644 --- a/x-pack/test/apm_api_integration/basic/tests/transaction_groups/top_transaction_groups.ts +++ b/x-pack/test/apm_api_integration/basic/tests/transaction_groups/top_transaction_groups.ts @@ -4,9 +4,18 @@ * you may not use this file except in compliance with the Elastic License. */ import expect from '@kbn/expect'; +import { sortBy } from 'lodash'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; import expectedTransactionGroups from './expectation/top_transaction_groups.json'; +function sortTransactionGroups(items: any[]) { + return sortBy(items, 'impact'); +} + +function omitSampleFromTransactionGroups(items: any[]) { + return sortTransactionGroups(items).map(({ sample, ...item }) => ({ ...item })); +} + export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const esArchiver = getService('esArchiver'); @@ -48,15 +57,19 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); it('returns the correct buckets (when ignoring samples)', async () => { - function omitSample(items: any[]) { - return items.map(({ sample, ...item }) => ({ ...item })); - } - - expect(omitSample(response.body.items)).to.eql(omitSample(expectedTransactionGroups.items)); + expect(omitSampleFromTransactionGroups(response.body.items)).to.eql( + omitSampleFromTransactionGroups(expectedTransactionGroups.items) + ); }); it('returns the correct buckets and samples', async () => { - expect(response.body.items).to.eql(expectedTransactionGroups.items); + // sample should provide enough information to deeplink to a transaction detail page + response.body.items.forEach((item: any) => { + expect(item.sample.trace.id).to.be.an('string'); + expect(item.sample.transaction.id).to.be.an('string'); + expect(item.sample.service.name).to.be('opbeans-node'); + expect(item.sample.transaction.name).to.be(item.key); + }); }); }); }); diff --git a/x-pack/test/functional/apps/maps/es_pew_pew_source.js b/x-pack/test/functional/apps/maps/es_pew_pew_source.js index ec02dd2901c7d..382bde510170f 100644 --- a/x-pack/test/functional/apps/maps/es_pew_pew_source.js +++ b/x-pack/test/functional/apps/maps/es_pew_pew_source.js @@ -35,5 +35,14 @@ export default function ({ getPageObjects, getService }) { expect(features.length).to.equal(2); expect(features[0].geometry.type).to.equal('LineString'); }); + + it('should fit to bounds', async () => { + // Set view to other side of world so no matching results + await PageObjects.maps.setView(-70, 0, 6); + await PageObjects.maps.clickFitToBounds('connections'); + const { lat, lon } = await PageObjects.maps.getView(); + expect(Math.round(lat)).to.equal(41); + expect(Math.round(lon)).to.equal(-70); + }); }); } diff --git a/x-pack/test/functional/apps/ml/data_frame_analytics/cloning.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/cloning.ts index e2f7960f9d856..00be1b8e12b49 100644 --- a/x-pack/test/functional/apps/ml/data_frame_analytics/cloning.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/cloning.ts @@ -157,6 +157,7 @@ export default function ({ getService }: FtrProviderContext) { await ml.api.deleteIndices(cloneDestIndex); await ml.api.deleteIndices(testData.job.dest!.index as string); await ml.testResources.deleteIndexPatternByTitle(testData.job.dest!.index as string); + await ml.testResources.deleteIndexPatternByTitle(cloneDestIndex); }); it('should open the wizard with a proper header', async () => { diff --git a/x-pack/test/functional/es_archives/endpoint/artifacts/api_feature/data.json b/x-pack/test/functional/es_archives/endpoint/artifacts/api_feature/data.json index 47390f0428742..3af1070597671 100644 --- a/x-pack/test/functional/es_archives/endpoint/artifacts/api_feature/data.json +++ b/x-pack/test/functional/es_archives/endpoint/artifacts/api_feature/data.json @@ -1,28 +1,3 @@ -{ - "type": "doc", - "value": { - "id": "endpoint:user-artifact:endpoint-exceptionlist-linux-v1-d2a9c760005b08d43394e59a8701ae75c80881934ccf15a006944452b80f7f9f", - "index": ".kibana", - "source": { - "references": [ - ], - "endpoint:user-artifact": { - "body": "eJylkM8KwjAMxl9Fci59gN29iicvMqR02QjUbiSpKGPvbiw6ETwpuX1/fh9kBszKhALNcQa9TQgNCJ2nhOA+vJ4wdWaGqJSHPY8RRXxPCb3QkJEtP07IQUe2GOWYSoedqU8qXq16ikGqeAmpPNRtCqIU3WbnDx4WN38d/WvhQqmCXzDlIlojP9CsjLC0bqWtHwhaGN/1jHVkae3u+6N6Sg==", - "created": 1593016187465, - "compressionAlgorithm": "zlib", - "encryptionAlgorithm": "none", - "identifier": "endpoint-exceptionlist-linux-v1", - "encodedSha256": "5caaeabcb7864d47157fc7c28d5a7398b4f6bbaaa565d789c02ee809253b7613", - "encodedSize": 160, - "decodedSha256": "d2a9c760005b08d43394e59a8701ae75c80881934ccf15a006944452b80f7f9f", - "decodedSize": 358 - }, - "type": "endpoint:user-artifact", - "updated_at": "2020-06-24T16:29:47.584Z" - } - } -} - { "type": "doc", "value": { @@ -83,8 +58,9 @@ ], "endpoint:user-artifact-manifest": { "created": 1593183699663, + "schemaVersion": "v1", + "semanticVersion": "1.0.1", "ids": [ - "endpoint-exceptionlist-linux-v1-d2a9c760005b08d43394e59a8701ae75c80881934ccf15a006944452b80f7f9f", "endpoint-exceptionlist-macos-v1-d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658", "endpoint-exceptionlist-windows-v1-8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e" ] diff --git a/x-pack/test/functional/services/ml/data_frame_analytics_creation.ts b/x-pack/test/functional/services/ml/data_frame_analytics_creation.ts index 5f3d21b80a830..a49febfe68f61 100644 --- a/x-pack/test/functional/services/ml/data_frame_analytics_creation.ts +++ b/x-pack/test/functional/services/ml/data_frame_analytics_creation.ts @@ -335,18 +335,24 @@ export function MachineLearningDataFrameAnalyticsCreationProvider( }, async continueToAdditionalOptionsStep() { - await testSubjects.clickWhenNotDisabled('mlAnalyticsCreateJobWizardContinueButton'); - await this.assertAdditionalOptionsStepActive(); + await retry.tryForTime(5000, async () => { + await testSubjects.clickWhenNotDisabled('mlAnalyticsCreateJobWizardContinueButton'); + await this.assertAdditionalOptionsStepActive(); + }); }, async continueToDetailsStep() { - await testSubjects.clickWhenNotDisabled('mlAnalyticsCreateJobWizardContinueButton'); - await this.assertDetailsStepActive(); + await retry.tryForTime(5000, async () => { + await testSubjects.clickWhenNotDisabled('mlAnalyticsCreateJobWizardContinueButton'); + await this.assertDetailsStepActive(); + }); }, async continueToCreateStep() { - await testSubjects.clickWhenNotDisabled('mlAnalyticsCreateJobWizardContinueButton'); - await this.assertCreateStepActive(); + await retry.tryForTime(5000, async () => { + await testSubjects.clickWhenNotDisabled('mlAnalyticsCreateJobWizardContinueButton'); + await this.assertCreateStepActive(); + }); }, async assertModelMemoryInputExists() { diff --git a/x-pack/test/functional/services/ml/test_resources.ts b/x-pack/test/functional/services/ml/test_resources.ts index 9927c987bbea5..942dc4a80d4ac 100644 --- a/x-pack/test/functional/services/ml/test_resources.ts +++ b/x-pack/test/functional/services/ml/test_resources.ts @@ -56,7 +56,7 @@ export function MachineLearningTestResourcesProvider({ getService }: FtrProvider ): Promise { log.debug(`Searching for '${objectType}' with title '${title}'...`); const findResponse = await supertest - .get(`/api/saved_objects/_find?type=${objectType}`) + .get(`/api/saved_objects/_find?type=${objectType}&per_page=10000`) .set(COMMON_REQUEST_HEADERS) .expect(200) .then((res: any) => res.body); diff --git a/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts b/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts index 2fbda8f2d3c81..98b26c1c04ebb 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts @@ -29,7 +29,7 @@ export default function ({ getService }: FtrProviderContext) { return response.body; }; const listResponse = await fetchPackageList(); - expect(listResponse.response.length).to.be(6); + expect(listResponse.response.length).to.be(13); } else { warnAndSkipTest(this, log); } diff --git a/x-pack/test/ingest_manager_api_integration/apis/index.js b/x-pack/test/ingest_manager_api_integration/apis/index.js index 1045ff5d82d12..d21b80bd6eed7 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/index.js +++ b/x-pack/test/ingest_manager_api_integration/apis/index.js @@ -22,6 +22,7 @@ export default function ({ loadTestFile }) { // Package configs loadTestFile(require.resolve('./package_config/create')); loadTestFile(require.resolve('./package_config/update')); + loadTestFile(require.resolve('./package_config/get')); // Agent config loadTestFile(require.resolve('./agent_config/index')); }); diff --git a/x-pack/test/ingest_manager_api_integration/apis/package_config/create.ts b/x-pack/test/ingest_manager_api_integration/apis/package_config/create.ts index 27581550ac2bc..cae4ff79bdef6 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/package_config/create.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/package_config/create.ts @@ -18,9 +18,7 @@ export default function ({ getService }: FtrProviderContext) { // because `this` has to point to the Mocha context // see https://mochajs.org/#arrow-functions - // Temporarily skipped to promote snapshot - // Re-enabled in https://github.com/elastic/kibana/pull/71727 - describe.skip('Package Config - create', async function () { + describe('Package Config - create', async function () { let agentConfigId: string; before(async function () { diff --git a/x-pack/test/ingest_manager_api_integration/apis/package_config/get.ts b/x-pack/test/ingest_manager_api_integration/apis/package_config/get.ts new file mode 100644 index 0000000000000..94b7543d982ad --- /dev/null +++ b/x-pack/test/ingest_manager_api_integration/apis/package_config/get.ts @@ -0,0 +1,89 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; +import { skipIfNoDockerRegistry } from '../../helpers'; + +export default function (providerContext: FtrProviderContext) { + const { getService } = providerContext; + const supertest = getService('supertest'); + const dockerServers = getService('dockerServers'); + + const server = dockerServers.get('registry'); + // use function () {} and not () => {} here + // because `this` has to point to the Mocha context + // see https://mochajs.org/#arrow-functions + + describe('Package Config - get by id', async function () { + skipIfNoDockerRegistry(providerContext); + let agentConfigId: string; + let packageConfigId: string; + + before(async function () { + if (!server.enabled) { + return; + } + const { body: agentConfigResponse } = await supertest + .post(`/api/ingest_manager/agent_configs`) + .set('kbn-xsrf', 'xxxx') + .send({ + name: 'Test config', + namespace: 'default', + }); + agentConfigId = agentConfigResponse.item.id; + + const { body: packageConfigResponse } = await supertest + .post(`/api/ingest_manager/package_configs`) + .set('kbn-xsrf', 'xxxx') + .send({ + name: 'filetest-1', + description: '', + namespace: 'default', + config_id: agentConfigId, + enabled: true, + output_id: '', + inputs: [], + package: { + name: 'filetest', + title: 'For File Tests', + version: '0.1.0', + }, + }); + packageConfigId = packageConfigResponse.item.id; + }); + + after(async function () { + if (!server.enabled) { + return; + } + + await supertest + .post(`/api/ingest_manager/agent_configs/delete`) + .set('kbn-xsrf', 'xxxx') + .send({ agentConfigId }) + .expect(200); + + await supertest + .post(`/api/ingest_manager/package_configs/delete`) + .set('kbn-xsrf', 'xxxx') + .send({ packageConfigIds: [packageConfigId] }) + .expect(200); + }); + + it('should succeed with a valid id', async function () { + const { body: apiResponse } = await supertest + .get(`/api/ingest_manager/package_configs/${packageConfigId}`) + .expect(200); + + expect(apiResponse.success).to.be(true); + }); + + it('should return a 404 with an invalid id', async function () { + await supertest.get(`/api/ingest_manager/package_configs/IS_NOT_PRESENT`).expect(404); + }); + }); +} diff --git a/x-pack/test/security_solution_cypress/config.ts b/x-pack/test/security_solution_cypress/config.ts index 1ad3a36cc57ae..83290a60a17a6 100644 --- a/x-pack/test/security_solution_cypress/config.ts +++ b/x-pack/test/security_solution_cypress/config.ts @@ -46,8 +46,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { '--csp.strict=false', // define custom kibana server args here `--elasticsearch.ssl.certificateAuthorities=${CA_CERT_PATH}`, - '--xpack.ingestManager.enabled=true', - '--xpack.ingestManager.fleet.enabled=true', ], }, }; diff --git a/x-pack/test/security_solution_cypress/es_archives/export_rule/data.json.gz b/x-pack/test/security_solution_cypress/es_archives/export_rule/data.json.gz index 373251d9e4f93..aad07a0bf6d53 100644 Binary files a/x-pack/test/security_solution_cypress/es_archives/export_rule/data.json.gz and b/x-pack/test/security_solution_cypress/es_archives/export_rule/data.json.gz differ diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts index 07667a140d090..85d0e56231643 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts @@ -36,8 +36,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { [ 'Hostname', 'Host Status', - 'Policy', - 'Policy Status', + 'Integration', + 'Configuration Status', 'Operating System', 'IP Address', 'Version', @@ -119,7 +119,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); // The integration does not work properly yet. Skipping this test for now. - it.skip('navigates to ingest fleet when the Reassign Policy link is clicked', async () => { + it.skip('navigates to ingest fleet when the Reassign Configuration link is clicked', async () => { await (await testSubjects.find('hostnameCellLink')).click(); await (await testSubjects.find('hostDetailsLinkToIngest')).click(); await testSubjects.existOrFail('fleetAgentListTable'); @@ -145,8 +145,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { 'OS', 'Last Seen', 'Alerts', - 'Policy', - 'Policy Status', + 'Integration', + 'Configuration Status', 'IP Address', 'Hostname', 'Sensor Version', diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts index eec3da4ce1c5e..7962ec60ff57e 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts @@ -29,7 +29,6 @@ export default function (providerContext: FtrProviderContext) { await ingestManager.setup(); }); loadTestFile(require.resolve('./endpoint_list')); - loadTestFile(require.resolve('./policy_list')); loadTestFile(require.resolve('./policy_details')); }); } diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts index cf76f297d83be..d4947222a6cc0 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts @@ -27,7 +27,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await pageObjects.policy.navigateToPolicyDetails('invalid-id'); await testSubjects.existOrFail('policyDetailsIdNotFoundMessage'); expect(await testSubjects.getVisibleText('policyDetailsIdNotFoundMessage')).to.equal( - 'Saved object [ingest-package-configs/invalid-id] not found' + 'Package config invalid-id not found' ); }); }); @@ -73,7 +73,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await testSubjects.existOrFail('policyDetailsSuccessMessage'); expect(await testSubjects.getVisibleText('policyDetailsSuccessMessage')).to.equal( - `Policy ${policyInfo.packageConfig.name} has been updated.` + `Integration ${policyInfo.packageConfig.name} has been updated.` ); }); it('should persist update on the screen', async () => { @@ -81,7 +81,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await pageObjects.policy.confirmAndSave(); await testSubjects.existOrFail('policyDetailsSuccessMessage'); - await pageObjects.policy.navigateToPolicyList(); + await pageObjects.endpoint.navigateToHostList(); await pageObjects.policy.navigateToPolicyDetails(policyInfo.packageConfig.id); expect(await (await testSubjects.find('policyWindowsEvent_process')).isSelected()).to.equal( @@ -118,18 +118,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }, artifact_manifest: { artifacts: { - 'endpoint-exceptionlist-linux-v1': { - compression_algorithm: 'zlib', - decoded_sha256: - 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', - decoded_size: 14, - encoded_sha256: - 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', - encoded_size: 22, - encryption_algorithm: 'none', - relative_url: - '/api/endpoint/artifacts/download/endpoint-exceptionlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', - }, 'endpoint-exceptionlist-macos-v1': { compression_algorithm: 'zlib', decoded_sha256: diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/artifacts/index.ts b/x-pack/test/security_solution_endpoint_api_int/apis/artifacts/index.ts index a4a8de418157f..d5106f5549924 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/artifacts/index.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/artifacts/index.ts @@ -83,24 +83,24 @@ export default function (providerContext: FtrProviderContext) { it('should download an artifact with list items', async () => { await supertestWithoutAuth .get( - '/api/endpoint/artifacts/download/endpoint-exceptionlist-linux-v1/d2a9c760005b08d43394e59a8701ae75c80881934ccf15a006944452b80f7f9f' + '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e' ) .set('kbn-xsrf', 'xxx') .set('authorization', `ApiKey ${agentAccessAPIKey}`) .send() .expect(200) .expect((response) => { - expect(response.body.byteLength).to.equal(160); + expect(response.body.byteLength).to.equal(191); const encodedHash = createHash('sha256').update(response.body).digest('hex'); expect(encodedHash).to.equal( - '5caaeabcb7864d47157fc7c28d5a7398b4f6bbaaa565d789c02ee809253b7613' + '73015ee5131dabd1b48aa4776d3e766d836f8dd8c9fa8999c9b931f60027f07f' ); const decodedBody = inflateSync(response.body); const decodedHash = createHash('sha256').update(decodedBody).digest('hex'); expect(decodedHash).to.equal( - 'd2a9c760005b08d43394e59a8701ae75c80881934ccf15a006944452b80f7f9f' + '8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e' ); - expect(decodedBody.byteLength).to.equal(358); + expect(decodedBody.byteLength).to.equal(704); const artifactJson = JSON.parse(decodedBody.toString()); expect(artifactJson).to.eql({ entries: [ @@ -113,6 +113,35 @@ export default function (providerContext: FtrProviderContext) { type: 'exact_cased', value: 'Elastic, N.V.', }, + { + entries: [ + { + field: 'signer', + operator: 'included', + type: 'exact_cased', + value: '😈', + }, + { + field: 'trusted', + operator: 'included', + type: 'exact_cased', + value: 'true', + }, + ], + field: 'file.signature', + type: 'nested', + }, + ], + }, + { + type: 'simple', + entries: [ + { + field: 'actingProcess.file.signer', + operator: 'included', + type: 'exact_cased', + value: 'Another signer', + }, { entries: [ { @@ -280,7 +309,7 @@ export default function (providerContext: FtrProviderContext) { it('should download an artifact from cache', async () => { await supertestWithoutAuth .get( - '/api/endpoint/artifacts/download/endpoint-exceptionlist-linux-v1/d2a9c760005b08d43394e59a8701ae75c80881934ccf15a006944452b80f7f9f' + '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e' ) .set('kbn-xsrf', 'xxx') .set('authorization', `ApiKey ${agentAccessAPIKey}`) @@ -292,22 +321,24 @@ export default function (providerContext: FtrProviderContext) { .then(async () => { await supertestWithoutAuth .get( - '/api/endpoint/artifacts/download/endpoint-exceptionlist-linux-v1/d2a9c760005b08d43394e59a8701ae75c80881934ccf15a006944452b80f7f9f' + '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e' ) .set('kbn-xsrf', 'xxx') .set('authorization', `ApiKey ${agentAccessAPIKey}`) .send() .expect(200) .expect((response) => { + expect(response.body.byteLength).to.equal(191); const encodedHash = createHash('sha256').update(response.body).digest('hex'); expect(encodedHash).to.equal( - '5caaeabcb7864d47157fc7c28d5a7398b4f6bbaaa565d789c02ee809253b7613' + '73015ee5131dabd1b48aa4776d3e766d836f8dd8c9fa8999c9b931f60027f07f' ); const decodedBody = inflateSync(response.body); const decodedHash = createHash('sha256').update(decodedBody).digest('hex'); expect(decodedHash).to.equal( - 'd2a9c760005b08d43394e59a8701ae75c80881934ccf15a006944452b80f7f9f' + '8d2bcc37e82fad5d06e2c9e4bd96793ea8905ace1d528a57d0d0579ecc8c647e' ); + expect(decodedBody.byteLength).to.equal(704); const artifactJson = JSON.parse(decodedBody.toString()); expect(artifactJson).to.eql({ entries: [ @@ -320,6 +351,35 @@ export default function (providerContext: FtrProviderContext) { type: 'exact_cased', value: 'Elastic, N.V.', }, + { + entries: [ + { + field: 'signer', + operator: 'included', + type: 'exact_cased', + value: '😈', + }, + { + field: 'trusted', + operator: 'included', + type: 'exact_cased', + value: 'true', + }, + ], + field: 'file.signature', + type: 'nested', + }, + ], + }, + { + type: 'simple', + entries: [ + { + field: 'actingProcess.file.signer', + operator: 'included', + type: 'exact_cased', + value: 'Another signer', + }, { entries: [ { diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/index.ts b/x-pack/test/security_solution_endpoint_api_int/apis/index.ts index fb11a7c52fd35..56adc2382e234 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/index.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/index.ts @@ -26,7 +26,8 @@ export default function endpointAPIIntegrationTests(providerContext: FtrProvider before(async () => { await ingestManager.setup(); }); - loadTestFile(require.resolve('./resolver')); + loadTestFile(require.resolve('./resolver/entity_id')); + loadTestFile(require.resolve('./resolver/tree')); loadTestFile(require.resolve('./metadata')); loadTestFile(require.resolve('./policy')); loadTestFile(require.resolve('./artifacts')); diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/resolver/entity_id.ts b/x-pack/test/security_solution_endpoint_api_int/apis/resolver/entity_id.ts new file mode 100644 index 0000000000000..4f2a801377204 --- /dev/null +++ b/x-pack/test/security_solution_endpoint_api_int/apis/resolver/entity_id.ts @@ -0,0 +1,156 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import expect from '@kbn/expect'; +import { SearchResponse } from 'elasticsearch'; +import { eventsIndexPattern } from '../../../../plugins/security_solution/common/endpoint/constants'; +import { + ResolverTree, + ResolverEntityIndex, +} from '../../../../plugins/security_solution/common/endpoint/types'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { + EndpointDocGenerator, + Event, +} from '../../../../plugins/security_solution/common/endpoint/generate_data'; +import { InsertedEvents } from '../../services/resolver'; + +export default function resolverAPIIntegrationTests({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + const resolver = getService('resolverGenerator'); + const es = getService('es'); + const generator = new EndpointDocGenerator('resolver'); + + describe('Resolver handling of entity ids', () => { + describe('entity api', () => { + let origin: Event; + let genData: InsertedEvents; + before(async () => { + origin = generator.generateEvent({ parentEntityID: 'a' }); + origin.process.entity_id = ''; + genData = await resolver.insertEvents([origin]); + }); + + after(async () => { + await resolver.deleteData(genData); + }); + + it('excludes events that have an empty entity_id field', async () => { + // first lets get the _id of the document using the parent.process.entity_id + // then we'll use the API to search for that specific document + const res = await es.search>({ + index: genData.indices[0], + body: { + query: { + bool: { + filter: [ + { + term: { 'process.parent.entity_id': origin.process.parent!.entity_id }, + }, + ], + }, + }, + }, + }); + const { body }: { body: ResolverEntityIndex } = await supertest.get( + // using the same indices value here twice to force the query parameter to be an array + // for some reason using supertest's query() function doesn't construct a parsable array + `/api/endpoint/resolver/entity?_id=${res.body.hits.hits[0]._id}&indices=${eventsIndexPattern}&indices=${eventsIndexPattern}` + ); + expect(body).to.be.empty(); + }); + }); + + describe('children', () => { + let origin: Event; + let childNoEntityID: Event; + let childWithEntityID: Event; + let events: Event[]; + let genData: InsertedEvents; + + before(async () => { + // construct a tree with an origin and two direct children. One child will not have an entity_id. That child + // should not be returned by the backend. + origin = generator.generateEvent({ entityID: 'a' }); + childNoEntityID = generator.generateEvent({ + parentEntityID: origin.process.entity_id, + ancestry: [origin.process.entity_id], + }); + // force it to be empty + childNoEntityID.process.entity_id = ''; + + childWithEntityID = generator.generateEvent({ + entityID: 'b', + parentEntityID: origin.process.entity_id, + ancestry: [origin.process.entity_id], + }); + events = [origin, childNoEntityID, childWithEntityID]; + genData = await resolver.insertEvents(events); + }); + + after(async () => { + await resolver.deleteData(genData); + }); + + it('does not find children without a process entity_id', async () => { + const { body }: { body: ResolverTree } = await supertest + .get(`/api/endpoint/resolver/${origin.process.entity_id}`) + .expect(200); + expect(body.children.childNodes.length).to.be(1); + expect(body.children.childNodes[0].entityID).to.be(childWithEntityID.process.entity_id); + }); + }); + + describe('ancestors', () => { + let origin: Event; + let ancestor1: Event; + let ancestor2: Event; + let ancestorNoEntityID: Event; + let events: Event[]; + let genData: InsertedEvents; + + before(async () => { + // construct a tree with an origin that has two ancestors. The origin will have an empty string as one of the + // entity_ids in the ancestry array. This is to make sure that the backend will not query for that event. + ancestor2 = generator.generateEvent({ + entityID: '2', + }); + ancestor1 = generator.generateEvent({ + entityID: '1', + parentEntityID: ancestor2.process.entity_id, + ancestry: [ancestor2.process.entity_id], + }); + + // we'll insert an event that doesn't have an entity id so if the backend does search for it, it should be + // returned and our test should fail + ancestorNoEntityID = generator.generateEvent({ + ancestry: [ancestor2.process.entity_id], + }); + ancestorNoEntityID.process.entity_id = ''; + + origin = generator.generateEvent({ + entityID: 'a', + parentEntityID: ancestor1.process.entity_id, + ancestry: ['', ancestor2.process.entity_id], + }); + + events = [origin, ancestor1, ancestor2, ancestorNoEntityID]; + genData = await resolver.insertEvents(events); + }); + + after(async () => { + await resolver.deleteData(genData); + }); + + it('does not query for ancestors that have an empty string for the entity_id', async () => { + const { body }: { body: ResolverTree } = await supertest + .get(`/api/endpoint/resolver/${origin.process.entity_id}`) + .expect(200); + expect(body.ancestry.ancestors.length).to.be(1); + expect(body.ancestry.ancestors[0].entityID).to.be(ancestor2.process.entity_id); + }); + }); + }); +} diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/resolver.ts b/x-pack/test/security_solution_endpoint_api_int/apis/resolver/tree.ts similarity index 98% rename from x-pack/test/security_solution_endpoint_api_int/apis/resolver.ts rename to x-pack/test/security_solution_endpoint_api_int/apis/resolver/tree.ts index 3b515f86c6761..3527e7e575c99 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/resolver.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/resolver/tree.ts @@ -16,12 +16,12 @@ import { LegacyEndpointEvent, ResolverNodeStats, ResolverRelatedAlerts, -} from '../../../plugins/security_solution/common/endpoint/types'; +} from '../../../../plugins/security_solution/common/endpoint/types'; import { parentEntityId, eventId, -} from '../../../plugins/security_solution/common/endpoint/models/event'; -import { FtrProviderContext } from '../ftr_provider_context'; +} from '../../../../plugins/security_solution/common/endpoint/models/event'; +import { FtrProviderContext } from '../../ftr_provider_context'; import { Event, Tree, @@ -29,8 +29,8 @@ import { RelatedEventCategory, RelatedEventInfo, categoryMapping, -} from '../../../plugins/security_solution/common/endpoint/generate_data'; -import { Options, GeneratedTrees } from '../services/resolver'; +} from '../../../../plugins/security_solution/common/endpoint/generate_data'; +import { Options, GeneratedTrees } from '../../services/resolver'; /** * Check that the given lifecycle is in the resolver tree's corresponding map @@ -256,7 +256,7 @@ export default function resolverAPIIntegrationTests({ getService }: FtrProviderC ancestryArraySize: 2, }; - describe('Resolver', () => { + describe('Resolver tree', () => { before(async () => { await esArchiver.load('endpoint/resolver/api_feature'); resolverTrees = await resolver.createTrees(treeOptions); @@ -264,7 +264,7 @@ export default function resolverAPIIntegrationTests({ getService }: FtrProviderC tree = resolverTrees.trees[0]; }); after(async () => { - await resolver.deleteTrees(resolverTrees); + await resolver.deleteData(resolverTrees); // this unload is for an endgame-* index so it does not use data streams await esArchiver.unload('endpoint/resolver/api_feature'); }); diff --git a/x-pack/test/security_solution_endpoint_api_int/services/resolver.ts b/x-pack/test/security_solution_endpoint_api_int/services/resolver.ts index 7f568a2b00314..335689b804d5b 100644 --- a/x-pack/test/security_solution_endpoint_api_int/services/resolver.ts +++ b/x-pack/test/security_solution_endpoint_api_int/services/resolver.ts @@ -7,9 +7,12 @@ import { TreeOptions, Tree, EndpointDocGenerator, + Event, } from '../../../plugins/security_solution/common/endpoint/generate_data'; import { FtrProviderContext } from '../ftr_provider_context'; +const processIndex = 'logs-endpoint.events.process-default'; + /** * Options for build a resolver tree */ @@ -26,17 +29,41 @@ export interface Options extends TreeOptions { */ export interface GeneratedTrees { trees: Tree[]; - eventsIndex: string; - alertsIndex: string; + indices: string[]; +} + +/** + * Structure containing the events inserted into ES and the index they live in + */ +export interface InsertedEvents { + events: Event[]; + indices: string[]; +} + +interface BulkCreateHeader { + create: { + _index: string; + }; } export function ResolverGeneratorProvider({ getService }: FtrProviderContext) { const client = getService('es'); return { + async insertEvents( + events: Event[], + eventsIndex: string = processIndex + ): Promise { + const body = events.reduce((array: Array, doc) => { + array.push({ create: { _index: eventsIndex } }, doc); + return array; + }, []); + await client.bulk({ body, refresh: true }); + return { events, indices: [eventsIndex] }; + }, async createTrees( options: Options, - eventsIndex: string = 'logs-endpoint.events.process-default', + eventsIndex: string = processIndex, alertsIndex: string = 'logs-endpoint.alerts-default' ): Promise { const seed = options.seed || 'resolver-seed'; @@ -45,7 +72,7 @@ export function ResolverGeneratorProvider({ getService }: FtrProviderContext) { const numTrees = options.numTrees ?? 1; for (let j = 0; j < numTrees; j++) { const tree = generator.generateTree(options); - const body = tree.allEvents.reduce((array: Array>, doc) => { + const body = tree.allEvents.reduce((array: Array, doc) => { let index = eventsIndex; if (doc.event.kind === 'alert') { index = alertsIndex; @@ -60,23 +87,21 @@ export function ResolverGeneratorProvider({ getService }: FtrProviderContext) { await client.bulk({ body, refresh: true }); allTrees.push(tree); } - return { trees: allTrees, eventsIndex, alertsIndex }; + return { trees: allTrees, indices: [eventsIndex, alertsIndex] }; }, - async deleteTrees(trees: GeneratedTrees) { - /** - * The ingest manager handles creating the template for the endpoint's indices. It is using a V2 template - * with data streams. Data streams aren't included in the javascript elasticsearch client in kibana yet so we - * need to do raw requests here. Delete a data stream is slightly different than that of a regular index which - * is why we're using _data_stream here. - */ - await client.transport.request({ - method: 'DELETE', - path: `_data_stream/${trees.eventsIndex}`, - }); - await client.transport.request({ - method: 'DELETE', - path: `_data_stream/${trees.alertsIndex}`, - }); + async deleteData(genData: { indices: string[] }) { + for (const index of genData.indices) { + /** + * The ingest manager handles creating the template for the endpoint's indices. It is using a V2 template + * with data streams. Data streams aren't included in the javascript elasticsearch client in kibana yet so we + * need to do raw requests here. Delete a data stream is slightly different than that of a regular index which + * is why we're using _data_stream here. + */ + await client.transport.request({ + method: 'DELETE', + path: `_data_stream/${index}`, + }); + } }, }; } diff --git a/yarn.lock b/yarn.lock index c1328731db150..60d073330b35d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -25,7 +25,7 @@ dependencies: "@babel/highlight" "^7.0.0" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5", "@babel/code-frame@^7.8.3": +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e" integrity sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g== @@ -57,27 +57,7 @@ invariant "^2.2.4" semver "^5.5.0" -"@babel/core@7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.5.tgz#17b2686ef0d6bc58f963dddd68ab669755582c30" - integrity sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg== - dependencies: - "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.5.5" - "@babel/helpers" "^7.5.5" - "@babel/parser" "^7.5.5" - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.5.5" - "@babel/types" "^7.5.5" - convert-source-map "^1.1.0" - debug "^4.1.0" - json5 "^2.1.0" - lodash "^4.17.13" - resolve "^1.3.2" - semver "^5.4.1" - source-map "^0.5.0" - -"@babel/core@^7.0.0", "@babel/core@^7.0.1", "@babel/core@^7.1.0", "@babel/core@^7.4.3", "@babel/core@^7.7.5": +"@babel/core@^7.0.1", "@babel/core@^7.1.0", "@babel/core@^7.4.3", "@babel/core@^7.7.5": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.9.0.tgz#ac977b538b77e132ff706f3b8a4dbad09c03c56e" integrity sha512-kWc7L0fw1xwvI0zi8OKVBuxRVefwGOrKSQMvrQ3dW+bIIavBY3/NpXmpjMy7bQnLgwgzWQZ8TlM57YHpHNHz4w== @@ -121,7 +101,7 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.0.0", "@babel/generator@^7.5.5", "@babel/generator@^7.9.0": +"@babel/generator@^7.0.0", "@babel/generator@^7.9.0": version "7.9.4" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.9.4.tgz#12441e90c3b3c4159cdecf312075bf1a8ce2dbce" integrity sha512-rjP8ahaDy/ouhrvCoU1E5mqaitWrxwuNGU+dy1EpaoK48jZay4MdkskKGIMHLZNewg8sAsqpGSREJwP0zH3YQA== @@ -249,7 +229,7 @@ "@babel/helper-replace-supers" "^7.10.1" "@babel/helper-split-export-declaration" "^7.10.1" -"@babel/helper-create-class-features-plugin@^7.4.4", "@babel/helper-create-class-features-plugin@^7.5.5", "@babel/helper-create-class-features-plugin@^7.8.3": +"@babel/helper-create-class-features-plugin@^7.8.3": version "7.8.6" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.8.6.tgz#243a5b46e2f8f0f674dc1387631eb6b28b851de0" integrity sha512-klTBDdsr+VFFqaDHm5rR69OpEQtO2Qv8ECxHS1mNhJJvaHArR6a1xTf5K/eZW7eZpJbhCx3NW1Yt/sKsLXLblg== @@ -576,7 +556,7 @@ "@babel/traverse" "^7.10.1" "@babel/types" "^7.10.1" -"@babel/helpers@^7.5.5", "@babel/helpers@^7.9.0": +"@babel/helpers@^7.9.0": version "7.9.2" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.9.2.tgz#b42a81a811f1e7313b88cba8adc66b3d9ae6c09f" integrity sha512-JwLvzlXVPjO8eU9c/wF9/zOIN7X6h8DYf7mG4CiFRZRvZNKEF5dQ3H3V+ASkHoIB3mWhatgl5ONhyqHRI6MppA== @@ -603,7 +583,7 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.2.0", "@babel/parser@^7.5.5", "@babel/parser@^7.7.5", "@babel/parser@^7.8.6", "@babel/parser@^7.9.0": +"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.2.0", "@babel/parser@^7.7.5", "@babel/parser@^7.8.6", "@babel/parser@^7.9.0": version "7.9.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.9.4.tgz#68a35e6b0319bbc014465be43828300113f2f2e8" integrity sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA== @@ -622,7 +602,7 @@ "@babel/helper-remap-async-to-generator" "^7.10.1" "@babel/plugin-syntax-async-generators" "^7.8.0" -"@babel/plugin-proposal-async-generator-functions@^7.2.0", "@babel/plugin-proposal-async-generator-functions@^7.8.3": +"@babel/plugin-proposal-async-generator-functions@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.8.3.tgz#bad329c670b382589721b27540c7d288601c6e6f" integrity sha512-NZ9zLv848JsV3hs8ryEh7Uaz/0KsmPLqv0+PdkDJL1cJy0K4kOCFa8zc1E3mp+RHPQcpdfb/6GovEsW4VDrOMw== @@ -631,14 +611,6 @@ "@babel/helper-remap-async-to-generator" "^7.8.3" "@babel/plugin-syntax-async-generators" "^7.8.0" -"@babel/plugin-proposal-class-properties@7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.5.5.tgz#a974cfae1e37c3110e71f3c6a2e48b8e71958cd4" - integrity sha512-AF79FsnWFxjlaosgdi421vmYG6/jg79bVD0dpD44QdgobzHKuLZ6S3vl8la9qIeSwGi8i1fS0O1mfuDAAdo1/A== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.5.5" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-class-properties@^7.10.1": version "7.10.1" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.10.1.tgz#046bc7f6550bb08d9bd1d4f060f5f5a4f1087e01" @@ -647,7 +619,7 @@ "@babel/helper-create-class-features-plugin" "^7.10.1" "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-proposal-class-properties@^7.3.3", "@babel/plugin-proposal-class-properties@^7.7.0": +"@babel/plugin-proposal-class-properties@^7.7.0": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.8.3.tgz#5e06654af5cd04b608915aada9b2a6788004464e" integrity sha512-EqFhbo7IosdgPgZggHaNObkmO1kNUe3slaKu54d5OWvy+p9QIKOzK1GAEpAIsZtWVtPXUHSMcT4smvDrCfY4AA== @@ -655,15 +627,6 @@ "@babel/helper-create-class-features-plugin" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-proposal-decorators@7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.4.4.tgz#de9b2a1a8ab0196f378e2a82f10b6e2a36f21cc0" - integrity sha512-z7MpQz3XC/iQJWXH9y+MaWcLPNSMY9RQSthrLzak8R8hCj0fuyNk+Dzi9kfNe/JxxlWQ2g7wkABbgWjW36MTcw== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.4.4" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-decorators" "^7.2.0" - "@babel/plugin-proposal-dynamic-import@^7.10.1": version "7.10.1" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.10.1.tgz#e36979dc1dc3b73f6d6816fc4951da2363488ef0" @@ -672,7 +635,7 @@ "@babel/helper-plugin-utils" "^7.10.1" "@babel/plugin-syntax-dynamic-import" "^7.8.0" -"@babel/plugin-proposal-dynamic-import@^7.5.0", "@babel/plugin-proposal-dynamic-import@^7.8.3": +"@babel/plugin-proposal-dynamic-import@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.8.3.tgz#38c4fe555744826e97e2ae930b0fb4cc07e66054" integrity sha512-NyaBbyLFXFLT9FP+zk0kYlUlA8XtCUbehs67F0nnEg7KICgMc2mNkIeu9TYhKzyXMkrapZFwAhXLdnt4IYHy1w== @@ -696,7 +659,7 @@ "@babel/helper-plugin-utils" "^7.10.1" "@babel/plugin-syntax-json-strings" "^7.8.0" -"@babel/plugin-proposal-json-strings@^7.2.0", "@babel/plugin-proposal-json-strings@^7.8.3": +"@babel/plugin-proposal-json-strings@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.8.3.tgz#da5216b238a98b58a1e05d6852104b10f9a70d6b" integrity sha512-KGhQNZ3TVCQG/MjRbAUwuH+14y9q0tpxs1nWWs3pbSleRdDro9SAMMDyye8HhY1gqZ7/NqIc8SKhya0wRDgP1Q== @@ -736,14 +699,6 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-numeric-separator" "^7.8.3" -"@babel/plugin-proposal-object-rest-spread@7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.5.tgz#61939744f71ba76a3ae46b5eea18a54c16d22e58" - integrity sha512-F2DxJJSQ7f64FyTVl5cw/9MWn6naXGdk3Q3UhDbFEEHv+EilCPoeRD3Zh/Utx1CJz4uyKlQ4uH+bJPbEhMV7Zw== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread@^7.10.1": version "7.10.1" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.10.1.tgz#cba44908ac9f142650b4a65b8aa06bf3478d5fb6" @@ -753,7 +708,7 @@ "@babel/plugin-syntax-object-rest-spread" "^7.8.0" "@babel/plugin-transform-parameters" "^7.10.1" -"@babel/plugin-proposal-object-rest-spread@^7.3.2", "@babel/plugin-proposal-object-rest-spread@^7.5.5", "@babel/plugin-proposal-object-rest-spread@^7.6.2", "@babel/plugin-proposal-object-rest-spread@^7.9.0": +"@babel/plugin-proposal-object-rest-spread@^7.6.2", "@babel/plugin-proposal-object-rest-spread@^7.9.0": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.9.0.tgz#a28993699fc13df165995362693962ba6b061d6f" integrity sha512-UgqBv6bjq4fDb8uku9f+wcm1J7YxJ5nT7WO/jBr0cl0PLKb7t1O6RNR1kZbjgx2LQtsDI9hwoQVmn0yhXeQyow== @@ -769,7 +724,7 @@ "@babel/helper-plugin-utils" "^7.10.1" "@babel/plugin-syntax-optional-catch-binding" "^7.8.0" -"@babel/plugin-proposal-optional-catch-binding@^7.2.0", "@babel/plugin-proposal-optional-catch-binding@^7.8.3": +"@babel/plugin-proposal-optional-catch-binding@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.8.3.tgz#9dee96ab1650eed88646ae9734ca167ac4a9c5c9" integrity sha512-0gkX7J7E+AtAw9fcwlVQj8peP61qhdg/89D5swOkjYbkboA2CVckn3kiyum1DE0wskGb7KJJxBdyEBApDLLVdw== @@ -817,7 +772,7 @@ "@babel/helper-create-regexp-features-plugin" "^7.8.8" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-async-generators@^7.2.0", "@babel/plugin-syntax-async-generators@^7.8.0", "@babel/plugin-syntax-async-generators@^7.8.4": +"@babel/plugin-syntax-async-generators@^7.8.0", "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== @@ -845,20 +800,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-decorators@^7.2.0": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.8.3.tgz#8d2c15a9f1af624b0025f961682a9d53d3001bda" - integrity sha512-8Hg4dNNT9/LcA1zQlfwuKR8BUc/if7Q7NkTam9sGTcJphLwpf2g4S42uhspQrIrR+dpzE0dtTqBVFoHl8GtnnQ== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-syntax-dynamic-import@7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.2.0.tgz#69c159ffaf4998122161ad8ebc5e6d1f55df8612" - integrity sha512-mVxuJ0YroI/h/tbFTPGZR8cv6ai+STMKNBq0f8hFxsxWjl94qqhsb+wXbpNMDPU3cfR1TIsVFzU3nXyZMqyK4w== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-dynamic-import@^7.2.0", "@babel/plugin-syntax-dynamic-import@^7.8.0": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" @@ -873,14 +814,14 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-flow@^7.2.0", "@babel/plugin-syntax-flow@^7.8.3": +"@babel/plugin-syntax-flow@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.8.3.tgz#f2c883bd61a6316f2c89380ae5122f923ba4527f" integrity sha512-innAx3bUbA0KSYj2E2MNFSn9hiCeowOFLxlsuhXzw8hMQnzkDomUr9QCD7E9VF60NmnG1sNTuuv6Qf4f8INYsg== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-json-strings@^7.2.0", "@babel/plugin-syntax-json-strings@^7.8.0", "@babel/plugin-syntax-json-strings@^7.8.3": +"@babel/plugin-syntax-json-strings@^7.8.0", "@babel/plugin-syntax-json-strings@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== @@ -929,14 +870,14 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-object-rest-spread@^7.2.0", "@babel/plugin-syntax-object-rest-spread@^7.8.0", "@babel/plugin-syntax-object-rest-spread@^7.8.3": +"@babel/plugin-syntax-object-rest-spread@^7.8.0", "@babel/plugin-syntax-object-rest-spread@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-optional-catch-binding@^7.2.0", "@babel/plugin-syntax-optional-catch-binding@^7.8.0", "@babel/plugin-syntax-optional-catch-binding@^7.8.3": +"@babel/plugin-syntax-optional-catch-binding@^7.8.0", "@babel/plugin-syntax-optional-catch-binding@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== @@ -971,13 +912,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-syntax-typescript@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.8.3.tgz#c1f659dda97711a569cef75275f7e15dcaa6cabc" - integrity sha512-GO1MQ/SGGGoiEXY0e0bSpHimJvxqB7lktLLIq2pv8xG7WZ8IMEle74jIe1FhprHBWjwjZtXHkycDLZXIWM5Wfg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/plugin-transform-arrow-functions@^7.10.1": version "7.10.1" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.10.1.tgz#cb5ee3a36f0863c06ead0b409b4cc43a889b295b" @@ -985,7 +919,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-arrow-functions@^7.2.0", "@babel/plugin-transform-arrow-functions@^7.8.3": +"@babel/plugin-transform-arrow-functions@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.8.3.tgz#82776c2ed0cd9e1a49956daeb896024c9473b8b6" integrity sha512-0MRF+KC8EqH4dbuITCWwPSzsyO3HIWWlm30v8BbbpOrS1B++isGxPnnuq/IZvOX5J2D/p7DQalQm+/2PnlKGxg== @@ -1001,7 +935,7 @@ "@babel/helper-plugin-utils" "^7.10.1" "@babel/helper-remap-async-to-generator" "^7.10.1" -"@babel/plugin-transform-async-to-generator@^7.5.0", "@babel/plugin-transform-async-to-generator@^7.8.3": +"@babel/plugin-transform-async-to-generator@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.8.3.tgz#4308fad0d9409d71eafb9b1a6ee35f9d64b64086" integrity sha512-imt9tFLD9ogt56Dd5CI/6XgpukMwd/fLGSrix2httihVe7LOGVPhyhMh1BU5kDM7iHD08i8uUtmV2sWaBFlHVQ== @@ -1017,7 +951,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-block-scoped-functions@^7.2.0", "@babel/plugin-transform-block-scoped-functions@^7.8.3": +"@babel/plugin-transform-block-scoped-functions@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.8.3.tgz#437eec5b799b5852072084b3ae5ef66e8349e8a3" integrity sha512-vo4F2OewqjbB1+yaJ7k2EJFHlTP3jR634Z9Cj9itpqNjuLXvhlVxgnjsHsdRgASR8xYDrx6onw4vW5H6We0Jmg== @@ -1032,7 +966,7 @@ "@babel/helper-plugin-utils" "^7.10.1" lodash "^4.17.13" -"@babel/plugin-transform-block-scoping@^7.5.5", "@babel/plugin-transform-block-scoping@^7.8.3": +"@babel/plugin-transform-block-scoping@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.8.3.tgz#97d35dab66857a437c166358b91d09050c868f3a" integrity sha512-pGnYfm7RNRgYRi7bids5bHluENHqJhrV4bCZRwc5GamaWIIs07N4rZECcmJL6ZClwjDz1GbdMZFtPs27hTB06w== @@ -1054,7 +988,7 @@ "@babel/helper-split-export-declaration" "^7.10.1" globals "^11.1.0" -"@babel/plugin-transform-classes@^7.5.5", "@babel/plugin-transform-classes@^7.9.0": +"@babel/plugin-transform-classes@^7.9.0": version "7.9.2" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.9.2.tgz#8603fc3cc449e31fdbdbc257f67717536a11af8d" integrity sha512-TC2p3bPzsfvSsqBZo0kJnuelnoK9O3welkUpqSqBQuBF6R5MN2rysopri8kNvtlGIb2jmUO7i15IooAZJjZuMQ== @@ -1075,20 +1009,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-computed-properties@^7.2.0", "@babel/plugin-transform-computed-properties@^7.8.3": +"@babel/plugin-transform-computed-properties@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.8.3.tgz#96d0d28b7f7ce4eb5b120bb2e0e943343c86f81b" integrity sha512-O5hiIpSyOGdrQZRQ2ccwtTVkgUDBBiCuK//4RJ6UfePllUTCENOzKxfh6ulckXKc0DixTFLCfb2HVkNA7aDpzA== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-destructuring@7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.5.0.tgz#f6c09fdfe3f94516ff074fe877db7bc9ef05855a" - integrity sha512-YbYgbd3TryYYLGyC7ZR+Tq8H/+bCmwoaxHfJHupom5ECstzbRLTch6gOQbhEY9Z4hiCNHEURgq06ykFv9JZ/QQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-destructuring@^7.10.1": version "7.10.1" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.10.1.tgz#abd58e51337815ca3a22a336b85f62b998e71907" @@ -1096,7 +1023,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-destructuring@^7.5.0", "@babel/plugin-transform-destructuring@^7.8.3": +"@babel/plugin-transform-destructuring@^7.8.3": version "7.8.8" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.8.8.tgz#fadb2bc8e90ccaf5658de6f8d4d22ff6272a2f4b" integrity sha512-eRJu4Vs2rmttFCdhPUM3bV0Yo/xPSdPw6ML9KHs/bjB4bLA5HXlbvYXPOD5yASodGod+krjYx21xm1QmL8dCJQ== @@ -1126,7 +1053,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-duplicate-keys@^7.5.0", "@babel/plugin-transform-duplicate-keys@^7.8.3": +"@babel/plugin-transform-duplicate-keys@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.8.3.tgz#8d12df309aa537f272899c565ea1768e286e21f1" integrity sha512-s8dHiBUbcbSgipS4SMFuWGqCvyge5V2ZeAWzR6INTVC3Ltjig/Vw1G2Gztv0vU/hRG9X8IvKvYdoksnUfgXOEQ== @@ -1141,7 +1068,7 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.10.1" "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-exponentiation-operator@^7.2.0", "@babel/plugin-transform-exponentiation-operator@^7.8.3": +"@babel/plugin-transform-exponentiation-operator@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.8.3.tgz#581a6d7f56970e06bf51560cd64f5e947b70d7b7" integrity sha512-zwIpuIymb3ACcInbksHaNcR12S++0MDLKkiqXHl3AzpgdKlFNhog+z/K0+TGW+b0w5pgTq4H6IwV/WhxbGYSjQ== @@ -1149,14 +1076,6 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-flow-strip-types@7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.4.4.tgz#d267a081f49a8705fc9146de0768c6b58dccd8f7" - integrity sha512-WyVedfeEIILYEaWGAUWzVNyqG4sfsNooMhXWsu/YzOvVGcsnPb5PguysjJqI3t3qiaYj0BR8T2f5njdjTGe44Q== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-flow" "^7.2.0" - "@babel/plugin-transform-flow-strip-types@^7.9.0": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.9.0.tgz#8a3538aa40434e000b8f44a3c5c9ac7229bd2392" @@ -1172,7 +1091,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-for-of@^7.4.4", "@babel/plugin-transform-for-of@^7.9.0": +"@babel/plugin-transform-for-of@^7.9.0": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.9.0.tgz#0f260e27d3e29cd1bb3128da5e76c761aa6c108e" integrity sha512-lTAnWOpMwOXpyDx06N+ywmF3jNbafZEqZ96CGYabxHrxNX8l5ny7dt4bK/rGwAh9utyP2b2Hv7PlZh1AAS54FQ== @@ -1187,7 +1106,7 @@ "@babel/helper-function-name" "^7.10.1" "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-function-name@^7.4.4", "@babel/plugin-transform-function-name@^7.8.3": +"@babel/plugin-transform-function-name@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.8.3.tgz#279373cb27322aaad67c2683e776dfc47196ed8b" integrity sha512-rO/OnDS78Eifbjn5Py9v8y0aR+aSYhDhqAwVfsTl0ERuMZyr05L1aFSCJnbv2mmsLkit/4ReeQ9N2BgLnOcPCQ== @@ -1202,7 +1121,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-literals@^7.2.0", "@babel/plugin-transform-literals@^7.8.3": +"@babel/plugin-transform-literals@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.8.3.tgz#aef239823d91994ec7b68e55193525d76dbd5dc1" integrity sha512-3Tqf8JJ/qB7TeldGl+TT55+uQei9JfYaregDcEAyBZ7akutriFrt6C/wLYIer6OYhleVQvH/ntEhjE/xMmy10A== @@ -1216,7 +1135,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-member-expression-literals@^7.2.0", "@babel/plugin-transform-member-expression-literals@^7.8.3": +"@babel/plugin-transform-member-expression-literals@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.8.3.tgz#963fed4b620ac7cbf6029c755424029fa3a40410" integrity sha512-3Wk2EXhnw+rP+IDkK6BdtPKsUE5IeZ6QOGrPYvw52NwBStw9V1ZVzxgK6fSKSxqUvH9eQPR3tm3cOq79HlsKYA== @@ -1232,7 +1151,7 @@ "@babel/helper-plugin-utils" "^7.10.1" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-amd@^7.5.0", "@babel/plugin-transform-modules-amd@^7.9.0": +"@babel/plugin-transform-modules-amd@^7.9.0": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.9.0.tgz#19755ee721912cf5bb04c07d50280af3484efef4" integrity sha512-vZgDDF003B14O8zJy0XXLnPH4sg+9X5hFBBGN1V+B2rgrB+J2xIypSN6Rk9imB2hSTHQi5OHLrFWsZab1GMk+Q== @@ -1251,7 +1170,7 @@ "@babel/helper-simple-access" "^7.10.1" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-commonjs@^7.5.0", "@babel/plugin-transform-modules-commonjs@^7.9.0": +"@babel/plugin-transform-modules-commonjs@^7.9.0": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.9.0.tgz#e3e72f4cbc9b4a260e30be0ea59bdf5a39748940" integrity sha512-qzlCrLnKqio4SlgJ6FMMLBe4bySNis8DFn1VkGmOcxG9gqEyPIOzeQrA//u0HAKrWpJlpZbZMPB1n/OPa4+n8g== @@ -1271,7 +1190,7 @@ "@babel/helper-plugin-utils" "^7.10.1" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-systemjs@^7.5.0", "@babel/plugin-transform-modules-systemjs@^7.9.0": +"@babel/plugin-transform-modules-systemjs@^7.9.0": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.9.0.tgz#e9fd46a296fc91e009b64e07ddaa86d6f0edeb90" integrity sha512-FsiAv/nao/ud2ZWy4wFacoLOm5uxl0ExSQ7ErvP7jpoihLR6Cq90ilOFyX9UXct3rbtKsAiZ9kFt5XGfPe/5SQ== @@ -1289,7 +1208,7 @@ "@babel/helper-module-transforms" "^7.10.1" "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-modules-umd@^7.2.0", "@babel/plugin-transform-modules-umd@^7.9.0": +"@babel/plugin-transform-modules-umd@^7.9.0": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.9.0.tgz#e909acae276fec280f9b821a5f38e1f08b480697" integrity sha512-uTWkXkIVtg/JGRSIABdBoMsoIeoHQHPTL0Y2E7xf5Oj7sLqwVsNXOkNk0VJc7vF0IMBsPeikHxFjGe+qmwPtTQ== @@ -1297,7 +1216,7 @@ "@babel/helper-module-transforms" "^7.9.0" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-named-capturing-groups-regex@^7.4.5", "@babel/plugin-transform-named-capturing-groups-regex@^7.8.3": +"@babel/plugin-transform-named-capturing-groups-regex@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.8.3.tgz#a2a72bffa202ac0e2d0506afd0939c5ecbc48c6c" integrity sha512-f+tF/8UVPU86TrCb06JoPWIdDpTNSGGcAtaD9mLP0aYGA0OS0j7j7DHJR0GTFrUZPUU6loZhbsVZgTh0N+Qdnw== @@ -1311,7 +1230,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-new-target@^7.4.4", "@babel/plugin-transform-new-target@^7.8.3": +"@babel/plugin-transform-new-target@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.8.3.tgz#60cc2ae66d85c95ab540eb34babb6434d4c70c43" integrity sha512-QuSGysibQpyxexRyui2vca+Cmbljo8bcRckgzYV4kRIsHpVeyeC3JDO63pY+xFZ6bWOBn7pfKZTqV4o/ix9sFw== @@ -1326,7 +1245,7 @@ "@babel/helper-plugin-utils" "^7.10.1" "@babel/helper-replace-supers" "^7.10.1" -"@babel/plugin-transform-object-super@^7.5.5", "@babel/plugin-transform-object-super@^7.8.3": +"@babel/plugin-transform-object-super@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.8.3.tgz#ebb6a1e7a86ffa96858bd6ac0102d65944261725" integrity sha512-57FXk+gItG/GejofIyLIgBKTas4+pEU47IXKDBWFTxdPd7F80H8zybyAY7UoblVfBhBGs2EKM+bJUu2+iUYPDQ== @@ -1342,7 +1261,7 @@ "@babel/helper-get-function-arity" "^7.10.1" "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-parameters@^7.4.4", "@babel/plugin-transform-parameters@^7.8.7": +"@babel/plugin-transform-parameters@^7.8.7": version "7.9.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.9.3.tgz#3028d0cc20ddc733166c6e9c8534559cee09f54a" integrity sha512-fzrQFQhp7mIhOzmOtPiKffvCYQSK10NR8t6BBz2yPbeUHb9OLW8RZGtgDRBn8z2hGcwvKDL3vC7ojPTLNxmqEg== @@ -1357,7 +1276,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-property-literals@^7.2.0", "@babel/plugin-transform-property-literals@^7.8.3": +"@babel/plugin-transform-property-literals@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.8.3.tgz#33194300d8539c1ed28c62ad5087ba3807b98263" integrity sha512-uGiiXAZMqEoQhRWMK17VospMZh5sXWg+dlh2soffpkAl96KAm+WZuJfa6lcELotSRmooLqg0MWdH6UUq85nmmg== @@ -1371,27 +1290,20 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-react-display-name@7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.2.0.tgz#ebfaed87834ce8dc4279609a4f0c324c156e3eb0" - integrity sha512-Htf/tPa5haZvRMiNSQSFifK12gtr/8vwfr+A9y69uF0QcU77AVu4K7MiHEkTxF7lQoHOL0F9ErqgfNEAKgXj7A== +"@babel/plugin-transform-react-display-name@^7.10.1": + version "7.10.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.10.1.tgz#e6a33f6d48dfb213dda5e007d0c7ff82b6a3d8ef" + integrity sha512-rBjKcVwjk26H3VX8pavMxGf33LNlbocMHdSeldIEswtQ/hrjyTG8fKKILW1cSkODyRovckN/uZlGb2+sAV9JUQ== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-react-display-name@^7.0.0", "@babel/plugin-transform-react-display-name@^7.8.3": +"@babel/plugin-transform-react-display-name@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.8.3.tgz#70ded987c91609f78353dd76d2fb2a0bb991e8e5" integrity sha512-3Jy/PCw8Fe6uBKtEgz3M82ljt+lTg+xJaM4og+eyu83qLT87ZUSckn0wy7r31jflURWLO83TW6Ylf7lyXj3m5A== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-react-display-name@^7.10.1": - version "7.10.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.10.1.tgz#e6a33f6d48dfb213dda5e007d0c7ff82b6a3d8ef" - integrity sha512-rBjKcVwjk26H3VX8pavMxGf33LNlbocMHdSeldIEswtQ/hrjyTG8fKKILW1cSkODyRovckN/uZlGb2+sAV9JUQ== - dependencies: - "@babel/helper-plugin-utils" "^7.10.1" - "@babel/plugin-transform-react-jsx-development@^7.10.1": version "7.10.1" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.10.1.tgz#1ac6300d8b28ef381ee48e6fec430cc38047b7f3" @@ -1410,14 +1322,6 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-jsx" "^7.8.3" -"@babel/plugin-transform-react-jsx-self@^7.0.0", "@babel/plugin-transform-react-jsx-self@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.9.0.tgz#f4f26a325820205239bb915bad8e06fcadabb49b" - integrity sha512-K2ObbWPKT7KUTAoyjCsFilOkEgMvFG+y0FqOl6Lezd0/13kMkkjHskVsZvblRPj1PHA44PrToaZANrryppzTvQ== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/plugin-syntax-jsx" "^7.8.3" - "@babel/plugin-transform-react-jsx-self@^7.10.1": version "7.10.1" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.10.1.tgz#22143e14388d72eb88649606bb9e46f421bc3821" @@ -1426,10 +1330,10 @@ "@babel/helper-plugin-utils" "^7.10.1" "@babel/plugin-syntax-jsx" "^7.10.1" -"@babel/plugin-transform-react-jsx-source@^7.0.0", "@babel/plugin-transform-react-jsx-source@^7.9.0": +"@babel/plugin-transform-react-jsx-self@^7.9.0": version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.9.0.tgz#89ef93025240dd5d17d3122294a093e5e0183de0" - integrity sha512-K6m3LlSnTSfRkM6FcRk8saNEeaeyG5k7AVkBU2bZK3+1zdkSED3qNdsWrUgQBeTVD2Tp3VMmerxVO2yM5iITmw== + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.9.0.tgz#f4f26a325820205239bb915bad8e06fcadabb49b" + integrity sha512-K2ObbWPKT7KUTAoyjCsFilOkEgMvFG+y0FqOl6Lezd0/13kMkkjHskVsZvblRPj1PHA44PrToaZANrryppzTvQ== dependencies: "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-jsx" "^7.8.3" @@ -1442,13 +1346,11 @@ "@babel/helper-plugin-utils" "^7.10.1" "@babel/plugin-syntax-jsx" "^7.10.1" -"@babel/plugin-transform-react-jsx@^7.0.0", "@babel/plugin-transform-react-jsx@^7.9.4": - version "7.9.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.9.4.tgz#86f576c8540bd06d0e95e0b61ea76d55f6cbd03f" - integrity sha512-Mjqf3pZBNLt854CK0C/kRuXAnE6H/bo7xYojP+WGtX8glDGSibcwnsWwhwoSuRg0+EBnxPC1ouVnuetUIlPSAw== +"@babel/plugin-transform-react-jsx-source@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.9.0.tgz#89ef93025240dd5d17d3122294a093e5e0183de0" + integrity sha512-K6m3LlSnTSfRkM6FcRk8saNEeaeyG5k7AVkBU2bZK3+1zdkSED3qNdsWrUgQBeTVD2Tp3VMmerxVO2yM5iITmw== dependencies: - "@babel/helper-builder-react-jsx" "^7.9.0" - "@babel/helper-builder-react-jsx-experimental" "^7.9.0" "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-jsx" "^7.8.3" @@ -1462,6 +1364,16 @@ "@babel/helper-plugin-utils" "^7.10.1" "@babel/plugin-syntax-jsx" "^7.10.1" +"@babel/plugin-transform-react-jsx@^7.9.4": + version "7.9.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.9.4.tgz#86f576c8540bd06d0e95e0b61ea76d55f6cbd03f" + integrity sha512-Mjqf3pZBNLt854CK0C/kRuXAnE6H/bo7xYojP+WGtX8glDGSibcwnsWwhwoSuRg0+EBnxPC1ouVnuetUIlPSAw== + dependencies: + "@babel/helper-builder-react-jsx" "^7.9.0" + "@babel/helper-builder-react-jsx-experimental" "^7.9.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-jsx" "^7.8.3" + "@babel/plugin-transform-react-pure-annotations@^7.10.1": version "7.10.1" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.10.1.tgz#f5e7c755d3e7614d4c926e144f501648a5277b70" @@ -1477,7 +1389,7 @@ dependencies: regenerator-transform "^0.14.2" -"@babel/plugin-transform-regenerator@^7.4.5", "@babel/plugin-transform-regenerator@^7.8.7": +"@babel/plugin-transform-regenerator@^7.8.7": version "7.8.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.8.7.tgz#5e46a0dca2bee1ad8285eb0527e6abc9c37672f8" integrity sha512-TIg+gAl4Z0a3WmD3mbYSk+J9ZUH6n/Yc57rtKRnlA/7rcCvpekHXe0CMZHP1gYp7/KLe9GHTuIba0vXmls6drA== @@ -1491,23 +1403,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-reserved-words@^7.2.0", "@babel/plugin-transform-reserved-words@^7.8.3": +"@babel/plugin-transform-reserved-words@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.8.3.tgz#9a0635ac4e665d29b162837dd3cc50745dfdf1f5" integrity sha512-mwMxcycN3omKFDjDQUl+8zyMsBfjRFr0Zn/64I41pmjv4NJuqcYlEtezwYtw9TFd9WR1vN5kiM+O0gMZzO6L0A== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-runtime@7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.5.5.tgz#a6331afbfc59189d2135b2e09474457a8e3d28bc" - integrity sha512-6Xmeidsun5rkwnGfMOp6/z9nSzWpHFNVr2Jx7kwoq4mVatQfQx5S56drBgEHF+XQbKOdIaOiMIINvp/kAwMN+w== - dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - resolve "^1.8.1" - semver "^5.5.1" - "@babel/plugin-transform-runtime@^7.10.1": version "7.10.1" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.10.1.tgz#fd1887f749637fb2ed86dc278e79eb41df37f4b1" @@ -1525,7 +1427,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-shorthand-properties@^7.2.0", "@babel/plugin-transform-shorthand-properties@^7.8.3": +"@babel/plugin-transform-shorthand-properties@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.8.3.tgz#28545216e023a832d4d3a1185ed492bcfeac08c8" integrity sha512-I9DI6Odg0JJwxCHzbzW08ggMdCezoWcuQRz3ptdudgwaHxTjxw5HgdFJmZIkIMlRymL6YiZcped4TTCB0JcC8w== @@ -1539,7 +1441,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-spread@^7.2.0", "@babel/plugin-transform-spread@^7.8.3": +"@babel/plugin-transform-spread@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.8.3.tgz#9c8ffe8170fdfb88b114ecb920b82fb6e95fe5e8" integrity sha512-CkuTU9mbmAoFOI1tklFWYYbzX5qCIZVXPVy0jpXgGwkplCndQAa58s2jr66fTeQnA64bDox0HL4U56CFYoyC7g== @@ -1554,7 +1456,7 @@ "@babel/helper-plugin-utils" "^7.10.1" "@babel/helper-regex" "^7.10.1" -"@babel/plugin-transform-sticky-regex@^7.2.0", "@babel/plugin-transform-sticky-regex@^7.8.3": +"@babel/plugin-transform-sticky-regex@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.8.3.tgz#be7a1290f81dae767475452199e1f76d6175b100" integrity sha512-9Spq0vGCD5Bb4Z/ZXXSK5wbbLFMG085qd2vhL1JYu1WcQ5bXqZBAYRzU1d+p79GcHs2szYv5pVQCX13QgldaWw== @@ -1570,7 +1472,7 @@ "@babel/helper-annotate-as-pure" "^7.10.1" "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-template-literals@^7.4.4", "@babel/plugin-transform-template-literals@^7.8.3": +"@babel/plugin-transform-template-literals@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.8.3.tgz#7bfa4732b455ea6a43130adc0ba767ec0e402a80" integrity sha512-820QBtykIQOLFT8NZOcTRJ1UNuztIELe4p9DCgvj4NK+PwluSJ49we7s9FB1HIGNIYT7wFUJ0ar2QpCDj0escQ== @@ -1585,7 +1487,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-typeof-symbol@^7.2.0", "@babel/plugin-transform-typeof-symbol@^7.8.4": +"@babel/plugin-transform-typeof-symbol@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.8.4.tgz#ede4062315ce0aaf8a657a920858f1a2f35fc412" integrity sha512-2QKyfjGdvuNfHsb7qnBBlKclbD4CfshH2KvDabiijLMGXPHJXGxtDzwIF7bQP+T0ysw8fYTtxPafgfs/c1Lrqg== @@ -1601,15 +1503,6 @@ "@babel/helper-plugin-utils" "^7.10.1" "@babel/plugin-syntax-typescript" "^7.10.1" -"@babel/plugin-transform-typescript@^7.3.2": - version "7.9.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.9.4.tgz#4bb4dde4f10bbf2d787fce9707fb09b483e33359" - integrity sha512-yeWeUkKx2auDbSxRe8MusAG+n4m9BFY/v+lPjmQDgOFX5qnySkUY5oXzkp6FwPdsYqnKay6lorXYdC0n3bZO7w== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/plugin-syntax-typescript" "^7.8.3" - "@babel/plugin-transform-unicode-escapes@^7.10.1": version "7.10.1" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.10.1.tgz#add0f8483dab60570d9e03cecef6c023aa8c9940" @@ -1625,7 +1518,7 @@ "@babel/helper-create-regexp-features-plugin" "^7.10.1" "@babel/helper-plugin-utils" "^7.10.1" -"@babel/plugin-transform-unicode-regex@^7.4.4", "@babel/plugin-transform-unicode-regex@^7.8.3": +"@babel/plugin-transform-unicode-regex@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.8.3.tgz#0cef36e3ba73e5c57273effb182f46b91a1ecaad" integrity sha512-+ufgJjYdmWfSQ+6NS9VGUR2ns8cjJjYbrbi11mZBTaWm+Fui/ncTLFF28Ei1okavY+xkojGr1eJxNsWYeA5aZw== @@ -1633,63 +1526,7 @@ "@babel/helper-create-regexp-features-plugin" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/preset-env@7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.5.5.tgz#bc470b53acaa48df4b8db24a570d6da1fef53c9a" - integrity sha512-GMZQka/+INwsMz1A5UEql8tG015h5j/qjptpKY2gJ7giy8ohzU710YciJB5rcKsWGWHiW3RUnHib0E5/m3Tp3A== - dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions" "^7.2.0" - "@babel/plugin-proposal-dynamic-import" "^7.5.0" - "@babel/plugin-proposal-json-strings" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread" "^7.5.5" - "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" - "@babel/plugin-syntax-async-generators" "^7.2.0" - "@babel/plugin-syntax-dynamic-import" "^7.2.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" - "@babel/plugin-transform-arrow-functions" "^7.2.0" - "@babel/plugin-transform-async-to-generator" "^7.5.0" - "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.5.5" - "@babel/plugin-transform-classes" "^7.5.5" - "@babel/plugin-transform-computed-properties" "^7.2.0" - "@babel/plugin-transform-destructuring" "^7.5.0" - "@babel/plugin-transform-dotall-regex" "^7.4.4" - "@babel/plugin-transform-duplicate-keys" "^7.5.0" - "@babel/plugin-transform-exponentiation-operator" "^7.2.0" - "@babel/plugin-transform-for-of" "^7.4.4" - "@babel/plugin-transform-function-name" "^7.4.4" - "@babel/plugin-transform-literals" "^7.2.0" - "@babel/plugin-transform-member-expression-literals" "^7.2.0" - "@babel/plugin-transform-modules-amd" "^7.5.0" - "@babel/plugin-transform-modules-commonjs" "^7.5.0" - "@babel/plugin-transform-modules-systemjs" "^7.5.0" - "@babel/plugin-transform-modules-umd" "^7.2.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.5" - "@babel/plugin-transform-new-target" "^7.4.4" - "@babel/plugin-transform-object-super" "^7.5.5" - "@babel/plugin-transform-parameters" "^7.4.4" - "@babel/plugin-transform-property-literals" "^7.2.0" - "@babel/plugin-transform-regenerator" "^7.4.5" - "@babel/plugin-transform-reserved-words" "^7.2.0" - "@babel/plugin-transform-shorthand-properties" "^7.2.0" - "@babel/plugin-transform-spread" "^7.2.0" - "@babel/plugin-transform-sticky-regex" "^7.2.0" - "@babel/plugin-transform-template-literals" "^7.4.4" - "@babel/plugin-transform-typeof-symbol" "^7.2.0" - "@babel/plugin-transform-unicode-regex" "^7.4.4" - "@babel/types" "^7.5.5" - browserslist "^4.6.0" - core-js-compat "^3.1.1" - invariant "^2.2.2" - js-levenshtein "^1.1.3" - semver "^5.5.0" - -"@babel/preset-env@^7.0.0", "@babel/preset-env@^7.4.3", "@babel/preset-env@^7.4.5", "@babel/preset-env@^7.7.1": +"@babel/preset-env@^7.0.0", "@babel/preset-env@^7.4.3", "@babel/preset-env@^7.4.5": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.9.0.tgz#a5fc42480e950ae8f5d9f8f2bbc03f52722df3a8" integrity sha512-712DeRXT6dyKAM/FMbQTV/FvRCms2hPCx+3weRjZ8iQVQWZejWWk1wwG6ViWMyqb/ouBbGOl5b6aCk0+j1NmsQ== @@ -1844,18 +1681,7 @@ "@babel/types" "^7.4.4" esutils "^2.0.2" -"@babel/preset-react@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.0.0.tgz#e86b4b3d99433c7b3e9e91747e2653958bc6b3c0" - integrity sha512-oayxyPS4Zj+hF6Et11BwuBkmpgT/zMxyuZgFrMeZID6Hdh3dGlk4sHCAhdBCpuCKW2ppBfl2uCCetlrUIJRY3w== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-react-display-name" "^7.0.0" - "@babel/plugin-transform-react-jsx" "^7.0.0" - "@babel/plugin-transform-react-jsx-self" "^7.0.0" - "@babel/plugin-transform-react-jsx-source" "^7.0.0" - -"@babel/preset-react@^7.0.0", "@babel/preset-react@^7.7.0": +"@babel/preset-react@^7.0.0": version "7.9.4" resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.9.4.tgz#c6c97693ac65b6b9c0b4f25b948a8f665463014d" integrity sha512-AxylVB3FXeOTQXNXyiuAQJSvss62FEotbX2Pzx3K/7c+MKJMdSg6Ose6QYllkdCFA8EInCJVw7M/o5QbLuA4ZQ== @@ -1880,14 +1706,6 @@ "@babel/plugin-transform-react-jsx-source" "^7.10.1" "@babel/plugin-transform-react-pure-annotations" "^7.10.1" -"@babel/preset-typescript@7.3.3": - version "7.3.3" - resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.3.3.tgz#88669911053fa16b2b276ea2ede2ca603b3f307a" - integrity sha512-mzMVuIP4lqtn4du2ynEfdO0+RYcslwrZiJHXu4MGaC1ctJiW2fyaeDrtjJGs7R/KebZ1sgowcIoWf4uRpEfKEg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-typescript" "^7.3.2" - "@babel/preset-typescript@^7.10.1": version "7.10.1" resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.10.1.tgz#a8d8d9035f55b7d99a2461a0bdc506582914d07e" @@ -1922,14 +1740,7 @@ dependencies: regenerator-runtime "^0.12.0" -"@babel/runtime@7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132" - integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ== - dependencies: - regenerator-runtime "^0.13.2" - -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.0", "@babel/runtime@^7.6.2", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.4", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.0", "@babel/runtime@^7.6.2", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": version "7.9.2" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.9.2.tgz#d90df0583a3a252f09aaa619665367bae518db06" integrity sha512-NE2DtOdufG7R5vnfQUTehdTfNycfUANEtCa9PssN9O/xmTzP4E08UI797ixaei6hBEVL9BI/PsdJS5x7mWoB9Q== @@ -1943,7 +1754,19 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/template@^7.0.0", "@babel/template@^7.3.3", "@babel/template@^7.4.4", "@babel/template@^7.7.4", "@babel/template@^7.8.3", "@babel/template@^7.8.6": +"@babel/runtime@^7.3.1", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.7": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.10.5.tgz#303d8bd440ecd5a491eae6117fd3367698674c5c" + integrity sha512-otddXKhdNn7d0ptoFRHtMLa8LqDxLYwTjB4nYgM1yy5N6gU/MUf8zqyyLltCH3yAVitBzmwK4us+DD0l/MauAg== + dependencies: + regenerator-runtime "^0.13.4" + +"@babel/standalone@^7.4.5": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/standalone/-/standalone-7.10.5.tgz#4ee38dc79fda10a2a0da0897f09e270310151314" + integrity sha512-PERGHqhQ7H3TrdglvSW4pEHULywMJEdytnzaR0VPF1HN45aS+3FcE62efb90XPKS9TlgrEUkYDvYMt+0m6G0YA== + +"@babel/template@^7.0.0", "@babel/template@^7.3.3", "@babel/template@^7.7.4", "@babel/template@^7.8.3", "@babel/template@^7.8.6": version "7.8.6" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.6.tgz#86b22af15f828dfb086474f964dcc3e39c43ce2b" integrity sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg== @@ -1961,7 +1784,7 @@ "@babel/parser" "^7.10.1" "@babel/types" "^7.10.1" -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.1.6", "@babel/traverse@^7.4.5", "@babel/traverse@^7.5.5", "@babel/traverse@^7.8.3", "@babel/traverse@^7.8.6", "@babel/traverse@^7.9.0": +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.1.6", "@babel/traverse@^7.4.5", "@babel/traverse@^7.8.3", "@babel/traverse@^7.8.6", "@babel/traverse@^7.9.0": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.9.0.tgz#d3882c2830e513f4fe4cec9fe76ea1cc78747892" integrity sha512-jAZQj0+kn4WTHO5dUZkZKhbFrqZE7K5LAQ5JysMnmvGij+wOdr+8lWqPeW0BcF4wFwrEXXtdGO7wcV6YPJcf3w== @@ -2006,7 +1829,7 @@ globals "^11.1.0" lodash "^4.17.13" -"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0": +"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.9.0.tgz#00b064c3df83ad32b2dbf5ff07312b15c7f1efb5" integrity sha512-BS9JKfXkzzJl8RluW4JGknzpiUV7ZrvTayM6yfqLTVBEnFtyowVIOu6rqxRd5cVO6yGoWf4T8u8dgK9oB+GCng== @@ -2345,7 +2168,29 @@ "@emotion/utils" "0.11.2" "@emotion/weak-memoize" "0.2.4" -"@emotion/core@^10.0.14", "@emotion/core@^10.0.9": +"@emotion/cache@^10.0.27": + version "10.0.29" + resolved "https://registry.yarnpkg.com/@emotion/cache/-/cache-10.0.29.tgz#87e7e64f412c060102d589fe7c6dc042e6f9d1e0" + integrity sha512-fU2VtSVlHiF27empSbxi1O2JFdNWZO+2NFHfwO0pxgTep6Xa3uGb+3pVKfLww2l/IBGLNEZl5Xf/++A4wAYDYQ== + dependencies: + "@emotion/sheet" "0.9.4" + "@emotion/stylis" "0.8.5" + "@emotion/utils" "0.11.3" + "@emotion/weak-memoize" "0.2.5" + +"@emotion/core@^10.0.20": + version "10.0.28" + resolved "https://registry.yarnpkg.com/@emotion/core/-/core-10.0.28.tgz#bb65af7262a234593a9e952c041d0f1c9b9bef3d" + integrity sha512-pH8UueKYO5jgg0Iq+AmCLxBsvuGtvlmiDCOuv8fGNYn3cowFpLN98L8zO56U0H1PjDIyAlXymgL3Wu7u7v6hbA== + dependencies: + "@babel/runtime" "^7.5.5" + "@emotion/cache" "^10.0.27" + "@emotion/css" "^10.0.27" + "@emotion/serialize" "^0.11.15" + "@emotion/sheet" "0.9.4" + "@emotion/utils" "0.11.3" + +"@emotion/core@^10.0.9": version "10.0.22" resolved "https://registry.yarnpkg.com/@emotion/core/-/core-10.0.22.tgz#2ac7bcf9b99a1979ab5b0a876fbf37ab0688b177" integrity sha512-7eoP6KQVUyOjAkE6y4fdlxbZRA4ILs7dqkkm6oZUJmihtHv0UBq98VgPirq9T8F9K2gKu0J/au/TpKryKMinaA== @@ -2366,35 +2211,32 @@ "@emotion/utils" "0.11.2" babel-plugin-emotion "^10.0.22" -"@emotion/hash@0.7.2": - version "0.7.2" - resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.7.2.tgz#53211e564604beb9befa7a4400ebf8147473eeef" - integrity sha512-RMtr1i6E8MXaBWwhXL3yeOU8JXRnz8GNxHvaUfVvwxokvayUY0zoBeWbKw1S9XkufmGEEdQd228pSZXFkAln8Q== +"@emotion/css@^10.0.27": + version "10.0.27" + resolved "https://registry.yarnpkg.com/@emotion/css/-/css-10.0.27.tgz#3a7458198fbbebb53b01b2b87f64e5e21241e14c" + integrity sha512-6wZjsvYeBhyZQYNrGoR5yPMYbMBNEnanDrqmsqS1mzDm1cOTu12shvl2j4QHNS36UaTE0USIJawCH9C8oW34Zw== + dependencies: + "@emotion/serialize" "^0.11.15" + "@emotion/utils" "0.11.3" + babel-plugin-emotion "^10.0.27" "@emotion/hash@0.7.3": version "0.7.3" resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.7.3.tgz#a166882c81c0c6040975dd30df24fae8549bd96f" integrity sha512-14ZVlsB9akwvydAdaEnVnvqu6J2P6ySv39hYyl/aoB6w/V+bXX0tay8cF6paqbgZsN2n5Xh15uF4pE+GvE+itw== -"@emotion/is-prop-valid@0.8.5": - version "0.8.5" - resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.8.5.tgz#2dda0791f0eafa12b7a0a5b39858405cc7bde983" - integrity sha512-6ZODuZSFofbxSbcxwsFz+6ioPjb0ISJRRPLZ+WIbjcU2IMU0Io+RGQjjaTgOvNQl007KICBm7zXQaYQEC1r6Bg== - dependencies: - "@emotion/memoize" "0.7.3" +"@emotion/hash@0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.8.0.tgz#bbbff68978fefdbe68ccb533bc8cbe1d1afb5413" + integrity sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow== -"@emotion/is-prop-valid@^0.8.8": +"@emotion/is-prop-valid@0.8.8", "@emotion/is-prop-valid@^0.8.8": version "0.8.8" resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz#db28b1c4368a259b60a97311d6a952d4fd01ac1a" integrity sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA== dependencies: "@emotion/memoize" "0.7.4" -"@emotion/memoize@0.7.2": - version "0.7.2" - resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.2.tgz#7f4c71b7654068dfcccad29553520f984cc66b30" - integrity sha512-hnHhwQzvPCW1QjBWFyBtsETdllOM92BfrKWbUTmh9aeOlcVOiXvlPsK4104xH8NsaKfg86PTFsWkueQeUfMA/w== - "@emotion/memoize@0.7.3": version "0.7.3" resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.3.tgz#5b6b1c11d6a6dddf1f2fc996f74cf3b219644d78" @@ -2405,7 +2247,7 @@ resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.4.tgz#19bf0f5af19149111c40d98bb0cf82119f5d9eeb" integrity sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw== -"@emotion/serialize@^0.11.12", "@emotion/serialize@^0.11.14", "@emotion/serialize@^0.11.9": +"@emotion/serialize@^0.11.12", "@emotion/serialize@^0.11.14": version "0.11.14" resolved "https://registry.yarnpkg.com/@emotion/serialize/-/serialize-0.11.14.tgz#56a6d8d04d837cc5b0126788b2134c51353c6488" integrity sha512-6hTsySIuQTbDbv00AnUO6O6Xafdwo5GswRlMZ5hHqiFx+4pZ7uGWXUQFW46Kc2taGhP89uXMXn/lWQkdyTosPA== @@ -2416,49 +2258,85 @@ "@emotion/utils" "0.11.2" csstype "^2.5.7" +"@emotion/serialize@^0.11.15", "@emotion/serialize@^0.11.16": + version "0.11.16" + resolved "https://registry.yarnpkg.com/@emotion/serialize/-/serialize-0.11.16.tgz#dee05f9e96ad2fb25a5206b6d759b2d1ed3379ad" + integrity sha512-G3J4o8by0VRrO+PFeSc3js2myYNOXVJ3Ya+RGVxnshRYgsvErfAOglKAiy1Eo1vhzxqtUvjCyS5gtewzkmvSSg== + dependencies: + "@emotion/hash" "0.8.0" + "@emotion/memoize" "0.7.4" + "@emotion/unitless" "0.7.5" + "@emotion/utils" "0.11.3" + csstype "^2.5.7" + "@emotion/sheet@0.9.3": version "0.9.3" resolved "https://registry.yarnpkg.com/@emotion/sheet/-/sheet-0.9.3.tgz#689f135ecf87d3c650ed0c4f5ddcbe579883564a" integrity sha512-c3Q6V7Df7jfwSq5AzQWbXHa5soeE4F5cbqi40xn0CzXxWW9/6Mxq48WJEtqfWzbZtW9odZdnRAkwCQwN12ob4A== -"@emotion/styled-base@^10.0.23": - version "10.0.24" - resolved "https://registry.yarnpkg.com/@emotion/styled-base/-/styled-base-10.0.24.tgz#9497efd8902dfeddee89d24b0eeb26b0665bfe8b" - integrity sha512-AnBImerf0h4dGAJVo0p0VE8KoAns71F28ErGFK474zbNAHX6yqSWQUasb+1jvg/VPwZjCp19+tAr6oOB0pwmLQ== +"@emotion/sheet@0.9.4": + version "0.9.4" + resolved "https://registry.yarnpkg.com/@emotion/sheet/-/sheet-0.9.4.tgz#894374bea39ec30f489bbfc3438192b9774d32e5" + integrity sha512-zM9PFmgVSqBw4zL101Q0HrBVTGmpAxFZH/pYx/cjJT5advXguvcgjHFTCaIO3enL/xr89vK2bh0Mfyj9aa0ANA== + +"@emotion/styled-base@^10.0.27": + version "10.0.31" + resolved "https://registry.yarnpkg.com/@emotion/styled-base/-/styled-base-10.0.31.tgz#940957ee0aa15c6974adc7d494ff19765a2f742a" + integrity sha512-wTOE1NcXmqMWlyrtwdkqg87Mu6Rj1MaukEoEmEkHirO5IoHDJ8LgCQL4MjJODgxWxXibGR3opGp1p7YvkNEdXQ== dependencies: "@babel/runtime" "^7.5.5" - "@emotion/is-prop-valid" "0.8.5" - "@emotion/serialize" "^0.11.14" - "@emotion/utils" "0.11.2" + "@emotion/is-prop-valid" "0.8.8" + "@emotion/serialize" "^0.11.15" + "@emotion/utils" "0.11.3" -"@emotion/styled@^10.0.14": - version "10.0.23" - resolved "https://registry.yarnpkg.com/@emotion/styled/-/styled-10.0.23.tgz#2f8279bd59b99d82deade76d1046249ddfab7c1b" - integrity sha512-gNr04eqBQ2iYUx8wFLZDfm3N8/QUOODu/ReDXa693uyQGy2OqA+IhPJk+kA7id8aOfwAsMuvZ0pJImEXXKtaVQ== +"@emotion/styled@^10.0.17": + version "10.0.27" + resolved "https://registry.yarnpkg.com/@emotion/styled/-/styled-10.0.27.tgz#12cb67e91f7ad7431e1875b1d83a94b814133eaf" + integrity sha512-iK/8Sh7+NLJzyp9a5+vIQIXTYxfT4yB/OJbjzQanB2RZpvmzBQOHZWhpAMZWYEKRNNbsD6WfBw5sVWkb6WzS/Q== dependencies: - "@emotion/styled-base" "^10.0.23" - babel-plugin-emotion "^10.0.23" + "@emotion/styled-base" "^10.0.27" + babel-plugin-emotion "^10.0.27" "@emotion/stylis@0.8.4", "@emotion/stylis@^0.8.4": version "0.8.4" resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.8.4.tgz#6c51afdf1dd0d73666ba09d2eb6c25c220d6fe4c" integrity sha512-TLmkCVm8f8gH0oLv+HWKiu7e8xmBIaokhxcEKPh1m8pXiV/akCiq50FvYgOwY42rjejck8nsdQxZlXZ7pmyBUQ== +"@emotion/stylis@0.8.5": + version "0.8.5" + resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.8.5.tgz#deacb389bd6ee77d1e7fcaccce9e16c5c7e78e04" + integrity sha512-h6KtPihKFn3T9fuIrwvXXUOwlx3rfUvfZIcP5a6rh8Y7zjE3O06hT5Ss4S/YI1AYhuZ1kjaE/5EaOOI2NqSylQ== + "@emotion/unitless@0.7.4", "@emotion/unitless@^0.7.4": version "0.7.4" resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.4.tgz#a87b4b04e5ae14a88d48ebef15015f6b7d1f5677" integrity sha512-kBa+cDHOR9jpRJ+kcGMsysrls0leukrm68DmFQoMIWQcXdr2cZvyvypWuGYT7U+9kAExUE7+T7r6G3C3A6L8MQ== +"@emotion/unitless@0.7.5": + version "0.7.5" + resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed" + integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg== + "@emotion/utils@0.11.2": version "0.11.2" resolved "https://registry.yarnpkg.com/@emotion/utils/-/utils-0.11.2.tgz#713056bfdffb396b0a14f1c8f18e7b4d0d200183" integrity sha512-UHX2XklLl3sIaP6oiMmlVzT0J+2ATTVpf0dHQVyPJHTkOITvXfaSqnRk6mdDhV9pR8T/tHc3cex78IKXssmzrA== +"@emotion/utils@0.11.3": + version "0.11.3" + resolved "https://registry.yarnpkg.com/@emotion/utils/-/utils-0.11.3.tgz#a759863867befa7e583400d322652a3f44820924" + integrity sha512-0o4l6pZC+hI88+bzuaX/6BgOvQVhbt2PfmxauVaYOGgbsAw14wdKyvMCZXnsnsHys94iadcF+RG/wZyx6+ZZBw== + "@emotion/weak-memoize@0.2.4": version "0.2.4" resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.4.tgz#622a72bebd1e3f48d921563b4b60a762295a81fc" integrity sha512-6PYY5DVdAY1ifaQW6XYTnOMihmBVT27elqSjEoodchsGjzYlEsTQMcEhSud99kVawatyTZRTiVkJ/c6lwbQ7nA== +"@emotion/weak-memoize@0.2.5": + version "0.2.5" + resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz#8eed982e2ee6f7f4e44c253e12962980791efd46" + integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA== + "@gulp-sourcemaps/identity-map@1.X": version "1.0.2" resolved "https://registry.yarnpkg.com/@gulp-sourcemaps/identity-map/-/identity-map-1.0.2.tgz#1e6fe5d8027b1f285dc0d31762f566bccd73d5a9" @@ -2767,26 +2645,24 @@ "@types/yargs" "^15.0.0" chalk "^3.0.0" -"@jimp/bmp@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/bmp/-/bmp-0.9.6.tgz#379e261615d7c1f3b52af4d5a0f324666de53d7d" - integrity sha512-T2Fh/k/eN6cDyOx0KQ4y56FMLo8+mKNhBh7GXMQXLK2NNZ0ckpFo3VHDBZ3HnaFeVTZXF/atLiR9CfnXH+rLxA== +"@jimp/bmp@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/bmp/-/bmp-0.14.0.tgz#6df246026554f276f7b354047c6fff9f5b2b5182" + integrity sha512-5RkX6tSS7K3K3xNEb2ygPuvyL9whjanhoaB/WmmXlJS6ub4DjTqrapu8j4qnIWmO4YYtFeTbDTXV6v9P1yMA5A== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" + "@jimp/utils" "^0.14.0" bmp-js "^0.1.0" - core-js "^3.4.1" -"@jimp/core@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/core/-/core-0.9.6.tgz#a553f801bd436526d36e8982b99e58e8afc3d17a" - integrity sha512-sQO04S+HZNid68a9ehb4BC2lmW6iZ5JgU9tC+thC2Lhix+N/XKDJcBJ6HevbLgeTzuIAw24C5EKuUeO3C+rE5w== +"@jimp/core@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/core/-/core-0.14.0.tgz#870c9ca25b40be353ebda1d2abb48723d9010055" + integrity sha512-S62FcKdtLtj3yWsGfJRdFXSutjvHg7aQNiFogMbwq19RP4XJWqS2nOphu7ScB8KrSlyy5nPF2hkWNhLRLyD82w== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" + "@jimp/utils" "^0.14.0" any-base "^1.1.0" buffer "^5.2.0" - core-js "^3.4.1" exif-parser "^0.1.12" file-type "^9.0.0" load-bmfont "^1.3.1" @@ -2795,256 +2671,269 @@ pixelmatch "^4.0.2" tinycolor2 "^1.4.1" -"@jimp/custom@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/custom/-/custom-0.9.6.tgz#3d8a19d6ed717f0f1aa3f1b8f42fa374f43bc715" - integrity sha512-ZYKgrBZVoQwvIGlQSO7MFmn7Jn8a9X5g1g+KOTDO9Q0s4vnxdPTtr/qUjG9QYX6zW/6AK4LaIsDinDrrKDnOag== +"@jimp/custom@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/custom/-/custom-0.14.0.tgz#1dbbf0094df7403f4e03bc984ed92e7458842f74" + integrity sha512-kQJMeH87+kWJdVw8F9GQhtsageqqxrvzg7yyOw3Tx/s7v5RToe8RnKyMM+kVtBJtNAG+Xyv/z01uYQ2jiZ3GwA== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/core" "^0.9.6" - core-js "^3.4.1" + "@jimp/core" "^0.14.0" -"@jimp/gif@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/gif/-/gif-0.9.6.tgz#0a7b1e521daca635b02259f941bdb3600569d8e6" - integrity sha512-Z2muC2On8KHEVrWKCCM0L2eua9kw4bQETzT7gmVsizc8MXAKdS8AyVV9T3ZrImiI0o5UkAN/u0cPi1U2pSiD8Q== +"@jimp/gif@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/gif/-/gif-0.14.0.tgz#db159f57c3cfd1566bbe8b124958791998614960" + integrity sha512-DHjoOSfCaCz72+oGGEh8qH0zE6pUBaBxPxxmpYJjkNyDZP7RkbBkZJScIYeQ7BmJxmGN4/dZn+MxamoQlr+UYg== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" + gifwrap "^0.9.2" omggif "^1.0.9" -"@jimp/jpeg@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/jpeg/-/jpeg-0.9.6.tgz#fb90bdc0111966987c5ba59cdca7040be86ead41" - integrity sha512-igSe0pIX3le/CKdvqW4vLXMxoFjTLjEaW6ZHt/h63OegaEa61TzJ2OM7j7DxrEHcMCMlkhUc9Bapk57MAefCTQ== +"@jimp/jpeg@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/jpeg/-/jpeg-0.14.0.tgz#8a687a6a653bbbae38c522edef8f84bb418d9461" + integrity sha512-561neGbr+87S/YVQYnZSTyjWTHBm9F6F1obYHiyU3wVmF+1CLbxY3FQzt4YolwyQHIBv36Bo0PY2KkkU8BEeeQ== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" - jpeg-js "^0.3.4" + "@jimp/utils" "^0.14.0" + jpeg-js "^0.4.0" -"@jimp/plugin-blit@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-blit/-/plugin-blit-0.9.6.tgz#7937e02e3514b95dbe4c70d444054847f6e9ce3c" - integrity sha512-zp7X6uDU1lCu44RaSY88aAvsSKbgqUrfDyWRX1wsamJvvZpRnp1WekWlGyydRtnlUBAGIpiHCHmyh/TJ2I4RWA== +"@jimp/plugin-blit@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-blit/-/plugin-blit-0.14.0.tgz#5eb374be1201313b2113899fb842232d8fcfd345" + integrity sha512-YoYOrnVHeX3InfgbJawAU601iTZMwEBZkyqcP1V/S33Qnz9uzH1Uj1NtC6fNgWzvX6I4XbCWwtr4RrGFb5CFrw== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-blur@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-blur/-/plugin-blur-0.9.6.tgz#3d74b18c27e9eae11b956ffe26290ece6d250813" - integrity sha512-xEi63hvzewUp7kzw+PI3f9CIrgZbphLI4TDDHWNYuS70RvhTuplbR6RMHD/zFhosrANCkJGr5OZJlrJnsCg6ug== +"@jimp/plugin-blur@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-blur/-/plugin-blur-0.14.0.tgz#fe07e4932d5a2f5d8c9831e245561553224bfc60" + integrity sha512-9WhZcofLrT0hgI7t0chf7iBQZib//0gJh9WcQMUt5+Q1Bk04dWs8vTgLNj61GBqZXgHSPzE4OpCrrLDBG8zlhQ== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-color@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-color/-/plugin-color-0.9.6.tgz#d0fca0ed4c2c48fd6f929ef4a03cebf9c1342e14" - integrity sha512-o1HSoqBVUUAsWbqSXnpiHU0atKWy/Q1GUbZ3F5GWt/0OSDyl9RWM82V9axT2vePZHInKjIaimhnx1gGj8bfxkQ== +"@jimp/plugin-circle@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-circle/-/plugin-circle-0.14.0.tgz#82c0e904a34e90fa672fb9c286bc892e92088ddf" + integrity sha512-o5L+wf6QA44tvTum5HeLyLSc5eVfIUd5ZDVi5iRfO4o6GT/zux9AxuTSkKwnjhsG8bn1dDmywAOQGAx7BjrQVA== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.14.0" + +"@jimp/plugin-color@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-color/-/plugin-color-0.14.0.tgz#772bd2d80a88bc66ea1331d010207870f169a74b" + integrity sha512-JJz512SAILYV0M5LzBb9sbOm/XEj2fGElMiHAxb7aLI6jx+n0agxtHpfpV/AePTLm1vzzDxx6AJxXbKv355hBQ== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" tinycolor2 "^1.4.1" -"@jimp/plugin-contain@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-contain/-/plugin-contain-0.9.6.tgz#7d7bbd5e9c2fa4391a3d63620e13a28f51e1e7e8" - integrity sha512-Xz467EN1I104yranET4ff1ViVKMtwKLg1uRe8j3b5VOrjtiXpDbjirNZjP3HTlv8IEUreWNz4BK7ZtfHSptufA== +"@jimp/plugin-contain@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-contain/-/plugin-contain-0.14.0.tgz#c68115420d182e696f81bbe76fb5e704909b2b6a" + integrity sha512-RX2q233lGyaxiMY6kAgnm9ScmEkNSof0hdlaJAVDS1OgXphGAYAeSIAwzESZN4x3ORaWvkFefeVH9O9/698Evg== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-cover@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-cover/-/plugin-cover-0.9.6.tgz#2853de7f8302f655ae8e95f51ab25a0ed77e3756" - integrity sha512-Ocr27AvtvH4ZT/9EWZgT3+HQV9fG5njwh2CYMHbdpx09O62Asj6pZ4QI0kKzOcux1oLgv59l7a93pEfMOfkfwQ== +"@jimp/plugin-cover@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-cover/-/plugin-cover-0.14.0.tgz#4755322589c5885e44e14e31b86b542e907297ce" + integrity sha512-0P/5XhzWES4uMdvbi3beUgfvhn4YuQ/ny8ijs5kkYIw6K8mHcl820HahuGpwWMx56DJLHRl1hFhJwo9CeTRJtQ== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-crop@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-crop/-/plugin-crop-0.9.6.tgz#82e539af2a2417783abbd143124a57672ff4cc31" - integrity sha512-d9rNdmz3+eYLbSKcTyyp+b8Nmhf6HySnimDXlTej4UP6LDtkq2VAyVaJ12fz9x6dfd8qcXOBXMozSfNCcgpXYA== +"@jimp/plugin-crop@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-crop/-/plugin-crop-0.14.0.tgz#4cbd856ca84ffc37230fad2534906f2f75aa3057" + integrity sha512-Ojtih+XIe6/XSGtpWtbAXBozhCdsDMmy+THUJAGu2x7ZgKrMS0JotN+vN2YC3nwDpYkM+yOJImQeptSfZb2Sug== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-displace@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-displace/-/plugin-displace-0.9.6.tgz#67564d081dc6b19007248ca222d025fd6f90c03b" - integrity sha512-SWpbrxiHmUYBVWtDDMjaG3eRDBASrTPaad7l07t73/+kmU6owAKWQW6KtVs05MYSJgXz7Ggdr0fhEn9AYLH1Rg== +"@jimp/plugin-displace@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-displace/-/plugin-displace-0.14.0.tgz#b0e6a57d00cb1f893f541413fe9d737d23c3b70c" + integrity sha512-c75uQUzMgrHa8vegkgUvgRL/PRvD7paFbFJvzW0Ugs8Wl+CDMGIPYQ3j7IVaQkIS+cAxv+NJ3TIRBQyBrfVEOg== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-dither@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-dither/-/plugin-dither-0.9.6.tgz#dc48669cf51f3933761aa9137e99ebfa000b8cce" - integrity sha512-abm1GjfYK7ru/PoxH9fAUmhl+meHhGEClbVvjjMMe5g2S0BSTvMJl3SrkQD/FMkRLniaS/Qci6aQhIi+8rZmSw== +"@jimp/plugin-dither@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-dither/-/plugin-dither-0.14.0.tgz#9185ec4c38e02edc9e5831f5d709f6ba891e1b93" + integrity sha512-g8SJqFLyYexXQQsoh4dc1VP87TwyOgeTElBcxSXX2LaaMZezypmxQfLTzOFzZoK8m39NuaoH21Ou1Ftsq7LzVQ== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-flip@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-flip/-/plugin-flip-0.9.6.tgz#f81f9b886da8cd56e23dd04d5aa359f2b94f939e" - integrity sha512-KFZTzAzQQ5bct3ii7gysOhWrTKVdUOghkkoSzLi+14nO3uS/dxiu8fPeH1m683ligbdnuM/b22OuLwEwrboTHA== +"@jimp/plugin-fisheye@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-fisheye/-/plugin-fisheye-0.14.0.tgz#9f26346cf2fbc660cc2008cd7fd30a83b5029e78" + integrity sha512-BFfUZ64EikCaABhCA6mR3bsltWhPpS321jpeIQfJyrILdpFsZ/OccNwCgpW1XlbldDHIoNtXTDGn3E+vCE7vDg== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-gaussian@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-gaussian/-/plugin-gaussian-0.9.6.tgz#6c93897ee0ff979466184d7d0ec0fbc95c679be4" - integrity sha512-WXKLtJKWchXfWHT5HIOq1HkPKpbH7xBLWPgVRxw00NV/6I8v4xT63A7/Nag78m00JgjwwiE7eK2tLGDbbrPYig== +"@jimp/plugin-flip@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-flip/-/plugin-flip-0.14.0.tgz#7966d6aa3b5fe1aa4d2d561ff12b8ef5ccb9b071" + integrity sha512-WtL1hj6ryqHhApih+9qZQYA6Ye8a4HAmdTzLbYdTMrrrSUgIzFdiZsD0WeDHpgS/+QMsWwF+NFmTZmxNWqKfXw== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-invert@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-invert/-/plugin-invert-0.9.6.tgz#4b3fa7b81ea976b09b82b3db59ee00ac3093d2fd" - integrity sha512-Pab/cupZrYxeRp07N4L5a4C/3ksTN9k6Knm/o2G5C789OF0rYsGGLcnBR/6h69nPizRZHBYdXCEyXYgujlIFiw== +"@jimp/plugin-gaussian@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-gaussian/-/plugin-gaussian-0.14.0.tgz#452bc1971a4467ad9b984aa67f4c200bf941bb65" + integrity sha512-uaLwQ0XAQoydDlF9tlfc7iD9drYPriFe+jgYnWm8fbw5cN+eOIcnneEX9XCOOzwgLPkNCxGox6Kxjn8zY6GxtQ== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-mask@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-mask/-/plugin-mask-0.9.6.tgz#d70be0030ab3294b191f5b487fb655d776820b19" - integrity sha512-ikypRoDJkbxXlo6gW+EZOcTiLDIt0DrPwOFMt1bvL8UV2QPgX+GJ685IYwhIfEhBf/GSNFgB/NYsVvuSufTGeg== +"@jimp/plugin-invert@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-invert/-/plugin-invert-0.14.0.tgz#cd31a555860e9f821394936d15af161c09c42921" + integrity sha512-UaQW9X9vx8orQXYSjT5VcITkJPwDaHwrBbxxPoDG+F/Zgv4oV9fP+udDD6qmkgI9taU+44Fy+zm/J/gGcMWrdg== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-normalize@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-normalize/-/plugin-normalize-0.9.6.tgz#c9128412a53485d91236a1da241f3166e572be4a" - integrity sha512-V3GeuAJ1NeL7qsLoDjnypJq24RWDCwbXpKhtxB+Yg9zzgOCkmb041p7ysxbcpkuJsRpKLNABZeNCCqd83bRawA== +"@jimp/plugin-mask@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-mask/-/plugin-mask-0.14.0.tgz#52619643ac6222f85e6b27dee33c771ca3a6a4c9" + integrity sha512-tdiGM69OBaKtSPfYSQeflzFhEpoRZ+BvKfDEoivyTjauynbjpRiwB1CaiS8En1INTDwzLXTT0Be9SpI3LkJoEA== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-print@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-print/-/plugin-print-0.9.6.tgz#fea31ffeafee18ae7b5cfd6fa131bb205abfee51" - integrity sha512-gKkqZZPQtMSufHOL0mtJm5d/KI2O6+0kUpOBVSYdGedtPXA61kmVnsOd3wwajIMlXA3E0bDxLXLdAguWqjjGgw== +"@jimp/plugin-normalize@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-normalize/-/plugin-normalize-0.14.0.tgz#bf39e356b6d473f582ce95633ad49c9cdb82492b" + integrity sha512-AfY8sqlsbbdVwFGcyIPy5JH/7fnBzlmuweb+Qtx2vn29okq6+HelLjw2b+VT2btgGUmWWHGEHd86oRGSoWGyEQ== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" + +"@jimp/plugin-print@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-print/-/plugin-print-0.14.0.tgz#1c43c2a92a7adc05b464863882cb89ce486d63e6" + integrity sha512-MwP3sH+VS5AhhSTXk7pui+tEJFsxnTKFY3TraFJb8WFbA2Vo2qsRCZseEGwpTLhENB7p/JSsLvWoSSbpmxhFAQ== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.14.0" load-bmfont "^1.4.0" -"@jimp/plugin-resize@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-resize/-/plugin-resize-0.9.6.tgz#7fb939c8a42e2a3639d661cc7ab24057598693bd" - integrity sha512-r5wJcVII7ZWMuY2l6WSbHPG6gKMFemtCHmJRXGUu+/ZhPGBz3IFluycBpHkWW3OB+jfvuyv1EGQWHU50N1l8Og== +"@jimp/plugin-resize@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-resize/-/plugin-resize-0.14.0.tgz#ef7fc6c2e45f8bcab62456baf8fd3bc415b02b64" + integrity sha512-qFeMOyXE/Bk6QXN0GQo89+CB2dQcXqoxUcDb2Ah8wdYlKqpi53skABkgVy5pW3EpiprDnzNDboMltdvDslNgLQ== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-rotate@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-rotate/-/plugin-rotate-0.9.6.tgz#06d725155e5cdb615133f57a52f5a860a9d03f3e" - integrity sha512-B2nm/eO2nbvn1DgmnzMd79yt3V6kffhRNrKoo2VKcKFiVze1vGP3MD3fVyw5U1PeqwAFu7oTICFnCf9wKDWSqg== +"@jimp/plugin-rotate@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-rotate/-/plugin-rotate-0.14.0.tgz#3632bc159bf1c3b9ec9f459d9c05d02a11781ee7" + integrity sha512-aGaicts44bvpTcq5Dtf93/8TZFu5pMo/61lWWnYmwJJU1RqtQlxbCLEQpMyRhKDNSfPbuP8nyGmaqXlM/82J0Q== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugin-scale@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugin-scale/-/plugin-scale-0.9.6.tgz#3fa939c1a4f44383e12afeb7c434eb41f20e4a1c" - integrity sha512-DLsLB5S3mh9+TZY5ycwfLgOJvUcoS7bP0Mi3I8vE1J91qmA+TXoWFFgrIVgnEPw5jSKzNTt8WhykQ0x2lKXncw== +"@jimp/plugin-scale@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-scale/-/plugin-scale-0.14.0.tgz#d30f0cd1365b8e68f43fa423300ae7f124e9bf10" + integrity sha512-ZcJk0hxY5ZKZDDwflqQNHEGRblgaR+piePZm7dPwPUOSeYEH31P0AwZ1ziceR74zd8N80M0TMft+e3Td6KGBHw== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" -"@jimp/plugins@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/plugins/-/plugins-0.9.6.tgz#a1cfdf9f3e1adf5b124686486343888a16c8fd27" - integrity sha512-eQI29e+K+3L/fb5GbPgsBdoftvaYetSOO2RL5z+Gjk6R4EF4QFRo63YcFl+f72Kc1b0JTOoDxClvn/s5GMV0tg== +"@jimp/plugin-shadow@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-shadow/-/plugin-shadow-0.14.0.tgz#471fdb9f109ff2d9e20d533d45e1e18e0b48c749" + integrity sha512-p2igcEr/iGrLiTu0YePNHyby0WYAXM14c5cECZIVnq/UTOOIQ7xIcWZJ1lRbAEPxVVXPN1UibhZAbr3HAb5BjQ== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/plugin-blit" "^0.9.6" - "@jimp/plugin-blur" "^0.9.6" - "@jimp/plugin-color" "^0.9.6" - "@jimp/plugin-contain" "^0.9.6" - "@jimp/plugin-cover" "^0.9.6" - "@jimp/plugin-crop" "^0.9.6" - "@jimp/plugin-displace" "^0.9.6" - "@jimp/plugin-dither" "^0.9.6" - "@jimp/plugin-flip" "^0.9.6" - "@jimp/plugin-gaussian" "^0.9.6" - "@jimp/plugin-invert" "^0.9.6" - "@jimp/plugin-mask" "^0.9.6" - "@jimp/plugin-normalize" "^0.9.6" - "@jimp/plugin-print" "^0.9.6" - "@jimp/plugin-resize" "^0.9.6" - "@jimp/plugin-rotate" "^0.9.6" - "@jimp/plugin-scale" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" + +"@jimp/plugin-threshold@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugin-threshold/-/plugin-threshold-0.14.0.tgz#ebd72721c7d1d518c5bb6e494e55d97ac3351d3b" + integrity sha512-N4BlDgm/FoOMV/DQM2rSpzsgqAzkP0DXkWZoqaQrlRxQBo4zizQLzhEL00T/YCCMKnddzgEhnByaocgaaa0fKw== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.14.0" + +"@jimp/plugins@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/plugins/-/plugins-0.14.0.tgz#41dba85f15ab8dadb4162100eb54e5f27b93ee2c" + integrity sha512-vDO3XT/YQlFlFLq5TqNjQkISqjBHT8VMhpWhAfJVwuXIpilxz5Glu4IDLK6jp4IjPR6Yg2WO8TmRY/HI8vLrOw== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/plugin-blit" "^0.14.0" + "@jimp/plugin-blur" "^0.14.0" + "@jimp/plugin-circle" "^0.14.0" + "@jimp/plugin-color" "^0.14.0" + "@jimp/plugin-contain" "^0.14.0" + "@jimp/plugin-cover" "^0.14.0" + "@jimp/plugin-crop" "^0.14.0" + "@jimp/plugin-displace" "^0.14.0" + "@jimp/plugin-dither" "^0.14.0" + "@jimp/plugin-fisheye" "^0.14.0" + "@jimp/plugin-flip" "^0.14.0" + "@jimp/plugin-gaussian" "^0.14.0" + "@jimp/plugin-invert" "^0.14.0" + "@jimp/plugin-mask" "^0.14.0" + "@jimp/plugin-normalize" "^0.14.0" + "@jimp/plugin-print" "^0.14.0" + "@jimp/plugin-resize" "^0.14.0" + "@jimp/plugin-rotate" "^0.14.0" + "@jimp/plugin-scale" "^0.14.0" + "@jimp/plugin-shadow" "^0.14.0" + "@jimp/plugin-threshold" "^0.14.0" timm "^1.6.1" -"@jimp/png@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/png/-/png-0.9.6.tgz#00ed7e6fb783b94f2f1a9fadf9a42bd75f70cc7f" - integrity sha512-9vhOG2xylcDqPbBf4lzpa2Sa1WNJrEZNGvPvWcM+XVhqYa8+DJBLYkoBlpI/qWIYA+eVWDnLF3ygtGj8CElICw== +"@jimp/png@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/png/-/png-0.14.0.tgz#0f2dddb5125c0795ca7e67c771204c5437fcda4b" + integrity sha512-0RV/mEIDOrPCcNfXSPmPBqqSZYwGADNRVUTyMt47RuZh7sugbYdv/uvKmQSiqRdR0L1sfbCBMWUEa5G/8MSbdA== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/utils" "^0.9.6" - core-js "^3.4.1" + "@jimp/utils" "^0.14.0" pngjs "^3.3.3" -"@jimp/tiff@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/tiff/-/tiff-0.9.6.tgz#9ff12122e727ee15f27f40a710516102a636f66b" - integrity sha512-pKKEMqPzX9ak8mek2iVVoW34+h/TSWUyI4NjbYWJMQ2WExfuvEJvLocy9Q9xi6HqRuJmUxgNIiC5iZM1PDEEfg== +"@jimp/tiff@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/tiff/-/tiff-0.14.0.tgz#a5b25bbe7c43fc3b07bad4e2ab90e0e164c1967f" + integrity sha512-zBYDTlutc7j88G/7FBCn3kmQwWr0rmm1e0FKB4C3uJ5oYfT8645lftUsvosKVUEfkdmOaMAnhrf4ekaHcb5gQw== dependencies: "@babel/runtime" "^7.7.2" - core-js "^3.4.1" utif "^2.0.1" -"@jimp/types@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/types/-/types-0.9.6.tgz#7be7f415ad93be733387c03b8a228c587a868a18" - integrity sha512-PSjdbLZ8d50En+Wf1XkWFfrXaf/GqyrxxgIwFWPbL+wrW4pmbYovfxSLCY61s8INsOFOft9dzzllhLBtg1aQ6A== +"@jimp/types@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/types/-/types-0.14.0.tgz#ef681ff702883c5f105b5e4e30d49abf39ee9e34" + integrity sha512-hx3cXAW1KZm+b+XCrY3LXtdWy2U+hNtq0rPyJ7NuXCjU7lZR3vIkpz1DLJ3yDdS70hTi5QDXY3Cd9kd6DtloHQ== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/bmp" "^0.9.6" - "@jimp/gif" "^0.9.6" - "@jimp/jpeg" "^0.9.6" - "@jimp/png" "^0.9.6" - "@jimp/tiff" "^0.9.6" - core-js "^3.4.1" + "@jimp/bmp" "^0.14.0" + "@jimp/gif" "^0.14.0" + "@jimp/jpeg" "^0.14.0" + "@jimp/png" "^0.14.0" + "@jimp/tiff" "^0.14.0" timm "^1.6.1" -"@jimp/utils@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@jimp/utils/-/utils-0.9.6.tgz#a3e6c29e835e2b9ea9f3899c9d3d230dc63bd518" - integrity sha512-kzxcp0i4ecSdMXFEmtH+NYdBQysINEUTsrjm7v0zH8t/uwaEMOG46I16wo/iPBXJkUeNdL2rbXoGoxxoeSfrrA== +"@jimp/utils@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@jimp/utils/-/utils-0.14.0.tgz#296254e63118554c62c31c19ac6b8c4bfe6490e5" + integrity sha512-MY5KFYUru0y74IsgM/9asDwb3ERxWxXEu3CRCZEvE7DtT86y1bR1XgtlSliMrptjz4qbivNGMQSvUBpEFJDp1A== dependencies: "@babel/runtime" "^7.7.2" - core-js "^3.4.1" + regenerator-runtime "^0.13.3" "@mapbox/extent@0.4.0": version "0.4.0" @@ -3614,44 +3503,24 @@ "@types/node" ">=8.9.0" axios "^0.18.0" -"@storybook/addon-actions@^5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-5.2.6.tgz#4fe411fc3bdb1d44058f23fbc8eb8d1bac29d521" - integrity sha512-CwTJPqe3NcEU7oqS5KoiCX9FXYmI2Dyp1Sh6r90JmXZ8B49ZXm6BDLX0gS3TooD6/AcdU8xdBcSvN0CkxQ5QGA== - dependencies: - "@storybook/addons" "5.2.6" - "@storybook/api" "5.2.6" - "@storybook/client-api" "5.2.6" - "@storybook/components" "5.2.6" - "@storybook/core-events" "5.2.6" - "@storybook/theming" "5.2.6" - core-js "^3.0.1" - fast-deep-equal "^2.0.1" - global "^4.3.2" - polished "^3.3.1" - prop-types "^15.7.2" - react "^16.8.3" - react-inspector "^3.0.2" - uuid "^3.3.2" - -"@storybook/addon-actions@^5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-5.2.8.tgz#f63c6e1afb59e94ca1ebc776b7cad9b815e7419e" - integrity sha512-hadk+UaU6upOW0g447RfLRrnXRgE2rjRVk5sT8mVxBMj032NnwUd7ie/BZwy1yg5B8oFtpkgQYwqhPtoO2xBaQ== - dependencies: - "@storybook/addons" "5.2.8" - "@storybook/api" "5.2.8" - "@storybook/client-api" "5.2.8" - "@storybook/components" "5.2.8" - "@storybook/core-events" "5.2.8" - "@storybook/theming" "5.2.8" +"@storybook/addon-actions@^5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-5.3.19.tgz#50548fa6e84bc79ad95233ce23ade4878fc7cfac" + integrity sha512-gXF29FFUgYlUoFf1DcVCmH1chg2ElaHWMmCi5h7aZe+g6fXBQw0UtEdJnYLMOqZCIiWoZyuf1ETD0RbNHPhRIw== + dependencies: + "@storybook/addons" "5.3.19" + "@storybook/api" "5.3.19" + "@storybook/client-api" "5.3.19" + "@storybook/components" "5.3.19" + "@storybook/core-events" "5.3.19" + "@storybook/theming" "5.3.19" core-js "^3.0.1" fast-deep-equal "^2.0.1" global "^4.3.2" polished "^3.3.1" prop-types "^15.7.2" react "^16.8.3" - react-inspector "^3.0.2" + react-inspector "^4.0.0" uuid "^3.3.2" "@storybook/addon-console@^1.2.1": @@ -3661,19 +3530,18 @@ dependencies: global "^4.3.2" -"@storybook/addon-info@^5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/addon-info/-/addon-info-5.2.8.tgz#bf29741c21c16c85f4a7007606e8afa3eb77965c" - integrity sha512-iY8malDF6yayLfpiffMwDXOWeeoXdRbxse1f+kNHK4aVEUXLyh+uiogPhO8dzVDy8dQw1LP9C7xKZe2Dls59kw== +"@storybook/addon-info@^5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/addon-info/-/addon-info-5.3.19.tgz#175af53ba54ddb8fe24b3c979206ffbbf42bc4f4" + integrity sha512-MiFLcyoOmwawquagQHkqiPHnvBOKrVaS/wnO1XyBvIHwkK+KN7CZ9l7HakA4SO76kugrY9OJYyi5YvEEdN6vww== dependencies: - "@storybook/addons" "5.2.8" - "@storybook/client-logger" "5.2.8" - "@storybook/components" "5.2.8" - "@storybook/theming" "5.2.8" + "@storybook/addons" "5.3.19" + "@storybook/client-logger" "5.3.19" + "@storybook/components" "5.3.19" + "@storybook/theming" "5.3.19" core-js "^3.0.1" global "^4.3.2" - jsx-to-string "^1.4.0" - marksy "^7.0.0" + marksy "^8.0.0" nested-object-assign "^1.0.3" prop-types "^15.7.2" react "^16.8.3" @@ -3683,17 +3551,17 @@ react-lifecycles-compat "^3.0.4" util-deprecate "^1.0.2" -"@storybook/addon-knobs@^5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/addon-knobs/-/addon-knobs-5.2.6.tgz#28b2c74ea26519fef204915142a03bd7476f247c" - integrity sha512-whEZl6PpUPtOWBhmWlZ11EloxN6ad3WrJk5FyYlg3BcXG/HtlMVogBKdch83SYTT9jhHwbfwKnAng9J3UjgPbQ== - dependencies: - "@storybook/addons" "5.2.6" - "@storybook/api" "5.2.6" - "@storybook/client-api" "5.2.6" - "@storybook/components" "5.2.6" - "@storybook/core-events" "5.2.6" - "@storybook/theming" "5.2.6" +"@storybook/addon-knobs@^5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/addon-knobs/-/addon-knobs-5.3.19.tgz#b2483e401e2dca6390e1c0a81801130a0b515efb" + integrity sha512-e7z6KhvVOUGjygK4VL5Un1U3t0XG0jkb/BOHVWQMtH5dWNn3zofD3LrZZy24eAsyre/ej/LGo/BzwDSXkKLTog== + dependencies: + "@storybook/addons" "5.3.19" + "@storybook/api" "5.3.19" + "@storybook/client-api" "5.3.19" + "@storybook/components" "5.3.19" + "@storybook/core-events" "5.3.19" + "@storybook/theming" "5.3.19" "@types/react-color" "^3.0.1" copy-to-clipboard "^3.0.8" core-js "^3.0.1" @@ -3705,130 +3573,64 @@ qs "^6.6.0" react-color "^2.17.0" react-lifecycles-compat "^3.0.4" - react-select "^3.0.0" - -"@storybook/addon-knobs@^5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/addon-knobs/-/addon-knobs-5.2.8.tgz#e0d03823969921a0da57a329376d03066dd749ee" - integrity sha512-5SAMJj+0pbhCiyNkKjkUxEbM9L/wrOE4HTvM7gvm902fULuKZklb3wV8iiUNRfIPCs6VhmmIhPzXICGjhW5xIg== - dependencies: - "@storybook/addons" "5.2.8" - "@storybook/api" "5.2.8" - "@storybook/client-api" "5.2.8" - "@storybook/components" "5.2.8" - "@storybook/core-events" "5.2.8" - "@storybook/theming" "5.2.8" - "@types/react-color" "^3.0.1" - copy-to-clipboard "^3.0.8" - core-js "^3.0.1" - escape-html "^1.0.3" - fast-deep-equal "^2.0.1" - global "^4.3.2" - lodash "^4.17.15" - prop-types "^15.7.2" - qs "^6.6.0" - react-color "^2.17.0" - react-lifecycles-compat "^3.0.4" - react-select "^3.0.0" + react-select "^3.0.8" -"@storybook/addon-options@^5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/addon-options/-/addon-options-5.2.8.tgz#579c7e1f331303382541fa77c1c26242d7d6b79d" - integrity sha512-w7b6c+K5kv6AnQW1tnGSuNEQ8Ek2kFZ4anTaMYiGpoa1nQJjDrvS6R13GWHgxGACFpOtcBPMxTEX6YKAxiOgaA== +"@storybook/addon-options@^5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/addon-options/-/addon-options-5.3.19.tgz#065e8f6be53073b37ebcaebe602dcc85ee202eaf" + integrity sha512-i5PzPlsv4QWdOvQhYVlyOW7VEW2ovhxg4MWVRjCoVy6vhF42MR+0HRtIOeOENuc3XnpSxsSk0ci/UI2XQjnX3Q== dependencies: - "@storybook/addons" "5.2.8" + "@storybook/addons" "5.3.19" core-js "^3.0.1" util-deprecate "^1.0.2" -"@storybook/addon-storyshots@^5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/addon-storyshots/-/addon-storyshots-5.2.6.tgz#cc94f256cb28e2769a3dd472af420f8e0fcc306f" - integrity sha512-04UX6VXFOrv1o41L8P3mevFYN2H9RU6JCNXfqCJLtD4ZxP5iDoXjF8/0VWLdqCPANe9Ng58r5BnZgNwWPjcGbA== - dependencies: - "@jest/transform" "^24.9.0" - "@storybook/addons" "5.2.6" - core-js "^3.0.1" - glob "^7.1.3" - global "^4.3.2" - jest-specific-snapshot "^2.0.0" - read-pkg-up "^6.0.0" - regenerator-runtime "^0.12.1" - ts-dedent "^1.1.0" - -"@storybook/addon-storyshots@^5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/addon-storyshots/-/addon-storyshots-5.2.8.tgz#1878d0cc7490941cc4006bd3bd96bfd06005e1e3" - integrity sha512-izUQTwzt1I0TdtYn3jv6yFIaW7H48gPW+nehisVXOA+0b0f+IySnC63+q3YcCQcC9cmZ5xxzZNJ1XycrsyVm0A== +"@storybook/addon-storyshots@^5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/addon-storyshots/-/addon-storyshots-5.3.19.tgz#cb07ac3cc20d3a399ed4b6758008e10f910691d0" + integrity sha512-4TBbpAqbc9HLPxaJB2koQija67OBgGRhBZ5l2goczbgIWbbh3BXDrg3SwmKXC0cFnslgbuKU3CMX7infgtkByA== dependencies: "@jest/transform" "^24.9.0" - "@storybook/addons" "5.2.8" + "@storybook/addons" "5.3.19" + "@storybook/client-api" "5.3.19" + "@storybook/core" "5.3.19" + "@types/glob" "^7.1.1" + "@types/jest" "^24.0.16" + "@types/jest-specific-snapshot" "^0.5.3" + babel-plugin-require-context-hook "^1.0.0" core-js "^3.0.1" glob "^7.1.3" global "^4.3.2" jest-specific-snapshot "^2.0.0" - read-pkg-up "^6.0.0" - regenerator-runtime "^0.12.1" + read-pkg-up "^7.0.0" + regenerator-runtime "^0.13.3" ts-dedent "^1.1.0" -"@storybook/addons@5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-5.2.6.tgz#c1278137acb3502e068b0b0d07a8371c607e9c02" - integrity sha512-5MF64lsAhIEMxTbVpYROz5Wez595iwSw45yXyP8gWt12d+EmFO5tdy7cYJCxcMuVhDfaCI78tFqS9orr1atVyA== - dependencies: - "@storybook/api" "5.2.6" - "@storybook/channels" "5.2.6" - "@storybook/client-logger" "5.2.6" - "@storybook/core-events" "5.2.6" - core-js "^3.0.1" - global "^4.3.2" - util-deprecate "^1.0.2" - -"@storybook/addons@5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-5.2.8.tgz#f8bf8bd555b7a69fb1e9a52ab8cdb96384d931ff" - integrity sha512-yAo1N5z/45bNIQP8SD+HVTr7X898bYAtz1EZBrQ6zD8bGamzA2Br06rOLL9xXw29eQhsaVnPlqgDwCS1sTC7aQ== - dependencies: - "@storybook/api" "5.2.8" - "@storybook/channels" "5.2.8" - "@storybook/client-logger" "5.2.8" - "@storybook/core-events" "5.2.8" - core-js "^3.0.1" - global "^4.3.2" - util-deprecate "^1.0.2" - -"@storybook/api@5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/api/-/api-5.2.6.tgz#43d3c20b90e585e6c94b36e29845d39704ae2135" - integrity sha512-X/di44/SAL68mD6RHTX2qdWwhjRW6BgcfPtu0dMd38ErB3AfsfP4BITXs6kFOeSM8kWiaQoyuw0pOBzA8vlYug== +"@storybook/addons@5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-5.3.19.tgz#3a7010697afd6df9a41b8c8a7351d9a06ff490a4" + integrity sha512-Ky/k22p6i6FVNvs1VhuFyGvYJdcp+FgXqFgnPyY/OXJW/vPDapdElpTpHJZLFI9I2FQBDcygBPU5RXkumQ+KUQ== dependencies: - "@storybook/channels" "5.2.6" - "@storybook/client-logger" "5.2.6" - "@storybook/core-events" "5.2.6" - "@storybook/router" "5.2.6" - "@storybook/theming" "5.2.6" + "@storybook/api" "5.3.19" + "@storybook/channels" "5.3.19" + "@storybook/client-logger" "5.3.19" + "@storybook/core-events" "5.3.19" core-js "^3.0.1" - fast-deep-equal "^2.0.1" global "^4.3.2" - lodash "^4.17.15" - memoizerific "^1.11.3" - prop-types "^15.6.2" - react "^16.8.3" - semver "^6.0.0" - shallow-equal "^1.1.0" - store2 "^2.7.1" - telejson "^3.0.2" util-deprecate "^1.0.2" -"@storybook/api@5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/api/-/api-5.2.8.tgz#21f03df8041114eb929bd10b570a17f266568b7f" - integrity sha512-rFrPtTFDIPQoicLwq1AVsOvZNTUKnjD1w/NX1kKcyuWLL9BcOkU3YNLBlliGBg2JX/yS+fJKMyKk4NMzNBCZCg== +"@storybook/api@5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/api/-/api-5.3.19.tgz#77f15e9e2eee59fe1ddeaba1ef39bc34713a6297" + integrity sha512-U/VzDvhNCPmw2igvJYNNM+uwJCL+3teiL6JmuoL4/cmcqhI6IqqG9dZmMP1egoCd19wXEP7rnAfB/VcYVg41dQ== dependencies: - "@storybook/channels" "5.2.8" - "@storybook/client-logger" "5.2.8" - "@storybook/core-events" "5.2.8" - "@storybook/router" "5.2.8" - "@storybook/theming" "5.2.8" + "@reach/router" "^1.2.1" + "@storybook/channels" "5.3.19" + "@storybook/client-logger" "5.3.19" + "@storybook/core-events" "5.3.19" + "@storybook/csf" "0.0.1" + "@storybook/router" "5.3.19" + "@storybook/theming" "5.3.19" + "@types/reach__router" "^1.2.3" core-js "^3.0.1" fast-deep-equal "^2.0.1" global "^4.3.2" @@ -3839,78 +3641,39 @@ semver "^6.0.0" shallow-equal "^1.1.0" store2 "^2.7.1" - telejson "^3.0.2" + telejson "^3.2.0" util-deprecate "^1.0.2" -"@storybook/channel-postmessage@5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/channel-postmessage/-/channel-postmessage-5.2.6.tgz#60aaef0e80300c9812a571ca3ce0f28e2c404f04" - integrity sha512-y+63wWiEc/Q4s4MZ3KJ//5A8j5VLufxuLvPxwv9FuS4z8lmN0fqeGJn857qIlFGbZhzsQaoRdmfsCQpBBgUneg== - dependencies: - "@storybook/channels" "5.2.6" - "@storybook/client-logger" "5.2.6" - core-js "^3.0.1" - global "^4.3.2" - telejson "^3.0.2" - -"@storybook/channel-postmessage@5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/channel-postmessage/-/channel-postmessage-5.2.8.tgz#7a84869ce0fc270c3b5dcd7fa4ed798b6055816f" - integrity sha512-RS3iDW1kpfODN+kBq3youn+KtLqHslZ4m7mTlOL80BUHKb4YkrA1lVkzpy1kVMWBU523pyDVQUVXr+M8y3iVug== +"@storybook/channel-postmessage@5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/channel-postmessage/-/channel-postmessage-5.3.19.tgz#ef9fe974c2a529d89ce342ff7acf5cc22805bae9" + integrity sha512-Iq0f4NPHR0UVVFCWt0cI7Myadk4/SATXYJPT6sv95KhnLjKEeYw571WBlThfp8a9FM80887xG+eIRe93c8dleA== dependencies: - "@storybook/channels" "5.2.8" - "@storybook/client-logger" "5.2.8" + "@storybook/channels" "5.3.19" + "@storybook/client-logger" "5.3.19" core-js "^3.0.1" global "^4.3.2" - telejson "^3.0.2" - -"@storybook/channels@5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-5.2.6.tgz#e2837508864dc4d5b5e03f078886f0ce113762ea" - integrity sha512-/UsktYsXuvb1efjVPCEivhh5ywRhm7hl73pQnpJLJHRqyLMM2I5nGPFELTTNuU9yWy7sP9QL5gRqBBPe1sqjZQ== - dependencies: - core-js "^3.0.1" + telejson "^3.2.0" -"@storybook/channels@5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-5.2.8.tgz#79a99ad85dcacb688073c22340c5b7d16b801202" - integrity sha512-mFwQec27QSrqcl+IH0xA+4jfoEqC4m1G99LBHt/aTDjLZXclX1A470WqeZCp7Gx4OALpaPEVTaaaKPbiKz4C6w== +"@storybook/channels@5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-5.3.19.tgz#65ad7cd19d70aa5eabbb2e5e39ceef5e510bcb7f" + integrity sha512-38seaeyshRGotTEZJppyYMg/Vx2zRKgFv1L6uGqkJT0LYoNSYtJhsiNFCJ2/KUJu2chAJ/j8h80bpVBVLQ/+WA== dependencies: core-js "^3.0.1" -"@storybook/client-api@5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/client-api/-/client-api-5.2.6.tgz#5760cb4302d82ce9210a63f3f55b1e05f04759c1" - integrity sha512-upynf4ER2fkThNnE+mBlfRFFJxTiOh60fho1ODFcBun9BbvRD2wOHLvw7+WigIhb99HM20vk8f2dhv3I5Udzlg== - dependencies: - "@storybook/addons" "5.2.6" - "@storybook/channel-postmessage" "5.2.6" - "@storybook/channels" "5.2.6" - "@storybook/client-logger" "5.2.6" - "@storybook/core-events" "5.2.6" - "@storybook/router" "5.2.6" - common-tags "^1.8.0" - core-js "^3.0.1" - eventemitter3 "^4.0.0" - global "^4.3.2" - is-plain-object "^3.0.0" - lodash "^4.17.15" - memoizerific "^1.11.3" - qs "^6.6.0" - util-deprecate "^1.0.2" - -"@storybook/client-api@5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/client-api/-/client-api-5.2.8.tgz#1de791f7888442287f848e5f544eb883c5edc0da" - integrity sha512-OCKhZ+2sS3ot0ZV48nD79BWVzvvdMjUFYl0073ps5q+1+TLic1AlNmH0Sb5/9NrYXNV86v3VrM2jUbGsKe1qyw== - dependencies: - "@storybook/addons" "5.2.8" - "@storybook/channel-postmessage" "5.2.8" - "@storybook/channels" "5.2.8" - "@storybook/client-logger" "5.2.8" - "@storybook/core-events" "5.2.8" - "@storybook/router" "5.2.8" - common-tags "^1.8.0" +"@storybook/client-api@5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/client-api/-/client-api-5.3.19.tgz#7a5630bb8fffb92742b1773881e9004ee7fdf8e0" + integrity sha512-Dh8ZLrLH91j9Fa28Gmp0KFUvvgK348aNMrDNAUdj4m4witz/BWQ2pxz6qq9/xFVErk/GanVC05kazGElqgYCRQ== + dependencies: + "@storybook/addons" "5.3.19" + "@storybook/channel-postmessage" "5.3.19" + "@storybook/channels" "5.3.19" + "@storybook/client-logger" "5.3.19" + "@storybook/core-events" "5.3.19" + "@storybook/csf" "0.0.1" + "@types/webpack-env" "^1.15.0" core-js "^3.0.1" eventemitter3 "^4.0.0" global "^4.3.2" @@ -3919,435 +3682,231 @@ memoizerific "^1.11.3" qs "^6.6.0" stable "^0.1.8" + ts-dedent "^1.1.0" util-deprecate "^1.0.2" -"@storybook/client-logger@5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-5.2.6.tgz#cfc4536e9b724b086f7509c2bb34c221016713c9" - integrity sha512-hJvPD267cCwLIRMOISjDH8h9wbwOcXIJip29UlJbU9iMtZtgE+YelmlpmZJvqcDfUiXWWrOh7tP76mj8EAfwIQ== - dependencies: - core-js "^3.0.1" - -"@storybook/client-logger@5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-5.2.8.tgz#5affe2f9dbbee374721fd2e8729116f5ac39c779" - integrity sha512-+oVSEJdeh7TQ1Bhanb3mCr7fc3Bug3+K79abZ28J45Ub5x4L/ZVClj1xMgUsJs30BZ5FB8vhdgH6TQb0NSxR4A== - dependencies: - core-js "^3.0.1" - -"@storybook/components@5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/components/-/components-5.2.6.tgz#cddb60227720aea7cae34fe782d0370bcdbd4005" - integrity sha512-C7OS90bZ1ZvxlWUZ3B2MPFFggqAtUo7X8DqqS3IwsuDUiK9dD/KS0MwPgOuFDnOTW1R5XqmQd/ylt53w3s/U5g== +"@storybook/client-logger@5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-5.3.19.tgz#fbbd186e82102eaca1d6a5cca640271cae862921" + integrity sha512-nHftT9Ow71YgAd2/tsu79kwKk30mPuE0sGRRUHZVyCRciGFQweKNOS/6xi2Aq+WwBNNjPKNlbgxwRt1yKe1Vkg== dependencies: - "@storybook/client-logger" "5.2.6" - "@storybook/theming" "5.2.6" - "@types/react-syntax-highlighter" "10.1.0" - "@types/react-textarea-autosize" "^4.3.3" core-js "^3.0.1" - global "^4.3.2" - markdown-to-jsx "^6.9.1" - memoizerific "^1.11.3" - polished "^3.3.1" - popper.js "^1.14.7" - prop-types "^15.7.2" - react "^16.8.3" - react-dom "^16.8.3" - react-focus-lock "^1.18.3" - react-helmet-async "^1.0.2" - react-popper-tooltip "^2.8.3" - react-syntax-highlighter "^8.0.1" - react-textarea-autosize "^7.1.0" - simplebar-react "^1.0.0-alpha.6" -"@storybook/components@5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/components/-/components-5.2.8.tgz#f5d4a06ba4ba8c700b2d962deae182105b72fb99" - integrity sha512-h9l/LAMaj+emUCOyY/+ETy/S3P0npwQU280J88uL4O9XJALJ72EKfyttBCvMLvpM50E+fAPeDzuYn0t5qzGGxg== +"@storybook/components@5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/components/-/components-5.3.19.tgz#aac1f9eea1247cc85bd93b10fca803876fb84a6b" + integrity sha512-3g23/+ktlocaHLJKISu9Neu3XKa6aYP2ctDYkRtGchSB0Q55hQsUVGO+BEVuT7Pk2D59mVCxboBjxcRoPUY4pw== dependencies: - "@storybook/client-logger" "5.2.8" - "@storybook/theming" "5.2.8" - "@types/react-syntax-highlighter" "10.1.0" + "@storybook/client-logger" "5.3.19" + "@storybook/theming" "5.3.19" + "@types/react-syntax-highlighter" "11.0.4" "@types/react-textarea-autosize" "^4.3.3" core-js "^3.0.1" global "^4.3.2" - markdown-to-jsx "^6.9.1" + lodash "^4.17.15" + markdown-to-jsx "^6.11.4" memoizerific "^1.11.3" polished "^3.3.1" popper.js "^1.14.7" prop-types "^15.7.2" react "^16.8.3" react-dom "^16.8.3" - react-focus-lock "^1.18.3" + react-focus-lock "^2.1.0" react-helmet-async "^1.0.2" react-popper-tooltip "^2.8.3" - react-syntax-highlighter "^8.0.1" + react-syntax-highlighter "^11.0.2" react-textarea-autosize "^7.1.0" simplebar-react "^1.0.0-alpha.6" + ts-dedent "^1.1.0" -"@storybook/core-events@5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-5.2.6.tgz#34c9aae256e7e5f4a565b81f1e77dda8bccc6752" - integrity sha512-W8kLJ7tc0aAxs11CPUxUOCReocKL4MYGyjTg8qwk0USLzPUb/FUQWmhcm2ilFz6Nz8dXLcKrXdRVYTmiMsgAeg== - dependencies: - core-js "^3.0.1" - -"@storybook/core-events@5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-5.2.8.tgz#93fc458ea0820ff1409d268b0fe51abba200f5a4" - integrity sha512-NkQKC5doO/YL9gsO61bqaxgveKktkiJWZ3XyyhL1ZebgnO9wTlrU+i9b5aX73Myk1oxbicQw9KcwDGYk0qFuNQ== - dependencies: - core-js "^3.0.1" - -"@storybook/core@5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/core/-/core-5.2.6.tgz#60c092607158d7d28db59f7e67da4f7e12703fb2" - integrity sha512-q7Ful7TCm9nmjgLsJFqIwVv395NlaOXgGajyaQCQlCKB2V+jgs7GDmdCNNdWAOue4eAsFU6wQSP9lWtq0yzK4w== +"@storybook/core-events@5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-5.3.19.tgz#18020cd52e0d8ef0973a8e9622a10d5f99796f79" + integrity sha512-lh78ySqMS7pDdMJAQAe35d1I/I4yPTqp09Cq0YIYOxx9BQZhah4DZTV1QIZt22H5p2lPb5MWLkWSxBaexZnz8A== dependencies: - "@babel/plugin-proposal-class-properties" "^7.3.3" - "@babel/plugin-proposal-object-rest-spread" "^7.3.2" - "@babel/plugin-syntax-dynamic-import" "^7.2.0" - "@babel/plugin-transform-react-constant-elements" "^7.2.0" - "@babel/preset-env" "^7.4.5" - "@storybook/addons" "5.2.6" - "@storybook/channel-postmessage" "5.2.6" - "@storybook/client-api" "5.2.6" - "@storybook/client-logger" "5.2.6" - "@storybook/core-events" "5.2.6" - "@storybook/node-logger" "5.2.6" - "@storybook/router" "5.2.6" - "@storybook/theming" "5.2.6" - "@storybook/ui" "5.2.6" - airbnb-js-shims "^1 || ^2" - ansi-to-html "^0.6.11" - autoprefixer "^9.4.9" - babel-plugin-add-react-displayname "^0.0.5" - babel-plugin-emotion "^10.0.14" - babel-plugin-macros "^2.4.5" - babel-preset-minify "^0.5.0 || 0.6.0-alpha.5" - boxen "^3.0.0" - case-sensitive-paths-webpack-plugin "^2.2.0" - chalk "^2.4.2" - cli-table3 "0.5.1" - commander "^2.19.0" - common-tags "^1.8.0" core-js "^3.0.1" - corejs-upgrade-webpack-plugin "^2.2.0" - css-loader "^3.0.0" - detect-port "^1.3.0" - dotenv-webpack "^1.7.0" - ejs "^2.6.1" - express "^4.17.0" - file-loader "^3.0.1" - file-system-cache "^1.0.5" - find-cache-dir "^3.0.0" - fs-extra "^8.0.1" - global "^4.3.2" - html-webpack-plugin "^4.0.0-beta.2" - inquirer "^6.2.0" - interpret "^1.2.0" - ip "^1.1.5" - json5 "^2.1.0" - lazy-universal-dotenv "^3.0.1" - node-fetch "^2.6.0" - open "^6.1.0" - pnp-webpack-plugin "1.4.3" - postcss-flexbugs-fixes "^4.1.0" - postcss-loader "^3.0.0" - pretty-hrtime "^1.0.3" - qs "^6.6.0" - raw-loader "^2.0.0" - react-dev-utils "^9.0.0" - regenerator-runtime "^0.12.1" - resolve "^1.11.0" - resolve-from "^5.0.0" - semver "^6.0.0" - serve-favicon "^2.5.0" - shelljs "^0.8.3" - style-loader "^0.23.1" - terser-webpack-plugin "^1.2.4" - unfetch "^4.1.0" - url-loader "^2.0.1" - util-deprecate "^1.0.2" - webpack "^4.33.0" - webpack-dev-middleware "^3.7.0" - webpack-hot-middleware "^2.25.0" -"@storybook/core@5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/core/-/core-5.2.8.tgz#3f6ddbacc705c1893deb15582c3a0a1ecd882cd1" - integrity sha512-P1Xx4setLBESPgS5KgL7Jskf5Q6fRa3ApwPt+ocjDoSDGCvsV7cUEpAp09U65u+89e5K4nQxvaZouhknFQBc1A== +"@storybook/core@5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/core/-/core-5.3.19.tgz#1e61f35c5148343a0c580f5d5efb77f3b4243a30" + integrity sha512-4EYzglqb1iD6x9gxtAYpRGwGP6qJGiU2UW4GiYrErEmeu6y6tkyaqW5AwGlIo9+6jAfwD0HjaK8afvjKTtmmMQ== dependencies: "@babel/plugin-proposal-class-properties" "^7.7.0" "@babel/plugin-proposal-object-rest-spread" "^7.6.2" "@babel/plugin-syntax-dynamic-import" "^7.2.0" - "@babel/plugin-transform-react-constant-elements" "^7.6.3" - "@babel/preset-env" "^7.7.1" - "@storybook/addons" "5.2.8" - "@storybook/channel-postmessage" "5.2.8" - "@storybook/client-api" "5.2.8" - "@storybook/client-logger" "5.2.8" - "@storybook/core-events" "5.2.8" - "@storybook/node-logger" "5.2.8" - "@storybook/router" "5.2.8" - "@storybook/theming" "5.2.8" - "@storybook/ui" "5.2.8" - airbnb-js-shims "^1 || ^2" + "@babel/plugin-transform-react-constant-elements" "^7.2.0" + "@babel/preset-env" "^7.4.5" + "@storybook/addons" "5.3.19" + "@storybook/channel-postmessage" "5.3.19" + "@storybook/client-api" "5.3.19" + "@storybook/client-logger" "5.3.19" + "@storybook/core-events" "5.3.19" + "@storybook/csf" "0.0.1" + "@storybook/node-logger" "5.3.19" + "@storybook/router" "5.3.19" + "@storybook/theming" "5.3.19" + "@storybook/ui" "5.3.19" + airbnb-js-shims "^2.2.1" ansi-to-html "^0.6.11" - autoprefixer "^9.4.9" + autoprefixer "^9.7.2" babel-plugin-add-react-displayname "^0.0.5" - babel-plugin-emotion "^10.0.14" - babel-plugin-macros "^2.4.5" + babel-plugin-emotion "^10.0.20" + babel-plugin-macros "^2.7.0" babel-preset-minify "^0.5.0 || 0.6.0-alpha.5" - boxen "^3.0.0" + boxen "^4.1.0" case-sensitive-paths-webpack-plugin "^2.2.0" - chalk "^2.4.2" + chalk "^3.0.0" cli-table3 "0.5.1" - commander "^2.19.0" - common-tags "^1.8.0" + commander "^4.0.1" core-js "^3.0.1" corejs-upgrade-webpack-plugin "^2.2.0" css-loader "^3.0.0" detect-port "^1.3.0" dotenv-webpack "^1.7.0" - ejs "^2.6.1" + ejs "^2.7.4" express "^4.17.0" - file-loader "^3.0.1" + file-loader "^4.2.0" file-system-cache "^1.0.5" find-cache-dir "^3.0.0" + find-up "^4.1.0" fs-extra "^8.0.1" + glob-base "^0.3.0" global "^4.3.2" html-webpack-plugin "^4.0.0-beta.2" - inquirer "^6.2.0" - interpret "^1.2.0" + inquirer "^7.0.0" + interpret "^2.0.0" ip "^1.1.5" - json5 "^2.1.0" + json5 "^2.1.1" lazy-universal-dotenv "^3.0.1" + micromatch "^4.0.2" node-fetch "^2.6.0" - open "^6.1.0" - pnp-webpack-plugin "1.4.3" + open "^7.0.0" + pnp-webpack-plugin "1.5.0" postcss-flexbugs-fixes "^4.1.0" postcss-loader "^3.0.0" pretty-hrtime "^1.0.3" qs "^6.6.0" - raw-loader "^2.0.0" + raw-loader "^3.1.0" react-dev-utils "^9.0.0" - regenerator-runtime "^0.12.1" + regenerator-runtime "^0.13.3" resolve "^1.11.0" resolve-from "^5.0.0" semver "^6.0.0" serve-favicon "^2.5.0" shelljs "^0.8.3" - style-loader "^0.23.1" - terser-webpack-plugin "^1.2.4" + style-loader "^1.0.0" + terser-webpack-plugin "^2.1.2" + ts-dedent "^1.1.0" unfetch "^4.1.0" url-loader "^2.0.1" util-deprecate "^1.0.2" webpack "^4.33.0" webpack-dev-middleware "^3.7.0" webpack-hot-middleware "^2.25.0" + webpack-virtual-modules "^0.2.0" -"@storybook/node-logger@5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-5.2.6.tgz#e353aff14375bef9e922c217a0afb50f93e2ceb1" - integrity sha512-Z3mn9CUSiG7kR2OBoz4lNeoeBS094h5d9wufZSp5S+M47L6KEXmTgNcuePKj+t8Z8KT/Ph8B63bjChseKp3DNw== +"@storybook/csf@0.0.1": + version "0.0.1" + resolved "https://registry.yarnpkg.com/@storybook/csf/-/csf-0.0.1.tgz#95901507dc02f0bc6f9ac8ee1983e2fc5bb98ce6" + integrity sha512-USTLkZze5gkel8MYCujSRBVIrUQ3YPBrLOx7GNk/0wttvVtlzWXAq9eLbQ4p/NicGxP+3T7KPEMVV//g+yubpw== dependencies: - chalk "^2.4.2" - core-js "^3.0.1" - npmlog "^4.1.2" - pretty-hrtime "^1.0.3" - regenerator-runtime "^0.12.1" + lodash "^4.17.15" -"@storybook/node-logger@5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-5.2.8.tgz#4a3df21d731014d54b9ca53d5b9a72dd350bb075" - integrity sha512-3TK5mx6VWbfJO+WUrqwPhTbTQ4qESTnwJY/02xPzOhvuC6tIG1QOxzi+Rq6rFlwxTpUuWh6iyDYnGIqFFQywkA== +"@storybook/node-logger@5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-5.3.19.tgz#c414e4d3781aeb06298715220012f552a36dff29" + integrity sha512-hKshig/u5Nj9fWy0OsyU04yqCxr0A9pydOHIassr4fpLAaePIN2YvqCqE2V+TxQHjZUnowSSIhbXrGt0DI5q2A== dependencies: - chalk "^2.4.2" + "@types/npmlog" "^4.1.2" + chalk "^3.0.0" core-js "^3.0.1" npmlog "^4.1.2" pretty-hrtime "^1.0.3" - regenerator-runtime "^0.12.1" - -"@storybook/react@^5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/react/-/react-5.2.6.tgz#e61c0ed184add9e715191649ddb995eead756a90" - integrity sha512-yzhxxuoUx4jwn+PymU5wemzLb9ryXD9Y2Dv5kipCDkUS4cqDJwKcVO8tyhMigFUGTHREmJTmAESCKKPDR45SiQ== - dependencies: - "@babel/plugin-transform-react-constant-elements" "^7.2.0" - "@babel/preset-flow" "^7.0.0" - "@babel/preset-react" "^7.0.0" - "@storybook/addons" "5.2.6" - "@storybook/core" "5.2.6" - "@storybook/node-logger" "5.2.6" - "@svgr/webpack" "^4.0.3" - "@types/webpack-env" "^1.13.7" - babel-plugin-add-react-displayname "^0.0.5" - babel-plugin-named-asset-import "^0.3.1" - babel-plugin-react-docgen "^3.0.0" - babel-preset-react-app "^9.0.0" - common-tags "^1.8.0" - core-js "^3.0.1" - global "^4.3.2" - lodash "^4.17.15" - mini-css-extract-plugin "^0.7.0" - prop-types "^15.7.2" - react-dev-utils "^9.0.0" - regenerator-runtime "^0.12.1" - semver "^6.0.0" - webpack "^4.33.0" + regenerator-runtime "^0.13.3" -"@storybook/react@^5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/react/-/react-5.2.8.tgz#8d44c2d34caa1d7d748ec1fc9cf0fe2a88b001f9" - integrity sha512-T1DoWpSz33vaGx85Dh7q2KYetg7dQyiYhuOnZm2WxZTFZOw1jP62si53JGFp0PKxnT6iOBLHo3v2QkRkjt2mdQ== +"@storybook/react@^5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/react/-/react-5.3.19.tgz#ad7e7a5538399e2794cdb5a1b844a2b77c10bd09" + integrity sha512-OBRUqol3YLQi/qE55x2pWkv4YpaAmmfj6/Km+7agx+og+oNQl0nnlXy7r27X/4j3ERczzURa5pJHtSjwiNaJNw== dependencies: "@babel/plugin-transform-react-constant-elements" "^7.6.3" "@babel/preset-flow" "^7.0.0" - "@babel/preset-react" "^7.7.0" - "@storybook/addons" "5.2.8" - "@storybook/core" "5.2.8" - "@storybook/node-logger" "5.2.8" + "@babel/preset-react" "^7.0.0" + "@storybook/addons" "5.3.19" + "@storybook/core" "5.3.19" + "@storybook/node-logger" "5.3.19" "@svgr/webpack" "^4.0.3" - "@types/webpack-env" "^1.13.7" + "@types/webpack-env" "^1.15.0" babel-plugin-add-react-displayname "^0.0.5" babel-plugin-named-asset-import "^0.3.1" - babel-plugin-react-docgen "^3.0.0" - babel-preset-react-app "^9.0.0" - common-tags "^1.8.0" + babel-plugin-react-docgen "^4.0.0" core-js "^3.0.1" global "^4.3.2" lodash "^4.17.15" mini-css-extract-plugin "^0.7.0" prop-types "^15.7.2" react-dev-utils "^9.0.0" - regenerator-runtime "^0.12.1" + regenerator-runtime "^0.13.3" semver "^6.0.0" + ts-dedent "^1.1.0" webpack "^4.33.0" -"@storybook/router@5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/router/-/router-5.2.6.tgz#5180d3785501699283c6c3717986c877f84fead5" - integrity sha512-/FZd3fYg5s2QzOqSIP8UMOSnCIFFIlli/jKlOxvm3WpcpxgwQOY4lfHsLO+r9ThCLs2UvVg2R/HqGrOHqDFU7A== - dependencies: - "@reach/router" "^1.2.1" - "@types/reach__router" "^1.2.3" - core-js "^3.0.1" - global "^4.3.2" - lodash "^4.17.15" - memoizerific "^1.11.3" - qs "^6.6.0" - -"@storybook/router@5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/router/-/router-5.2.8.tgz#d7de2d401701857c033e28560c30e16512f7f72f" - integrity sha512-wnbyKESUMyv9fwo9W+n4Fev/jXylB8whpjtHrOttjguUOYX1zGSHdwNI66voPetbtVLxUeHyJteJwdyRDSirJg== +"@storybook/router@5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/router/-/router-5.3.19.tgz#0f783b85658f99e4007f74347ad7ef17dbf7fc3a" + integrity sha512-yNClpuP7BXQlBTRf6Ggle3/R349/k6kvI5Aim4jf6X/2cFVg2pzBXDAF41imNm9PcvdxwabQLm6I48p7OvKr/w== dependencies: "@reach/router" "^1.2.1" + "@storybook/csf" "0.0.1" "@types/reach__router" "^1.2.3" core-js "^3.0.1" global "^4.3.2" lodash "^4.17.15" memoizerific "^1.11.3" qs "^6.6.0" + util-deprecate "^1.0.2" -"@storybook/theming@5.2.6", "@storybook/theming@^5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-5.2.6.tgz#e04170b3e53dcfc791b2381c8a39192ae88cd291" - integrity sha512-Xa9R/H8DDgmvxsCHloJUJ2d9ZQl80AeqHrL+c/AKNpx05s9lV74DcinusCf0kz72YGUO/Xt1bAjuOvLnAaS8Gw== - dependencies: - "@emotion/core" "^10.0.14" - "@emotion/styled" "^10.0.14" - "@storybook/client-logger" "5.2.6" - common-tags "^1.8.0" - core-js "^3.0.1" - deep-object-diff "^1.1.0" - emotion-theming "^10.0.14" - global "^4.3.2" - memoizerific "^1.11.3" - polished "^3.3.1" - prop-types "^15.7.2" - resolve-from "^5.0.0" - -"@storybook/theming@5.2.8", "@storybook/theming@^5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-5.2.8.tgz#a4c9e0e9a5789c1aa71e4fcb7a8ee86efe3dadcf" - integrity sha512-rGb66GkXb0jNJMH8UQ3Ru4FL+m1x0+UdxM8a8HSE/qb1GMv2qOwjVETfAL6nVL9u6ZmrtbhHoero4f6xDwZdRg== +"@storybook/theming@5.3.19", "@storybook/theming@^5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-5.3.19.tgz#177d9819bd64f7a1a6ea2f1920ffa5baf9a5f467" + integrity sha512-ecG+Rq3hc1GOzKHamYnD4wZ0PEP9nNg0mXbC3RhbxfHj+pMMCWWmx9B2Uu75SL1PTT8WcfkFO0hU/0IO84Pzlg== dependencies: - "@emotion/core" "^10.0.14" - "@emotion/styled" "^10.0.14" - "@storybook/client-logger" "5.2.8" - common-tags "^1.8.0" + "@emotion/core" "^10.0.20" + "@emotion/styled" "^10.0.17" + "@storybook/client-logger" "5.3.19" core-js "^3.0.1" deep-object-diff "^1.1.0" - emotion-theming "^10.0.14" + emotion-theming "^10.0.19" global "^4.3.2" memoizerific "^1.11.3" polished "^3.3.1" prop-types "^15.7.2" resolve-from "^5.0.0" + ts-dedent "^1.1.0" -"@storybook/ui@5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@storybook/ui/-/ui-5.2.6.tgz#33df2f2e03d9cf81dc52928a0dc4db280ee8f56a" - integrity sha512-jT3PtpEsTqnESO0U8BotC+5P971Xqy0s2leSZcgU9PNe4Eb7NaxypSULOulPgPAx1JOmMipUBdK54PP/nyudkA== - dependencies: - "@storybook/addons" "5.2.6" - "@storybook/api" "5.2.6" - "@storybook/channels" "5.2.6" - "@storybook/client-logger" "5.2.6" - "@storybook/components" "5.2.6" - "@storybook/core-events" "5.2.6" - "@storybook/router" "5.2.6" - "@storybook/theming" "5.2.6" - copy-to-clipboard "^3.0.8" - core-js "^3.0.1" - core-js-pure "^3.0.1" - emotion-theming "^10.0.14" - fast-deep-equal "^2.0.1" - fuse.js "^3.4.4" - global "^4.3.2" - lodash "^4.17.15" - markdown-to-jsx "^6.9.3" - memoizerific "^1.11.3" - polished "^3.3.1" - prop-types "^15.7.2" - qs "^6.6.0" - react "^16.8.3" - react-dom "^16.8.3" - react-draggable "^4.0.3" - react-helmet-async "^1.0.2" - react-hotkeys "2.0.0-pre4" - react-sizeme "^2.6.7" - regenerator-runtime "^0.13.2" - resolve-from "^5.0.0" - semver "^6.0.0" - store2 "^2.7.1" - telejson "^3.0.2" - util-deprecate "^1.0.2" - -"@storybook/ui@5.2.8": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@storybook/ui/-/ui-5.2.8.tgz#da8afca9eb29a40ef3ddc6a9f6e76d7a3344f2ef" - integrity sha512-7t1ARBfylhEsLmGsZBUCj1Wf1oAgCDDrf7fi+Fhdg5Rr16CMoBbe24Gv/mPYv01/pUDhGodxzltKGX5x0Hto2w== - dependencies: - "@storybook/addons" "5.2.8" - "@storybook/api" "5.2.8" - "@storybook/channels" "5.2.8" - "@storybook/client-logger" "5.2.8" - "@storybook/components" "5.2.8" - "@storybook/core-events" "5.2.8" - "@storybook/router" "5.2.8" - "@storybook/theming" "5.2.8" +"@storybook/ui@5.3.19": + version "5.3.19" + resolved "https://registry.yarnpkg.com/@storybook/ui/-/ui-5.3.19.tgz#ac03b67320044a3892ee784111d4436b61874332" + integrity sha512-r0VxdWab49nm5tzwvveVDnsHIZHMR76veYOu/NHKDUZ5hnQl1LMG1YyMCFFa7KiwD/OrZxRWr6/Ma7ep9kR4Gw== + dependencies: + "@emotion/core" "^10.0.20" + "@storybook/addons" "5.3.19" + "@storybook/api" "5.3.19" + "@storybook/channels" "5.3.19" + "@storybook/client-logger" "5.3.19" + "@storybook/components" "5.3.19" + "@storybook/core-events" "5.3.19" + "@storybook/router" "5.3.19" + "@storybook/theming" "5.3.19" copy-to-clipboard "^3.0.8" core-js "^3.0.1" core-js-pure "^3.0.1" - emotion-theming "^10.0.14" + emotion-theming "^10.0.19" fast-deep-equal "^2.0.1" - fuse.js "^3.4.4" + fuse.js "^3.4.6" global "^4.3.2" lodash "^4.17.15" - markdown-to-jsx "^6.9.3" + markdown-to-jsx "^6.11.4" memoizerific "^1.11.3" polished "^3.3.1" prop-types "^15.7.2" @@ -4356,13 +3915,13 @@ react-dom "^16.8.3" react-draggable "^4.0.3" react-helmet-async "^1.0.2" - react-hotkeys "2.0.0-pre4" + react-hotkeys "2.0.0" react-sizeme "^2.6.7" regenerator-runtime "^0.13.2" resolve-from "^5.0.0" semver "^6.0.0" store2 "^2.7.1" - telejson "^3.0.2" + telejson "^3.2.0" util-deprecate "^1.0.2" "@svgr/babel-plugin-add-jsx-attribute@^4.2.0": @@ -5229,6 +4788,13 @@ "@types/istanbul-lib-coverage" "*" "@types/istanbul-lib-report" "*" +"@types/jest-specific-snapshot@^0.5.3": + version "0.5.4" + resolved "https://registry.yarnpkg.com/@types/jest-specific-snapshot/-/jest-specific-snapshot-0.5.4.tgz#997364c39a59ddeff0ee790a19415e79dd061d1e" + integrity sha512-1qISn4fH8wkOOPFEx+uWRRjw6m/pP/It3OHLm8Ee1KQpO7Z9ZGYDtWPU5AgK05UXsNTAgOK+dPQvJKGdy9E/1g== + dependencies: + "@types/jest" "*" + "@types/jest@*", "@types/jest@^25.2.3": version "25.2.3" resolved "https://registry.yarnpkg.com/@types/jest/-/jest-25.2.3.tgz#33d27e4c4716caae4eced355097a47ad363fdcaf" @@ -5237,6 +4803,13 @@ jest-diff "^25.2.1" pretty-format "^25.2.1" +"@types/jest@^24.0.16": + version "24.9.1" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.9.1.tgz#02baf9573c78f1b9974a5f36778b366aa77bd534" + integrity sha512-Fb38HkXSVA4L8fGKEZ6le5bB8r6MRWlOCZbVuWZcmOMSCd2wCYOwN1ibj8daIoV9naq7aaOZjrLCoCMptKU/4Q== + dependencies: + jest-diff "^24.3.0" + "@types/joi@*", "@types/joi@^13.4.2": version "13.6.1" resolved "https://registry.yarnpkg.com/@types/joi/-/joi-13.6.1.tgz#325486a397504f8e22c8c551dc8b0e1d41d5d5ae" @@ -5511,6 +5084,11 @@ resolved "https://registry.yarnpkg.com/@types/normalize-path/-/normalize-path-3.0.0.tgz#bb5c46cab77b93350b4cf8d7ff1153f47189ae31" integrity sha512-Nd8y/5t/7CRakPYiyPzr/IAfYusy1FkcZYFEAcoMZkwpJv2n4Wm+olW+e7xBdHEXhOnWdG9ddbar0gqZWS4x5Q== +"@types/npmlog@^4.1.2": + version "4.1.2" + resolved "https://registry.yarnpkg.com/@types/npmlog/-/npmlog-4.1.2.tgz#d070fe6a6b78755d1092a3dc492d34c3d8f871c4" + integrity sha512-4QQmOF5KlwfxJ5IGXFIudkeLCdMABz03RcUXu+LCb24zmln8QW6aDjuGl4d4XPVLf2j+FnjelHTP7dvceAFbhA== + "@types/numeral@^0.0.25": version "0.0.25" resolved "https://registry.yarnpkg.com/@types/numeral/-/numeral-0.0.25.tgz#b6f55062827a4787fe4ab151cf3412a468e65271" @@ -5544,6 +5122,11 @@ dependencies: "@types/node" "*" +"@types/parse-json@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" + integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== + "@types/parse-link-header@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@types/parse-link-header/-/parse-link-header-1.0.0.tgz#69f059e40a0fa93dc2e095d4142395ae6adc5d7a" @@ -5724,10 +5307,10 @@ dependencies: "@types/react" "*" -"@types/react-syntax-highlighter@10.1.0": - version "10.1.0" - resolved "https://registry.yarnpkg.com/@types/react-syntax-highlighter/-/react-syntax-highlighter-10.1.0.tgz#9c534e29bbe05dba9beae1234f3ae944836685d4" - integrity sha512-dF49hC4FZp1dIKyzacOrHvqMUe8U2IXyQCQXOcT1e6n64gLBp+xM6qGtPsThIT9XjiIHSg2W5Jc2V5IqekBfnA== +"@types/react-syntax-highlighter@11.0.4": + version "11.0.4" + resolved "https://registry.yarnpkg.com/@types/react-syntax-highlighter/-/react-syntax-highlighter-11.0.4.tgz#d86d17697db62f98046874f62fdb3e53a0bbc4cd" + integrity sha512-9GfTo3a0PHwQeTVoqs0g5bS28KkSY48pp5659wA+Dp4MqceDEa8EHBqrllJvvtyusszyJhViUEap0FDvlk/9Zg== dependencies: "@types/react" "*" @@ -6123,10 +5706,10 @@ "@types/node" "*" chokidar "^2.1.2" -"@types/webpack-env@^1.13.7": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.14.1.tgz#0d8a53f308f017c53a5ddc3d07f4d6fa76b790d7" - integrity sha512-0Ki9jAAhKDSuLDXOIMADg54Hu60SuBTEsWaJGGy5cV+SSUQ63J2a+RrYYGrErzz39fXzTibhKrAQJAb8M7PNcA== +"@types/webpack-env@^1.15.0": + version "1.15.2" + resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.15.2.tgz#927997342bb9f4a5185a86e6579a0a18afc33b0a" + integrity sha512-67ZgZpAlhIICIdfQrB5fnDvaKFcDxpKibxznfYRVAT4mQE41Dido/3Ty+E3xGBmTogc5+0Qb8tWhna+5B8z1iQ== "@types/webpack-sources@*": version "0.1.5" @@ -6722,23 +6305,25 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" -"airbnb-js-shims@^1 || ^2": - version "2.1.1" - resolved "https://registry.yarnpkg.com/airbnb-js-shims/-/airbnb-js-shims-2.1.1.tgz#a509611480db7e6d9db62fe2acfaeb473b6842ac" - integrity sha512-h8UtyB/TCdOwWoEPQJGHgsWwSnTqPrRZbhyZYjAwY9/AbjdjfkKy9L/T3fIFS6MKX8YrpWFRm6xqFSgU+2DRGw== +airbnb-js-shims@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/airbnb-js-shims/-/airbnb-js-shims-2.2.1.tgz#db481102d682b98ed1daa4c5baa697a05ce5c040" + integrity sha512-wJNXPH66U2xjgo1Zwyjf9EydvJ2Si94+vSdk6EERcBfB2VZkeltpqIats0cqIZMLCXP3zcyaUKGYQeIBT6XjsQ== dependencies: array-includes "^3.0.3" array.prototype.flat "^1.2.1" array.prototype.flatmap "^1.2.1" - es5-shim "^4.5.10" - es6-shim "^0.35.3" + es5-shim "^4.5.13" + es6-shim "^0.35.5" function.prototype.name "^1.1.0" - object.entries "^1.0.4" - object.fromentries "^1.0.0" + globalthis "^1.0.0" + object.entries "^1.1.0" + object.fromentries "^2.0.0 || ^1.0.0" object.getownpropertydescriptors "^2.0.3" - object.values "^1.0.4" + object.values "^1.1.0" + promise.allsettled "^1.0.0" promise.prototype.finally "^3.1.0" - string.prototype.matchall "^3.0.0" + string.prototype.matchall "^4.0.0 || ^3.0.1" string.prototype.padend "^3.0.0" string.prototype.padstart "^3.0.0" symbol.prototype.description "^1.0.0" @@ -7608,6 +7193,16 @@ array.prototype.flatmap@^1.2.3: es-abstract "^1.17.0-next.1" function-bind "^1.1.1" +array.prototype.map@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array.prototype.map/-/array.prototype.map-1.0.2.tgz#9a4159f416458a23e9483078de1106b2ef68f8ec" + integrity sha512-Az3OYxgsa1g7xDYp86l0nnN4bcmuEITGe1rbdEBVkrqkzMgDcbdQ2R7r41pNzti+4NMces3H8gMmuioZUilLgw== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + es-array-method-boxes-properly "^1.0.0" + is-string "^1.0.4" + arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" @@ -7690,16 +7285,16 @@ ast-types@0.11.3: resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.11.3.tgz#c20757fe72ee71278ea0ff3d87e5c2ca30d9edf8" integrity sha512-XA5o5dsNw8MhyW0Q7MWXJWc4oOzZKbdsEJq45h7c8q/d9DwWZ5F2ugUc1PuMLPGsUnphCt/cNDHu8JeBbxf1qA== -ast-types@0.12.4: - version "0.12.4" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.12.4.tgz#71ce6383800f24efc9a1a3308f3a6e420a0974d1" - integrity sha512-ky/YVYCbtVAS8TdMIaTiPFHwEpRB5z1hctepJplTr3UW5q8TDrpIMCILyk8pmLxGtn2KCtC/lSn7zOsaI7nzDw== - ast-types@0.9.6: version "0.9.6" resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.6.tgz#102c9e9e9005d3e7e3829bf0c4fa24ee862ee9b9" integrity sha1-ECyenpAF0+fjgpvwxPok7oYu6bk= +ast-types@^0.13.2: + version "0.13.3" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.13.3.tgz#50da3f28d17bdbc7969a3a2d83a0e4a72ae755a7" + integrity sha512-XTZ7xGML849LkQP86sWdQzfhwbt3YwIO6MqbX9mUNYY98VKaaVZP7YNNm70IpwecbkkxmfC5IYAzOQ/2p29zRA== + ast-types@^0.7.0: version "0.7.8" resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.7.8.tgz#902d2e0d60d071bdcd46dc115e1809ed11c138a9" @@ -7838,7 +7433,20 @@ autobind-decorator@^1.3.4: resolved "https://registry.yarnpkg.com/autobind-decorator/-/autobind-decorator-1.4.3.tgz#4c96ffa77b10622ede24f110f5dbbf56691417d1" integrity sha1-TJb/p3sQYi7eJPEQ9du/VmkUF9E= -autoprefixer@^9.4.9, autoprefixer@^9.7.4: +autoprefixer@^9.7.2: + version "9.8.5" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.8.5.tgz#2c225de229ddafe1d1424c02791d0c3e10ccccaa" + integrity sha512-C2p5KkumJlsTHoNv9w31NrBRgXhf6eCMteJuHZi2xhkgC+5Vm40MEtCKPhc0qdgAOhox0YPy1SQHTAky05UoKg== + dependencies: + browserslist "^4.12.0" + caniuse-lite "^1.0.30001097" + colorette "^1.2.0" + normalize-range "^0.1.2" + num2fraction "^1.2.2" + postcss "^7.0.32" + postcss-value-parser "^4.1.0" + +autoprefixer@^9.7.4: version "9.7.4" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.7.4.tgz#f8bf3e06707d047f0641d87aee8cfb174b2a5378" integrity sha512-g0Ya30YrMBAEZk60lp+qfX5YQllG+S5W3GYCFvyHTvhOki0AEQJLPEcIuGRsqVwLi8FvXPVtwTGhfr38hVpm0g== @@ -8033,7 +7641,7 @@ babel-plugin-add-react-displayname@^0.0.5: resolved "https://registry.yarnpkg.com/babel-plugin-add-react-displayname/-/babel-plugin-add-react-displayname-0.0.5.tgz#339d4cddb7b65fd62d1df9db9fe04de134122bd5" integrity sha1-M51M3be2X9YtHfnbn+BN4TQSK9U= -babel-plugin-dynamic-import-node@2.3.0, babel-plugin-dynamic-import-node@^2.3.0: +babel-plugin-dynamic-import-node@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" integrity sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ== @@ -8047,15 +7655,15 @@ babel-plugin-dynamic-import-node@^2.3.3: dependencies: object.assign "^4.1.0" -babel-plugin-emotion@^10.0.14: - version "10.0.16" - resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-10.0.16.tgz#cb306798058b102a634ca80e69b012caa345bb09" - integrity sha512-a01Xrourr/VRpw4KicX9drDwfVGHmw8HmlQk++N4fv0j73EfHKWC1Ah4Vu8s1cTGVvTiwum+UhVpJenV8j03FQ== +babel-plugin-emotion@^10.0.20, babel-plugin-emotion@^10.0.27: + version "10.0.33" + resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-10.0.33.tgz#ce1155dcd1783bbb9286051efee53f4e2be63e03" + integrity sha512-bxZbTTGz0AJQDHm8k6Rf3RQJ8tX2scsfsRyKVgAbiUPUNIRtlK+7JxP+TAd1kRLABFxe0CFm2VdK4ePkoA9FxQ== dependencies: "@babel/helper-module-imports" "^7.0.0" - "@emotion/hash" "0.7.2" - "@emotion/memoize" "0.7.2" - "@emotion/serialize" "^0.11.9" + "@emotion/hash" "0.8.0" + "@emotion/memoize" "0.7.4" + "@emotion/serialize" "^0.11.16" babel-plugin-macros "^2.0.0" babel-plugin-syntax-jsx "^6.18.0" convert-source-map "^1.5.0" @@ -8063,7 +7671,7 @@ babel-plugin-emotion@^10.0.14: find-root "^1.1.0" source-map "^0.5.7" -babel-plugin-emotion@^10.0.22, babel-plugin-emotion@^10.0.23: +babel-plugin-emotion@^10.0.22: version "10.0.23" resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-10.0.23.tgz#040d40bf61dcab6d31dd6043d10e180240b8515b" integrity sha512-1JiCyXU0t5S2xCbItejCduLGGcKmF3POT0Ujbexog2MI4IlRcIn/kWjkYwCUZlxpON0O5FC635yPl/3slr7cKQ== @@ -8116,16 +7724,7 @@ babel-plugin-jest-hoist@^25.5.0: "@babel/types" "^7.3.3" "@types/babel__traverse" "^7.0.6" -babel-plugin-macros@2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.6.1.tgz#41f7ead616fc36f6a93180e89697f69f51671181" - integrity sha512-6W2nwiXme6j1n2erPOnmRiWfObUhWH7Qw1LMi9XZy8cj+KtESu3T6asZvtk5bMQQjX8te35o7CFueiSdL/2NmQ== - dependencies: - "@babel/runtime" "^7.4.2" - cosmiconfig "^5.2.0" - resolve "^1.10.0" - -babel-plugin-macros@^2.0.0, babel-plugin-macros@^2.4.5: +babel-plugin-macros@^2.0.0: version "2.5.0" resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.5.0.tgz#01f4d3b50ed567a67b80a30b9da066e94f4097b6" integrity sha512-BWw0lD0kVZAXRD3Od1kMrdmfudqzDzYv2qrN3l2ISR1HVp1EgLKfbOrYV9xmY5k3qx3RIu5uPAUZZZHpo0o5Iw== @@ -8133,6 +7732,15 @@ babel-plugin-macros@^2.0.0, babel-plugin-macros@^2.4.5: cosmiconfig "^5.0.5" resolve "^1.8.1" +babel-plugin-macros@^2.7.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz#0f958a7cc6556b1e65344465d99111a1e5e10138" + integrity sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg== + dependencies: + "@babel/runtime" "^7.7.2" + cosmiconfig "^6.0.0" + resolve "^1.12.0" + babel-plugin-minify-builtins@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/babel-plugin-minify-builtins/-/babel-plugin-minify-builtins-0.5.0.tgz#31eb82ed1a0d0efdc31312f93b6e4741ce82c36b" @@ -8212,16 +7820,16 @@ babel-plugin-named-asset-import@^0.3.1: resolved "https://registry.yarnpkg.com/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.3.tgz#9ba2f3ac4dc78b042651654f07e847adfe50667c" integrity sha512-1XDRysF4894BUdMChT+2HHbtJYiO7zx5Be7U6bT8dISy7OdyETMGIAQBMPQCsY1YRf0xcubwnKKaDr5bk15JTA== -babel-plugin-react-docgen@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/babel-plugin-react-docgen/-/babel-plugin-react-docgen-3.1.0.tgz#14b02b363a38cc9e08c871df16960d27ef92030f" - integrity sha512-W6xqZnZIWjZuE9IjP7XolxxgFGB5Y9GZk4cLPSWKa10MrT86q7bX4ke9jbrNhFVIRhbmzL8wE1Sn++mIWoJLbw== +babel-plugin-react-docgen@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/babel-plugin-react-docgen/-/babel-plugin-react-docgen-4.1.0.tgz#1dfa447dac9ca32d625a123df5733a9e47287c26" + integrity sha512-vzpnBlfGv8XOhJM2zbPyyqw2OLEbelgZZsaaRRTpVwNKuYuc+pUg4+dy7i9gCRms0uOQn4osX571HRcCJMJCmA== dependencies: - lodash "^4.17.11" - react-docgen "^4.1.0" + lodash "^4.17.15" + react-docgen "^5.0.0" recast "^0.14.7" -"babel-plugin-require-context-hook@npm:babel-plugin-require-context-hook-babel7@1.0.0": +babel-plugin-require-context-hook@^1.0.0, "babel-plugin-require-context-hook@npm:babel-plugin-require-context-hook-babel7@1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/babel-plugin-require-context-hook-babel7/-/babel-plugin-require-context-hook-babel7-1.0.0.tgz#1273d4cee7e343d0860966653759a45d727e815d" integrity sha512-kez0BAN/cQoyO1Yu1nre1bQSYZEF93Fg7VQiBHFfMWuaZTy7vJSTT4FY68FwHTYG53Nyt0A7vpSObSVxwweQeQ== @@ -8284,11 +7892,6 @@ babel-plugin-transform-property-literals@^6.9.4: dependencies: esutils "^2.0.2" -babel-plugin-transform-react-remove-prop-types@0.4.24: - version "0.4.24" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz#f2edaf9b4c6a5fbe5c1d678bfb531078c1555f3a" - integrity sha512-eqj0hVcJUR57/Ug2zE1Yswsw4LhuqqHhD+8v120T1cl3kjg76QwtyBrdIk4WVwK+lAhBJVYCd/v+4nc4y+8JsA== - babel-plugin-transform-regexp-constructors@^0.4.3: version "0.4.3" resolved "https://registry.yarnpkg.com/babel-plugin-transform-regexp-constructors/-/babel-plugin-transform-regexp-constructors-0.4.3.tgz#58b7775b63afcf33328fae9a5f88fbd4fb0b4965" @@ -8383,28 +7986,6 @@ babel-preset-jest@^25.5.0: babel-plugin-transform-undefined-to-void "^6.9.4" lodash.isplainobject "^4.0.6" -babel-preset-react-app@^9.0.0: - version "9.0.1" - resolved "https://registry.yarnpkg.com/babel-preset-react-app/-/babel-preset-react-app-9.0.1.tgz#16a2cf84363045b530b6a03460527a5c6eac42ba" - integrity sha512-v7MeY+QxdBhM9oU5uOQCIHLsErYkEbbjctXsb10II+KAnttbe0rvprvP785dRxfa9dI4ZbsGXsRU07Qdi5BtOw== - dependencies: - "@babel/core" "7.5.5" - "@babel/plugin-proposal-class-properties" "7.5.5" - "@babel/plugin-proposal-decorators" "7.4.4" - "@babel/plugin-proposal-object-rest-spread" "7.5.5" - "@babel/plugin-syntax-dynamic-import" "7.2.0" - "@babel/plugin-transform-destructuring" "7.5.0" - "@babel/plugin-transform-flow-strip-types" "7.4.4" - "@babel/plugin-transform-react-display-name" "7.2.0" - "@babel/plugin-transform-runtime" "7.5.5" - "@babel/preset-env" "7.5.5" - "@babel/preset-react" "7.0.0" - "@babel/preset-typescript" "7.3.3" - "@babel/runtime" "7.5.5" - babel-plugin-dynamic-import-node "2.3.0" - babel-plugin-macros "2.6.1" - babel-plugin-transform-react-remove-prop-types "0.4.24" - babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" @@ -8413,11 +7994,6 @@ babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.26.0: core-js "^2.4.0" regenerator-runtime "^0.11.0" -babel-standalone@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-standalone/-/babel-standalone-6.26.0.tgz#15fb3d35f2c456695815ebf1ed96fe7f015b6886" - integrity sha1-Ffs9NfLEVmlYFevx7Zb+fwFbaIY= - babel-template@^6.16.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" @@ -8829,21 +8405,7 @@ boxen@^1.2.1, boxen@^1.2.2: term-size "^1.2.0" widest-line "^2.0.0" -boxen@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/boxen/-/boxen-3.2.0.tgz#fbdff0de93636ab4450886b6ff45b92d098f45eb" - integrity sha512-cU4J/+NodM3IHdSL2yN8bqYqnmlBTidDR4RC7nJs61ZmtGz8VZzM3HLQX0zY5mrSmPtR3xWwsq2jOUQqFZN8+A== - dependencies: - ansi-align "^3.0.0" - camelcase "^5.3.1" - chalk "^2.4.2" - cli-boxes "^2.2.0" - string-width "^3.0.0" - term-size "^1.2.0" - type-fest "^0.3.0" - widest-line "^2.0.0" - -boxen@^4.2.0: +boxen@^4.1.0, boxen@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/boxen/-/boxen-4.2.0.tgz#e411b62357d6d6d36587c8ac3d5d974daa070e64" integrity sha512-eB4uT9RGzg2odpER62bBwSLvUeGC+WbRjjyyFhGsKnc8wp/m0+hQsMUvUe3H2V0D5vw0nBdO1hCJoZo5mKeuIQ== @@ -9047,7 +8609,7 @@ browserslist@^4.12.0: node-releases "^1.1.53" pkg-up "^2.0.0" -browserslist@^4.6.0, browserslist@^4.6.6, browserslist@^4.8.3: +browserslist@^4.6.6, browserslist@^4.8.3: version "4.8.5" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.8.5.tgz#691af4e327ac877b25e7a3f7ee869c4ef36cdea3" integrity sha512-4LMHuicxkabIB+n9874jZX/az1IaZ5a+EUuvD7KFOu9x/Bd5YHyO0DIz2ls/Kl8g0ItS4X/ilEgf4T1Br0lgSg== @@ -9497,6 +9059,11 @@ caniuse-lite@^1.0.30000984, caniuse-lite@^1.0.30001020, caniuse-lite@^1.0.300010 resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001094.tgz#0b11d02e1cdc201348dbd8e3e57bd9b6ce82b175" integrity sha512-ufHZNtMaDEuRBpTbqD93tIQnngmJ+oBknjvr0IbFympSdtFpAUFmNv4mVKbb53qltxFx0nK3iy32S9AqkLzUNA== +caniuse-lite@^1.0.30001097: + version "1.0.30001107" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001107.tgz#809360df7a5b3458f627aa46b0f6ed6d5239da9a" + integrity sha512-86rCH+G8onCmdN4VZzJet5uPELII59cUzDphko3thQFgAQG1RNa+sVLDoALIhRYmflo5iSIzWY3vu1XTWtNMQQ== + canvas@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/canvas/-/canvas-2.6.1.tgz#0d087dd4d60f5a5a9efa202757270abea8bef89e" @@ -10377,6 +9944,11 @@ color@3.0.x: color-convert "^1.9.1" color-string "^1.5.2" +colorette@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b" + integrity sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw== + colornames@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/colornames/-/colornames-1.1.1.tgz#f8889030685c7c4ff9e2a559f5077eb76a816f96" @@ -10493,7 +10065,7 @@ commander@~2.8.1: dependencies: graceful-readlink ">= 1.0.0" -common-tags@1.8.0, common-tags@^1.8.0: +common-tags@1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.0.tgz#8e3153e542d4a39e9b10554434afaaf98956a937" integrity sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw== @@ -10887,15 +10459,6 @@ copy-webpack-plugin@^6.0.2: serialize-javascript "^3.1.0" webpack-sources "^1.4.3" -core-js-compat@^3.1.1: - version "3.1.3" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.1.3.tgz#0cc3ba4c7f62928c2837e1cffbe8dc78b4f1ae14" - integrity sha512-EP018pVhgwsKHz3YoN1hTq49aRe+h017Kjz0NQz3nXV0cCRMvH3fLQl+vEPGr4r4J5sk4sU3tUC7U1aqTCeJeA== - dependencies: - browserslist "^4.6.0" - core-js-pure "3.1.3" - semver "^6.1.0" - core-js-compat@^3.6.2: version "3.6.4" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.4.tgz#938476569ebb6cda80d339bcf199fae4f16fff17" @@ -10904,11 +10467,6 @@ core-js-compat@^3.6.2: browserslist "^4.8.3" semver "7.0.0" -core-js-pure@3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.1.3.tgz#4c90752d5b9471f641514f3728f51c1e0783d0b5" - integrity sha512-k3JWTrcQBKqjkjI0bkfXS0lbpWPxYuHWfMMjC1VDmzU4Q58IwSbuXSo99YO/hUHlw/EB4AlfA2PVxOGkrIq6dA== - core-js-pure@^3.0.1: version "3.2.1" resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.2.1.tgz#879a23699cff46175bfd2d09158b5c50645a3c45" @@ -10924,7 +10482,7 @@ core-js@^2.4.0, core-js@^2.5.0, core-js@^2.5.1, core-js@^2.5.3, core-js@^2.6.5, resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2" integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A== -core-js@^3.0.1, core-js@^3.0.4, core-js@^3.4.1, core-js@^3.6.4: +core-js@^3.0.1, core-js@^3.0.4, core-js@^3.6.4: version "3.6.4" resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.4.tgz#440a83536b458114b9cb2ac1580ba377dc470647" integrity sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw== @@ -10980,6 +10538,17 @@ cosmiconfig@^5.2.0, cosmiconfig@^5.2.1: js-yaml "^3.13.1" parse-json "^4.0.0" +cosmiconfig@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982" + integrity sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg== + dependencies: + "@types/parse-json" "^4.0.0" + import-fresh "^3.1.0" + parse-json "^5.0.0" + path-type "^4.0.0" + yaml "^1.7.2" + cp-file@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/cp-file/-/cp-file-7.0.0.tgz#b9454cfd07fe3b974ab9ea0e5f29655791a9b8cd" @@ -11073,14 +10642,6 @@ create-react-class@^15.5.2: loose-envify "^1.3.1" object-assign "^4.1.1" -create-react-context@<=0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/create-react-context/-/create-react-context-0.2.2.tgz#9836542f9aaa22868cd7d4a6f82667df38019dca" - integrity sha512-KkpaLARMhsTsgp0d2NA/R94F/eDLbhXERdIq3LvX2biCAXcDvHYoOqHfWCHf1+OLj+HKBotLG3KqaOOf+C1C+A== - dependencies: - fbjs "^0.8.0" - gud "^1.0.0" - create-react-context@^0.1.5: version "0.1.6" resolved "https://registry.yarnpkg.com/create-react-context/-/create-react-context-0.1.6.tgz#0f425931d907741127acc6e31acb4f9015dd9fdc" @@ -12498,13 +12059,6 @@ dom-converter@~0.2: resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.3.1.tgz#fc1a4e15ffdf60ddde03a480a9c0fece821dd4a6" integrity sha512-2Sm+JaYn74OiTM2wHvxJOo3roiq/h25Yi69Fqk269cNUwIXsCvATB6CRSFC9Am/20G2b28hGv/+7NiWydIrPvg== -dom-helpers@^3.3.1: - version "3.4.0" - resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.4.0.tgz#e9b369700f959f62ecde5a6babde4bccd9169af8" - integrity sha512-LnuPJ+dwqKDIyotW1VzmOZ5TONUN7CwkCR5hrgawTUbkBGYdeoNLZo6nNfGkCrjtE1nXXaj7iMMpDa8/d9WoIA== - dependencies: - "@babel/runtime" "^7.1.2" - dom-helpers@^5.0.0: version "5.1.3" resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-5.1.3.tgz#7233248eb3a2d1f74aafca31e52c5299cc8ce821" @@ -12513,6 +12067,14 @@ dom-helpers@^5.0.0: "@babel/runtime" "^7.6.3" csstype "^2.6.7" +dom-helpers@^5.0.1: + version "5.1.4" + resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-5.1.4.tgz#4609680ab5c79a45f2531441f1949b79d6587f4b" + integrity sha512-TjMyeVUvNEnOnhzs6uAn9Ya47GmMo3qq7m+Lr/3ON0Rs5kHvb8I+SQYjLUSYn7qhEm0QjW0yrBkvz9yOrwwz1A== + dependencies: + "@babel/runtime" "^7.8.7" + csstype "^2.6.7" + dom-serializer@0, dom-serializer@~0.1.0, dom-serializer@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.1.tgz#1ec4059e284babed36eec2941d4a970a189ce7c0" @@ -12793,10 +12355,10 @@ ejs@^2.2.4, ejs@^2.3.1: resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.7.tgz#cc872c168880ae3c7189762fd5ffc00896c9518a" integrity sha1-zIcsFoiArjxxiXYv1f/ACJbJUYo= -ejs@^2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.6.1.tgz#498ec0d495655abc6f23cd61868d926464071aa0" - integrity sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ== +ejs@^2.7.4: + version "2.7.4" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.7.4.tgz#48661287573dcc53e366c7a1ae52c3a120eec9ba" + integrity sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA== ejs@^3.0.1: version "3.0.2" @@ -12944,13 +12506,13 @@ emojis-list@^3.0.0: resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78" integrity sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q== -emotion-theming@^10.0.14: - version "10.0.19" - resolved "https://registry.yarnpkg.com/emotion-theming/-/emotion-theming-10.0.19.tgz#66d13db74fccaefad71ba57c915b306cf2250295" - integrity sha512-dQRBPLAAQ6eA8JKhkLCIWC8fdjPbiNC1zNTdFF292h9amhZXofcNGUP7axHoHX4XesqQESYwZrXp53OPInMrKw== +emotion-theming@^10.0.19: + version "10.0.27" + resolved "https://registry.yarnpkg.com/emotion-theming/-/emotion-theming-10.0.27.tgz#1887baaec15199862c89b1b984b79806f2b9ab10" + integrity sha512-MlF1yu/gYh8u+sLUqA0YuA9JX0P4Hb69WlKc/9OLo+WCXuX6sy/KoIa+qJimgmr2dWqnypYKYPX37esjDBbhdw== dependencies: "@babel/runtime" "^7.5.5" - "@emotion/weak-memoize" "0.2.4" + "@emotion/weak-memoize" "0.2.5" hoist-non-react-statics "^3.3.0" enabled@1.0.x: @@ -13160,7 +12722,7 @@ error@^7.0.0, error@^7.0.2: string-template "~0.2.1" xtend "~4.0.0" -es-abstract@^1.10.0, es-abstract@^1.11.0, es-abstract@^1.13.0, es-abstract@^1.14.2, es-abstract@^1.4.3, es-abstract@^1.5.0, es-abstract@^1.5.1, es-abstract@^1.7.0, es-abstract@^1.9.0: +es-abstract@^1.10.0, es-abstract@^1.13.0, es-abstract@^1.4.3, es-abstract@^1.5.0, es-abstract@^1.5.1, es-abstract@^1.7.0, es-abstract@^1.9.0: version "1.17.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.0.tgz#f42a517d0036a5591dbb2c463591dc8bb50309b1" integrity sha512-yYkE07YF+6SIBmg1MsJ9dlub5L48Ek7X0qz+c/CPCHS9EBXfESorzng4cJQjJW5/pB6vDF41u7F8vUhLVDqIug== @@ -13211,7 +12773,12 @@ es-abstract@^1.17.0-next.1: string.prototype.trimleft "^2.1.1" string.prototype.trimright "^2.1.1" -es-get-iterator@^1.1.0: +es-array-method-boxes-properly@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz#873f3e84418de4ee19c5be752990b2e44718d09e" + integrity sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA== + +es-get-iterator@^1.0.2, es-get-iterator@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/es-get-iterator/-/es-get-iterator-1.1.0.tgz#bb98ad9d6d63b31aacdc8f89d5d0ee57bcb5b4c8" integrity sha512-UfrmHuWQlNMTs35e1ypnvikg6jCz3SK8v8ImvmDsh36fCVUR1MqoFDiyn0/k52C8NqO3YsO8Oe0azeesNuqSsQ== @@ -13250,10 +12817,10 @@ es5-ext@^0.10.45, es5-ext@~0.10.2, es5-ext@~0.10.46: es6-symbol "~3.1.1" next-tick "1" -es5-shim@^4.5.10: - version "4.5.12" - resolved "https://registry.yarnpkg.com/es5-shim/-/es5-shim-4.5.12.tgz#508c13dda1c87dd3df1b50e69e7b96b82149b649" - integrity sha512-MjoCAHE6P2Dirme70Cxd9i2Ng8rhXiaVSsxDWdSwimfLERJL/ypR2ed2rTYkeeYrMk8gq281dzKLiGcdrmc8qg== +es5-shim@^4.5.13: + version "4.5.14" + resolved "https://registry.yarnpkg.com/es5-shim/-/es5-shim-4.5.14.tgz#90009e1019d0ea327447cb523deaff8fe45697ef" + integrity sha512-7SwlpL+2JpymWTt8sNLuC2zdhhc+wrfe5cMPI2j0o6WsPdfAiPwmFy2f0AocPB4RQVBOZ9kNTgi5YF7TdhkvEg== es6-error@^4.0.1: version "4.1.1" @@ -13314,10 +12881,10 @@ es6-set@^0.1.5, es6-set@~0.1.5: es6-symbol "3.1.1" event-emitter "~0.3.5" -es6-shim@^0.35.3: - version "0.35.4" - resolved "https://registry.yarnpkg.com/es6-shim/-/es6-shim-0.35.4.tgz#8d5a4109756383d3f0323421089c423acf8378f1" - integrity sha512-oJidbXjN/VWXZJs41E9JEqWzcFbjt43JupimIoVX82Thzt5qy1CiYezdhRmWkj3KOuwJ106IG/ZZrcFC6fgIUQ== +es6-shim@^0.35.5: + version "0.35.5" + resolved "https://registry.yarnpkg.com/es6-shim/-/es6-shim-0.35.5.tgz#46f59dc0a84a1c5029e8ff1166ca0a902077a9ab" + integrity sha512-E9kK/bjtCQRpN1K28Xh4BlmP8egvZBGJJ+9GtnzOwt7mdqtrjHFuVGr7QJfdjBIKqrlU5duPf3pCBoDrkjVYFg== es6-symbol@3.1.1, es6-symbol@^3.1.1, es6-symbol@~3.1.1: version "3.1.1" @@ -14378,6 +13945,13 @@ fastq@^1.6.0: dependencies: reusify "^1.0.0" +fault@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/fault/-/fault-1.0.4.tgz#eafcfc0a6d214fc94601e170df29954a4f842f13" + integrity sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA== + dependencies: + format "^0.2.0" + faye-websocket@^0.10.0, faye-websocket@~0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.10.0.tgz#4e492f8d04dfb6f89003507f6edbf2d501e7c6f4" @@ -14515,14 +14089,6 @@ file-loader@4.2.0, file-loader@^4.2.0: loader-utils "^1.2.3" schema-utils "^2.0.0" -file-loader@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-3.0.1.tgz#f8e0ba0b599918b51adfe45d66d1e771ad560faa" - integrity sha512-4sNIOXgtH/9WZq4NvlfU3Opn5ynUsqBwSLyM+I7UOwdGigTBYfVVQEwe/msZNX/j4pCJTIM14Fsw66Svo1oVrw== - dependencies: - loader-utils "^1.0.2" - schema-utils "^1.0.0" - file-saver@^1.3.8: version "1.3.8" resolved "https://registry.yarnpkg.com/file-saver/-/file-saver-1.3.8.tgz#e68a30c7cb044e2fb362b428469feb291c2e09d8" @@ -14856,10 +14422,10 @@ focus-lock@^0.5.2: resolved "https://registry.yarnpkg.com/focus-lock/-/focus-lock-0.5.4.tgz#537644d61b9e90fd97075aa680b8add1de24e819" integrity sha512-A9ngdb0NyI6UygBQ0eD+p8SpLWTkdEDn67I3EGUUcDUfxH694mLA/xBWwhWhoj/2YLtsv2EoQdAx9UOKs8d/ZQ== -focus-lock@^0.6.3: - version "0.6.5" - resolved "https://registry.yarnpkg.com/focus-lock/-/focus-lock-0.6.5.tgz#f6eb37832a9b1b205406175f5277396a28c0fce1" - integrity sha512-i/mVBOoa9o+tl+u9owOJUF8k8L85odZNIsctB+JAK2HFT8jckiBwmk+3uydlm6FN8czgnkIwQtBv6yyAbrzXjw== +focus-lock@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/focus-lock/-/focus-lock-0.7.0.tgz#b2bfb0ca7beacc8710a1ff74275fe0dc60a1d88a" + integrity sha512-LI7v2mH02R55SekHYdv9pRHR9RajVNyIJ2N5IEkWbg7FT5ZmJ9Hw4mWxHeEUcd+dJo0QmzztHvDvWcc7prVFsw== focus-trap-react@^3.0.4, focus-trap-react@^3.1.1: version "3.1.2" @@ -15025,6 +14591,11 @@ form-data@~2.1.1: combined-stream "^1.0.5" mime-types "^2.1.12" +format@^0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b" + integrity sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs= + formidable@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.1.1.tgz#96b8886f7c3c3508b932d6bd70c4d3a88f35f1a9" @@ -15254,10 +14825,10 @@ functions-have-names@^1.2.0: resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.0.tgz#83da7583e4ea0c9ac5ff530f73394b033e0bf77d" integrity sha512-zKXyzksTeaCSw5wIX79iCA40YAa6CJMJgNg9wdkU/ERBrIdPSimPICYiLp65lRbSBqtiHql/HZfS2DyI/AH6tQ== -fuse.js@^3.4.4: - version "3.4.5" - resolved "https://registry.yarnpkg.com/fuse.js/-/fuse.js-3.4.5.tgz#8954fb43f9729bd5dbcb8c08f251db552595a7a6" - integrity sha512-s9PGTaQIkT69HaeoTVjwGsLfb8V8ScJLx5XGFcKHg0MqLUH/UZ4EKOtqtXX9k7AFqCGxD1aJmYb8Q5VYDibVRQ== +fuse.js@^3.4.6: + version "3.6.1" + resolved "https://registry.yarnpkg.com/fuse.js/-/fuse.js-3.6.1.tgz#7de85fdd6e1b3377c23ce010892656385fd9b10c" + integrity sha512-hT9yh/tiinkmirKrlv4KWOjztdoZo1mx9Qh4KvWqC7isoXwdUY3PNWUxceF4/qO9R6riA2C29jdTOeQOIROjgw== gauge@~1.2.5: version "1.2.7" @@ -15487,6 +15058,14 @@ gh-got@^5.0.0: got "^6.2.0" is-plain-obj "^1.1.0" +gifwrap@^0.9.2: + version "0.9.2" + resolved "https://registry.yarnpkg.com/gifwrap/-/gifwrap-0.9.2.tgz#348e286e67d7cf57942172e1e6f05a71cee78489" + integrity sha512-fcIswrPaiCDAyO8xnWvHSZdWChjKXUanKKpAiWWJ/UTkEi/aYKn5+90e7DE820zbEaVR9CE2y4z9bzhQijZ0BA== + dependencies: + image-q "^1.1.1" + omggif "^1.0.10" + git-clone@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/git-clone/-/git-clone-0.1.0.tgz#0d76163778093aef7f1c30238f2a9ef3f07a2eb9" @@ -15541,6 +15120,21 @@ glob-all@^3.1.0, glob-all@^3.2.1: glob "^7.1.2" yargs "^15.3.1" +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + integrity sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q= + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + integrity sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg= + dependencies: + is-glob "^2.0.0" + glob-parent@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" @@ -15762,6 +15356,13 @@ globals@^9.18.0, globals@^9.2.0: resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== +globalthis@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.1.tgz#40116f5d9c071f9e8fb0037654df1ab3a83b7ef9" + integrity sha512-mJPRTc/P39NH/iNG4mXa9aIhNymaQikTrnspeCa2ZuJ+mH2QN/rXwtX3XwKrHqWgUQFbNZKtHM105aHzJalElw== + dependencies: + define-properties "^1.1.3" + globby@8.0.2, globby@^8.0.1: version "8.0.2" resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.2.tgz#5697619ccd95c5275dbb2d6faa42087c1a941d8d" @@ -16825,7 +16426,7 @@ hawk@~6.0.2: hoek "4.x.x" sntp "2.x.x" -he@1.2.0, he@1.2.x, he@^1.1.1, he@^1.2.0: +he@1.2.0, he@1.2.x, he@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== @@ -16862,6 +16463,11 @@ highlight.js@^9.12.0, highlight.js@~9.12.0: resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e" integrity sha1-5tnb5Xy+/mB1HwKvM2GVhwyQwB4= +highlight.js@~9.13.0: + version "9.13.1" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.13.1.tgz#054586d53a6863311168488a0f58d6c505ce641e" + integrity sha512-Sc28JNQNDzaH6PORtRLMvif9RSn1mYuOoX3omVjnb0+HbpPygU2ALBI0R/wsiqCb4/fcp07Gdo8g+fhtFrQl6A== + history-extra@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/history-extra/-/history-extra-5.0.1.tgz#95a2e59dda526c4241d0ae1b124a77a5e4675ce8" @@ -17368,6 +16974,11 @@ ignore@^5.1.1, ignore@^5.1.4: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== +image-q@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/image-q/-/image-q-1.1.1.tgz#fc84099664460b90ca862d9300b6bfbbbfbf8056" + integrity sha1-/IQJlmRGC5DKhi2TALa/u7+/gFY= + image-size@^0.8.2: version "0.8.3" resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.8.3.tgz#f0b568857e034f29baffd37013587f2c0cad8b46" @@ -17395,11 +17006,6 @@ immer@^1.5.0: resolved "https://registry.yarnpkg.com/immer/-/immer-1.12.1.tgz#40c6e5b292c00560836c2993bda3a24379d466f5" integrity sha512-3fmKM6ovaqDt0CdC9daXpNi5x/YCYS3i4cwLdTVkhJdk5jrDXoPs7lCm3IqM3yhfSnz4tjjxbRG2CziQ7m8ztg== -immutable@^4.0.0-rc.9: - version "4.0.0-rc.12" - resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.0.0-rc.12.tgz#ca59a7e4c19ae8d9bf74a97bdf0f6e2f2a5d0217" - integrity sha512-0M2XxkZLx/mi3t8NVwIm1g8nHoEmM9p9UBl/G9k4+hm0kBgOVdMV/B3CY5dQ8qG8qc80NN4gDV4HQv6FTJ5q7A== - import-cwd@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9" @@ -17423,6 +17029,14 @@ import-fresh@^3.0.0: parent-module "^1.0.0" resolve-from "^4.0.0" +import-fresh@^3.1.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" + integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + import-from@2.1.0, import-from@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-from/-/import-from-2.1.0.tgz#335db7f2a7affd53aaa471d4b8021dee36b7f3b1" @@ -17704,25 +17318,6 @@ inquirer@^6.0.0: strip-ansi "^4.0.0" through "^2.3.6" -inquirer@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.0.tgz#51adcd776f661369dc1e894859c2560a224abdd8" - integrity sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg== - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^3.0.0" - figures "^2.0.0" - lodash "^4.17.10" - mute-stream "0.0.7" - run-async "^2.2.0" - rxjs "^6.1.0" - string-width "^2.1.0" - strip-ansi "^4.0.0" - through "^2.3.6" - inquirer@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.0.0.tgz#9e2b032dde77da1db5db804758b8fea3a970519a" @@ -17798,11 +17393,16 @@ internal-slot@^1.0.2: has "^1.0.3" side-channel "^1.0.2" -interpret@1.2.0, interpret@^1.0.0, interpret@^1.1.0, interpret@^1.2.0: +interpret@1.2.0, interpret@^1.0.0, interpret@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" integrity sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw== +interpret@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" + integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== + intl-format-cache@^2.0.5, intl-format-cache@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/intl-format-cache/-/intl-format-cache-2.1.0.tgz#04a369fecbfad6da6005bae1f14333332dcf9316" @@ -18092,6 +17692,11 @@ is-docker@^1.0.0: resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-1.1.0.tgz#f04374d4eee5310e9a8e113bf1495411e46176a1" integrity sha1-8EN01O7lMQ6ajhE78UlUEeRhdqE= +is-docker@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.0.0.tgz#2cb0df0e75e2d064fe1864c37cdeacb7b2dcf25b" + integrity sha512-pJEdRugimx4fBMra5z2/5iRdZ63OhYV0vr0Dwm5+xtW4D1FvRkB8hamMIhnWfyJeDdyr/aa7BDyNbtG38VxgoQ== + is-dom@^1.0.9: version "1.0.9" resolved "https://registry.yarnpkg.com/is-dom/-/is-dom-1.0.9.tgz#483832d52972073de12b9fe3f60320870da8370d" @@ -18535,6 +18140,13 @@ is-symbol@^1.0.2: dependencies: has-symbols "^1.0.0" +is-symbol@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" + integrity sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== + dependencies: + has-symbols "^1.0.1" + is-typed-array@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.3.tgz#a4ff5a5e672e1a55f99c7f54e59597af5c1df04d" @@ -18844,6 +18456,19 @@ iterall@^1.2.2: resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.3.0.tgz#afcb08492e2915cbd8a0884eb93a8c94d0d72fea" integrity sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg== +iterate-iterator@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/iterate-iterator/-/iterate-iterator-1.0.1.tgz#1693a768c1ddd79c969051459453f082fe82e9f6" + integrity sha512-3Q6tudGN05kbkDQDI4CqjaBf4qf85w6W6GnuZDtUVYwKgtC1q8yxYX7CZed7N+tLzQqS6roujWvszf13T+n9aw== + +iterate-value@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/iterate-value/-/iterate-value-1.0.2.tgz#935115bd37d006a52046535ebc8d07e9c9337f57" + integrity sha512-A6fMAio4D2ot2r/TYzr4yUWrmwNdsN5xL7+HUiyACE4DXm+q8HtPcnFTp+NnW3k4N05tZ7FVYFFb2CR13NxyHQ== + dependencies: + es-get-iterator "^1.0.2" + iterate-iterator "^1.0.1" + jest-canvas-mock@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/jest-canvas-mock/-/jest-canvas-mock-2.2.0.tgz#45fbc58589c6ce9df50dc90bd8adce747cbdada7" @@ -18929,7 +18554,7 @@ jest-config@^25.5.4: pretty-format "^25.5.0" realpath-native "^2.0.0" -jest-diff@^24.9.0: +jest-diff@^24.3.0, jest-diff@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ== @@ -19398,16 +19023,15 @@ jest@^25.5.4: import-local "^3.0.2" jest-cli "^25.5.4" -jimp@^0.9.6: - version "0.9.6" - resolved "https://registry.yarnpkg.com/jimp/-/jimp-0.9.6.tgz#abf381daf193a4fa335cb4ee0e22948049251eb9" - integrity sha512-DBDHYeNVqVpoPkcvo0PKTNGvD+i7NYvkKTsl0I3k7ql36uN8wGTptRg0HtgQyYE/bhGSLI6Lq5qLwewaOPXNfg== +jimp@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/jimp/-/jimp-0.14.0.tgz#fde55f69bdb918c1b01ac633d89a25853af85625" + integrity sha512-8BXU+J8+SPmwwyq9ELihpSV4dWPTiOKBWCEgtkbnxxAVMjXdf3yGmyaLSshBfXc8sP/JQ9OZj5R8nZzz2wPXgA== dependencies: "@babel/runtime" "^7.7.2" - "@jimp/custom" "^0.9.6" - "@jimp/plugins" "^0.9.6" - "@jimp/types" "^0.9.6" - core-js "^3.4.1" + "@jimp/custom" "^0.14.0" + "@jimp/plugins" "^0.14.0" + "@jimp/types" "^0.14.0" regenerator-runtime "^0.13.3" jit-grunt@0.10.0: @@ -19429,10 +19053,10 @@ joi@13.x.x, joi@^13.5.2: isemail "3.x.x" topo "3.x.x" -jpeg-js@^0.3.4: - version "0.3.4" - resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.3.4.tgz#dc2ba501ee3d58b7bb893c5d1fab47294917e7e7" - integrity sha512-6IzjQxvnlT8UlklNmDXIJMWxijULjqGrzgqc0OG7YadZdvm7KPQ1j0ehmQQHckgEWOfgpptzcnWgESovxudpTA== +jpeg-js@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.4.1.tgz#937a3ae911eb6427f151760f8123f04c8bfe6ef7" + integrity sha512-jA55yJiB5tCXEddos8JBbvW+IMrqY0y1tjjx9KNVtA+QPmu7ND5j0zkKopClpUTsaETL135uOM2XfcYG4XRjmw== jquery@^3.5.0: version "3.5.0" @@ -19449,11 +19073,6 @@ js-cookie@^2.2.1: resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8" integrity sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ== -js-levenshtein@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.3.tgz#3ef627df48ec8cf24bacf05c0f184ff30ef413c5" - integrity sha512-/812MXr9RBtMObviZ8gQBhHO8MOrGj8HlEE+4ccMTElNA/6I3u39u+bhny55Lk921yn44nSZFy9naNLElL5wgQ== - js-levenshtein@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" @@ -19623,7 +19242,7 @@ json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: dependencies: jsonify "~0.0.0" -json-stringify-pretty-compact@1.2.0, json-stringify-pretty-compact@^1.0.1: +json-stringify-pretty-compact@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/json-stringify-pretty-compact/-/json-stringify-pretty-compact-1.2.0.tgz#0bc316b5e6831c07041fc35612487fb4e9ab98b8" integrity sha512-/11Pj1OyX814QMKO7K8l85SHPTr/KsFxHp8GE2zVa0BtJgGimDjXHfM3FhC7keQdWDea7+nXf+f1de7ATZcZkQ== @@ -19665,12 +19284,12 @@ json5@^1.0.1: dependencies: minimist "^1.2.0" -json5@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" - integrity sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ== +json5@^2.1.1: + version "2.1.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43" + integrity sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA== dependencies: - minimist "^1.2.0" + minimist "^1.2.5" json5@^2.1.2: version "2.1.2" @@ -19817,15 +19436,6 @@ jsx-ast-utils@^2.4.1: array-includes "^3.1.1" object.assign "^4.1.0" -jsx-to-string@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/jsx-to-string/-/jsx-to-string-1.4.0.tgz#66dc34d773dab9f40fe993cff9940e5da655b705" - integrity sha1-Ztw013PaufQP6ZPP+ZQOXaZVtwU= - dependencies: - immutable "^4.0.0-rc.9" - json-stringify-pretty-compact "^1.0.1" - react "^0.14.0" - jszip@^3.2.2: version "3.3.0" resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.3.0.tgz#29d72c21a54990fa885b11fc843db320640d5271" @@ -20737,16 +20347,16 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@4.17.11, lodash@4.17.15, lodash@>4.17.4, lodash@^4, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.10.0, lodash@^4.11.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@~4.17.10, lodash@~4.17.15, lodash@~4.17.5: - version "4.17.15" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" - integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== - -lodash@4.17.19, lodash@^4.17.16: +lodash@4.17.11, lodash@4.17.19, lodash@>4.17.4, lodash@^4, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.10.0, lodash@^4.11.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.16, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@~4.17.10, lodash@~4.17.15, lodash@~4.17.5: version "4.17.19" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== +lodash@4.17.15: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + lodash@^3.10.1: version "3.10.1" resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" @@ -20916,6 +20526,14 @@ lowercase-keys@^2.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== +lowlight@~1.11.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/lowlight/-/lowlight-1.11.0.tgz#1304d83005126d4e8b1dc0f07981e9b689ec2efc" + integrity sha512-xrGGN6XLL7MbTMdPD6NfWPwY43SNkjf/d0mecSx/CW36fUZTjRHEq0/Cdug3TWKtRXLWi7iMl1eP0olYxj/a4A== + dependencies: + fault "^1.0.2" + highlight.js "~9.13.0" + lowlight@~1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/lowlight/-/lowlight-1.9.1.tgz#ed7c3dffc36f8c1f263735c0fe0c907847c11250" @@ -21144,27 +20762,27 @@ markdown-it@^10.0.0: mdurl "^1.0.1" uc.micro "^1.0.5" -markdown-to-jsx@^6.9.1, markdown-to-jsx@^6.9.3: - version "6.11.0" - resolved "https://registry.yarnpkg.com/markdown-to-jsx/-/markdown-to-jsx-6.11.0.tgz#a2e3f2bc781c3402d8bb0f8e0a12a186474623b0" - integrity sha512-RH7LCJQ4RFmPqVeZEesKaO1biRzB/k4utoofmTCp3Eiw6D7qfvK8fzZq/2bjEJAtVkfPrM5SMt5APGf2rnaKMg== +markdown-to-jsx@^6.11.4: + version "6.11.4" + resolved "https://registry.yarnpkg.com/markdown-to-jsx/-/markdown-to-jsx-6.11.4.tgz#b4528b1ab668aef7fe61c1535c27e837819392c5" + integrity sha512-3lRCD5Sh+tfA52iGgfs/XZiw33f7fFX9Bn55aNnVNUd2GzLDkOWyKYYD8Yju2B1Vn+feiEdgJs8T6Tg0xNokPw== dependencies: prop-types "^15.6.2" unquote "^1.1.0" -marked@^0.6.2: - version "0.6.3" - resolved "https://registry.yarnpkg.com/marked/-/marked-0.6.3.tgz#79babad78af638ba4d522a9e715cdfdd2429e946" - integrity sha512-Fqa7eq+UaxfMriqzYLayfqAE40WN03jf+zHjT18/uXNuzjq3TY0XTbrAoPeqSJrAmPz11VuUA+kBPYOhHt9oOQ== +marked@^0.3.12: + version "0.3.19" + resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.19.tgz#5d47f709c4c9fc3c216b6d46127280f40b39d790" + integrity sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg== -marksy@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/marksy/-/marksy-7.0.1.tgz#fb26f780ce56bf5ca48fc137efdef1f97dd4c7ef" - integrity sha512-tB4cQxIY7f8PWTcIouJO/V60rl9JVVOmCDjmukYVO7mdpGM1JWl4qIP98iDYItexSXZ0DkEqk6yXFxgdmZRMxA== +marksy@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/marksy/-/marksy-8.0.0.tgz#b595f121fd47058df9dda1448f6ee156ab48810a" + integrity sha512-mmHcKZojCQAGuKTuu3153viXdCuxUmsSxomFaSOBTkOlfWFOZBmDhmJkOp0CsPMNRQ7m6oN2wflvAHLpBNZVPw== dependencies: - babel-standalone "^6.26.0" - he "^1.1.1" - marked "^0.6.2" + "@babel/standalone" "^7.4.5" + he "^1.2.0" + marked "^0.3.12" matchdep@^2.0.0: version "2.0.0" @@ -22978,17 +22596,7 @@ object.entries@^1.1.2: es-abstract "^1.17.5" has "^1.0.3" -object.fromentries@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-1.0.0.tgz#e90ec27445ec6e37f48be9af9077d9aa8bef0d40" - integrity sha512-F7XUm84lg0uNXNzrRAC5q8KJe0yYaxgLU9hTSqWYM6Rfnh0YjP24EG3xq7ncj2Wu1AdfueNHKCOlamIonG4UHQ== - dependencies: - define-properties "^1.1.2" - es-abstract "^1.11.0" - function-bind "^1.1.1" - has "^1.0.1" - -object.fromentries@^2.0.2: +"object.fromentries@^2.0.0 || ^1.0.0", object.fromentries@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.2.tgz#4a09c9b9bb3843dd0f89acdb517a794d4f355ac9" integrity sha512-r3ZiBH7MQppDJVLx6fhD618GKNG40CZYH9wgwdhKxBDDbQgjeWGGd4AtkZad84d291YxvWe7bJGuE65Anh0dxQ== @@ -23029,7 +22637,7 @@ object.reduce@^1.0.0: for-own "^1.0.0" make-iterator "^1.0.0" -object.values@^1.0.4, object.values@^1.1.0, object.values@^1.1.1: +object.values@^1.1.0, object.values@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.1.tgz#68a99ecde356b7e9295a3c5e0ce31dc8c953de5e" integrity sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA== @@ -23061,6 +22669,11 @@ octokit-pagination-methods@^1.1.0: resolved "https://registry.yarnpkg.com/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz#cf472edc9d551055f9ef73f6e42b4dbb4c80bea4" integrity sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ== +omggif@^1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/omggif/-/omggif-1.0.10.tgz#ddaaf90d4a42f532e9e7cb3a95ecdd47f17c7b19" + integrity sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw== + omggif@^1.0.9: version "1.0.9" resolved "https://registry.yarnpkg.com/omggif/-/omggif-1.0.9.tgz#dcb7024dacd50c52b4d303f04802c91c057c765f" @@ -23123,13 +22736,21 @@ onetime@^5.1.0: dependencies: mimic-fn "^2.1.0" -open@^6.1.0, open@^6.3.0: +open@^6.3.0: version "6.4.0" resolved "https://registry.yarnpkg.com/open/-/open-6.4.0.tgz#5c13e96d0dc894686164f18965ecfe889ecfc8a9" integrity sha512-IFenVPgF70fSm1keSd2iDBIDIBZkroLeuffXq+wKTzTJlBpesFWojV9lb8mzOfaAzM1sr7HQHuO0vtV0zYekGg== dependencies: is-wsl "^1.1.0" +open@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/open/-/open-7.1.0.tgz#68865f7d3cb238520fa1225a63cf28bcf8368a1c" + integrity sha512-lLPI5KgOwEYCDKXf4np7y1PBEkj7HYIyP2DY8mVDRnx0VIIu6bNrRB0R66TuO7Mack6EnTNLm4uvcl1UoklTpA== + dependencies: + is-docker "^2.0.0" + is-wsl "^2.1.1" + opener@^1.4.2: version "1.5.1" resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.1.tgz#6d2f0e77f1a0af0032aca716c2c1fbb8e7e8abed" @@ -24188,10 +23809,10 @@ pngjs@^3.0.0: resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.3.1.tgz#8e14e6679ee7424b544334c3b2d21cea6d8c209a" integrity sha512-ggXCTsqHRIsGMkHlCEhbHhUmNTA2r1lpkE0NL4Q9S8spkXbm4vE9TVmPso2AGYn90Gltdz8W5CyzhcIGg2Gejg== -pnp-webpack-plugin@1.4.3: - version "1.4.3" - resolved "https://registry.yarnpkg.com/pnp-webpack-plugin/-/pnp-webpack-plugin-1.4.3.tgz#0a100b63f4a1d09cee6ee55a87393b69f03ab5c7" - integrity sha512-ExrNwuFH3DudHwWY2uRMqyiCOBEDdhQYHIAsqW/CM6hIZlSgXC/ma/p08FoNOUhVyh9hl1NGnMpR94T5i3SHaQ== +pnp-webpack-plugin@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/pnp-webpack-plugin/-/pnp-webpack-plugin-1.5.0.tgz#62a1cd3068f46d564bb33c56eb250e4d586676eb" + integrity sha512-jd9olUr9D7do+RN8Wspzhpxhgp1n6Vd0NtQ4SFkmIACZoEL1nkyAdW9Ygrinjec0vgDcWjscFQQ1gDW8rsfKTg== dependencies: ts-pnp "^1.1.2" @@ -24334,6 +23955,11 @@ postcss-value-parser@^4.0.2: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.2.tgz#482282c09a42706d1fc9a069b73f44ec08391dc9" integrity sha512-LmeoohTpp/K4UiyQCwuGWlONxXamGzCMtFxLq4W1nZVGIQLYvMCJx3yAF9qyyuFpflABI9yVdtJAqbihOsCsJQ== +postcss-value-parser@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz#443f6a20ced6481a2bda4fa8532a6e55d789a2cb" + integrity sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ== + postcss-values-parser@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/postcss-values-parser/-/postcss-values-parser-1.5.0.tgz#5d9fa63e2bcb0179ce48f3235303765eb89f3047" @@ -24361,6 +23987,15 @@ postcss@^7.0.0, postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.2, postcss@^7.0.2 source-map "^0.6.1" supports-color "^6.1.0" +postcss@^7.0.32: + version "7.0.32" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.32.tgz#4310d6ee347053da3433db2be492883d62cec59d" + integrity sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw== + dependencies: + chalk "^2.4.2" + source-map "^0.6.1" + supports-color "^6.1.0" + potpack@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/potpack/-/potpack-1.0.1.tgz#d1b1afd89e4c8f7762865ec30bd112ab767e2ebf" @@ -24543,6 +24178,17 @@ promise-polyfill@^8.1.3: resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-8.1.3.tgz#8c99b3cf53f3a91c68226ffde7bde81d7f904116" integrity sha512-MG5r82wBzh7pSKDRa9y+vllNHz3e3d4CNj1PQE4BQYxLme0gKYYBm9YENq+UkEikyZ0XbiGWxYlVw3Rl9O/U8g== +promise.allsettled@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/promise.allsettled/-/promise.allsettled-1.0.2.tgz#d66f78fbb600e83e863d893e98b3d4376a9c47c9" + integrity sha512-UpcYW5S1RaNKT6pd+s9jp9K9rlQge1UXKskec0j6Mmuq7UJCvlS2J2/s/yuPN8ehftf9HXMxWlKiPbGGUzpoRg== + dependencies: + array.prototype.map "^1.0.1" + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + function-bind "^1.1.1" + iterate-value "^1.0.0" + promise.prototype.finally@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/promise.prototype.finally/-/promise.prototype.finally-3.1.0.tgz#66f161b1643636e50e7cf201dc1b84a857f3864e" @@ -25108,14 +24754,6 @@ raw-loader@3.1.0, raw-loader@^3.1.0: loader-utils "^1.1.0" schema-utils "^2.0.1" -raw-loader@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-2.0.0.tgz#e2813d9e1e3f80d1bbade5ad082e809679e20c26" - integrity sha512-kZnO5MoIyrojfrPWqrhFNLZemIAX8edMOCp++yC5RKxzFB3m92DqKNhKlU6+FvpOhWtvyh3jOaD7J6/9tpdIKg== - dependencies: - loader-utils "^1.1.0" - schema-utils "^1.0.0" - raw-loader@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa" @@ -25244,6 +24882,13 @@ react-clientside-effect@^1.2.0: "@babel/runtime" "^7.0.0" shallowequal "^1.1.0" +react-clientside-effect@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/react-clientside-effect/-/react-clientside-effect-1.2.2.tgz#6212fb0e07b204e714581dd51992603d1accc837" + integrity sha512-nRmoyxeok5PBO6ytPvSjKp9xwXg9xagoTK1mMjwnQxqM9Hd7MNPl+LS1bOSOe+CV2+4fnEquc7H/S8QD3q697A== + dependencies: + "@babel/runtime" "^7.0.0" + react-color@^2.13.8: version "2.14.1" resolved "https://registry.yarnpkg.com/react-color/-/react-color-2.14.1.tgz#db8ad4f45d81e74896fc2e1c99508927c6d084e0" @@ -25341,18 +24986,19 @@ react-docgen-typescript@^1.12.3: resolved "https://registry.yarnpkg.com/react-docgen-typescript/-/react-docgen-typescript-1.12.3.tgz#fe62a5ce82e93573e316366e53adfe8273121c70" integrity sha512-s1XswWs4ykNdWKsPyfM4qptV5dT8nnjnVi2IcjoS/vGlRNYrc0TkW0scVOrinHZ+ndKhPqA4iVNrdwhxZBzJcg== -react-docgen@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/react-docgen/-/react-docgen-4.1.1.tgz#8fef0212dbf14733e09edecef1de6b224d87219e" - integrity sha512-o1wdswIxbgJRI4pckskE7qumiFyqkbvCO++TylEDOo2RbMiueIOg8YzKU4X9++r0DjrbXePw/LHnh81GRBTWRw== +react-docgen@^5.0.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/react-docgen/-/react-docgen-5.3.0.tgz#9aabde5e69f1993c8ba839fd9a86696504654589" + integrity sha512-hUrv69k6nxazOuOmdGeOpC/ldiKy7Qj/UFpxaQi0eDMrUFUTIPGtY5HJu7BggSmiyAMfREaESbtBL9UzdQ+hyg== dependencies: - "@babel/core" "^7.0.0" - "@babel/runtime" "^7.0.0" - async "^2.1.4" + "@babel/core" "^7.7.5" + "@babel/runtime" "^7.7.6" + ast-types "^0.13.2" commander "^2.19.0" doctrine "^3.0.0" + neo-async "^2.6.1" node-dir "^0.1.10" - recast "^0.17.3" + strip-indent "^3.0.0" react-dom@^16.12.0, react-dom@^16.8.3, react-dom@^16.8.5: version "16.12.0" @@ -25416,15 +25062,17 @@ react-focus-lock@^1.17.7: prop-types "^15.6.2" react-clientside-effect "^1.2.0" -react-focus-lock@^1.18.3: - version "1.19.1" - resolved "https://registry.yarnpkg.com/react-focus-lock/-/react-focus-lock-1.19.1.tgz#2f3429793edaefe2d077121f973ce5a3c7a0651a" - integrity sha512-TPpfiack1/nF4uttySfpxPk4rGZTLXlaZl7ncZg/ELAk24Iq2B1UUaUioID8H8dneUXqznT83JTNDHDj+kwryw== +react-focus-lock@^2.1.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/react-focus-lock/-/react-focus-lock-2.4.1.tgz#e842cc93da736b5c5d331799012544295cbcee4f" + integrity sha512-c5ZP56KSpj9EAxzScTqQO7bQQNPltf/W1ZEBDqNDOV1XOIwvAyHX0O7db9ekiAtxyKgnqZjQlLppVg94fUeL9w== dependencies: "@babel/runtime" "^7.0.0" - focus-lock "^0.6.3" + focus-lock "^0.7.0" prop-types "^15.6.2" - react-clientside-effect "^1.2.0" + react-clientside-effect "^1.2.2" + use-callback-ref "^1.2.1" + use-sidecar "^1.0.1" react-grid-layout@^0.16.2: version "0.16.6" @@ -25448,10 +25096,10 @@ react-helmet-async@^1.0.2: react-fast-compare "2.0.4" shallowequal "1.1.0" -react-hotkeys@2.0.0-pre4: - version "2.0.0-pre4" - resolved "https://registry.yarnpkg.com/react-hotkeys/-/react-hotkeys-2.0.0-pre4.tgz#a1c248a51bdba4282c36bf3204f80d58abc73333" - integrity sha512-oa+UncSWyOwMK3GExt+oELXaR7T3ItgcMolsupQFdKvwkEhVAluJd5rYczsRSQpQlVkdNoHG46De2NUeuS+88Q== +react-hotkeys@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/react-hotkeys/-/react-hotkeys-2.0.0.tgz#a7719c7340cbba888b0e9184f806a9ec0ac2c53f" + integrity sha512-3n3OU8vLX/pfcJrR3xJ1zlww6KS1kEJt0Whxc4FiGV+MJrQ1mYSYI3qS/11d2MJDFm8IhOXMTFQirfu6AVOF6Q== dependencies: prop-types "^15.6.1" @@ -25477,12 +25125,12 @@ react-input-range@^1.3.0: autobind-decorator "^1.3.4" prop-types "^15.5.8" -react-inspector@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/react-inspector/-/react-inspector-3.0.2.tgz#c530a06101f562475537e47df428e1d7aff16ed8" - integrity sha512-PSR8xDoGFN8R3LKmq1NT+hBBwhxjd9Qwz8yKY+5NXY/CHpxXHm01CVabxzI7zFwFav/M3JoC/Z0Ro2kSX6Ef2Q== +react-inspector@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/react-inspector/-/react-inspector-4.0.1.tgz#0f888f78ff7daccbc7be5d452b20c96dc6d5fbb8" + integrity sha512-xSiM6CE79JBqSj8Fzd9dWBHv57tLTH7OM57GP3VrE5crzVF3D5Khce9w1Xcw75OAbvrA0Mi2vBneR1OajKmXFg== dependencies: - babel-runtime "^6.26.0" + "@babel/runtime" "^7.6.3" is-dom "^1.0.9" prop-types "^15.6.1" @@ -25566,21 +25214,13 @@ react-onclickoutside@^6.7.1: resolved "https://registry.yarnpkg.com/react-onclickoutside/-/react-onclickoutside-6.8.0.tgz#9f91b5b3ed59f4d9e43fd71620dc200773a4d569" integrity sha512-5Q4Rn7QLEoh7WIe66KFvYIpWJ49GeHoygP1/EtJyZjXKgrWH19Tf0Ty3lWyQzrEEDyLOwUvvmBFSE3dcDdvagA== -react-popper-tooltip@^2.10.1: - version "2.10.1" - resolved "https://registry.yarnpkg.com/react-popper-tooltip/-/react-popper-tooltip-2.10.1.tgz#e10875f31916297c694d64a677d6f8fa0a48b4d1" - integrity sha512-cib8bKiyYcrIlHo9zXx81G0XvARfL8Jt+xum709MFCgQa3HTqTi4au3iJ9tm7vi7WU7ngnqbpWkMinBOtwo+IQ== - dependencies: - "@babel/runtime" "^7.7.4" - react-popper "^1.3.6" - -react-popper-tooltip@^2.8.3: - version "2.8.3" - resolved "https://registry.yarnpkg.com/react-popper-tooltip/-/react-popper-tooltip-2.8.3.tgz#1c63e7473a96362bd93be6c94fa404470a265197" - integrity sha512-g5tfxmuj8ClNVwH4zswYJcD3GKoc5RMeRawd/WZnbyZGEDecsRKaVL+Kj7L3BG7w5qb6/MHcLTG8yE4CidwezQ== +react-popper-tooltip@^2.10.1, react-popper-tooltip@^2.8.3: + version "2.11.1" + resolved "https://registry.yarnpkg.com/react-popper-tooltip/-/react-popper-tooltip-2.11.1.tgz#3c4bdfd8bc10d1c2b9a162e859bab8958f5b2644" + integrity sha512-04A2f24GhyyMicKvg/koIOQ5BzlrRbKiAgP6L+Pdj1MVX3yJ1NeZ8+EidndQsbejFT55oW1b++wg2Z8KlAyhfQ== dependencies: - "@babel/runtime" "^7.4.5" - react-popper "^1.3.3" + "@babel/runtime" "^7.9.2" + react-popper "^1.3.7" react-popper@^0.9.1: version "0.9.5" @@ -25590,19 +25230,7 @@ react-popper@^0.9.1: popper.js "^1.14.1" prop-types "^15.6.1" -react-popper@^1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/react-popper/-/react-popper-1.3.3.tgz#2c6cef7515a991256b4f0536cd4bdcb58a7b6af6" - integrity sha512-ynMZBPkXONPc5K4P5yFWgZx5JGAUIP3pGGLNs58cfAPgK67olx7fmLp+AdpZ0+GoQ+ieFDa/z4cdV6u7sioH6w== - dependencies: - "@babel/runtime" "^7.1.2" - create-react-context "<=0.2.2" - popper.js "^1.14.4" - prop-types "^15.6.1" - typed-styles "^0.0.7" - warning "^4.0.2" - -react-popper@^1.3.6: +react-popper@^1.3.7: version "1.3.7" resolved "https://registry.yarnpkg.com/react-popper/-/react-popper-1.3.7.tgz#f6a3471362ef1f0d10a4963673789de1baca2324" integrity sha512-nmqYTx7QVjCm3WUZLeuOomna138R1luC4EqkW3hxJUrAe+3eNz3oFCLYdnPwILfn0mX1Ew2c3wctrjlUMYYUww== @@ -25717,10 +25345,10 @@ react-router@^3.2.0: prop-types "^15.5.6" warning "^3.0.0" -react-select@^3.0.0: - version "3.0.8" - resolved "https://registry.yarnpkg.com/react-select/-/react-select-3.0.8.tgz#06ff764e29db843bcec439ef13e196865242e0c1" - integrity sha512-v9LpOhckLlRmXN5A6/mGGEft4FMrfaBFTGAnuPHcUgVId7Je42kTq9y0Z+Ye5z8/j0XDT3zUqza8gaRaI1PZIg== +react-select@^3.0.8: + version "3.1.0" + resolved "https://registry.yarnpkg.com/react-select/-/react-select-3.1.0.tgz#ab098720b2e9fe275047c993f0d0caf5ded17c27" + integrity sha512-wBFVblBH1iuCBprtpyGtd1dGMadsG36W5/t2Aj8OE6WbByDg5jIFyT7X5gT+l0qmT5TqWhxX+VsKJvCEl2uL9g== dependencies: "@babel/runtime" "^7.4.4" "@emotion/cache" "^10.0.9" @@ -25729,7 +25357,7 @@ react-select@^3.0.0: memoize-one "^5.0.0" prop-types "^15.6.0" react-input-autosize "^2.2.2" - react-transition-group "^2.2.1" + react-transition-group "^4.3.0" react-shortcuts@^2.0.0: version "2.0.1" @@ -25770,6 +25398,17 @@ react-sticky@^6.0.3: prop-types "^15.5.8" raf "^3.3.0" +react-syntax-highlighter@^11.0.2: + version "11.0.2" + resolved "https://registry.yarnpkg.com/react-syntax-highlighter/-/react-syntax-highlighter-11.0.2.tgz#4e3f376e752b20d2f54e4c55652fd663149e4029" + integrity sha512-kqmpM2OH5OodInbEADKARwccwSQWBfZi0970l5Jhp4h39q9Q65C4frNcnd6uHE5pR00W8pOWj9HDRntj2G4Rww== + dependencies: + "@babel/runtime" "^7.3.1" + highlight.js "~9.13.0" + lowlight "~1.11.0" + prismjs "^1.8.4" + refractor "^2.4.1" + react-syntax-highlighter@^5.7.0: version "5.8.0" resolved "https://registry.yarnpkg.com/react-syntax-highlighter/-/react-syntax-highlighter-5.8.0.tgz#a220c010fd0641751d93532509ba7159cc3a4383" @@ -25779,17 +25418,6 @@ react-syntax-highlighter@^5.7.0: highlight.js "~9.12.0" lowlight "~1.9.1" -react-syntax-highlighter@^8.0.1: - version "8.1.0" - resolved "https://registry.yarnpkg.com/react-syntax-highlighter/-/react-syntax-highlighter-8.1.0.tgz#59103ff17a828a27ed7c8f035ae2558f09b6b78c" - integrity sha512-G2bkZxmF3VOa4atEdXIDSfwwCqjw6ZQX5znfTaHcErA1WqHIS0o6DaSCDKFPVaOMXQEB9Hf1UySYQvuJmV8CXg== - dependencies: - babel-runtime "^6.18.0" - highlight.js "~9.12.0" - lowlight "~1.9.1" - prismjs "^1.8.4" - refractor "^2.4.1" - react-test-renderer@^16.0.0-0, react-test-renderer@^16.12.0: version "16.12.0" resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.12.0.tgz#11417ffda579306d4e841a794d32140f3da1b43f" @@ -25815,15 +25443,15 @@ react-tiny-virtual-list@^2.2.0: dependencies: prop-types "^15.5.7" -react-transition-group@^2.2.1: - version "2.7.1" - resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.7.1.tgz#1fe6d54e811e8f9dfd329aa836b39d9cd16587cb" - integrity sha512-b0VJTzNRnXxRpCuxng6QJbAzmmrhBn1BZJfPPnHbH2PIo8msdkajqwtfdyGm/OypPXZNfAHKEqeN15wjMXrRJQ== +react-transition-group@^4.3.0: + version "4.4.1" + resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-4.4.1.tgz#63868f9325a38ea5ee9535d828327f85773345c9" + integrity sha512-Djqr7OQ2aPUiYurhPalTrVy9ddmFCCzwhqQmtN+J3+3DzLO209Fdr70QrN8Z3DsglWql6iY1lDWAfpFiBtuKGw== dependencies: - dom-helpers "^3.3.1" + "@babel/runtime" "^7.5.5" + dom-helpers "^5.0.1" loose-envify "^1.4.0" prop-types "^15.6.2" - react-lifecycles-compat "^3.0.4" react-use@^13.27.0: version "13.27.0" @@ -25897,7 +25525,7 @@ react-visibility-sensor@^5.1.1: dependencies: prop-types "^15.7.2" -react@^0.14.0, react@^16.12.0, react@^16.8.3, react@^16.8.5: +react@^16.12.0, react@^16.8.3, react@^16.8.5: version "16.12.0" resolved "https://registry.yarnpkg.com/react/-/react-16.12.0.tgz#0c0a9c6a142429e3614834d5a778e18aa78a0b83" integrity sha512-fglqy3k5E+81pA8s+7K0/T3DBCF0ZDOher1elBFzF7O6arXJgzyu/FW+COxFvAWXJoJN9KIZbT2LXlukwphYTA== @@ -25999,15 +25627,6 @@ read-pkg-up@^4.0.0: find-up "^3.0.0" read-pkg "^3.0.0" -read-pkg-up@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-6.0.0.tgz#da75ce72762f2fa1f20c5a40d4dd80c77db969e3" - integrity sha512-odtTvLl+EXo1eTsMnoUHRmg/XmXdTkwXVxy4VFE9Kp6cCq7b3l7QMdBndND3eAFzrbSAXC/WCUOQQ9rLjifKZw== - dependencies: - find-up "^4.0.0" - read-pkg "^5.1.1" - type-fest "^0.5.0" - read-pkg-up@^7.0.0, read-pkg-up@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507" @@ -26044,7 +25663,7 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" -read-pkg@^5.1.1, read-pkg@^5.2.0: +read-pkg@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== @@ -26201,16 +25820,6 @@ recast@^0.14.7: private "~0.1.5" source-map "~0.6.1" -recast@^0.17.3: - version "0.17.6" - resolved "https://registry.yarnpkg.com/recast/-/recast-0.17.6.tgz#64ae98d0d2dfb10ff92ff5fb9ffb7371823b69fa" - integrity sha512-yoQRMRrK1lszNtbkGyM4kN45AwylV5hMiuEveUBlxytUViWevjvX6w+tzJt1LH4cfUhWt4NZvy3ThIhu6+m5wQ== - dependencies: - ast-types "0.12.4" - esprima "~4.0.0" - private "^0.1.8" - source-map "~0.6.1" - recast@~0.11.12: version "0.11.23" resolved "https://registry.yarnpkg.com/recast/-/recast-0.11.23.tgz#451fd3004ab1e4df9b4e4b66376b2a21912462d3" @@ -26439,7 +26048,7 @@ regenerator-runtime@^0.11.0: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== -regenerator-runtime@^0.12.0, regenerator-runtime@^0.12.1: +regenerator-runtime@^0.12.0: version "0.12.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de" integrity sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg== @@ -28893,18 +28502,7 @@ string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" -string.prototype.matchall@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-3.0.2.tgz#c1fdb23f90058e929a69cfa2e8b12300daefe030" - integrity sha512-hsRe42jQ8+OJej2GVjhnSVodQ3NQgHV0FDD6dW7ZTM22J4uIbuYiAADCCc1tfyN7ocEl/KUUbudM36E2tZcF8w== - dependencies: - define-properties "^1.1.3" - es-abstract "^1.14.2" - function-bind "^1.1.1" - has-symbols "^1.0.0" - regexp.prototype.flags "^1.2.0" - -string.prototype.matchall@^4.0.2: +"string.prototype.matchall@^4.0.0 || ^3.0.1", string.prototype.matchall@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.2.tgz#48bb510326fb9fdeb6a33ceaa81a6ea04ef7648e" integrity sha512-N/jp6O5fMf9os0JU3E72Qhf590RSRZU/ungsL/qJUYVTNv7hTG0P/dbPjxINVN9jpscu3nzYwKESU3P3RY5tOg== @@ -29175,13 +28773,13 @@ style-it@^2.1.3: dependencies: react-lib-adler32 "^1.0.3" -style-loader@^0.23.1: - version "0.23.1" - resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.23.1.tgz#cb9154606f3e771ab6c4ab637026a1049174d925" - integrity sha512-XK+uv9kWwhZMZ1y7mysB+zoihsEj4wneFWAS5qoiLwzW0WzSqMrrsIy+a3zkQJq0ipFtBpX5W3MqyRIBF/WFGg== +style-loader@^1.0.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.2.1.tgz#c5cbbfbf1170d076cfdd86e0109c5bba114baa1a" + integrity sha512-ByHSTQvHLkWE9Ir5+lGbVOXhxX10fbprhLvdg96wedFZb4NDekDPxVKv5Fwmio+QcMlkkNfuK+5W1peQ5CUhZg== dependencies: - loader-utils "^1.1.0" - schema-utils "^1.0.0" + loader-utils "^2.0.0" + schema-utils "^2.6.6" style-loader@^1.1.3: version "1.1.3" @@ -29673,16 +29271,16 @@ teamwork@3.x.x: resolved "https://registry.yarnpkg.com/teamwork/-/teamwork-3.0.1.tgz#ff38c7161f41f8070b7813716eb6154036ece196" integrity sha512-hEkJIpDOfOYe9NYaLFk00zQbzZeKNCY8T2pRH3I13Y1mJwxaSQ6NEsjY5rCp+11ezCiZpWGoGFTbOuhg4qKevQ== -telejson@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/telejson/-/telejson-3.1.0.tgz#c648479afe0d8edd90aeaf478b0b8a2fe9f59513" - integrity sha512-mhiVy+xp2atri1bzSzdy/gVGXlOhibaoZ092AUq5xhnrZGdzhF0fLaOduHJQghkro+qmjYMwhsOL9CkD2zTicg== +telejson@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/telejson/-/telejson-3.3.0.tgz#6d814f3c0d254d5c4770085aad063e266b56ad03" + integrity sha512-er08AylQ+LEbDLp1GRezORZu5wKOHaBczF6oYJtgC3Idv10qZ8A3p6ffT+J5BzDKkV9MqBvu8HAKiIIOp6KJ2w== dependencies: "@types/is-function" "^1.0.0" global "^4.4.0" is-function "^1.0.1" is-regex "^1.0.4" - is-symbol "^1.0.2" + is-symbol "^1.0.3" isobject "^4.0.0" lodash "^4.17.15" memoizerific "^1.11.3" @@ -29726,7 +29324,7 @@ terminal-link@^2.0.0, terminal-link@^2.1.1: ansi-escapes "^4.2.1" supports-hyperlinks "^2.0.0" -terser-webpack-plugin@^1.2.4, terser-webpack-plugin@^1.4.3: +terser-webpack-plugin@^1.4.3: version "1.4.4" resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.4.tgz#2c63544347324baafa9a56baaddf1634c8abfc2f" integrity sha512-U4mACBHIegmfoEe5fdongHESNJWqsGU+W0S/9+BmYGVQDw1+c2Ow05TpMhxjPK1sRb7cuYq1BPl1e5YHJMTCqA== @@ -30919,7 +30517,7 @@ type-fest@^0.13.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.13.1.tgz#0172cb5bce80b0bd542ea348db50c7e21834d934" integrity sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg== -type-fest@^0.3.0, type-fest@^0.3.1: +type-fest@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1" integrity sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ== @@ -30929,7 +30527,7 @@ type-fest@^0.4.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.4.1.tgz#8bdf77743385d8a4f13ba95f610f5ccd68c728f8" integrity sha512-IwzA/LSfD2vC1/YDYMv/zHP4rDF1usCwllsDpbolT3D4fUepIO7f9K70jjmUewU/LmGUKJcwcVtDCpnKk4BPMw== -type-fest@^0.5.0, type-fest@^0.5.2: +type-fest@^0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2" integrity sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw== @@ -31572,6 +31170,11 @@ url@0.11.0, url@^0.11.0: punycode "1.3.2" querystring "0.2.0" +use-callback-ref@^1.2.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/use-callback-ref/-/use-callback-ref-1.2.4.tgz#d86d1577bfd0b955b6e04aaf5971025f406bea3c" + integrity sha512-rXpsyvOnqdScyied4Uglsp14qzag1JIemLeTWGKbwpotWht57hbP78aNT+Q4wdFKQfQibbUX4fb6Qb4y11aVOQ== + use-memo-one@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/use-memo-one/-/use-memo-one-1.1.1.tgz#39e6f08fe27e422a7d7b234b5f9056af313bd22c" @@ -31584,6 +31187,14 @@ use-resize-observer@^6.0.0: dependencies: resize-observer-polyfill "^1.5.1" +use-sidecar@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/use-sidecar/-/use-sidecar-1.0.2.tgz#e72f582a75842f7de4ef8becd6235a4720ad8af6" + integrity sha512-287RZny6m5KNMTb/Kq9gmjafi7lQL0YHO1lYolU6+tY1h9+Z3uCtkJJ3OSOq3INwYf2hBryCcDh4520AhJibMA== + dependencies: + detect-node "^2.0.4" + tslib "^1.9.3" + use@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/use/-/use-2.0.2.tgz#ae28a0d72f93bf22422a18a2e379993112dec8e8" @@ -32574,6 +32185,13 @@ webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack- source-list-map "^2.0.0" source-map "~0.6.1" +webpack-virtual-modules@^0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/webpack-virtual-modules/-/webpack-virtual-modules-0.2.2.tgz#20863dc3cb6bb2104729fff951fbe14b18bd0299" + integrity sha512-kDUmfm3BZrei0y+1NTHJInejzxfhtU8eDj2M7OKb2IWrPFAeO1SOH2KuQ68MSZu9IGEHcxbkKKR1v18FrUSOmA== + dependencies: + debug "^3.0.0" + webpack@^4.33.0, webpack@^4.38.0, webpack@^4.41.5: version "4.41.5" resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.41.5.tgz#3210f1886bce5310e62bb97204d18c263341b77c" @@ -33232,6 +32850,11 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== +yaml@^1.7.2: + version "1.10.0" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e" + integrity sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg== + yargs-parser@13.1.2, yargs-parser@^13.1.0, yargs-parser@^13.1.2: version "13.1.2" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38"