-
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
NP Migration: Move doc views registry and existing doc views into discover plugin #53465
Conversation
@@ -43,7 +43,7 @@ describe('Test of <Doc /> helper / hook', () => { | |||
`); | |||
}); | |||
|
|||
test('useEsDocSearch', () => { | |||
test('useEsDocSearch', async () => { |
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.
This is just a small cleanup getting rid of the async state update outside of act(...)
warnings.
The latest react update made it possible to wait for the async updates by using asynchronous act
. In the case of this test the assertions assumed no async functions would be called, so the mocks had to be slightly adjusted.
@@ -67,7 +67,7 @@ async function mountDoc(search: () => void, update = false, indexPatternGetter: | |||
indexPatternService, | |||
} as DocProps; | |||
let comp!: ReactWrapper; | |||
act(() => { | |||
await act(async () => { |
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.
Some here - getting rid of react warnings during test run
@@ -25,7 +25,7 @@ import { findTestSubject } from '@elastic/eui/lib/test'; | |||
import { Doc, DocProps } from './doc'; | |||
|
|||
jest.mock('../doc_viewer/doc_viewer', () => ({ | |||
DocViewer: 'test', | |||
DocViewer: () => 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.
If the doc viewer is actually rendered (which happens now because of async act
), test
throws another warning because it's not a valid react component
src/core/MIGRATION.md
Outdated
@@ -1173,6 +1173,7 @@ import { setup, start } from '../core_plugins/visualizations/public/legacy'; | |||
| `ui/registry/field_formats` | `data.fieldFormats` | | | |||
| `ui/registry/feature_catalogue` | `home.featureCatalogue.register` | Must add `home` as a dependency in your kibana.json. | | |||
| `ui/registry/vis_types` | `visualizations.types` | -- | | |||
| `ui/registry/doc_views` | `discover.addDocView` | Currently shimmed in the old platform - use `import { setup } from '../kibana/public/discover'; setup.addDocView(...)` | |
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 it ready to be consumed by new platform plugins? it means no webpack imports, no global angular
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.
No, it's still in the legacy world for now, good point. I will remove it.
@elasticmachine merge upstream |
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.
Started to test, and have a question, I've added the following code in discover/index.ts
, to test if Angular rendering works (it does 👍 )
setup.addDocView({
title: 'JSON-2',
order: 30,
directive: {
template: '<pre>{{hitJson}}</pre>',
scope: {
hit: '=',
},
controller: ($scope: any) => {
$scope.hitJson = JSON.stringify($scope.hit, null, 2);
},
},
});
but typescript complains, it might be a Promise, which could be the case, but it isn't here?
That removes the warning, but is it wise? many thx
export const setup = pluginInstance.setup(npSetup.core, {
...npSetup.plugins,
__LEGACY: {
chrome,
},
}) as DiscoverSetup;
Good point @kertal, I improved the types by changing the definition of export const plugin = (context: PluginInitializerContext) => {
return new DiscoverPlugin();
}; Now |
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.
Code LGTM, didn't test again, but it worked yesterday, also with a legacy angular component.
💔 Build FailedHistory
To update your PR or re-run it, just comment with: |
💔 Build FailedTo update your PR or re-run it, just comment with: |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
…le-saved-objects * 'master' of github.com:elastic/kibana: (86 commits) [Uptime] Added date range filter into expanded list query (elastic#52609) [SIEM] Add react/display-name eslint rule (elastic#53107) [SIEM] Enable eslint prefer-template rule (elastic#53983) Elasticsearch snapshots automation (elastic#53706) [SIEM] Enable eslint react/no-children-prop (elastic#53985) [DOCS][Reporting] Adds info about using a custom reporting index (elastic#54052) Changing background color to align with EUI color (elastic#54060) Fix linting issues (elastic#54068) NP Migration: Move doc views registry and existing doc views into discover plugin (elastic#53465) [ML] DF Analytics job creation: Add 'excludes' input field to form (elastic#53856) EMT-issue-65: add endpoint list api (elastic#53861) [SIEM] Fix doubled drag handles in Timeline (elastic#52679) Functional tests: refactor visualize_page (elastic#53845) [Dashboard] Redesign empty screen in readonly mode (elastic#54073) [ML] Support search for partitions on Single Metric Viewer (elastic#53879) update apm index pattern (elastic#54095) Add data ui for envoyproxy Metricbeat Module (elastic#53476) [ML] persist the brush when expanded to full width (elastic#54020) Skip failing test (elastic#54100) [APM] Show errors on the timeline instead of under the transaction (elastic#53756) ... # Conflicts: # src/legacy/core_plugins/console/public/np_ready/application/contexts/services_context.tsx # src/legacy/core_plugins/console/public/np_ready/application/index.tsx
…/kibana into feature/console-saved-objects * 'feature/console-saved-objects' of github.com:jloleysens/kibana: (86 commits) [Uptime] Added date range filter into expanded list query (elastic#52609) [SIEM] Add react/display-name eslint rule (elastic#53107) [SIEM] Enable eslint prefer-template rule (elastic#53983) Elasticsearch snapshots automation (elastic#53706) [SIEM] Enable eslint react/no-children-prop (elastic#53985) [DOCS][Reporting] Adds info about using a custom reporting index (elastic#54052) Changing background color to align with EUI color (elastic#54060) Fix linting issues (elastic#54068) NP Migration: Move doc views registry and existing doc views into discover plugin (elastic#53465) [ML] DF Analytics job creation: Add 'excludes' input field to form (elastic#53856) EMT-issue-65: add endpoint list api (elastic#53861) [SIEM] Fix doubled drag handles in Timeline (elastic#52679) Functional tests: refactor visualize_page (elastic#53845) [Dashboard] Redesign empty screen in readonly mode (elastic#54073) [ML] Support search for partitions on Single Metric Viewer (elastic#53879) update apm index pattern (elastic#54095) Add data ui for envoyproxy Metricbeat Module (elastic#53476) [ML] persist the brush when expanded to full width (elastic#54020) Skip failing test (elastic#54100) [APM] Show errors on the timeline instead of under the transaction (elastic#53756) ...
Moves the doc views registry into the setup contract of the discover plugin. Default doc views (json view and table) are also moved into the shimmed discover plugin.
Dev docs
The
ui/registry/doc_views
registry is removed in favor of the same functionality exposed through the setup contract of thediscover
plugin incore_plugins/kibana
.Old way of registering a doc view:
New way of registering a doc view: