-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into global_loading_indicator_subj
- Loading branch information
Showing
314 changed files
with
8,611 additions
and
2,449 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,8 +92,8 @@ | |
"@dnd-kit/core": "^3.1.1", | ||
"@dnd-kit/sortable": "^4.0.0", | ||
"@dnd-kit/utilities": "^2.0.0", | ||
"@elastic/apm-rum": "^5.13.0", | ||
"@elastic/apm-rum-react": "^1.4.3", | ||
"@elastic/apm-rum": "^5.14.0", | ||
"@elastic/apm-rum-react": "^1.4.4", | ||
"@elastic/charts": "59.1.0", | ||
"@elastic/datemath": "5.0.3", | ||
"@elastic/elasticsearch": "npm:@elastic/[email protected]", | ||
|
@@ -741,6 +741,7 @@ | |
"@kbn/url-state": "link:packages/kbn-url-state", | ||
"@kbn/usage-collection-plugin": "link:src/plugins/usage_collection", | ||
"@kbn/usage-collection-test-plugin": "link:test/plugin_functional/plugins/usage_collection", | ||
"@kbn/use-tracked-promise": "link:packages/kbn-use-tracked-promise", | ||
"@kbn/user-profile-components": "link:packages/kbn-user-profile-components", | ||
"@kbn/user-profile-examples-plugin": "link:examples/user_profile_examples", | ||
"@kbn/user-profiles-consumer-plugin": "link:x-pack/test/security_api_integration/plugins/user_profiles_consumer", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# @kbn/use-tracked-promise | ||
|
||
/** | ||
* This hook manages a Promise factory and can create new Promises from it. The | ||
* state of these Promises is tracked and they can be canceled when superseded | ||
* to avoid race conditions. | ||
* | ||
* ``` | ||
* const [requestState, performRequest] = useTrackedPromise( | ||
* { | ||
* cancelPreviousOn: 'resolution', | ||
* createPromise: async (url: string) => { | ||
* return await fetchSomething(url) | ||
* }, | ||
* onResolve: response => { | ||
* setSomeState(response.data); | ||
* }, | ||
* onReject: response => { | ||
* setSomeError(response); | ||
* }, | ||
* }, | ||
* [fetchSomething] | ||
* ); | ||
* ``` | ||
* | ||
* The `onResolve` and `onReject` handlers are registered separately, because | ||
* the hook will inject a rejection when in case of a canellation. The | ||
* `cancelPreviousOn` attribute can be used to indicate when the preceding | ||
* pending promises should be canceled: | ||
* | ||
* 'never': No preceding promises will be canceled. | ||
* | ||
* 'creation': Any preceding promises will be canceled as soon as a new one is | ||
* created. | ||
* | ||
* 'settlement': Any preceding promise will be canceled when a newer promise is | ||
* resolved or rejected. | ||
* | ||
* 'resolution': Any preceding promise will be canceled when a newer promise is | ||
* resolved. | ||
* | ||
* 'rejection': Any preceding promise will be canceled when a newer promise is | ||
* rejected. | ||
* | ||
* Any pending promises will be canceled when the component using the hook is | ||
* unmounted, but their status will not be tracked to avoid React warnings | ||
* about memory leaks. | ||
* | ||
* The last argument is a normal React hook dependency list that indicates | ||
* under which conditions a new reference to the configuration object should be | ||
* used. | ||
* | ||
* The `onResolve`, `onReject` and possible uncatched errors are only triggered | ||
* if the underlying component is mounted. To ensure they always trigger (i.e. | ||
* if the promise is called in a `useLayoutEffect`) use the `triggerOrThrow` | ||
* attribute: | ||
* | ||
* 'whenMounted': (default) they are called only if the component is mounted. | ||
* | ||
* 'always': they always call. The consumer is then responsible of ensuring no | ||
* side effects happen if the underlying component is not mounted. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* 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 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 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
export { useTrackedPromise } from './use_tracked_promise'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
* 2.0 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 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
module.exports = { | ||
preset: '@kbn/test/jest_node', | ||
rootDir: '../..', | ||
roots: ['<rootDir>/packages/kbn-use-tracked-promise'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"type": "shared-common", | ||
"id": "@kbn/use-tracked-promise", | ||
"owner": "@elastic/infra-monitoring-ui" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "@kbn/use-tracked-promise", | ||
"private": true, | ||
"version": "1.0.0", | ||
"license": "SSPL-1.0 OR Elastic License 2.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"outDir": "target/types", | ||
"types": [ | ||
"jest", | ||
"node" | ||
] | ||
}, | ||
"include": [ | ||
"**/*.ts", | ||
], | ||
"exclude": [ | ||
"target/**/*" | ||
], | ||
"kbn_references": [] | ||
} |
Oops, something went wrong.