-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Streams] Dashboard linking #204309
[Streams] Dashboard linking #204309
Conversation
…into init-streams-plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found an issue when you delete a linked Dashboard (from the Dashboard plugin) then reload the stream. When a dashboard is "missing" or "not found" the SavedObject interface returns an error object.
From a code style / organization perspective... All the dashboard routes are in the same file where all the other APIs each individual route is in a separate file. I don't care which way we go but I think we should try to maintain consistency.
|
||
return idsByType.dashboard.flatMap((dashboardId): Asset[] => { | ||
const dashboard = dashboardsById[dashboardId]; | ||
if (dashboard) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (dashboard) { | |
if (dashboard && dashboard.error == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I delete the dashboard Saved Object, dashboard
will become:
{
id: 'ca635bdd-5f15-44a0-93d1-d4edbe24d98e',
type: 'dashboard',
error: {
statusCode: 404,
error: 'Not Found',
message: 'Saved object [dashboard/ca635bdd-5f15-44a0-93d1-d4edbe24d98e] not found'
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for catching! will add an API test for this as well
import { useStreamsAppFetch } from './use_streams_app_fetch'; | ||
|
||
export const useDashboardsFetch = (id?: string) => { | ||
const { signal } = useAbortController(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to use signal
from const { signal } = useAbortController()
vs useStreamsAppFetch((signal) => ...)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume it's not intentional, it's mostly something Joe wrote. I'll change and confirm with him
@simianhacker re:
should have elaborated - I use {folder}/route.ts because that allows us to configure an ESLint rule to require explicit return types for the route handlers. The reason for that is that a route repository is a very heavy type, as it contains all the routes. if there's types in there that need to be inferred (from e.g. the handler function body), TypeScript ends up re-evaluating a lot of this code anything changes in the routes, which hurts TS responsiveness (a lot). So ideally we should use route.ts (and enable the linting rule: Line 1002 in ca5a08d
|
storageSettings | ||
); | ||
|
||
// get the client (which is shared across all adapters) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(which is shared across all adapters)
What does this mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its interface, will update the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the dashboard deletion bug.
## Summary So that it can be used from `streams_app` (o11y). See #204309 Steps to relocate: 1. Fetch latest `main` 2. Update the `group` and/or `visibility` in the module's manifest. 3. Run `node scripts/relocate --moveOnly @kbn/saved-objects-tagging-plugin`
Starting backport for target branches: 8.x |
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Unknown metric groupsAPI count
References to deprecated APIs
History
|
💔 All backports failed
Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
## Summary So that it can be used from `streams_app` (o11y). See elastic#204309 Steps to relocate: 1. Fetch latest `main` 2. Update the `group` and/or `visibility` in the module's manifest. 3. Run `node scripts/relocate --moveOnly @kbn/saved-objects-tagging-plugin`
Links dashboard to Streams. Changes: - Introduces `IndexStorageAdapter` to manage ES indices - see https://github.com/dgieselaar/kibana/blob/streams-app-asset-linking/x-pack/solutions/observability/packages/utils_server/es/storage/README.md for motivation - Introduces `AssetClient` and `AssetService` to manage asset links with `IndexStorageAdapter` - `RepositorySupertestClient` to make it easier to use `@kbn/server-route-repository` with FTR tests - refactors related to above changes --------- Co-authored-by: Chris Cowan <[email protected]> Co-authored-by: Joe Reuter <[email protected]> Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
Links dashboard to Streams. Changes: - Introduces `IndexStorageAdapter` to manage ES indices - see https://github.com/dgieselaar/kibana/blob/streams-app-asset-linking/x-pack/solutions/observability/packages/utils_server/es/storage/README.md for motivation - Introduces `AssetClient` and `AssetService` to manage asset links with `IndexStorageAdapter` - `RepositorySupertestClient` to make it easier to use `@kbn/server-route-repository` with FTR tests - refactors related to above changes --------- Co-authored-by: Chris Cowan <[email protected]> Co-authored-by: Joe Reuter <[email protected]> Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit 28414ce) # Conflicts: # .github/CODEOWNERS # x-pack/test/tsconfig.json
## Summary So that it can be used from `streams_app` (o11y). See elastic#204309 Steps to relocate: 1. Fetch latest `main` 2. Update the `group` and/or `visibility` in the module's manifest. 3. Run `node scripts/relocate --moveOnly @kbn/saved-objects-tagging-plugin` (cherry picked from commit a8579bb) # Conflicts: # .github/CODEOWNERS # packages/kbn-relocate/utils/relocate.ts
## Summary So that it can be used from `streams_app` (o11y). See elastic#204309 Steps to relocate: 1. Fetch latest `main` 2. Update the `group` and/or `visibility` in the module's manifest. 3. Run `node scripts/relocate --moveOnly @kbn/saved-objects-tagging-plugin`
Links dashboard to Streams. Changes: - Introduces `IndexStorageAdapter` to manage ES indices - see https://github.com/dgieselaar/kibana/blob/streams-app-asset-linking/x-pack/solutions/observability/packages/utils_server/es/storage/README.md for motivation - Introduces `AssetClient` and `AssetService` to manage asset links with `IndexStorageAdapter` - `RepositorySupertestClient` to make it easier to use `@kbn/server-route-repository` with FTR tests - refactors related to above changes --------- Co-authored-by: Chris Cowan <[email protected]> Co-authored-by: Joe Reuter <[email protected]> Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
Links dashboard to Streams.
Changes:
IndexStorageAdapter
to manage ES indices - see https://github.com/dgieselaar/kibana/blob/streams-app-asset-linking/x-pack/solutions/observability/packages/utils_server/es/storage/README.md for motivationAssetClient
andAssetService
to manage asset links withIndexStorageAdapter
RepositorySupertestClient
to make it easier to use@kbn/server-route-repository
with FTR tests