Updates Github link references from master to main (#116789)

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
Tyler Smalley 2021-10-29 09:53:08 -07:00 committed by GitHub
parent 2194f2b93c
commit c4815d319e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
123 changed files with 231 additions and 231 deletions

View file

@ -76,7 +76,7 @@ plugins/
- preboot plugins are bootstrapped to prepare the environment before Kibana starts.
- standard plugins define Kibana functionality while Kibana is running.
`owner` - [Required] Help users of your plugin know who manages this plugin and how to get in touch. For internal developers, `Owner.name` should be the name of the team that manages this plugin. This should match the team that owns this code in the [CODEOWNERS](https://github.com/elastic/kibana/blob/master/.github/CODEOWNERS) file (however, this is not currently enforced). Internal teams should also use a [GitHub team alias](https://github.com/orgs/elastic/teams) for `owner.githubTeam`. This value is used to create a link to `https://github.com/orgs/elastic/teams/${githubTeam}`, so leave the `elastic/` prefix should be left out. While many teams can contribute to a plugin, only a single team should be the primary owner.
`owner` - [Required] Help users of your plugin know who manages this plugin and how to get in touch. For internal developers, `Owner.name` should be the name of the team that manages this plugin. This should match the team that owns this code in the [CODEOWNERS](https://github.com/elastic/kibana/blob/main/.github/CODEOWNERS) file (however, this is not currently enforced). Internal teams should also use a [GitHub team alias](https://github.com/orgs/elastic/teams) for `owner.githubTeam`. This value is used to create a link to `https://github.com/orgs/elastic/teams/${githubTeam}`, so leave the `elastic/` prefix should be left out. While many teams can contribute to a plugin, only a single team should be the primary owner.
`description` - [Required] Give your plugin a description to help other developers understand what it does. This is required for internal plugins.

View file

@ -33,7 +33,7 @@ At a super high-level, Kibana is composed of **plugins**, **core**, and **Kibana
<DocAccordion buttonContent="(Internal only) FAQ: Should I put my code in a plugin or a package?" color="warning">
<DocCallOut color="warning">
When the [Bazel migration](https://github.com/elastic/kibana/blob/master/legacy_rfcs/text/0015_bazel.md) is complete, all code, including plugins, will be a package. With that, packages won't be required to be in the `packages/` directory and can be located somewhere that makes more sense structurally.
When the [Bazel migration](https://github.com/elastic/kibana/blob/main/legacy_rfcs/text/0015_bazel.md) is complete, all code, including plugins, will be a package. With that, packages won't be required to be in the `packages/` directory and can be located somewhere that makes more sense structurally.
In the meantime, the following can be used to determine whether it makes sense to add code to a package inside the `packages` folder, or a plugin inside `src/plugins` or `x-pack/plugins`.
@ -49,7 +49,7 @@ Downsides to packages:
1. <b>It's not <DocLink id="kibDevPrinciples" text="organized by domain"/></b>. The packages folder is far away from the plugins folder. Having your stateless code in a plugin and the rest in a package may make it hard to find, leading to duplication. The Operations team hopes to fix this by supporting packages and plugins existing in the same folder. You can track this work by following [this issue](https://github.com/elastic/kibana/issues/112886).
2. <b>Development overhead</b>. Developers have to run `yarn kbn watch` to have changes rebuilt automatically. [Phase II](https://github.com/elastic/kibana/blob/master/legacy_rfcs/text/0015_bazel.md#phase-ii---docs-developer-experience) of the Bazel migration work will bring the development experience on par with plugin development. This work can be tracked [here](https://github.com/elastic/kibana/issues/104519).
2. <b>Development overhead</b>. Developers have to run `yarn kbn watch` to have changes rebuilt automatically. [Phase II](https://github.com/elastic/kibana/blob/main/legacy_rfcs/text/0015_bazel.md#phase-ii---docs-developer-experience) of the Bazel migration work will bring the development experience on par with plugin development. This work can be tracked [here](https://github.com/elastic/kibana/issues/104519).
3. <b>Development performance</b>. Rebuild time is typically longer than it would be for the same code in a plugin. The reasons are captured in [this issue](https://github.com/elastic/kibana/issues/107648). The ops team is actively working to reduce this performance increase.

View file

@ -30,7 +30,7 @@ Assuming you want to link from your app to *Discover*. When building such URL th
### Prepending a proper `basePath`
To prepend Kibana's `basePath` use the [core.http.basePath.prepend](https://github.com/elastic/kibana/blob/master/docs/development/core/public/kibana-plugin-core-public.ibasepath.prepend.md) helper:
To prepend Kibana's `basePath` use the [core.http.basePath.prepend](https://github.com/elastic/kibana/blob/main/docs/development/core/public/kibana-plugin-core-public.ibasepath.prepend.md) helper:
```tsx
const discoverUrl = core.http.basePath.prepend(`/discover`);
@ -50,7 +50,7 @@ console.log(discoverUrl); // http://localhost:5601/bpr/s/space/app/discover
const discoverUrlWithSomeState = core.http.basePath.prepend(`/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:'2020-09-10T11:39:50.203Z',to:'2020-09-10T11:40:20.249Z'))&_a=(columns:!(_source),filters:!(),index:'90943e30-9a47-11e8-b64d-95841ca0b247',interval:auto,query:(language:kuery,query:''),sort:!())`);
```
Instead, each app should expose [a locator](https://github.com/elastic/kibana/blob/master/src/plugins/share/common/url_service/locators/README.md).
Instead, each app should expose [a locator](https://github.com/elastic/kibana/blob/main/src/plugins/share/common/url_service/locators/README.md).
Other apps should use those locators for navigation or URL creation.
```tsx
@ -60,7 +60,7 @@ const discoverUrl = await plugins.discover.locator.getUrl({filters, timeRange});
await plugins.discover.locator.navigate({filters, timeRange});
```
To get a better idea, take a look at *Discover* locator [implementation](https://github.com/elastic/kibana/blob/master/src/plugins/discover/public/locator.ts).
To get a better idea, take a look at *Discover* locator [implementation](https://github.com/elastic/kibana/blob/main/src/plugins/discover/public/locator.ts).
It allows specifying various **Discover** app state pieces like: index pattern, filters, query, time range and more.
There are two ways to access locators of other apps:
@ -86,8 +86,8 @@ window.location.href = urlToADashboard;
To navigate between different Kibana apps without a page reload there are APIs in `core`:
* [core.application.navigateToApp](https://github.com/elastic/kibana/blob/master/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetoapp.md)
* [core.application.navigateToUrl](https://github.com/elastic/kibana/blob/master/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetourl.md)
* [core.application.navigateToApp](https://github.com/elastic/kibana/blob/main/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetoapp.md)
* [core.application.navigateToUrl](https://github.com/elastic/kibana/blob/main/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetourl.md)
*Rendering a link to a different app on its own would also cause a full page reload:*
@ -112,7 +112,7 @@ const MySPALink = () =>
```
As it would be too much boilerplate to do this for each link in your app, there is a handy wrapper that helps with it:
[RedirectAppLinks](https://github.com/elastic/kibana/blob/master/src/plugins/kibana_react/public/app_links/redirect_app_link.tsx#L49).
[RedirectAppLinks](https://github.com/elastic/kibana/blob/main/src/plugins/kibana_react/public/app_links/redirect_app_link.tsx#L49).
```jsx
const MyApp = () =>
@ -134,9 +134,9 @@ Common rules to follow in this scenario:
This is required to make sure `core` is aware of navigations triggered inside your app, so it could act accordingly when needed.
* `Core`'s [ScopedHistory](https://github.com/elastic/kibana/blob/master/docs/development/core/public/kibana-plugin-core-public.scopedhistory.md) instance.
* [Example usage](https://github.com/elastic/kibana/blob/master/docs/development/core/public/kibana-plugin-core-public.appmountparameters.history.md)
* [Example plugin](https://github.com/elastic/kibana/blob/master/test/plugin_functional/plugins/core_plugin_a/public/application.tsx#L120)
* `Core`'s [ScopedHistory](https://github.com/elastic/kibana/blob/main/docs/development/core/public/kibana-plugin-core-public.scopedhistory.md) instance.
* [Example usage](https://github.com/elastic/kibana/blob/main/docs/development/core/public/kibana-plugin-core-public.appmountparameters.history.md)
* [Example plugin](https://github.com/elastic/kibana/blob/main/test/plugin_functional/plugins/core_plugin_a/public/application.tsx#L120)
Relative links will be resolved relative to your app's route (e.g.: `http://localhost5601/app/{your-app-id}`)
and setting up internal links in your app in SPA friendly way would look something like:
@ -152,7 +152,7 @@ const MyInternalLink = () => <Link to="/my-other-page"></Link>
Try to avoid using `window.location` and `window.history` directly.
<DocCallOut>
Instead, use [ScopedHistory](https://github.com/elastic/kibana/blob/master/docs/development/core/public/kibana-plugin-core-public.scopedhistory.md) instance provided by `core`.
Instead, use [ScopedHistory](https://github.com/elastic/kibana/blob/main/docs/development/core/public/kibana-plugin-core-public.scopedhistory.md) instance provided by `core`.
</DocCallOut>
- This way `core` will know about location changes triggered within your app, and it would act accordingly.
@ -190,7 +190,7 @@ There are utils to help you to implement such kind of state syncing.
- Adding a query param flag or simple key/value to the URL.
<DocCallOut>
Follow [these docs](https://github.com/elastic/kibana/blob/master/src/plugins/kibana_utils/docs/state_sync#state-syncing-utilities) to learn more.
Follow [these docs](https://github.com/elastic/kibana/blob/main/src/plugins/kibana_utils/docs/state_sync#state-syncing-utilities) to learn more.
</DocCallOut>
## Preserving state between navigations
@ -212,7 +212,7 @@ you'd notice that state is stored inside that link, and it also gets updated whe
![image](../assets/state_inside_the_link.png)
This is where separation into `_a` and `_g` query params comes into play. What is considered a *global* state gets constantly updated in those navigation links. In the example above it was a time filter.
This is backed by [KbnUrlTracker](https://github.com/elastic/kibana/blob/master/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.ts#L57) util. You can use it to achieve similar behavior.
This is backed by [KbnUrlTracker](https://github.com/elastic/kibana/blob/main/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.ts#L57) util. You can use it to achieve similar behavior.
NOTE: After migrating to KP navigation works without page reloads and all plugins are loaded simultaneously.
Hence, likely there are simpler ways to preserve state of your application, unless you want to do it through URL.

View file

@ -49,7 +49,7 @@ If the state your plugin is storing can be provided by other plugins (your plugi
Any plugin that stores any persistable state as part of their saved object should make sure that its saved object migration
and reference extraction and injection methods correctly use the matching `PersistableStateService` implementation for the state they are storing.
Take a look at [example saved object](https://github.com/elastic/kibana/blob/master/examples/embeddable_examples/server/searchable_list_saved_object.ts#L32) which stores an embeddable state. Note how the `migrations`, `extractReferences` and `injectReferences` are defined.
Take a look at [example saved object](https://github.com/elastic/kibana/blob/main/examples/embeddable_examples/server/searchable_list_saved_object.ts#L32) which stores an embeddable state. Note how the `migrations`, `extractReferences` and `injectReferences` are defined.
## Storing persistable state as part of URL
@ -71,7 +71,7 @@ To support persisting your state in saved objects owned by another plugin, the <
text="Learn how to define Saved Object references"
/>
[See example embeddable providing extract/inject functions](https://github.com/elastic/kibana/blob/master/examples/embeddable_examples/public/migrations/migrations_embeddable_factory.ts)
[See example embeddable providing extract/inject functions](https://github.com/elastic/kibana/blob/main/examples/embeddable_examples/public/migrations/migrations_embeddable_factory.ts)
### Migrations and Backward compatibility
@ -79,9 +79,9 @@ As your plugin evolves, you may need to change your state in a breaking way. If
<DocLink id="kibDevTutorialSavedObject" section="migrations" text="How to write a migration" />.
[See an example saved object storing embeddable state implementing saved object migration function](https://github.com/elastic/kibana/blob/master/examples/embeddable_examples/server/searchable_list_saved_object.ts)
[See an example saved object storing embeddable state implementing saved object migration function](https://github.com/elastic/kibana/blob/main/examples/embeddable_examples/server/searchable_list_saved_object.ts)
[See example embeddable providing migration functions](https://github.com/elastic/kibana/blob/master/examples/embeddable_examples/public/migrations/migrations_embeddable_factory.ts)
[See example embeddable providing migration functions](https://github.com/elastic/kibana/blob/main/examples/embeddable_examples/public/migrations/migrations_embeddable_factory.ts)
## Telemetry