Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
12f6457
Update LogsOverviewHeader
iblancof Sep 5, 2025
a0a35dc
Add onToggle and forceState in ContentFrameworkSection
iblancof Sep 5, 2025
168185c
Update LogsOverviewStacktraceSection
iblancof Sep 5, 2025
5e3b81b
Manage separator in ContentFrameworkSection
iblancof Sep 5, 2025
6d0bf8f
Add spacer to the ContentFrameworkSection
iblancof Sep 5, 2025
396195f
Merge branch 'main' into 233743-discover-adapt-logs-flyout-to-use-the…
iblancof Sep 8, 2025
d1f281f
Merge branch 'main' into 233743-discover-adapt-logs-flyout-to-use-the…
iblancof Sep 9, 2025
b9b0a5d
Adapt highlights to new content framework
iblancof Sep 10, 2025
43d9af8
Update text truncate in NamePopoverContent
iblancof Sep 10, 2025
3f7c267
Extract data-test-subj as prop for TraceIdLink
iblancof Sep 10, 2025
4bfba42
Extract data-test-subj as prop for ServiceNameLink
iblancof Sep 10, 2025
7fe3acd
Add field type to NamePopoverContent
iblancof Sep 10, 2025
6fc6eca
Remove service name link from logs overview
iblancof Sep 10, 2025
4c665b9
Reorganize log overview
iblancof Sep 10, 2025
acf1f50
Update LogsOverviewDegradedFields to match ContentFramework UI
iblancof Sep 10, 2025
3879280
Update DiscoverFlyoutStreamField to match ContentFramework UI)
iblancof Sep 10, 2025
5ca23e9
Add function props to LogsOverviewHighlights
iblancof Sep 10, 2025
c94dba7
Add configuration for truncate value content
iblancof Sep 10, 2025
7b8ffb1
Remove unused imports
iblancof Sep 10, 2025
76ff72c
Fix beta badge alignment
iblancof Sep 10, 2025
ee9e8e5
Update table styles
iblancof Sep 10, 2025
c2fa690
Remove unused content
iblancof Sep 10, 2025
fc31cae
Merge branch 'main' into 233743-discover-adapt-logs-flyout-to-use-the…
iblancof Sep 15, 2025
3ca442b
Update streams links sizing
iblancof Sep 15, 2025
c575593
Update degraded fields text sizing
iblancof Sep 15, 2025
4017f8b
Merge branch 'main' into 233743-discover-adapt-logs-flyout-to-use-the…
iblancof Sep 15, 2025
6269920
Update logs overview tests
iblancof Sep 15, 2025
75fdea5
Refactor logs overview highlights
iblancof Sep 15, 2025
1f37e15
Unify constants
iblancof Sep 15, 2025
941a7f3
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Sep 15, 2025
49706b2
Clean translation keys
iblancof Sep 15, 2025
d7da6e6
Fix typing issues
iblancof Sep 15, 2025
97c007e
Merge branch '233743-discover-adapt-logs-flyout-to-use-the-new-conten…
iblancof Sep 15, 2025
02dd805
Create LazyContentFrameworkSection
iblancof Sep 16, 2025
a79c067
Fix ContentFrameworkSection imports
iblancof Sep 17, 2025
d1f518e
Refactor accordion state
iblancof Sep 17, 2025
0b96352
Improve flex html structure in NamePopoverContent
iblancof Sep 17, 2025
2ca38de
Make valueCellContent required
iblancof Sep 17, 2025
97b8324
Extract field label and description to a common place
iblancof Sep 17, 2025
6b82db3
Add missing export
iblancof Sep 17, 2025
5180847
Update translations
iblancof Sep 17, 2025
3c628de
Update NamePopoverContent tests
iblancof Sep 17, 2025
9c1cfc3
Update src/platform/plugins/shared/unified_doc_viewer/public/componen…
iblancof Sep 17, 2025
e0184db
[CI] Auto-commit changed files from 'node scripts/eslint_all_files --…
kibanamachine Sep 17, 2025
6267b28
Merge branch 'main' into 233743-discover-adapt-logs-flyout-to-use-the…
iblancof Sep 18, 2025
d08ecdd
Update test
iblancof Sep 18, 2025
fa45cfd
Inlcude highlights in header section
iblancof Sep 18, 2025
b1652d7
Fix type issues
iblancof Sep 18, 2025
4c4bf2a
Merge branch 'main' into 233743-discover-adapt-logs-flyout-to-use-the…
iblancof Sep 19, 2025
d3d7fc3
Refactor logs overview types and tests
iblancof Sep 19, 2025
e4c2c06
Update section reference in tests
iblancof Sep 19, 2025
3295964
Merge branch 'main' into 233743-discover-adapt-logs-flyout-to-use-the…
iblancof Sep 22, 2025
3ddd79d
Remove border bottom from last row
iblancof Sep 22, 2025
a0de7e4
Merge branch 'main' into 233743-discover-adapt-logs-flyout-to-use-the…
iblancof Sep 23, 2025
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 @@ -8,3 +8,5 @@
*/

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

import React, { useState } from 'react';
import type { IconType } from '@elastic/eui';
import React, { useEffect, useState } from 'react';
import type { EuiAccordionProps, IconType } from '@elastic/eui';
import {
EuiAccordion,
EuiBetaBadge,
EuiButtonEmpty,
EuiButtonIcon,
EuiFlexGroup,
Expand Down Expand Up @@ -40,6 +41,9 @@ export interface ContentFrameworkSectionProps {
actions?: Action[];
children: React.ReactNode;
'data-test-subj'?: string;
onToggle?: (isOpen: boolean) => void;
forceState?: EuiAccordionProps['forceState'];
isTechPreview?: boolean;
}

export function ContentFrameworkSection({
Expand All @@ -48,9 +52,15 @@ export function ContentFrameworkSection({
description,
actions,
children,
onToggle,
forceState = 'open',
'data-test-subj': accordionDataTestSubj,
isTechPreview = false,
}: ContentFrameworkSectionProps) {
const [isAccordionExpanded, setIsAccordionExpanded] = useState(true);
const [isAccordionExpanded, setIsAccordionExpanded] = useState(
forceState ? forceState === 'open' : true
);

const renderActions = () => (
<EuiFlexGroup gutterSize="s" justifyContent="flexEnd" alignItems="center">
{actions?.map((action, idx) => {
Expand Down Expand Up @@ -84,38 +94,63 @@ export function ContentFrameworkSection({
</EuiFlexGroup>
);

useEffect(() => {
if (forceState !== undefined) {
setIsAccordionExpanded(forceState === 'open');
}
}, [forceState]);

const handleToggle = (isOpen: boolean) => {
setIsAccordionExpanded(isOpen);
if (onToggle) {
onToggle(isOpen);
}
};

return (
<>
<EuiAccordion
data-test-subj={accordionDataTestSubj}
id={`sectionAccordion-${id}`}
initialIsOpen
onToggle={setIsAccordionExpanded}
initialIsOpen={forceState !== 'closed'}
onToggle={handleToggle}
forceState={isAccordionExpanded ? 'open' : 'closed'}
buttonContent={
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiTitle size="xs">
<h3>{title}</h3>
</EuiTitle>
</EuiFlexItem>
{description && (
{description ? (
<EuiFlexItem grow={false}>
<EuiIconTip
content={description}
size="s"
color="subdued"
aria-label={description}
/>
{isTechPreview ? (
<EuiBetaBadge
size="s"
label={description}
alignment="middle"
color="hollow"
iconType="beaker"
title={title}
/>
) : (
<EuiIconTip
content={description}
size="s"
color="subdued"
aria-label={description}
/>
)}
</EuiFlexItem>
)}
) : null}
</EuiFlexGroup>
}
extraAction={
actions?.length ? (
actions?.length && (
<EuiFlexGroup justifyContent="spaceBetween" alignItems="center">
<EuiFlexItem grow={false}>{renderActions()}</EuiFlexItem>
</EuiFlexGroup>
) : null
)
}
>
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import type { ContentFrameworkSectionProps } from '.';
import { ContentFrameworkSection } from '.';
import userEvent from '@testing-library/user-event';

const defaultProps: ContentFrameworkSectionProps = {
title: 'Test Section',
Expand All @@ -32,6 +33,7 @@ const defaultProps: ContentFrameworkSectionProps = {
],
children: <div>Section children</div>,
id: 'testSection',
'data-test-subj': 'testSection',
};

describe('ContentFrameworkSection', () => {
Expand Down Expand Up @@ -84,4 +86,12 @@ describe('ContentFrameworkSection', () => {
screen.queryByTestId('unifiedDocViewerSectionActionButton-fullScreen')
).not.toBeInTheDocument();
});

it('calls onToggle when the accordion is toggled', async () => {
const onToggle = jest.fn();
render(<ContentFrameworkSection {...defaultProps} onToggle={onToggle} forceState="open" />);
const toggleBtn = screen.getByText('Test Section');
await userEvent.click(toggleBtn);
expect(onToggle).toHaveBeenCalled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import React from 'react';

interface FormattedValueProps {
value: string;
truncate?: boolean;
}

export function FormattedValue({ value }: FormattedValueProps) {
export function FormattedValue({ value, truncate }: FormattedValueProps) {
return (
<EuiText
className="eui-textTruncate"
className={truncate ? 'eui-textTruncate' : 'eui-textBreakWord'}
data-test-subj="ContentFrameworkTableFormattedValue"
size="xs"
// Value returned from formatFieldValue is always sanitized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import React from 'react';
import { render, screen } from '@testing-library/react';
import { NamePopoverContent } from './name_popover_content';

jest.mock('@kbn/field-utils/src/components/field_icon', () => ({
FieldIcon: ({}: { type: string; size: string }) => <span data-test-subj="fieldIcon" />,
}));

describe('NamePopoverContent', () => {
it('renders the field name', () => {
render(
Expand Down Expand Up @@ -55,4 +59,27 @@ describe('NamePopoverContent', () => {
);
expect(screen.getByText('ActionBtn')).toBeInTheDocument();
});

it('renders FieldIcon when fieldConfig.type is provided', () => {
render(
<NamePopoverContent
fieldName="myField"
fieldConfig={{ name: 'name', value: 'value', type: 'keyword', description: 'desc' }}
cellActions={null}
/>
);
const icon = screen.getByTestId('fieldIcon');
expect(icon).toBeInTheDocument();
});

it('does not render FieldIcon when fieldConfig.type is not provided', () => {
render(
<NamePopoverContent
fieldName="myField"
fieldConfig={{ name: 'name', value: 'value', description: 'desc' }}
cellActions={null}
/>
);
expect(screen.queryByTestId('fieldIcon')).toBeNull();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { EuiText, EuiSpacer } from '@elastic/eui';
import { EuiText, EuiSpacer, EuiFlexGroup } from '@elastic/eui';
import React from 'react';
import { FieldIcon } from '@kbn/field-utils/src/components/field_icon';
import type { TableFieldConfiguration } from '..';

interface NamePopoverContentProps {
Expand All @@ -24,13 +25,16 @@ export function NamePopoverContent({
}: NamePopoverContentProps) {
return (
<>
<EuiText size="s" className="eui-textTruncate">
{fieldName}
</EuiText>
<EuiFlexGroup alignItems="center" gutterSize="s">
{fieldConfig.type && <FieldIcon type={fieldConfig.type} size="s" />}
<EuiText size="s" className="eui-textBreakWord">
{fieldName}
</EuiText>
</EuiFlexGroup>
{fieldConfig?.description && (
<>
<EuiSpacer size="s" />
<EuiText size="xs" className="eui-textTruncate">
<EuiText size="xs" className="eui-textBreakWord">
{fieldConfig.description}
</EuiText>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('ValuePopoverContent', () => {
it('renders the valueCellContent', () => {
render(
<ValuePopoverContent
fieldConfig={{ ...defaultFieldConfig, valueCellContent: <span>Cell Value</span> }}
fieldConfig={{ ...defaultFieldConfig, valueCellContent: () => <span>Cell Value</span> }}
cellActions={null}
/>
);
Expand All @@ -31,7 +31,7 @@ describe('ValuePopoverContent', () => {
it('renders cellActions if provided', () => {
render(
<ValuePopoverContent
fieldConfig={{ ...defaultFieldConfig, valueCellContent: <span>With Action</span> }}
fieldConfig={{ ...defaultFieldConfig, valueCellContent: () => <span>With Action</span> }}
cellActions={<button>ActionBtn</button>}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function ValuePopoverContent({ fieldConfig, cellActions }: ValuePopoveCon
: undefined
}
>
{fieldConfig?.valueCellContent}
{fieldConfig?.valueCellContent ? fieldConfig.valueCellContent({ truncate: false }) : null}
</EuiText>
{cellActions}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export interface TableFieldConfiguration {
name: string;
value: unknown;
description?: string;
valueCellContent?: React.ReactNode;
type?: string;
valueCellContent?: (params?: { truncate?: boolean }) => React.ReactNode;
}

export interface ContentFrameworkTableProps
Expand All @@ -54,6 +55,7 @@ export interface ContentFrameworkTableProps
fieldNames: string[];
fieldConfigurations?: Record<string, FieldConfiguration>;
id: string;
'data-test-subj'?: string;
}

export function ContentFrameworkTable({
Expand All @@ -64,6 +66,7 @@ export function ContentFrameworkTable({
columns,
id,
textBasedHits,
'data-test-subj': dataTestSubj,
filter,
onAddColumn,
onRemoveColumn,
Expand All @@ -74,7 +77,7 @@ export function ContentFrameworkTable({
fieldFormats,
} = getUnifiedDocViewerServices();
const { fieldsMetadata = {} } = useFieldsMetadata({
attributes: ['short'],
attributes: ['short', 'type'],
fieldNames,
});

Expand Down Expand Up @@ -108,11 +111,14 @@ export function ContentFrameworkTable({
name: fieldConfiguration?.title || fieldName,
value,
description: fieldDescription,
valueCellContent: fieldConfiguration?.formatter ? (
<>{fieldConfiguration.formatter(value, formattedValue)}</>
) : (
<FormattedValue value={formattedValue} />
),
type: fieldsMetadata[fieldName]?.type,
valueCellContent: ({ truncate }: { truncate?: boolean } = { truncate: true }) => {
return fieldConfiguration?.formatter ? (
<>{fieldConfiguration.formatter(value, formattedValue)}</>
) : (
<FormattedValue value={formattedValue} truncate={truncate} />
);
},
};

acc.rows.push(
Expand Down Expand Up @@ -151,18 +157,26 @@ export function ContentFrameworkTable({

if (!fieldConfig) return null;
if (columnId === 'name') {
const rowDataTestSubj = `${dataTestSubj}${fieldConfig.name
.replace(/ (\w)/g, (_, c) => c.toUpperCase())
.replace(/^\w/, (c) => c.toUpperCase())}`;

return (
<>
<EuiSpacer size="s" />
<EuiText size="xs" css={{ fontWeight: euiTheme.font.weight.bold }}>
<EuiText
size="xs"
css={{ fontWeight: euiTheme.font.weight.bold }}
data-test-subj={rowDataTestSubj}
>
{fieldConfig.name}
</EuiText>
</>
);
}
return fieldConfig.valueCellContent;
return fieldConfig.valueCellContent ? fieldConfig.valueCellContent() : null;
},
[rows, fields, euiTheme.font.weight]
[rows, fields, dataTestSubj, euiTheme.font.weight.bold]
);

const cellPopoverRenderer = useCallback(
Expand Down Expand Up @@ -198,6 +212,7 @@ export function ContentFrameworkTable({
height: auto !important;
}
`}
data-test-subj={dataTestSubj}
>
<TableGrid
data-test-subj="ContentFrameworkTableTableGrid"
Expand Down
Loading