-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Inspector -> New Platform #42164
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
Merged
Merged
Inspector -> New Platform #42164
Changes from 15 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
5996835
refactor: 💡 remove SASS and clean up InspectorView component
streamich 78e1fde
refactor: 💡 clean up inspector, convert .js -> .ts
streamich 6766866
feat: 🎸 add Inspector NP plugin boilerplate
streamich c0b40fa
feat: 🎸 move view registry to NP, move types, add registerView
streamich f02deff
docs: ✏️ move inspector README to NP plugin
streamich 055f37c
refactor: 💡 move ui/inspector/ui to NP
streamich 49ce4d1
refactor: 💡 move Inspector adapters to NP
streamich d4d86b7
refactor: 💡 move Inspector.isAvailable to New Platform
streamich 53fc00d
refactor: 💡 move Inspector.open to New Platform plugin
streamich d626647
test: 💍 move Inspector tests to NP plugin
streamich 6e1cd4d
chore: 🤖 fix imports
streamich 8974d0f
feat: 🎸 update translations
streamich 1074e14
test: 💍 fix failing translation snapshot
streamich 328d7a6
test: 💍 fix yarn test:browser tests
streamich 423fa3a
Merge branch 'master' into ui-inspector-to-np
streamich e40b153
Update src/legacy/ui/public/inspector/build_tabular_inspector_data.ts
streamich 151a0e6
[ML] [Job wizards] switching to new kibana context provider
jgowdyelastic 74472ce
Merge remote-tracking branch 'upstream/master' into ui-inspector-to-np
streamich af75060
Merge remote-tracking branch 'jgowdyelastic/switching-to-new-kibana-c…
streamich 7263157
fix: 🐛 specify translation path directly to the plugin
streamich 4ea86b6
docs: ✏️ add comment about Webpack config fix
streamich a6dda9e
Update src/legacy/ui/public/inspector/build_tabular_inspector_data.ts
streamich 41ae462
Update src/legacy/ui/public/inspector/build_tabular_inspector_data.ts
streamich a4e4596
feat: 🎸 improve types as per review
streamich d5fea29
Merge remote-tracking branch 'origin/ui-inspector-to-np' into ui-insp…
streamich e63259f
fix: 🐛 remove <InspectorView> comp and fix view layouts
streamich 6daa23b
test: 💍 improve mocks
streamich 3867bca
Merge remote-tracking branch 'upstream/master' into ui-inspector-to-np
streamich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -24,3 +24,5 @@ jest.doMock('ui/capabilities', () => ({ | |
| }, | ||
| }, | ||
| })); | ||
|
|
||
| jest.mock('ui/new_platform'); | ||
26 changes: 22 additions & 4 deletions
26
src/legacy/core_plugins/inspector_views/public/data/__snapshots__/data_view.test.js.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,127 +1,6 @@ | ||
| # Inspector | ||
|
|
||
| The inspector is a contextual tool to gain insights into different elements | ||
| in Kibana, e.g. visualizations. It has the form of a flyout panel. | ||
|
|
||
| ## Inspector Views | ||
|
|
||
| The "Inspector Panel" can have multiple so called "Inspector Views" inside of it. | ||
| These views are used to gain different information into the element you are inspecting. | ||
| There is a request inspector view to gain information in the requests done for this | ||
| element or a data inspector view to inspect the underlying data. Whether or not | ||
| a specific view is available depends on the used adapters. | ||
|
|
||
| ## Inspector Adapters | ||
|
|
||
| Since the Inspector panel itself is not tied to a specific type of elements (visualizations, | ||
| saved searches, etc.), everything you need to open the inspector is a collection | ||
| of so called inspector adapters. A single adapter can be any type of JavaScript class. | ||
|
|
||
| Most likely an adapter offers some kind of logging capabilities for the element, that | ||
| uses it e.g. the request adapter allows element (like visualizations) to log requests | ||
| they make. | ||
|
|
||
| The corresponding inspector view will then use the information inside the adapter | ||
| to present the data in the panel. That concept allows different types of elements | ||
| to use the Inspector panel, while they can use completely or partial different adapters | ||
| and inspector views than other elements. | ||
|
|
||
| For example a visualization could provide the request and data adapter while a saved | ||
| search could only provide the request adapter and a Vega visualization could additionally | ||
| provide a Vega adapter. | ||
|
|
||
| There is no 1 to 1 relationship between adapters and views. An adapter could be used | ||
| by multiple views and a view can use data from multiple adapters. It's up to the | ||
| view to decide whether or not it wants to be shown for a given adapters list. | ||
|
|
||
| ## Develop custom inspectors | ||
|
|
||
| You can extend the inspector panel by adding custom inspector views and inspector | ||
| adapters via a plugin. | ||
|
|
||
| ### Develop inspector views | ||
|
|
||
| To develop custom inspector views you should first register your file via `uiExports` | ||
| in your plugin config: | ||
|
|
||
| ```js | ||
| export default (kibana) => { | ||
| return new kibana.Plugin({ | ||
| uiExports: { | ||
| inspectorViews: [ 'plugins/your_plugin/custom_view' ], | ||
| } | ||
| }); | ||
| }; | ||
| ``` | ||
|
|
||
| Within the `custom_view.js` file in your `public` folder, you can define your | ||
| inspector view as follows: | ||
|
|
||
| ```js | ||
| import React from 'react'; | ||
| import { InspectorView, viewRegistry } from 'ui/inspector'; | ||
|
|
||
| function MyInspectorComponent(props) { | ||
| // props.adapters is the object of all adapters and may vary depending | ||
| // on who and where this inspector was opened. You should check for all | ||
| // adapters you need, in the below shouldShow method, before accessing | ||
| // them here. | ||
| return ( | ||
| <InspectorView> | ||
| { /* Always use InspectorView as the wrapping element! */ } | ||
| </InspectorView> | ||
| ); | ||
| } | ||
|
|
||
| const MyLittleInspectorView = { | ||
| // Title shown to select this view | ||
| title: 'Display Name', | ||
| // An icon id from the EUI icon list | ||
| icon: 'iconName', | ||
| // An order to sort the views (lower means first) | ||
| order: 10, | ||
| // An additional helptext, that wil | ||
| help: `And additional help text, that will be shown in the inspector help.`, | ||
| shouldShow(adapters) { | ||
| // Only show if `someAdapter` is available. Make sure to check for | ||
| // all adapters that you want to access in your view later on and | ||
| // any additional condition you want to be true to be shown. | ||
| return adapters.someAdapter; | ||
| }, | ||
| // A React component, that will be used for rendering | ||
| component: MyInspectorComponent | ||
| }; | ||
|
|
||
| viewRegistry.register(MyLittleInspectorView); | ||
| ``` | ||
|
|
||
| ### Develop custom adapters | ||
|
|
||
| An inspector adapter is just a plain JavaScript class, that can e.g. be attached | ||
| to custom visualization types, so an inspector view can show additional information for this | ||
| visualization. | ||
|
|
||
| To add additional adapters to your visualization type, use the `inspectorAdapters.custom` | ||
| object when defining the visualization type: | ||
|
|
||
| ```js | ||
| class MyCustomInspectorAdapter { | ||
| // .... | ||
| } | ||
|
|
||
| // inside your visualization type description (usually passed to VisFactory.create...Type) | ||
| { | ||
| // ... | ||
| inspectorAdapters: { | ||
| custom: { | ||
| someAdapter: MyCustomInspectorAdapter | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| An instance of MyCustomInspectorAdapter will now be available on each visualization | ||
| of that type and can be accessed via `vis.API.inspectorAdapters.someInspector`. | ||
|
|
||
| Custom inspector views can now check for the presence of `adapters.someAdapter` | ||
| in their `shouldShow` method and use this adapter in their component. | ||
| - Inspector has been moved to `inspector` New Platform plugin. | ||
| - You can find its documentation in `src/plugins/inspector/README.md`. | ||
| - This folder will be deleted soon, it is deprecated, do not use anything from here. | ||
| - This folder is ready to be deleted, as soon as nothing imports from here anymore. |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
68 changes: 0 additions & 68 deletions
68
src/legacy/ui/public/inspector/build_tabular_inspector_data.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.