Skip to content
Merged
Show file tree
Hide file tree
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 Jul 19, 2019
78e1fde
refactor: 💡 clean up inspector, convert .js -> .ts
streamich Jul 29, 2019
6766866
feat: 🎸 add Inspector NP plugin boilerplate
streamich Jul 29, 2019
c0b40fa
feat: 🎸 move view registry to NP, move types, add registerView
streamich Jul 29, 2019
f02deff
docs: ✏️ move inspector README to NP plugin
streamich Jul 29, 2019
055f37c
refactor: 💡 move ui/inspector/ui to NP
streamich Jul 29, 2019
49ce4d1
refactor: 💡 move Inspector adapters to NP
streamich Jul 29, 2019
d4d86b7
refactor: 💡 move Inspector.isAvailable to New Platform
streamich Jul 29, 2019
53fc00d
refactor: 💡 move Inspector.open to New Platform plugin
streamich Jul 29, 2019
d626647
test: 💍 move Inspector tests to NP plugin
streamich Jul 29, 2019
6e1cd4d
chore: 🤖 fix imports
streamich Jul 29, 2019
8974d0f
feat: 🎸 update translations
streamich Jul 29, 2019
1074e14
test: 💍 fix failing translation snapshot
streamich Jul 30, 2019
328d7a6
test: 💍 fix yarn test:browser tests
streamich Jul 30, 2019
423fa3a
Merge branch 'master' into ui-inspector-to-np
streamich Jul 31, 2019
e40b153
Update src/legacy/ui/public/inspector/build_tabular_inspector_data.ts
streamich Jul 31, 2019
151a0e6
[ML] [Job wizards] switching to new kibana context provider
jgowdyelastic Aug 2, 2019
74472ce
Merge remote-tracking branch 'upstream/master' into ui-inspector-to-np
streamich Aug 2, 2019
af75060
Merge remote-tracking branch 'jgowdyelastic/switching-to-new-kibana-c…
streamich Aug 2, 2019
7263157
fix: 🐛 specify translation path directly to the plugin
streamich Aug 2, 2019
4ea86b6
docs: ✏️ add comment about Webpack config fix
streamich Aug 2, 2019
a6dda9e
Update src/legacy/ui/public/inspector/build_tabular_inspector_data.ts
streamich Aug 2, 2019
41ae462
Update src/legacy/ui/public/inspector/build_tabular_inspector_data.ts
streamich Aug 2, 2019
a4e4596
feat: 🎸 improve types as per review
streamich Aug 2, 2019
d5fea29
Merge remote-tracking branch 'origin/ui-inspector-to-np' into ui-insp…
streamich Aug 2, 2019
e63259f
fix: 🐛 remove <InspectorView> comp and fix view layouts
streamich Aug 2, 2019
6daa23b
test: 💍 improve mocks
streamich Aug 2, 2019
3867bca
Merge remote-tracking branch 'upstream/master' into ui-inspector-to-np
streamich Aug 2, 2019
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
3 changes: 2 additions & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"timelion": "src/legacy/core_plugins/timelion",
"tagCloud": "src/legacy/core_plugins/tagcloud",
"tsvb": "src/legacy/core_plugins/metrics",
"kbnESQuery": "packages/kbn-es-query"
"kbnESQuery": "packages/kbn-es-query",
"plugins": "src/plugins"
},
"exclude": ["src/legacy/ui/ui_render/ui_render_mixin.js"],
"translations": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,11 @@
* under the License.
*/

import { fatalErrorsServiceMock, notificationServiceMock } from '../../../../core/public/mocks';

let modalContents: React.Component;

export const getModalContents = () => modalContents;

jest.doMock('ui/new_platform', () => {
return {
npStart: {
core: {
overlays: {
openFlyout: jest.fn(),
openModal: (component: React.Component) => {
modalContents = component;
return {
close: jest.fn(),
};
},
},
},
},
npSetup: {
core: {
fatalErrors: fatalErrorsServiceMock.createSetupContract(),
notifications: notificationServiceMock.createSetupContract(),
},
},
};
});
jest.mock('ui/new_platform');

jest.doMock('ui/metadata', () => ({
metadata: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ jest.doMock('ui/capabilities', () => ({
},
},
}));

jest.mock('ui/new_platform');

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { DataView } from './data_view';
import { DataAdapter } from 'ui/inspector/adapters';
import { mountWithIntl } from 'test_utils/enzyme_helpers';

jest.mock('ui/new_platform');
jest.mock('./lib/export_csv', () => ({
exportAsCsv: jest.fn(),
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jest.mock(
{ virtual: true }
);

jest.mock('ui/new_platform');

import { migratePanelsTo730 } from './migrate_to_730_panels';
import { SavedDashboardPanelTo60, SavedDashboardPanel730ToLatest } from '../types';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,11 @@
* under the License.
*/

import { fatalErrorsServiceMock, notificationServiceMock } from '../../../../../core/public/mocks';

let modalContents: React.Component;

export const getModalContents = () => modalContents;

jest.doMock('ui/new_platform', () => {
return {
npStart: {
core: {
overlays: {
openFlyout: jest.fn(),
openModal: (component: React.Component) => {
modalContents = component;
return {
close: jest.fn(),
};
},
},
},
},
npSetup: {
core: {
fatalErrors: fatalErrorsServiceMock.createSetupContract(),
notifications: notificationServiceMock.createSetupContract(),
},
},
};
});
jest.mock('ui/new_platform');

jest.doMock('ui/metadata', () => ({
metadata: {
Expand Down
5 changes: 4 additions & 1 deletion src/legacy/core_plugins/tests_bundle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,14 @@ export default (kibana) => {
modules: [...modules],
template: createTestEntryTemplate(uiSettingDefaults),
extendConfig(webpackConfig) {
return webpackMerge({
const mergedConfig = webpackMerge({
resolve: {
extensions: ['.karma_mock.js', '.karma_mock.tsx', '.karma_mock.ts']
}
}, webpackConfig);
delete mergedConfig.optimization.splitChunks.cacheGroups.commons;

return mergedConfig;
}
});

Expand Down
1 change: 0 additions & 1 deletion src/legacy/ui/public/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
@import './error_url_overflow/index';
@import './exit_full_screen/index';
@import './field_editor/index';
@import './inspector/index';
@import './kbn_top_nav/index';
@import './markdown/index';
@import './notify/index';
Expand Down
129 changes: 4 additions & 125 deletions src/legacy/ui/public/inspector/README.md
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.
1 change: 0 additions & 1 deletion src/legacy/ui/public/inspector/_index.scss

This file was deleted.

10 changes: 8 additions & 2 deletions src/legacy/ui/public/inspector/adapters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@
* under the License.
*/

export { DataAdapter, FormattedData } from './data';
export { RequestAdapter, RequestStatus } from './request';
/* eslint-disable */

/**
* Do not use this, use NP `inspector` plugin instead.
*
* @deprecated
*/
export * from '../../../../../plugins/inspector/public/adapters/index';
68 changes: 0 additions & 68 deletions src/legacy/ui/public/inspector/build_tabular_inspector_data.js

This file was deleted.

Loading