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

[Backport 2.19] Fix:Query-Insights-Dashboards-style-integration-QueryDetails #112

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 21 additions & 9 deletions public/pages/QueryDetails/Components/QuerySummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
*/

import React from 'react';
import { EuiFlexGrid, EuiFlexItem, EuiHorizontalRule, EuiPanel, EuiText } from '@elastic/eui';
import {
EuiFlexGrid,
EuiFlexItem,
EuiHorizontalRule,
EuiPanel,
EuiTitle,
EuiDescriptionList,
} from '@elastic/eui';
import { SearchQueryRecord } from '../../../../types/types';
import {
CPU_TIME,
Expand All @@ -21,10 +28,15 @@ import { calculateMetric } from '../../../../common/utils/MetricUtils';
// Panel component for displaying query detail values
const PanelItem = ({ label, value }: { label: string; value: string | number }) => (
<EuiFlexItem>
<EuiText size="xs">
<h4>{label}</h4>
</EuiText>
<EuiText size="xs">{value}</EuiText>
<EuiDescriptionList
compressed={true}
listItems={[
{
title: <h4>{label}</h4>,
description: value,
},
]}
/>
</EuiFlexItem>
);

Expand All @@ -33,9 +45,9 @@ const QuerySummary = ({ query }: { query: SearchQueryRecord | null }) => {
if (!query) {
return (
<EuiPanel data-test-subj={'query-details-summary-section'}>
<EuiText size="xs">
<EuiTitle size="xs">
<h2>No Data Available</h2>
</EuiText>
</EuiTitle>
</EuiPanel>
);
}
Expand All @@ -49,9 +61,9 @@ const QuerySummary = ({ query }: { query: SearchQueryRecord | null }) => {
const { timestamp, measurements, indices, search_type, node_id, total_shards } = query;
return (
<EuiPanel data-test-subj={'query-details-summary-section'}>
<EuiText size="xs">
<EuiTitle size="s">
<h2>Summary</h2>
</EuiText>
</EuiTitle>
<EuiHorizontalRule margin="m" />
<EuiFlexGrid columns={4}>
<PanelItem label={TIMESTAMP} value={convertTime(timestamp)} />
Expand Down
2 changes: 1 addition & 1 deletion public/pages/QueryDetails/QueryDetails.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ describe('QueryDetails component', () => {
expect(retrieveQueryById).toHaveBeenCalled();
});

const dateElements = container.getElementsByClassName('euiText euiText--extraSmall');
const dateElements = container.getElementsByClassName('euiDescriptionList__description');
Array.from(dateElements).forEach((element) => {
if (element.textContent?.includes('@')) {
element.textContent = 'Sep 24, 2021 @ 12:00:00 AM';
Expand Down
12 changes: 6 additions & 6 deletions public/pages/QueryDetails/QueryDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
EuiHorizontalRule,
EuiPanel,
EuiSpacer,
EuiText,
EuiTitle,
} from '@elastic/eui';
import { useHistory, useLocation } from 'react-router-dom';
Expand Down Expand Up @@ -162,12 +161,13 @@ const QueryDetails = ({
<EuiPanel data-test-subj={'query-details-source-section'}>
<EuiFlexGroup alignItems="center" justifyContent="spaceBetween">
<EuiFlexItem>
<EuiText size="xs">
<EuiTitle size="s">
<h2>Query</h2>
</EuiText>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton
size="s"
iconSide="right"
iconType="popout"
target="_blank"
Expand All @@ -192,10 +192,10 @@ const QueryDetails = ({
</EuiFlexItem>
<EuiFlexItem grow={1} style={{ alignSelf: 'start' }}>
<EuiPanel data-test-subj={'query-details-latency-chart'}>
<EuiText size="xs">
<EuiTitle size="xs">
<h2>Latency</h2>
</EuiText>
<EuiHorizontalRule margin="m" />
</EuiTitle>
<EuiHorizontalRule margin="xs" />
<div id="latency" />
</EuiPanel>
</EuiFlexItem>
Expand Down
Loading
Loading