mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Discover] Could not expand cell content in DiscoverGrid (#91289)
Closes: #90796 Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
643794eb9f
commit
4d01440012
5 changed files with 22 additions and 36 deletions
|
@ -9,7 +9,6 @@
|
|||
// data types
|
||||
export const kibanaJSON = 'kibana-json';
|
||||
export const geoPoint = 'geo-point';
|
||||
export const unknownType = 'unknown';
|
||||
export const gridStyle = {
|
||||
border: 'all',
|
||||
fontSize: 's',
|
||||
|
|
|
@ -28,7 +28,7 @@ describe('Discover grid columns ', function () {
|
|||
"display": undefined,
|
||||
"id": "extension",
|
||||
"isSortable": undefined,
|
||||
"schema": "unknown",
|
||||
"schema": "kibana-json",
|
||||
},
|
||||
Object {
|
||||
"actions": Object {
|
||||
|
@ -43,7 +43,7 @@ describe('Discover grid columns ', function () {
|
|||
"display": undefined,
|
||||
"id": "message",
|
||||
"isSortable": undefined,
|
||||
"schema": "unknown",
|
||||
"schema": "kibana-json",
|
||||
},
|
||||
]
|
||||
`);
|
||||
|
@ -68,7 +68,7 @@ describe('Discover grid columns ', function () {
|
|||
"display": undefined,
|
||||
"id": "extension",
|
||||
"isSortable": undefined,
|
||||
"schema": "unknown",
|
||||
"schema": "kibana-json",
|
||||
},
|
||||
Object {
|
||||
"actions": Object {
|
||||
|
@ -80,7 +80,7 @@ describe('Discover grid columns ', function () {
|
|||
"display": undefined,
|
||||
"id": "message",
|
||||
"isSortable": undefined,
|
||||
"schema": "unknown",
|
||||
"schema": "kibana-json",
|
||||
},
|
||||
]
|
||||
`);
|
||||
|
@ -106,7 +106,7 @@ describe('Discover grid columns ', function () {
|
|||
"id": "timestamp",
|
||||
"initialWidth": 180,
|
||||
"isSortable": undefined,
|
||||
"schema": "unknown",
|
||||
"schema": "kibana-json",
|
||||
},
|
||||
Object {
|
||||
"actions": Object {
|
||||
|
@ -121,7 +121,7 @@ describe('Discover grid columns ', function () {
|
|||
"display": undefined,
|
||||
"id": "extension",
|
||||
"isSortable": undefined,
|
||||
"schema": "unknown",
|
||||
"schema": "kibana-json",
|
||||
},
|
||||
Object {
|
||||
"actions": Object {
|
||||
|
@ -136,7 +136,7 @@ describe('Discover grid columns ', function () {
|
|||
"display": undefined,
|
||||
"id": "message",
|
||||
"isSortable": undefined,
|
||||
"schema": "unknown",
|
||||
"schema": "kibana-json",
|
||||
},
|
||||
]
|
||||
`);
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import React, { ReactNode } from 'react';
|
||||
import { EuiCodeBlock } from '@elastic/eui';
|
||||
import { geoPoint, kibanaJSON, unknownType } from './constants';
|
||||
import React from 'react';
|
||||
import { EuiCodeBlock, EuiDataGridPopoverContents } from '@elastic/eui';
|
||||
import { geoPoint, kibanaJSON } from './constants';
|
||||
import { KBN_FIELD_TYPES } from '../../../../../data/common';
|
||||
|
||||
export function getSchemaByKbnType(kbnType: string | undefined) {
|
||||
|
@ -24,12 +24,10 @@ export function getSchemaByKbnType(kbnType: string | undefined) {
|
|||
return 'string';
|
||||
case KBN_FIELD_TYPES.DATE:
|
||||
return 'datetime';
|
||||
case KBN_FIELD_TYPES._SOURCE:
|
||||
return kibanaJSON;
|
||||
case KBN_FIELD_TYPES.GEO_POINT:
|
||||
return geoPoint;
|
||||
default:
|
||||
return unknownType;
|
||||
return kibanaJSON;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,16 +43,6 @@ export function getSchemaDetectors() {
|
|||
icon: '',
|
||||
color: '',
|
||||
},
|
||||
{
|
||||
type: unknownType,
|
||||
detector() {
|
||||
return 0; // this schema is always explicitly defined
|
||||
},
|
||||
sortTextAsc: '',
|
||||
sortTextDesc: '',
|
||||
icon: '',
|
||||
color: '',
|
||||
},
|
||||
{
|
||||
type: geoPoint,
|
||||
detector() {
|
||||
|
@ -70,19 +58,12 @@ export function getSchemaDetectors() {
|
|||
/**
|
||||
* Returns custom popover content for certain schemas
|
||||
*/
|
||||
export function getPopoverContents() {
|
||||
export function getPopoverContents(): EuiDataGridPopoverContents {
|
||||
return {
|
||||
[geoPoint]: ({ children }: { children: ReactNode }) => {
|
||||
[geoPoint]: ({ children }) => {
|
||||
return <span className="geo-point">{children}</span>;
|
||||
},
|
||||
[unknownType]: ({ children }: { children: ReactNode }) => {
|
||||
return (
|
||||
<EuiCodeBlock isCopyable language="json" paddingSize="none" transparentBackground={true}>
|
||||
{children}
|
||||
</EuiCodeBlock>
|
||||
);
|
||||
},
|
||||
[kibanaJSON]: ({ children }: { children: ReactNode }) => {
|
||||
[kibanaJSON]: ({ children }) => {
|
||||
return (
|
||||
<EuiCodeBlock isCopyable language="json" paddingSize="none" transparentBackground={true}>
|
||||
{children}
|
||||
|
|
|
@ -78,7 +78,13 @@ describe('Discover grid cell rendering', function () {
|
|||
);
|
||||
expect(component.html()).toMatchInlineSnapshot(`
|
||||
"<span>{
|
||||
"bytes": 100
|
||||
"_id": "1",
|
||||
"_index": "test",
|
||||
"_type": "test",
|
||||
"_score": 1,
|
||||
"_source": {
|
||||
"bytes": 100
|
||||
}
|
||||
}</span>"
|
||||
`);
|
||||
});
|
||||
|
|
|
@ -55,7 +55,7 @@ export const getRenderCellValueFn = (
|
|||
if (field && field.type === '_source') {
|
||||
if (isDetails) {
|
||||
// nicely formatted JSON for the expanded view
|
||||
return <span>{JSON.stringify(row[columnId], null, 2)}</span>;
|
||||
return <span>{JSON.stringify(row, null, 2)}</span>;
|
||||
}
|
||||
const formatted = indexPattern.formatHit(row);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue