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

[UnifiedDocViewer] Remove usage of KibanaContextProvider #167202

Merged
merged 19 commits into from
Dec 1, 2023

Conversation

lukasolson
Copy link
Member

@lukasolson lukasolson commented Sep 25, 2023

Summary

Removes usages of KibanaContextProvider to simplify the API of the UnifiedDocViewer component. Instead, necessary services are accessed from the plugin itself (via getUnifiedDocViewerServices). Removes the useUnifiedDocViewerServices hook since it's no longer needed.

Resolves #168380

Checklist

@lukasolson lukasolson added Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. Feature:UnifiedDocViewer Issues relating to the unified doc viewer component v8.11.0 labels Sep 25, 2023
@lukasolson lukasolson self-assigned this Sep 25, 2023
@kertal kertal removed the v8.11.0 label Oct 9, 2023
@lukasolson lukasolson marked this pull request as ready for review November 16, 2023 16:17
@lukasolson lukasolson requested review from a team as code owners November 16, 2023 16:17
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@lukasolson lukasolson added release_note:skip Skip the PR/issue when compiling release notes v8.12.0 labels Nov 16, 2023
Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes LGTM, and quickly tested in Discover and the doc viewer is working as expected 👍

@botelastic botelastic bot added the Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability label Nov 17, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

@kertal
Copy link
Member

kertal commented Nov 20, 2023

@elasticmachine merge upstream

Comment on lines -29 to +24
const { data: hit } = useFetcher<Promise<DataTableRecord | undefined>>(async () => {
if (!dataView?.id || !isFlyoutVisible) return;
const response = await data.search
.search({
params: {
index: SYNTHETICS_INDEX_PATTERN,
body: {
query: {
ids: {
values: [ping.docId],
},
},
fields: ['*'],
_source: false,
},
},
})
.toPromise();
const docs = response?.rawResponse?.hits?.hits ?? [];
if (docs.length > 0) {
return buildDataTableRecord(docs[0], dataView);
}
}, [data, dataView, ping.docId, isFlyoutVisible]);
const [, hit] = useEsDocSearch({ id: ping.docId, index: SYNTHETICS_INDEX_PATTERN, dataView });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Synthetics Changes LGTM !!

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
synthetics 883 859 -24
unifiedDocViewer 113 112 -1
total -25

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
unifiedDocViewer 10 9 -1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
synthetics 868.2KB 866.5KB -1.7KB
unifiedDocViewer 58.5KB 58.5KB -52.0B
total -1.8KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
unifiedDocViewer 3 2 -1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
unifiedDocViewer 9.9KB 9.6KB -325.0B
Unknown metric groups

API count

id before after diff
unifiedDocViewer 13 12 -1

ESLint disabled line counts

id before after diff
unifiedDocViewer 8 7 -1

Total ESLint disabled count

id before after diff
unifiedDocViewer 8 7 -1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @lukasolson

Copy link
Member

@jennypavlova jennypavlova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but I don't see why the review we need to review it as I couldn't find any code we own, approving to unblock.

@lukasolson lukasolson merged commit 1533f30 into elastic:main Dec 1, 2023
35 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:review backport:skip This commit does not require backporting ci:collect-apm Feature:UnifiedDocViewer Issues relating to the unified doc viewer component release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UnifiedDocViewer] Replace KibanaContextProvider
9 participants