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 table layout #43240

Merged
merged 83 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
972203e
Add large field collapse for doc viewer table rows in Discover
aaronoah Dec 20, 2018
79d9a1b
remove extra collapse button wrapper
aaronoah Feb 22, 2019
3aae380
Merge branch 'master' of github.com:elastic/kibana into discover-tabl…
timroes Jun 28, 2019
71e35a6
Merge branch 'discover-table-collapse' of https://github.com/aaronoah…
kertal Jul 12, 2019
2b83ecd
Merge branch 'master' of github.com:elastic/kibana into discover-tabl…
kertal Jul 12, 2019
6f96c08
Reposition toggle button, remove Array warning
kertal Jul 12, 2019
0a9193d
Merge branch 'master' of github.com:elastic/kibana into discover-tabl…
kertal Jul 15, 2019
2f135c8
Merge branch 'master' into aaronoah-discover-table-collapse
kertal Jul 19, 2019
9cbd9b5
Merge branch 'master' of github.com:elastic/kibana into discover-tabl…
kertal Jul 19, 2019
1f8f678
Initial Commit
kertal Jun 29, 2019
62add87
Extend formatHitProvider to format type 'text'
kertal Jun 29, 2019
9f18984
Add FieldName React Component
kertal Jul 22, 2019
ab9d37f
Merge remote-tracking branch 'upstream/master' into kertal-pr-discove…
kertal Jul 26, 2019
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
f4d6786
Merge remote-tracking branch 'upstream/master' into aaronoah-discover…
kertal Aug 2, 2019
486add7
Fix tests
kertal Aug 5, 2019
5fc669a
Migrate to reactDirective
kertal Aug 6, 2019
27ef26e
Merge remote-tracking branch 'upstream/master' into aaronoah-discover…
kertal Aug 6, 2019
36e90f4
Merge remote-tracking branch 'kertal/aaronoah-discover-table-collapse…
kertal Aug 9, 2019
77d6248
Merge branch 'master' of github.com:elastic/kibana into discover-tabl…
kertal Aug 9, 2019
369ab98
Remove unused translations
kertal Aug 12, 2019
28ea996
Merge branch 'master' of github.com:elastic/kibana into discover-tabl…
kertal Aug 12, 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
e5f9679
Fix merge conflict
kertal Aug 13, 2019
d07dbe0
Prevent multiple renderings by shouldComponentUpdate
kertal Aug 15, 2019
b9855ff
Apply spencers angular optimizations
kertal Aug 15, 2019
9dc44a8
Merge branch 'kertal-kertal-pr-doc_viewer' into kertal-kertal-pr-doc_…
kertal Aug 15, 2019
39f5614
Add I18n Provider to DocViewerTab
kertal Aug 16, 2019
e548e2d
Fix DocViewerTab txpescript
kertal Aug 16, 2019
90dbffc
Add text formatting to formatHitProvider
kertal Aug 16, 2019
febc818
Merge large field collapse
kertal Aug 16, 2019
4f9dcd2
Remove Angular html table
kertal Aug 18, 2019
afe7b17
Add refactored React table component
kertal Aug 18, 2019
a0dcef2
Extend formatHit to plain text formatting
kertal Aug 19, 2019
c3bfe28
Fix merge conflict
kertal Aug 19, 2019
5057a47
Remove unused imports
kertal Aug 19, 2019
c03750d
Merge remote-tracking branch 'upstream/master' into kertal-pr-doc_vie…
kertal Aug 19, 2019
dfc7c15
Fix merge conflicts
kertal Aug 20, 2019
7974f05
Fix merge conflicts
kertal Aug 20, 2019
abe4520
Adapt Types after merge
kertal Aug 20, 2019
e38222e
Fix jest test broken by merge
kertal Aug 20, 2019
5edff18
Add additional Warning buttons
kertal Aug 20, 2019
b4aa261
Restore server_plugins.js
kertal Aug 20, 2019
52ca8f7
Merge remote-tracking branch 'upstream/master' into kertal-pr-doc_vie…
kertal Aug 21, 2019
bf56014
Add more fields to test
kertal Aug 21, 2019
1c7889c
Remove column toggle for context
kertal Aug 22, 2019
8117d85
Improve jest tests
kertal Aug 23, 2019
f9dcca1
Merge remote-tracking branch 'upstream/master' into kertal-pr-doc_vie…
kertal Aug 23, 2019
59e622c
Add buttons with disabled attribute
kertal Aug 23, 2019
b957a96
EUI-ficate buttons
kertal Aug 23, 2019
e9062ff
Add aria label to inactive buttons
kertal Aug 23, 2019
e4f20a1
Merge remote-tracking branch 'upstream/master' into kertal-pr-doc_vie…
kertal Aug 23, 2019
d13c6f1
Improve action buttons
kertal Aug 26, 2019
9f31c9a
Merge remote-tracking branch 'upstream/master' into kertal-pr-doc_vie…
kertal Aug 26, 2019
9756d3f
Add jest tests for helper functions
kertal Aug 26, 2019
2a55976
Typescript improvements
kertal Aug 26, 2019
b759b3f
Remove focus opacity 1 of action buttons
kertal Aug 26, 2019
15768db
Convert warnings to use EuiIconTip
kertal Aug 26, 2019
00d889f
Remove redundant code duplication
kertal Aug 26, 2019
81e9a7c
Fix test for fields with no mapping
kertal Aug 26, 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
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,28 @@ const partialFormattedCache = new WeakMap();
// Takes a hit, merges it with any stored/scripted fields, and with the metaFields
// returns a formatted version
export function formatHitProvider(indexPattern: IndexPattern, defaultFormat: any) {
function convert(hit: Record<string, any>, val: any, fieldName: string) {
function convert(hit: Record<string, any>, val: any, fieldName: string, type: string = 'html') {
const field = indexPattern.fields.byName[fieldName];
if (!field) return defaultFormat.convert(val, 'html');
if (!field) return defaultFormat.convert(val, type);
const parsedUrl = {
origin: window.location.origin,
pathname: window.location.pathname,
};
return field.format.getConverterFor('html')(val, field, hit, parsedUrl);
return field.format.getConverterFor(type)(val, field, hit, parsedUrl);
}

function formatHit(hit: Record<string, any>) {
function formatHit(hit: Record<string, any>, type: string = 'html') {
if (type === 'text') {
// formatHit of type text is for react components to get rid of <span ng-non-bindable>
// since it's currently just used at the discover's doc view table, caching is not necessary
const flattened = indexPattern.flattenHit(hit);
const result: Record<string, any> = {};
for (const [key, value] of Object.entries(flattened)) {
result[key] = convert(hit, value, key, type);
}
return result;
}

const cached = formattedCache.get(hit);
if (cached) {
return cached;
Expand Down
102 changes: 0 additions & 102 deletions src/legacy/core_plugins/kbn_doc_views/public/views/table.html

This file was deleted.

77 changes: 0 additions & 77 deletions src/legacy/core_plugins/kbn_doc_views/public/views/table.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
* under the License.
*/

import { uiModules } from 'ui/modules';
const module = uiModules.get('apps/doc_views');
import _ from 'lodash';
import { addDocView } from 'ui/registry/doc_views';
import { i18n } from '@kbn/i18n';
import { DocViewTable } from './table/table';

// Simple filter to allow using ng-bind-html without explicitly calling $sce.trustAsHtml in a controller
// (See http://goo.gl/mpj9o2)
module.filter('trustAsHtml', function ($sce) {
return $sce.trustAsHtml;
addDocView({
title: i18n.translate('kbnDocViews.table.tableTitle', {
defaultMessage: 'Table',
}),
order: 10,
component: DocViewTable,
});
Loading