Skip to content

Commit 7cac277

Browse files
Merge branch 'master' into rollup_jobs_a11y_checkbox_fix
2 parents 0627e9f + d481adc commit 7cac277

1,044 files changed

Lines changed: 461631 additions & 9179 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: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@
187187
/x-pack/test/saved_object_tagging/ @elastic/kibana-core
188188
/packages/kbn-config-schema/ @elastic/kibana-core
189189
/packages/kbn-std/ @elastic/kibana-core
190+
/packages/kbn-config/ @elastic/kibana-core
191+
/packages/kbn-logging/ @elastic/kibana-core
192+
/packages/kbn-legacy-logging/ @elastic/kibana-core
190193
/src/legacy/server/config/ @elastic/kibana-core
191194
/src/legacy/server/http/ @elastic/kibana-core
192195
/src/legacy/server/logging/ @elastic/kibana-core
@@ -259,8 +262,31 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
259262

260263
# Enterprise Search
261264
# Shared
262-
/x-pack/plugins/enterprise_search/ @elastic/enterprise-search-frontend
265+
/x-pack/plugins/enterprise_search/* @elastic/enterprise-search-frontend
266+
/x-pack/plugins/enterprise_search/common/ @elastic/enterprise-search-frontend
267+
/x-pack/plugins/enterprise_search/public/* @elastic/enterprise-search-frontend
268+
/x-pack/plugins/enterprise_search/public/applications/* @elastic/enterprise-search-frontend
269+
/x-pack/plugins/enterprise_search/public/applications/enterprise_search/ @elastic/enterprise-search-frontend
270+
/x-pack/plugins/enterprise_search/public/applications/shared/ @elastic/enterprise-search-frontend
271+
/x-pack/plugins/enterprise_search/public/applications/__mocks__/ @elastic/enterprise-search-frontend
272+
/x-pack/plugins/enterprise_search/server/* @elastic/enterprise-search-frontend
273+
/x-pack/plugins/enterprise_search/server/lib/ @elastic/enterprise-search-frontend
274+
/x-pack/plugins/enterprise_search/server/__mocks__/ @elastic/enterprise-search-frontend
275+
/x-pack/plugins/enterprise_search/server/collectors/enterprise_search/ @elastic/enterprise-search-frontend
276+
/x-pack/plugins/enterprise_search/server/collectors/lib/ @elastic/enterprise-search-frontend
277+
/x-pack/plugins/enterprise_search/server/routes/enterprise_search/ @elastic/enterprise-search-frontend
278+
/x-pack/plugins/enterprise_search/server/saved_objects/enterprise_search/ @elastic/enterprise-search-frontend
263279
/x-pack/test/functional_enterprise_search/ @elastic/enterprise-search-frontend
280+
# App Search
281+
/x-pack/plugins/enterprise_search/public/applications/app_search/ @elastic/app-search-frontend
282+
/x-pack/plugins/enterprise_search/server/routes/app_search/ @elastic/app-search-frontend
283+
/x-pack/plugins/enterprise_search/server/collectors/app_search/ @elastic/app-search-frontend
284+
/x-pack/plugins/enterprise_search/server/saved_objects/app_search/ @elastic/app-search-frontend
285+
# Workplace Search
286+
/x-pack/plugins/enterprise_search/public/applications/workplace_search/ @elastic/workplace-search-frontend
287+
/x-pack/plugins/enterprise_search/server/routes/workplace_search/ @elastic/workplace-search-frontend
288+
/x-pack/plugins/enterprise_search/server/collectors/workplace_search/ @elastic/workplace-search-frontend
289+
/x-pack/plugins/enterprise_search/server/saved_objects/workplace_search/ @elastic/workplace-search-frontend
264290

265291
# Elasticsearch UI
266292
/src/plugins/dev_tools/ @elastic/es-ui

.i18nrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"src/plugins/management"
2828
],
2929
"maps_legacy": "src/plugins/maps_legacy",
30+
"monaco": "packages/kbn-monaco/src",
3031
"indexPatternManagement": "src/plugins/index_pattern_management",
3132
"advancedSettings": "src/plugins/advanced_settings",
3233
"kibana_legacy": "src/plugins/kibana_legacy",

STYLEGUIDE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,24 @@ Do not use setters, they cause more problems than they can solve.
589589
590590
[sideeffect]: http://en.wikipedia.org/wiki/Side_effect_(computer_science)
591591
592+
### Avoid circular dependencies
593+
594+
As part of a future effort to use correct and idempotent build tools we need our code to be
595+
able to be represented as a directed acyclic graph. We must avoid having circular dependencies
596+
both on code and type imports to achieve that. One of the most critical parts is the plugins
597+
code. We've developed a tool to identify plugins with circular dependencies which
598+
has allowed us to build a list of plugins who have circular dependencies
599+
between each other.
600+
601+
When building plugins we should avoid importing from plugins
602+
who are known to have circular dependencies at the moment as well as introducing
603+
new circular dependencies. You can run the same tool we use on our CI locally by
604+
typing `node scripts/find_plugins_with_circular_deps --debug`. It will error out in
605+
case new circular dependencies has been added with your changes
606+
(which will also happen in the CI) as well as print out the current list of
607+
the known circular dependencies which, as mentioned before, should not be imported
608+
by your code until the circular dependencies on these have been solved.
609+
592610
## SASS files
593611
594612
When writing a new component, create a sibling SASS file of the same name and import directly into the **top** of the JS/TS component file. Doing so ensures the styles are never separated or lost on import and allows for better modularization (smaller individual plugin asset footprint).

docs/api/saved-objects/create.asciidoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ experimental[] Create {kib} saved objects.
99
[[saved-objects-api-create-request]]
1010
==== Request
1111

12-
`POST <kibana host>:<port>/api/saved_objects/<type>` +
12+
`POST <kibana host>:<port>/api/saved_objects/<type>`
1313

1414
`POST <kibana host>:<port>/api/saved_objects/<type>/<id>`
1515

16-
`POST <kibana host>:<port>/s/<space_id>/saved_objects/<type>`
16+
`POST <kibana host>:<port>/s/<space_id>/api/saved_objects/<type>`
17+
18+
`POST <kibana host>:<port>/s/<space_id>/api/saved_objects/<type>/<id>`
1719

1820
[[saved-objects-api-create-path-params]]
1921
==== Path parameters

docs/apm/apm-alerts.asciidoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<titleabbrev>Create an alert</titleabbrev>
77
++++
88

9-
beta::[]
109

1110
The APM app integrates with Kibana's {kibana-ref}/alerting-getting-started.html[alerting and actions] feature.
1211
It provides a set of built-in **actions** and APM specific threshold **alerts** for you to use

docs/developer/best-practices/typescript.asciidoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ More details are available in the https://www.typescriptlang.org/docs/handbook/p
1919
==== Caveats
2020
This architecture imposes several limitations to which we must comply:
2121

22-
- Projects cannot have circular dependencies. Even though the Kibana platform doesn't support circular dependencies between Kibana plugins, TypeScript (and ES6 modules) does allow circular imports between files. So in theory, you may face a problem when migrating to the TS project references and you will have to resolve this circular dependency. https://github.com/elastic/kibana/issues/78162 is going to provide a tool to find such problem places.
22+
- Projects cannot have circular dependencies. Even though the Kibana platform doesn't support circular dependencies between Kibana plugins, TypeScript (and ES6 modules) does allow circular imports between files. So in theory, you may face a problem when migrating to the TS project references and you will have to resolve this circular dependency. We've built a tool that can be used to find such problems. Please read the prerequisites section below to know how to use it.
2323
- A project must emit its type declaration. It's not always possible to generate a type declaration if the compiler cannot infer a type. There are two basic cases:
2424

2525
1. Your plugin exports a type inferring an internal type declared in Kibana codebase. In this case, you'll have to either export an internal type or to declare an exported type explicitly.
@@ -30,6 +30,8 @@ This architecture imposes several limitations to which we must comply:
3030
Since project refs rely on generated `d.ts` files, the migration order does matter. You can migrate your plugin only when all the plugin dependencies already have migrated. It creates a situation where commonly used plugins (such as `data` or `kibana_react`) have to migrate first.
3131
Run `node scripts/find_plugins_without_ts_refs.js --id your_plugin_id` to get a list of plugins that should be switched to TS project refs to unblock your plugin migration.
3232

33+
Additionally, in order to migrate into project refs, you also need to make sure your plugin doesn't have circular dependencies with other plugins both on code and type imports. We run a job in the CI for each PR trying to find if new circular dependencies are being added which runs our tool with `node scripts/find_plugins_with_circular_deps`. However there are also a couple of circular dependencies already identified and that are in an allowed list to be solved. You also need to make sure your plugin don't rely in any other plugin into that allowed list. For a complete overview of the circular dependencies both found and in the allowed list as well as the complete circular dependencies path please run the following script locally with the debug flag `node scripts/find_plugins_with_circular_deps --debug` .
34+
3335
[discrete]
3436
==== Implementation
3537
- Make sure all the plugins listed as dependencies in *requiredPlugins*, *optionalPlugins* & *requiredBundles* properties of `kibana.json` manifest file have migrated to TS project references.

docs/developer/plugin/migrating-legacy-plugins-examples.asciidoc

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,77 @@ router.get(
11431143
);
11441144
----
11451145

1146+
==== Accessing the client from a collector's `fetch` method
1147+
1148+
At the moment, the `fetch` method's context receives preconfigured
1149+
<<scoped-services, scoped clients>> for Elasticsearch and SavedObjects.
1150+
To help in the transition, both, the legacy (`callCluster`) and new clients are provided,
1151+
but we strongly discourage using the deprecated legacy ones for any new implementation.
1152+
1153+
[source,typescript]
1154+
----
1155+
usageCollection.makeUsageCollector<MyUsage>({
1156+
type: 'my-collector',
1157+
isReady: async () => true, // Logic to confirm the `fetch` method is ready to be called
1158+
schema: {...},
1159+
async fetch(context) {
1160+
const { callCluster, esClient, soClient } = context;
1161+
1162+
// Before:
1163+
const result = callCluster('search', options)
1164+
1165+
// After:
1166+
const { body: result } = esClient.search(options);
1167+
1168+
return result;
1169+
}
1170+
});
1171+
----
1172+
1173+
Regarding the `soClient`, it is encouraged to use it instead of the plugin's owned SavedObject's repository
1174+
as we used to do in the past.
1175+
1176+
Before:
1177+
1178+
[source,typescript]
1179+
----
1180+
function getUsageCollector(
1181+
usageCollection: UsageCollectionSetup,
1182+
getSavedObjectsRepository: () => ISavedObjectsRepository | undefined
1183+
) {
1184+
usageCollection.makeUsageCollector<MyUsage>({
1185+
type: 'my-collector',
1186+
isReady: () => typeof getSavedObjectsRepository() !== 'undefined',
1187+
schema: {...},
1188+
async fetch() {
1189+
const savedObjectsRepository = getSavedObjectsRepository();
1190+
1191+
const { attributes: result } = await savedObjectsRepository.get('my-so-type', 'my-so-id');
1192+
1193+
return result;
1194+
}
1195+
});
1196+
}
1197+
----
1198+
1199+
After:
1200+
1201+
[source,typescript]
1202+
----
1203+
function getUsageCollector(usageCollection: UsageCollectionSetup) {
1204+
usageCollection.makeUsageCollector<MyUsage>({
1205+
type: 'my-collector',
1206+
isReady: () => true,
1207+
schema: {...},
1208+
async fetch({ soClient }) {
1209+
const { attributes: result } = await soClient.get('my-so-type', 'my-so-id');
1210+
1211+
return result;
1212+
}
1213+
});
1214+
}
1215+
----
1216+
11461217
==== Creating a custom client
11471218

11481219
Note that the `plugins` option is no longer available on the new

docs/development/core/public/kibana-plugin-core-public.app.exactroute.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ exactRoute?: boolean;
1818
```ts
1919
core.application.register({
2020
id: 'my_app',
21-
title: 'My App'
21+
title: 'My App',
2222
exactRoute: true,
2323
mount: () => { ... },
2424
})

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface App<HistoryLocationState = unknown>
2727
| [mount](./kibana-plugin-core-public.app.mount.md) | <code>AppMount&lt;HistoryLocationState&gt; &#124; AppMountDeprecated&lt;HistoryLocationState&gt;</code> | A mount function called when the user navigates to this app's route. May have signature of [AppMount](./kibana-plugin-core-public.appmount.md) or [AppMountDeprecated](./kibana-plugin-core-public.appmountdeprecated.md)<!-- -->. |
2828
| [navLinkStatus](./kibana-plugin-core-public.app.navlinkstatus.md) | <code>AppNavLinkStatus</code> | The initial status of the application's navLink. Defaulting to <code>visible</code> if <code>status</code> is <code>accessible</code> and <code>hidden</code> if status is <code>inaccessible</code> See [AppNavLinkStatus](./kibana-plugin-core-public.appnavlinkstatus.md) |
2929
| [order](./kibana-plugin-core-public.app.order.md) | <code>number</code> | An ordinal used to sort nav links relative to one another for display. |
30+
| [searchDeepLinks](./kibana-plugin-core-public.app.searchdeeplinks.md) | <code>AppSearchDeepLink[]</code> | Array of links that represent secondary in-app locations for the app. |
3031
| [status](./kibana-plugin-core-public.app.status.md) | <code>AppStatus</code> | The initial status of the application. Defaulting to <code>accessible</code> |
3132
| [title](./kibana-plugin-core-public.app.title.md) | <code>string</code> | The title of the application. |
3233
| [tooltip](./kibana-plugin-core-public.app.tooltip.md) | <code>string</code> | A tooltip shown when hovering over app link. |
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [App](./kibana-plugin-core-public.app.md) &gt; [searchDeepLinks](./kibana-plugin-core-public.app.searchdeeplinks.md)
4+
5+
## App.searchDeepLinks property
6+
7+
Array of links that represent secondary in-app locations for the app.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
searchDeepLinks?: AppSearchDeepLink[];
13+
```
14+
15+
## Remarks
16+
17+
Used to populate navigational search results (where available). Can be updated using the [App.updater$](./kibana-plugin-core-public.app.updater_.md) observable. See for more details.
18+
19+
## Example
20+
21+
The `path` property on deep links should not include the application's `appRoute`<!-- -->:
22+
23+
```ts
24+
core.application.register({
25+
id: 'my_app',
26+
title: 'My App',
27+
searchDeepLinks: [
28+
{ id: 'sub1', title: 'Sub1', path: '/sub1' },
29+
{
30+
id: 'sub2',
31+
title: 'Sub2',
32+
searchDeepLinks: [
33+
{ id: 'subsub', title: 'SubSub', path: '/sub2/sub' }
34+
]
35+
}
36+
],
37+
mount: () => { ... },
38+
})
39+
40+
```
41+
Will produce deep links on these paths: - `/app/my_app/sub1` - `/app/my_app/sub2/sub`
42+

0 commit comments

Comments
 (0)