Skip to content

Commit 8342965

Browse files
Merge branch 'master' into logs-ui-analysis-partition-log-rate-results
2 parents 8f16977 + 919b00b commit 8342965

829 files changed

Lines changed: 24034 additions & 17349 deletions

File tree

Some content is hidden

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

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
# APM
1515
/x-pack/legacy/plugins/apm/ @elastic/apm-ui
16+
/x-pack/test/functional/apps/apm/ @elastic/apm-ui
17+
/src/legacy/core_plugins/apm_oss/ @elastic/apm-ui
1618

1719
# Beats
1820
/x-pack/legacy/plugins/beats_management/ @elastic/beats

STYLEGUIDE.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,39 @@ function addBar(foos, foo) {
141141
}
142142
```
143143
144+
### Avoid `any` whenever possible
145+
146+
Since TypeScript 3.0 and the introduction of the
147+
[`unknown` type](https://mariusschulz.com/blog/the-unknown-type-in-typescript) there are rarely any
148+
reasons to use `any` as a type. Nearly all places of former `any` usage can be replace by either a
149+
generic or `unknown` (in cases the type is really not known).
150+
151+
You should always prefer using those mechanisms over using `any`, since they are stricter typed and
152+
less likely to introduce bugs in the future due to insufficient types.
153+
154+
If you’re not having `any` in your plugin or are starting a new plugin, you should enable the
155+
[`@typescript-eslint/no-explicit-any`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md)
156+
linting rule for your plugin via the [`.eslintrc.js`](https://github.com/elastic/kibana/blob/master/.eslintrc.js) config.
157+
158+
### Avoid non-null assertions
159+
160+
You should try avoiding non-null assertions (`!.`) wherever possible. By using them you tell
161+
TypeScript, that something is not null even though by it’s type it could be. Usage of non-null
162+
assertions is most often a side-effect of you actually checked that the variable is not `null`
163+
but TypeScript doesn’t correctly carry on that information till the usage of the variable.
164+
165+
In most cases it’s possible to replace the non-null assertion by structuring your code/checks slightly different
166+
or using [user defined type guards](https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards)
167+
to properly tell TypeScript what type a variable has.
168+
169+
Using non-null assertion increases the risk for future bugs. In case the condition under which we assumed that the
170+
variable can’t be null has changed (potentially even due to changes in compeltely different files), the non-null
171+
assertion would now wrongly disable proper type checking for us.
172+
173+
If you’re not using non-null assertions in your plugin or are starting a new plugin, consider enabling the
174+
[`@typescript-eslint/no-non-null-assertion`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-assertion.md)
175+
linting rule for you plugin in the [`.eslintrc.js`](https://github.com/elastic/kibana/blob/master/.eslintrc.js) config.
176+
144177
### Return/throw early from functions
145178
146179
To avoid deep nesting of if-statements, always return a function's value as early

config/kibana.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
# default to `true` starting in Kibana 7.0.
1919
#server.rewriteBasePath: false
2020

21-
# Specifies the default route when opening Kibana. You can use this setting to modify
22-
# the landing page when opening Kibana.
23-
#server.defaultRoute: /app/kibana
24-
2521
# The maximum payload size in bytes for incoming server requests.
2622
#server.maxPayloadBytes: 1048576
2723

docs/api/saved-objects/find.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ experimental[] Retrieve a paginated set of {kib} saved objects by various condit
4141
`has_reference`::
4242
(Optional, object) Filters to objects that have a relationship with the type and ID combination.
4343

44+
`filter`::
45+
(Optional, string) The filter is a KQL string with the caveat that if you filter with an attribute from your type saved object.
46+
It should look like that savedObjectType.attributes.title: "myTitle". However, If you used a direct attribute of a saved object like `updatedAt`,
47+
you will have to define your filter like that savedObjectType.updatedAt > 2018-12-22.
48+
4449
NOTE: As objects change in {kib}, the results on each page of the response also
4550
change. Use the find API for traditional paginated results, but avoid using it to export large amounts of data.
4651

docs/development/core/public/kibana-plugin-public.savedobjectsclient.find.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ Search for objects
99
<b>Signature:</b>
1010

1111
```typescript
12-
find: <T extends SavedObjectAttributes>(options: Pick<SavedObjectFindOptionsServer, "search" | "type" | "defaultSearchOperator" | "searchFields" | "sortField" | "hasReference" | "page" | "perPage" | "fields">) => Promise<SavedObjectsFindResponsePublic<T>>;
12+
find: <T extends SavedObjectAttributes>(options: Pick<SavedObjectFindOptionsServer, "search" | "filter" | "type" | "page" | "perPage" | "sortField" | "fields" | "searchFields" | "hasReference" | "defaultSearchOperator">) => Promise<SavedObjectsFindResponsePublic<T>>;
1313
```

docs/development/core/public/kibana-plugin-public.savedobjectsclient.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export declare class SavedObjectsClient
2020
| [bulkGet](./kibana-plugin-public.savedobjectsclient.bulkget.md) | | <code>(objects?: {</code><br/><code> id: string;</code><br/><code> type: string;</code><br/><code> }[]) =&gt; Promise&lt;SavedObjectsBatchResponse&lt;SavedObjectAttributes&gt;&gt;</code> | Returns an array of objects by id |
2121
| [create](./kibana-plugin-public.savedobjectsclient.create.md) | | <code>&lt;T extends SavedObjectAttributes&gt;(type: string, attributes: T, options?: SavedObjectsCreateOptions) =&gt; Promise&lt;SimpleSavedObject&lt;T&gt;&gt;</code> | Persists an object |
2222
| [delete](./kibana-plugin-public.savedobjectsclient.delete.md) | | <code>(type: string, id: string) =&gt; Promise&lt;{}&gt;</code> | Deletes an object |
23-
| [find](./kibana-plugin-public.savedobjectsclient.find.md) | | <code>&lt;T extends SavedObjectAttributes&gt;(options: Pick&lt;SavedObjectFindOptionsServer, &quot;search&quot; &#124; &quot;type&quot; &#124; &quot;defaultSearchOperator&quot; &#124; &quot;searchFields&quot; &#124; &quot;sortField&quot; &#124; &quot;hasReference&quot; &#124; &quot;page&quot; &#124; &quot;perPage&quot; &#124; &quot;fields&quot;&gt;) =&gt; Promise&lt;SavedObjectsFindResponsePublic&lt;T&gt;&gt;</code> | Search for objects |
23+
| [find](./kibana-plugin-public.savedobjectsclient.find.md) | | <code>&lt;T extends SavedObjectAttributes&gt;(options: Pick&lt;SavedObjectFindOptionsServer, &quot;search&quot; &#124; &quot;filter&quot; &#124; &quot;type&quot; &#124; &quot;page&quot; &#124; &quot;perPage&quot; &#124; &quot;sortField&quot; &#124; &quot;fields&quot; &#124; &quot;searchFields&quot; &#124; &quot;hasReference&quot; &#124; &quot;defaultSearchOperator&quot;&gt;) =&gt; Promise&lt;SavedObjectsFindResponsePublic&lt;T&gt;&gt;</code> | Search for objects |
2424
| [get](./kibana-plugin-public.savedobjectsclient.get.md) | | <code>&lt;T extends SavedObjectAttributes&gt;(type: string, id: string) =&gt; Promise&lt;SimpleSavedObject&lt;T&gt;&gt;</code> | Fetches a single object |
2525

2626
## Methods
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObjectsFindOptions](./kibana-plugin-public.savedobjectsfindoptions.md) &gt; [filter](./kibana-plugin-public.savedobjectsfindoptions.filter.md)
4+
5+
## SavedObjectsFindOptions.filter property
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
filter?: string;
11+
```

docs/development/core/public/kibana-plugin-public.savedobjectsfindoptions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface SavedObjectsFindOptions extends SavedObjectsBaseOptions
1717
| --- | --- | --- |
1818
| [defaultSearchOperator](./kibana-plugin-public.savedobjectsfindoptions.defaultsearchoperator.md) | <code>'AND' &#124; 'OR'</code> | |
1919
| [fields](./kibana-plugin-public.savedobjectsfindoptions.fields.md) | <code>string[]</code> | An array of fields to include in the results |
20+
| [filter](./kibana-plugin-public.savedobjectsfindoptions.filter.md) | <code>string</code> | |
2021
| [hasReference](./kibana-plugin-public.savedobjectsfindoptions.hasreference.md) | <code>{</code><br/><code> type: string;</code><br/><code> id: string;</code><br/><code> }</code> | |
2122
| [page](./kibana-plugin-public.savedobjectsfindoptions.page.md) | <code>number</code> | |
2223
| [perPage](./kibana-plugin-public.savedobjectsfindoptions.perpage.md) | <code>number</code> | |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsFindOptions](./kibana-plugin-server.savedobjectsfindoptions.md) &gt; [filter](./kibana-plugin-server.savedobjectsfindoptions.filter.md)
4+
5+
## SavedObjectsFindOptions.filter property
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
filter?: string;
11+
```

docs/development/core/server/kibana-plugin-server.savedobjectsfindoptions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface SavedObjectsFindOptions extends SavedObjectsBaseOptions
1717
| --- | --- | --- |
1818
| [defaultSearchOperator](./kibana-plugin-server.savedobjectsfindoptions.defaultsearchoperator.md) | <code>'AND' &#124; 'OR'</code> | |
1919
| [fields](./kibana-plugin-server.savedobjectsfindoptions.fields.md) | <code>string[]</code> | An array of fields to include in the results |
20+
| [filter](./kibana-plugin-server.savedobjectsfindoptions.filter.md) | <code>string</code> | |
2021
| [hasReference](./kibana-plugin-server.savedobjectsfindoptions.hasreference.md) | <code>{</code><br/><code> type: string;</code><br/><code> id: string;</code><br/><code> }</code> | |
2122
| [page](./kibana-plugin-server.savedobjectsfindoptions.page.md) | <code>number</code> | |
2223
| [perPage](./kibana-plugin-server.savedobjectsfindoptions.perpage.md) | <code>number</code> | |

0 commit comments

Comments
 (0)