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

[Logs Overview] Add a flyout to show category document examples #194867

Merged
merged 100 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 90 commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
b3a1af8
Add rare logs scenario
weltenwort Aug 20, 2024
0a43169
Add empty logs_overview package
weltenwort Aug 21, 2024
d373e59
Add gaussian distribution to the unstructured logs scenario
weltenwort Sep 2, 2024
278365e
Add support for xstate5
weltenwort Sep 2, 2024
1f4bd0f
Add xstate5 console inspector
weltenwort Sep 2, 2024
76ea2a5
Add cateogorization service
weltenwort Sep 2, 2024
0528e8b
Add categories grid
weltenwort Sep 2, 2024
0b7fc2c
Enable translation linting for the package
weltenwort Sep 2, 2024
b428bd4
Improve typing of the sorting config
weltenwort Sep 2, 2024
5be73af
Improve default column widths
weltenwort Sep 2, 2024
e0af1bb
Add loading screen with cancellation
weltenwort Sep 2, 2024
c70a37a
Merge branch 'main' into logs-enhanced-embeddable-iteration-1
weltenwort Sep 3, 2024
169df23
Bump XState 5 version
weltenwort Sep 3, 2024
901bee3
Start cleaning up names and introducing the overview component
weltenwort Sep 3, 2024
1023d69
Provide a self-contained overview via logs_shared
weltenwort Sep 4, 2024
0d35529
Fix unnecessary uiSettings dependency
weltenwort Sep 4, 2024
d551da4
Fix some refactoring mistakes
weltenwort Sep 4, 2024
47153c8
Memoize time overview props
weltenwort Sep 4, 2024
dc8ea70
Update zod import
weltenwort Sep 5, 2024
3793877
Add service filters and error reporting
weltenwort Sep 5, 2024
c69a83b
Fix fetching remaining categories
weltenwort Sep 5, 2024
870d347
Add logs overview feature flag
weltenwort Sep 6, 2024
d08f104
Add logs overview in infra hosts
weltenwort Sep 6, 2024
6ecd056
Fix sampling probability of second pass
weltenwort Sep 6, 2024
b0b1fe7
Signal categories limit being reached
weltenwort Sep 6, 2024
8c09788
Respect the abort signal when categorizing
weltenwort Sep 6, 2024
b028eab
Add empty state screen
weltenwort Sep 6, 2024
6a1ed55
Merge branch 'main' of github.com:elastic/kibana into logs-enhanced-e…
weltenwort Sep 9, 2024
463355c
Merge branch 'main' of github.com:elastic/kibana into logs-enhanced-e…
weltenwort Sep 12, 2024
6aad1a1
Fix race condition when rendering apm service details
weltenwort Sep 12, 2024
7f1fb14
Improve loading content in hosts
weltenwort Sep 12, 2024
4e95f04
Update XState v5 version
weltenwort Sep 16, 2024
ea9dfb2
Merge branch 'main' of github.com:elastic/kibana into logs-enhanced-e…
weltenwort Sep 16, 2024
a6ab7e1
Clean up TODOs and comments
weltenwort Sep 16, 2024
5bbda50
Remove temporary test
weltenwort Sep 16, 2024
7843215
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Sep 16, 2024
e3f3043
Update license headers
weltenwort Sep 16, 2024
3402293
Remove unused import
weltenwort Sep 16, 2024
542d1f1
Revert term separators back to asterisks
weltenwort Sep 16, 2024
eb089a6
Add a logs_overview mock
weltenwort Sep 16, 2024
78b0d4c
Fix telemetry schema
weltenwort Sep 16, 2024
76b9771
Merge branch 'main' of github.com:elastic/kibana into logs-enhanced-e…
weltenwort Sep 16, 2024
2d414c5
Merge branch 'main' of github.com:elastic/kibana into logs-enhanced-e…
weltenwort Sep 17, 2024
14be0af
Merge branch 'main' of github.com:elastic/kibana into logs-enhanced-e…
weltenwort Sep 18, 2024
c1962c0
Add link to open all log entries in discover
weltenwort Sep 18, 2024
90282cc
Fix dataview spec passed to locator
weltenwort Sep 18, 2024
6e77e63
Merge branch 'main' of github.com:elastic/kibana into logs-enhanced-e…
weltenwort Sep 18, 2024
1a90cb8
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Sep 18, 2024
70adf04
Merge remote-tracking branch 'upstream/main' into logs-enhanced-embed…
Kerry350 Sep 23, 2024
b522494
Merge remote-tracking branch 'upstream/main' into logs-enhanced-embed…
Kerry350 Oct 2, 2024
598d9a9
package.json changes from yarn kbn bootstrap
Kerry350 Oct 3, 2024
a34ab22
Fix two types
Kerry350 Oct 3, 2024
eb3f98c
Merge branch 'main' into logs-enhanced-embeddable-iteration-1
elasticmachine Oct 3, 2024
4940642
Merge remote-tracking branch 'upstream/main' into logs-enhanced-embed…
weltenwort Oct 9, 2024
46f8e9e
Merge branch 'main' into logs-enhanced-embeddable-iteration-1
elasticmachine Oct 9, 2024
c6d26db
Use timeField parameter instead of hard-coded field name
weltenwort Oct 9, 2024
7e34bc0
Add a flyout to show category document examples
Kerry350 Sep 30, 2024
1efa83b
Merge remote-tracking branch 'upstream/main' into 193450-show-categor…
Kerry350 Oct 10, 2024
246b0f7
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Oct 10, 2024
6a5087e
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Oct 10, 2024
0b08c2c
Remove line from merge conflict
Kerry350 Oct 10, 2024
965a477
Merge remote-tracking branch 'upstream/main' into 193450-show-categor…
Kerry350 Oct 14, 2024
c290819
Extract out columns / cells to new package
Kerry350 Oct 14, 2024
4e55806
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine Oct 14, 2024
8eaaec7
Merge remote-tracking branch 'upstream/main' into 193450-show-categor…
Kerry350 Oct 15, 2024
8c8b2a3
Update i18nrc.json
Kerry350 Oct 15, 2024
6e60316
More descriptive filter labels
Kerry350 Oct 15, 2024
b956a49
Auto-sort imports
Kerry350 Oct 15, 2024
d827ac7
Better grouped naming
Kerry350 Oct 15, 2024
d31a0f5
Move control columns to separate file
Kerry350 Oct 15, 2024
00584d2
Move label
Kerry350 Oct 15, 2024
f7cc019
Update x-pack/packages/observability/logs_overview/src/components/log…
Kerry350 Oct 15, 2024
4537b8a
Remove spacer
Kerry350 Oct 15, 2024
0d12e4d
Inverse dependencies
Kerry350 Oct 15, 2024
8de3655
Remove rowHeader as we don't use it
Kerry350 Oct 15, 2024
bf14132
Last > latest wording
Kerry350 Oct 15, 2024
1fe0ac0
Update packages/kbn-discover-contextual-components/kibana.jsonc
Kerry350 Oct 15, 2024
8312715
Merge branch '193450-show-category-docs-in-flyout' of github.com:Kerr…
Kerry350 Oct 15, 2024
88e38cc
Move query into filter
Kerry350 Oct 15, 2024
537b052
[CI] Auto-commit changed files from 'node scripts/lint_packages --fix'
kibanamachine Oct 15, 2024
601d1f9
Amend config for tests in new package
Kerry350 Oct 15, 2024
81e694f
Merge branch '193450-show-category-docs-in-flyout' of github.com:Kerr…
Kerry350 Oct 15, 2024
1be56ac
Merge remote-tracking branch 'upstream/main' into 193450-show-categor…
Kerry350 Oct 15, 2024
0d8959c
Add a spacer in for some breathing room
Kerry350 Oct 15, 2024
83d54fa
Merge branch 'main' into 193450-show-category-docs-in-flyout
Kerry350 Oct 16, 2024
73324f2
Merge branch 'main' into 193450-show-category-docs-in-flyout
Kerry350 Oct 16, 2024
b4cdf1f
Merge branch 'main' into 193450-show-category-docs-in-flyout
Kerry350 Oct 17, 2024
679dd9c
Merge remote-tracking branch 'upstream/main' into 193450-show-categor…
Kerry350 Oct 22, 2024
34d9f97
PR feedback
Kerry350 Oct 22, 2024
76ead24
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Oct 22, 2024
7b2545e
Don't prebind deps
Kerry350 Oct 23, 2024
87869d9
Amend constants imports / exports
Kerry350 Oct 23, 2024
0174610
i18n --fix
Kerry350 Oct 23, 2024
0b6e2d6
Merge branch '193450-show-category-docs-in-flyout' of github.com:Kerr…
Kerry350 Oct 23, 2024
78064e1
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Oct 23, 2024
b0a800f
Merge branch 'main' into 193450-show-category-docs-in-flyout
Kerry350 Oct 23, 2024
e228f15
Merge remote-tracking branch 'upstream/main' into 193450-show-categor…
Kerry350 Oct 24, 2024
4dc459d
PR changes
Kerry350 Oct 24, 2024
88bbf99
Amendments from upstream changes
Kerry350 Oct 24, 2024
336b0a0
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Oct 24, 2024
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ packages/kbn-dev-proc-runner @elastic/kibana-operations
src/plugins/dev_tools @elastic/kibana-management
packages/kbn-dev-utils @elastic/kibana-operations
examples/developer_examples @elastic/appex-sharedux
packages/kbn-discover-contextual-components @elastic/obs-ux-logs-team @elastic/kibana-data-discovery
examples/discover_customization_examples @elastic/kibana-data-discovery
x-pack/plugins/discover_enhanced @elastic/kibana-data-discovery
src/plugins/discover @elastic/kibana-data-discovery
Expand Down
2 changes: 1 addition & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"dataViews": "src/plugins/data_views",
"defaultNavigation": "packages/default-nav",
"devTools": "src/plugins/dev_tools",
"discover": ["src/plugins/discover", "packages/kbn-discover-utils"],
"discover": ["src/plugins/discover", "packages/kbn-discover-utils", "packages/kbn-discover-contextual-components"],
"savedSearch": "src/plugins/saved_search",
"embeddableApi": "src/plugins/embeddable",
"presentationPanel": "src/plugins/presentation_panel",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@
"@kbn/default-nav-ml": "link:packages/default-nav/ml",
"@kbn/dev-tools-plugin": "link:src/plugins/dev_tools",
"@kbn/developer-examples-plugin": "link:examples/developer_examples",
"@kbn/discover-contextual-components": "link:packages/kbn-discover-contextual-components",
"@kbn/discover-customization-examples-plugin": "link:examples/discover_customization_examples",
"@kbn/discover-enhanced-plugin": "link:x-pack/plugins/discover_enhanced",
"@kbn/discover-plugin": "link:src/plugins/discover",
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-discover-contextual-components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @kbn/discover-contextual-components

Houses contextual (e.g. logs) components that are used by Discover.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,4 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export interface SmartFieldGridColumnOptions {
type: 'smart-field';
smartField: 'content' | 'resource';
fallbackFields: string[];
width?: number;
}
export * from './src';
14 changes: 14 additions & 0 deletions packages/kbn-discover-contextual-components/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-discover-contextual-components'],
};
5 changes: 5 additions & 0 deletions packages/kbn-discover-contextual-components/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "shared-browser",
"id": "@kbn/discover-contextual-components",
"owner": ["@elastic/obs-ux-logs-team", "@elastic/kibana-data-discovery"]
}
7 changes: 7 additions & 0 deletions packages/kbn-discover-contextual-components/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@kbn/discover-contextual-components",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
"sideEffects": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import {
import { css } from '@emotion/react';
import { useBoolean } from '@kbn/react-hooks';
import { euiThemeVars } from '@kbn/ui-theme';
import { DocViewFilterFn } from '@kbn/unified-doc-viewer/types';
import type { DocViewFilterFn } from '@kbn/unified-doc-viewer/types';
import type { SharePluginStart } from '@kbn/share-plugin/public';
import type { CoreStart } from '@kbn/core-lifecycle-browser';
import {
actionFilterForText,
actionFilterOutText,
Expand Down Expand Up @@ -109,30 +111,32 @@ export function CellActionsPopover({
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiPopoverFooter>
<EuiFlexGroup responsive={false} gutterSize="s" wrap={true}>
<EuiButtonEmpty
key="addToFilterAction"
size="s"
iconType="plusInCircle"
aria-label={actionFilterForText(value)}
onClick={makeFilterHandlerByOperator('+')}
data-test-subj={`dataTableCellAction_addToFilterAction_${property}`}
>
{filterForText}
</EuiButtonEmpty>
<EuiButtonEmpty
key="removeFromFilterAction"
size="s"
iconType="minusInCircle"
aria-label={actionFilterOutText(value)}
onClick={makeFilterHandlerByOperator('-')}
data-test-subj={`dataTableCellAction_removeFromFilterAction_${property}`}
>
{filterOutText}
</EuiButtonEmpty>
</EuiFlexGroup>
</EuiPopoverFooter>
{onFilter ? (
<EuiPopoverFooter>
<EuiFlexGroup responsive={false} gutterSize="s" wrap={true}>
<EuiButtonEmpty
key="addToFilterAction"
size="s"
iconType="plusInCircle"
aria-label={actionFilterForText(value)}
onClick={makeFilterHandlerByOperator('+')}
data-test-subj={`dataTableCellAction_addToFilterAction_${property}`}
>
{filterForText}
</EuiButtonEmpty>
<EuiButtonEmpty
key="removeFromFilterAction"
size="s"
iconType="minusInCircle"
aria-label={actionFilterOutText(value)}
onClick={makeFilterHandlerByOperator('-')}
data-test-subj={`dataTableCellAction_removeFromFilterAction_${property}`}
>
{filterOutText}
</EuiButtonEmpty>
</EuiFlexGroup>
</EuiPopoverFooter>
) : null}
<EuiPopoverFooter>
<EuiCopy textToCopy={value}>
{(copy) => (
Expand All @@ -158,13 +162,21 @@ export interface FieldBadgeWithActionsProps
icon?: EuiBadgeProps['iconType'];
}

interface FieldBadgeWithActionsDependencies {
core?: CoreStart;
share?: SharePluginStart;
Comment on lines +166 to +167
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe my confusion about binding the dependencies early below is driven by the fact that I can't seem to figure out why we need those dependencies to be added here and all upstream usage sites. I'm surely missing something obvious, am I not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need share and core for the ServiceNameBadgeWithActions component. Previously this was accessed via context directly (as it lived in Discover). I changed this to accept the dependencies as props as everything was moved to the new package and we can no longer rely on that context.

The SummaryCellPopover ultimately uses this for the component map creation from this line now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for helping me understand that. ❤️

}

export type FieldBadgeWithActionsPropsAndDependencies = FieldBadgeWithActionsProps &
FieldBadgeWithActionsDependencies;

export function FieldBadgeWithActions({
icon,
onFilter,
property,
renderValue,
value,
}: FieldBadgeWithActionsProps) {
}: FieldBadgeWithActionsPropsAndDependencies) {
return (
<CellActionsPopover
onFilter={onFilter}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export * from './summary_column';
export * from './log_level_badge_cell/log_level_badge_cell';
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { buildDataTableRecord, DataTableRecord } from '@kbn/discover-utils';
import { dataViewMock } from '@kbn/discover-utils/src/__mocks__';
import { fieldFormatsMock } from '@kbn/field-formats-plugin/common/mocks';
import { render, screen } from '@testing-library/react';
import React from 'react';
import { getLogLevelBadgeCell } from './log_level_badge_cell';
import { dataViewMock } from '@kbn/discover-utils/src/__mocks__/data_view';
import { DataTableRecord, buildDataTableRecord } from '@kbn/discover-utils';

const renderCell = (logLevelField: string, record: DataTableRecord) => {
const LogLevelBadgeCell = getLogLevelBadgeCell(logLevelField);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import type { CSSObject } from '@emotion/react';
import React from 'react';
import type { DataGridCellValueElementProps } from '@kbn/unified-data-table/src/types';
import { LogLevelBadge } from '@kbn/discover-utils';
import type { DataGridCellValueElementProps } from '@kbn/unified-data-table';

const dataTestSubj = 'logLevelBadgeCell';
const badgeCss: CSSObject = { marginTop: '-4px' };
Expand All @@ -32,3 +32,5 @@ export const getLogLevelBadgeCell =
/>
);
};

export type LogLevelBadgeCell = ReturnType<typeof getLogLevelBadgeCell>;
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ import React from 'react';
import { getRouterLinkProps } from '@kbn/router-utils';
import { EuiLink } from '@elastic/eui';
import { OBSERVABILITY_ENTITY_CENTRIC_EXPERIENCE } from '@kbn/management-settings-ids';
import { SharePublicStart } from '@kbn/share-plugin/public/plugin';
import { useDiscoverServices } from '../../../hooks/use_discover_services';
import { FieldBadgeWithActions, FieldBadgeWithActionsProps } from './cell_actions_popover';
import type { SharePublicStart } from '@kbn/share-plugin/public/plugin';
import {
FieldBadgeWithActions,
FieldBadgeWithActionsProps,
FieldBadgeWithActionsPropsAndDependencies,
} from './cell_actions_popover';

const SERVICE_ENTITY_LOCATOR = 'SERVICE_ENTITY_LOCATOR';

export function ServiceNameBadgeWithActions(props: FieldBadgeWithActionsProps) {
const { share, core } = useDiscoverServices();
const canViewApm = core.application.capabilities.apm?.show || false;
export function ServiceNameBadgeWithActions(props: FieldBadgeWithActionsPropsAndDependencies) {
const { share, core } = props;
const canViewApm = core?.application.capabilities.apm?.show || false;
const isEntityCentricExperienceSettingEnabled = canViewApm
? core.uiSettings.get(OBSERVABILITY_ENTITY_CENTRIC_EXPERIENCE)
? core?.uiSettings.get(OBSERVABILITY_ENTITY_CENTRIC_EXPERIENCE)
: false;

const derivedPropsForEntityExperience = isEntityCentricExperienceSettingEnabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
getLogDocumentOverview,
getMessageFieldWithFallbacks,
} from '@kbn/discover-utils';
import * as constants from '../../../../../common/data_types/logs/constants';
import * as constants from '@kbn/discover-utils/src/data_types/logs/constants';
Kerry350 marked this conversation as resolved.
Show resolved Hide resolved
import { formatJsonDocumentForContent } from './utils';

interface ContentProps extends DataGridCellValueElementProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export * from './content';
export * from './resource';
export * from './summary_column';
export * from './utils';
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*/

import React from 'react';
import { EuiBadge, EuiFlexGroup } from '@elastic/eui';
import { DocViewFilterFn } from '@kbn/unified-doc-viewer/types';
import { CommonProps, EuiBadge, EuiFlexGroup } from '@elastic/eui';
import type { DocViewFilterFn } from '@kbn/unified-doc-viewer/types';
import { ResourceFieldDescriptor } from './utils';

const MAX_LIMITED_FIELDS_VISIBLE = 3;
Expand All @@ -19,6 +19,7 @@ interface ResourceProps {
/* When true, the column will render a predefined number of resources and indicates with a badge how many more we have */
limited?: boolean;
onFilter?: DocViewFilterFn;
css?: CommonProps['css'];
}

export const Resource = ({ fields, limited = false, onFilter, ...props }: ResourceProps) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,41 @@
*/

import React from 'react';
import { buildDataTableRecord, DataTableRecord } from '@kbn/discover-utils';
import { dataViewMock } from '@kbn/discover-utils/src/__mocks__';
import { fieldFormatsMock } from '@kbn/field-formats-plugin/common/mocks';
import { render, screen } from '@testing-library/react';
import SummaryColumn, { SummaryColumnFactoryDeps, SummaryColumnProps } from './summary_column';
import { DataGridDensity, ROWS_HEIGHT_OPTIONS } from '@kbn/unified-data-table';
import * as constants from '../../../../../common/data_types/logs/constants';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { discoverServiceMock } from '../../../../__mocks__/services';
import * as constants from '@kbn/discover-utils/src/data_types/logs/constants';
Kerry350 marked this conversation as resolved.
Show resolved Hide resolved
import { sharePluginMock } from '@kbn/share-plugin/public/mocks';
import { coreMock as corePluginMock } from '@kbn/core/public/mocks';
import { DataTableRecord, buildDataTableRecord } from '@kbn/discover-utils';
import { dataViewMock } from '@kbn/discover-utils/src/__mocks__/data_view';

const renderSummary = (
record: DataTableRecord,
opts: Partial<SummaryColumnProps & SummaryColumnFactoryDeps> = {}
) => {
render(
<KibanaContextProvider services={discoverServiceMock}>
<SummaryColumn
rowIndex={0}
colIndex={0}
columnId="_source"
isExpandable={true}
isExpanded={false}
isDetails={false}
row={record}
dataView={dataViewMock}
fieldFormats={fieldFormatsMock}
setCellProps={() => {}}
closePopover={() => {}}
density={DataGridDensity.COMPACT}
rowHeight={ROWS_HEIGHT_OPTIONS.single}
onFilter={jest.fn()}
shouldShowFieldHandler={() => true}
{...opts}
/>
</KibanaContextProvider>
<SummaryColumn
rowIndex={0}
colIndex={0}
columnId="_source"
isExpandable={true}
isExpanded={false}
isDetails={false}
row={record}
dataView={dataViewMock}
fieldFormats={fieldFormatsMock}
setCellProps={() => {}}
closePopover={() => {}}
density={DataGridDensity.COMPACT}
rowHeight={ROWS_HEIGHT_OPTIONS.single}
onFilter={jest.fn()}
shouldShowFieldHandler={() => true}
core={corePluginMock.createStart()}
share={sharePluginMock.createStartContract()}
{...opts}
/>
);
};

Expand Down
Loading