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

De-angularize DocViewer #42116

Merged
merged 36 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
045957e
Add angular tab
kertal Jul 29, 2019
f63c2ff
Add render tab
kertal Jul 29, 2019
cf06aec
Refactore docViewer directive
kertal Jul 29, 2019
4d8ecb7
Migrate DocViewerAngularTab to typescript
kertal Jul 30, 2019
5144985
Move data-test-subj in htmls
kertal Jul 30, 2019
d621799
Add component property for DocViewer tab
kertal Jul 30, 2019
996cb48
JSON tab adaption to use component prop
kertal Jul 30, 2019
65ab0f2
Refactor Table tab to compile and render angular
kertal Jul 30, 2019
8933e30
Adaption of tests
kertal Jul 30, 2019
29a37f3
Remove unused variable
kertal Jul 31, 2019
1e57bed
Move angular helper function to seperate file
kertal Jul 31, 2019
479f711
Convert to typescript
kertal Jul 31, 2019
93ebaf4
Refactor DocViewsRegistryProvider -> slim version
kertal Jul 31, 2019
bf8844e
Fix merge conflict
kertal Jul 31, 2019
96fcf0a
Remove doc_viewer browser tests
kertal Aug 1, 2019
cd7e6c5
Remove browser test to be replaced by jest
kertal Aug 1, 2019
f14523a
Convert more files to TypeScript, refactor types
kertal Aug 1, 2019
e16c806
Merge remote-tracking branch 'upstream/master' into kertal-pr-doc_viewer
kertal Aug 1, 2019
544d528
Merge remote-tracking branch 'upstream/master' into kertal-pr-doc_viewer
kertal Aug 2, 2019
066a613
Cleanup, remove duplicate an angular render
kertal Aug 2, 2019
57ff240
Merge remote-tracking branch 'upstream/master' into kertal-pr-doc_viewer
kertal Aug 2, 2019
04897ac
Fix typecheck error
kertal Aug 2, 2019
5fc669a
Migrate to reactDirective
kertal Aug 6, 2019
783fa4d
Improve doc_views registry
kertal Aug 13, 2019
dd79dda
Refactor, add tests and documation to doc_viewer
kertal Aug 13, 2019
7f81051
Merge remote-tracking branch 'upstream/master' into kertal-pr-doc_viewer
kertal Aug 13, 2019
d07dbe0
Prevent multiple renderings by shouldComponentUpdate
kertal Aug 15, 2019
b9855ff
Apply spencers angular optimizations
kertal Aug 15, 2019
b8664c9
Remove redundant EuiTabbedContent props
kertal Aug 19, 2019
3cdf1ac
Merge remote-tracking branch 'upstream/master' into kertal-pr-doc_viewer
kertal Aug 19, 2019
d6ad0e6
Remove redundant angular compiler, fix test
kertal Aug 19, 2019
e5fd439
Add hasError to shouldComponentUpdate
kertal Aug 19, 2019
1530a06
Remove double license header
kertal Aug 19, 2019
2a6ce7c
Fixing typos and types
kertal Aug 19, 2019
bc32540
Use ComponentType
kertal Aug 19, 2019
6615a2f
Fix merge conflict
kertal Aug 20, 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
272 changes: 0 additions & 272 deletions src/legacy/core_plugins/kbn_doc_views/public/__tests__/doc_views.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
import { addDocView } from 'ui/registry/doc_views';
import { i18n } from '@kbn/i18n';
import { JsonCodeEditor } from './json_code_editor';

import _ from 'lodash';
import { uiRegistry } from './_registry';

export const DocViewsRegistryProvider = uiRegistry({
name: 'docViews',
index: ['name'],
order: ['order'],
constructor() {
this.forEach(docView => {
docView.shouldShow = docView.shouldShow || _.constant(true);
docView.name = docView.name || docView.title;
});
}
/*
* Registration of the the doc view: json
* - used to display an ES hit as pretty printed JSON at Discover
*/
addDocView({
title: i18n.translate('kbnDocViews.json.jsonTitle', {
defaultMessage: 'JSON',
}),
order: 20,
component: JsonCodeEditor,
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@
import React from 'react';
import { shallow } from 'enzyme';
import { JsonCodeEditor } from './json_code_editor';
import { IndexPattern } from 'ui/index_patterns';

it('returns the `JsonCodeEditor` component', () => {
const hit = { _index: 'test', _source: { test: 123 } };
expect(shallow(<JsonCodeEditor hit={hit} />)).toMatchSnapshot();
const props = {
hit: { _index: 'test', _source: { test: 123 } },
columns: [],
indexPattern: {} as IndexPattern,
filter: jest.fn(),
onAddColumn: jest.fn(),
onRemoveColumn: jest.fn(),
};
expect(shallow(<JsonCodeEditor {...props} />)).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@
import { EuiCodeEditor } from '@elastic/eui';
import React from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { DocViewRenderProps } from 'ui/registry/doc_views';

export interface JsonCodeEditorProps {
hit: Record<string, any>;
}

export function JsonCodeEditor({ hit }: JsonCodeEditorProps) {
export function JsonCodeEditor({ hit }: DocViewRenderProps) {
return (
<EuiCodeEditor
aria-label={
Expand Down
Loading