From 1702235e6f8d0f18896215932c904d9f4261fb94 Mon Sep 17 00:00:00 2001
From: Michail Yasonik
Date: Fri, 28 Feb 2020 18:53:29 -0500
Subject: [PATCH] fixing sorting and schema detection and other bugs
---
.../create_discover_grid_directive.tsx | 2 +-
.../discover_grid/discover_grid.tsx | 49 ++++++++++++++++---
2 files changed, 42 insertions(+), 9 deletions(-)
diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/discover_grid/create_discover_grid_directive.tsx b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/discover_grid/create_discover_grid_directive.tsx
index cd004a22c02aa0..9b3605753b2d10 100644
--- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/discover_grid/create_discover_grid_directive.tsx
+++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/discover_grid/create_discover_grid_directive.tsx
@@ -33,6 +33,6 @@ export function createDiscoverGridDirective(reactDirective: any) {
['onRemoveColumn', { watchDepth: 'reference', wrapApply: false }],
['onAddColumn', { watchDepth: 'reference', wrapApply: false }],
['getContextAppHref', { watchDepth: 'reference', wrapApply: false }],
- ['onSort', { watchDepth: 'reference', wrapApply: false }],
+ ['onSort', { watchDepth: 'reference' }],
]);
}
diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/discover_grid/discover_grid.tsx b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/discover_grid/discover_grid.tsx
index cb2b9c0e441bec..5f1c8e2d79635c 100644
--- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/discover_grid/discover_grid.tsx
+++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/discover_grid/discover_grid.tsx
@@ -36,6 +36,7 @@ import {
EuiSpacer,
EuiDataGridColumn,
EuiDataGridCellValueElementProps,
+ EuiScreenReaderOnly,
} from '@elastic/eui';
import { DocViewer } from '../doc_viewer/doc_viewer';
import { IndexPattern } from '../../../kibana_services';
@@ -44,7 +45,8 @@ import { shortenDottedString } from '../../../../../../../../plugins/data/common
type Direction = 'asc' | 'desc';
type SortArr = [string, Direction];
-const KibanaJSON = 'kibana-json';
+const kibanaJSON = 'kibana-json';
+const geoPoint = 'geo-point';
interface SortObj {
id: string;
direction: Direction;
@@ -137,7 +139,7 @@ export const DiscoverGrid = React.memo(function DiscoverGridInner({
onAddColumn,
}: Props) {
const actionColumnId = 'uniqueString'; // TODO should be guaranteed unique...
- const lowestPageSize = 500;
+ const lowestPageSize = 50;
const timeString = i18n.translate('kbn.discover.timeLabel', {
defaultMessage: 'Time',
});
@@ -162,12 +164,18 @@ export const DiscoverGrid = React.memo(function DiscoverGridInner({
case 'date':
column.schema = 'datetime';
break;
- case 'numeric':
- column.schema = 'number';
+ case 'number':
+ column.schema = 'numeric';
break;
case '_source':
case 'object':
- column.schema = KibanaJSON;
+ column.schema = kibanaJSON;
+ break;
+ case 'geo_point':
+ column.schema = geoPoint;
+ break;
+ default:
+ column.schema = undefined;
break;
}
@@ -277,6 +285,7 @@ export const DiscoverGrid = React.memo(function DiscoverGridInner({
value = formattedField(row, fieldName);
if (showFilterActions(isDetails, fieldName)) {
+ // console.log(dataGridColumns[fieldName].schema)
return (
{
+ return {children};
+ },
+ }}
/>
{showDisclaimer && (
<>
@@ -382,7 +411,11 @@ export const DiscoverGrid = React.memo(function DiscoverGridInner({
>
)}
- {searchString && {searchString}
}
+ {searchString && (
+
+ {searchString}
+
+ )}
{typeof flyoutRow !== 'undefined' && (
setFlyoutRow(undefined)} size="l" ownFocus>