Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Sustainable Kibana Architecture: Move 11 modules under packages/core (#203638) #205108

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,23 @@ packages/kbn-content-management-utils @elastic/kibana-data-discovery
examples/controls_example @elastic/kibana-presentation
src/plugins/controls @elastic/kibana-presentation
src/core @elastic/kibana-core
packages/core/analytics/core-analytics-browser @elastic/kibana-core
packages/core/analytics/core-analytics-browser-internal @elastic/kibana-core
src/core/packages/analytics/browser @elastic/kibana-core
src/core/packages/analytics/browser-internal @elastic/kibana-core
packages/core/analytics/core-analytics-browser-mocks @elastic/kibana-core
packages/core/analytics/core-analytics-server @elastic/kibana-core
packages/core/analytics/core-analytics-server-internal @elastic/kibana-core
src/core/packages/analytics/server @elastic/kibana-core
src/core/packages/analytics/server-internal @elastic/kibana-core
packages/core/analytics/core-analytics-server-mocks @elastic/kibana-core
test/plugin_functional/plugins/core_app_status @elastic/kibana-core
packages/core/application/core-application-browser @elastic/kibana-core
packages/core/application/core-application-browser-internal @elastic/kibana-core
src/core/packages/application/browser @elastic/kibana-core
src/core/packages/application/browser-internal @elastic/kibana-core
packages/core/application/core-application-browser-mocks @elastic/kibana-core
packages/core/application/core-application-common @elastic/kibana-core
packages/core/apps/core-apps-browser-internal @elastic/kibana-core
src/core/packages/application/common @elastic/kibana-core
src/core/packages/apps/browser-internal @elastic/kibana-core
packages/core/apps/core-apps-browser-mocks @elastic/kibana-core
packages/core/apps/core-apps-server-internal @elastic/kibana-core
packages/core/base/core-base-browser-internal @elastic/kibana-core
src/core/packages/apps/server-internal @elastic/kibana-core
src/core/packages/base/browser-internal @elastic/kibana-core
packages/core/base/core-base-browser-mocks @elastic/kibana-core
packages/core/base/core-base-common @elastic/kibana-core
src/core/packages/base/common @elastic/kibana-core
packages/core/base/core-base-common-internal @elastic/kibana-core
packages/core/base/core-base-server-internal @elastic/kibana-core
packages/core/base/core-base-server-mocks @elastic/kibana-core
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class MyPlugin implements Plugin {
}
}
----
<1> Refer to {kib-repo}/blob/8.9/packages/core/application/core-application-browser/src/contracts.ts[application.register interface]
<1> Refer to {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/contracts.ts[application.register interface]
<2> Application specific URL.
<3> `mount` callback is invoked when a user navigates to the application-specific URL.
<4> `core.getStartServices` method provides API available during `start` lifecycle.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Registering a feature consists of the following fields. For more information, co
|A human readable name for your feature.

|`category` (required)
|{kib-repo}blob/{branch}/packages/core/application/core-application-common/src/app_category.ts[`AppCategory`]
|{kib-repo}blob/{branch}/src/core/packages/application/common/src/app_category.ts[`AppCategory`]
|`DEFAULT_APP_CATEGORIES.kibana`
|The `AppCategory` which best represents your feature. Used to organize the display
of features within the management screens.
Expand Down
16 changes: 8 additions & 8 deletions docs/developer/best-practices/navigation.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ window.location.href = urlToADashboard;

To navigate between different {kib} apps without a page reload (by default) there are APIs in `core`:

* {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/contracts.ts[core.application.navigateToApp]
* {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/contracts.ts[core.application.navigateToUrl]
* {kib-repo}tree/{branch}/src/core/packages/application/browser/src/contracts.ts[core.application.navigateToApp]
* {kib-repo}tree/{branch}/src/core/packages/application/browser/src/contracts.ts[core.application.navigateToUrl]

Both methods offer customization such as opening the target in a new page, with an `options` parameter. All the options are optional be default.

* {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/contracts.ts[core.application.navigateToApp options]
* {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/contracts.ts[core.application.navigateToUrl options]
* {kib-repo}tree/{branch}/src/core/packages/application/browser/src/contracts.ts[core.application.navigateToApp options]
* {kib-repo}tree/{branch}/src/core/packages/application/browser/src/contracts.ts[core.application.navigateToUrl options]

*Rendering a link to a different {kib} app on its own would also cause a full page reload:*

Expand Down Expand Up @@ -163,8 +163,8 @@ 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 {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/scoped_history.ts[ScopedHistory] instance.
* {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/app_mount.ts[Example usage]
* `Core`'s {kib-repo}tree/{branch}/src/core/packages/application/browser/src/scoped_history.ts[ScopedHistory] instance.
* {kib-repo}tree/{branch}/src/core/packages/application/browser/src/app_mount.ts[Example usage]
* {kib-repo}tree/{branch}/test/plugin_functional/plugins/core_plugin_a/public/application.tsx#L120[Example plugin]

Relative links will be resolved relative to your app's route (e.g.: `http://localhost5601/app/{your-app-id}`)
Expand All @@ -181,14 +181,14 @@ const MyInternalLink = () => <Link to="/my-other-page"></Link>
=== Using history and browser location

Try to avoid using `window.location` and `window.history` directly. +
Instead, consider using {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/scoped_history.ts[ScopedHistory]
Instead, consider using {kib-repo}tree/{branch}/src/core/packages/application/browser/src/scoped_history.ts[ScopedHistory]
instance provided by `core`.

* This way `core` will know about location changes triggered within your app, and it would act accordingly.
* Some plugins are listening to location changes. Triggering location change manually could lead to unpredictable and hard-to-catch bugs.

Common use-case for using
`core`'s {kib-repo}tree/{branch}/packages/core/application/core-application-browser/src/scoped_history.ts[ScopedHistory] directly:
`core`'s {kib-repo}tree/{branch}/src/core/packages/application/browser/src/scoped_history.ts[ScopedHistory] directly:

* Reading/writing query params or hash.
* Imperatively triggering internal navigations within your app.
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,18 +245,18 @@
"@kbn/controls-example-plugin": "link:examples/controls_example",
"@kbn/controls-plugin": "link:src/plugins/controls",
"@kbn/core": "link:src/core",
"@kbn/core-analytics-browser": "link:packages/core/analytics/core-analytics-browser",
"@kbn/core-analytics-browser-internal": "link:packages/core/analytics/core-analytics-browser-internal",
"@kbn/core-analytics-server": "link:packages/core/analytics/core-analytics-server",
"@kbn/core-analytics-server-internal": "link:packages/core/analytics/core-analytics-server-internal",
"@kbn/core-analytics-browser": "link:src/core/packages/analytics/browser",
"@kbn/core-analytics-browser-internal": "link:src/core/packages/analytics/browser-internal",
"@kbn/core-analytics-server": "link:src/core/packages/analytics/server",
"@kbn/core-analytics-server-internal": "link:src/core/packages/analytics/server-internal",
"@kbn/core-app-status-plugin": "link:test/plugin_functional/plugins/core_app_status",
"@kbn/core-application-browser": "link:packages/core/application/core-application-browser",
"@kbn/core-application-browser-internal": "link:packages/core/application/core-application-browser-internal",
"@kbn/core-application-common": "link:packages/core/application/core-application-common",
"@kbn/core-apps-browser-internal": "link:packages/core/apps/core-apps-browser-internal",
"@kbn/core-apps-server-internal": "link:packages/core/apps/core-apps-server-internal",
"@kbn/core-base-browser-internal": "link:packages/core/base/core-base-browser-internal",
"@kbn/core-base-common": "link:packages/core/base/core-base-common",
"@kbn/core-application-browser": "link:src/core/packages/application/browser",
"@kbn/core-application-browser-internal": "link:src/core/packages/application/browser-internal",
"@kbn/core-application-common": "link:src/core/packages/application/common",
"@kbn/core-apps-browser-internal": "link:src/core/packages/apps/browser-internal",
"@kbn/core-apps-server-internal": "link:src/core/packages/apps/server-internal",
"@kbn/core-base-browser-internal": "link:src/core/packages/base/browser-internal",
"@kbn/core-base-common": "link:src/core/packages/base/common",
"@kbn/core-base-common-internal": "link:packages/core/base/core-base-common-internal",
"@kbn/core-base-server-internal": "link:packages/core/base/core-base-server-internal",
"@kbn/core-capabilities-browser-internal": "link:packages/core/capabilities/core-capabilities-browser-internal",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

module.exports = {
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/application/core-application-common'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/analytics/browser-internal'],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": ["jest", "node"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

module.exports = {
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/apps/core-apps-browser-internal'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/analytics/browser'],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/analytics/core-analytics-server-internal'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/analytics/server-internal'],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/apps/core-apps-server-internal'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/analytics/server'],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
Expand Down
14 changes: 14 additions & 0 deletions src/core/packages/application/browser-internal/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/application/browser-internal'],
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

module.exports = {
preset: '@kbn/test/jest_integration',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/application/core-application-browser-internal'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/application/browser-internal'],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

module.exports = {
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/base/core-base-browser-internal'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/application/browser'],
};
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export interface ApplicationStart {
* application.navigateToUrl('/app/discover/some-path') // does not include the current basePath
* application.navigateToUrl('/base-path/s/my-space/app/unknown-app/some-path') // unknown application
* application.navigateToUrl('../discover') // resolve to `/base-path/s/my-space/discover` which is not a path of a known app.
* application.navigateToUrl('../../other-space/discover') // resolve to `/base-path/s/other-space/discover` which is not within the current basePath.
* application.navigateToUrl('../../../other-space/discover') // resolve to `/base-path/s/other-space/discover` which is not within the current basePath.
* ```
*
* @param url - an absolute URL, an absolute path or a relative path, to navigate to.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

module.exports = {
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/analytics/core-analytics-browser'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/application/common'],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
Expand Down
14 changes: 14 additions & 0 deletions src/core/packages/apps/browser-internal/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/apps/browser-internal'],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/analytics/core-analytics-server'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/apps/server-internal'],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"stripInternal": false,
Expand Down
14 changes: 14 additions & 0 deletions src/core/packages/base/browser-internal/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../../../../..',
roots: ['<rootDir>/src/core/packages/base/browser-internal'],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
Expand Down
Loading
Loading