Skip to content

Commit

Permalink
Apply document header in flyout details
Browse files Browse the repository at this point in the history
  • Loading branch information
Machi3mfl committed Jul 16, 2024
1 parent 2b42c03 commit 30a98e2
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
EuiTitle,
EuiFlyoutBody,
EuiFlexGroup,
EuiLink
} from '@elastic/eui';
import { useDataGrid, exportSearchToCSV, tDataGridColumn } from '../data-grid';
import { getWazuhCorePlugin } from '../../../kibana-services';
Expand All @@ -30,6 +31,7 @@ import { DocumentViewTableAndJson } from '../wazuh-discover/components/document-
import DiscoverDataGridAdditionalControls from '../wazuh-discover/components/data-grid-additional-controls';
import './wazuh-data-grid.scss';
import { wzDiscoverRenderColumns } from '../wazuh-discover/render-columns';
import DocDetailsHeader from '../wazuh-discover/components/doc-details-header';

export const MAX_ENTRIES_PER_QUERY = 10000;

Expand Down Expand Up @@ -180,7 +182,10 @@ const WazuhDataGrid = (props: tWazuhDataGridProps) => {
<EuiFlyout onClose={() => setInspectedHit(undefined)} size='m'>
<EuiFlyoutHeader>
<EuiTitle>
<h2>Document Details</h2>
<DocDetailsHeader
doc={inspectedHit}
indexPattern={indexPattern}
/>
</EuiTitle>
</EuiFlyoutHeader>
<EuiFlyoutBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
EuiFlyoutHeader,
EuiTitle,
EuiPanel,
EuiLink
} from '@elastic/eui';
import { IntlProvider } from 'react-intl';
import { IndexPattern } from '../../../../../../src/plugins/data/common';
Expand Down Expand Up @@ -43,6 +44,7 @@ import {
import DiscoverDataGridAdditionalControls from './components/data-grid-additional-controls';
import { wzDiscoverRenderColumns } from './render-columns';
import { WzSearchBar } from '../search-bar';
import DocDetailsHeader from './components/doc-details-header';

export const MAX_ENTRIES_PER_QUERY = 10000;

Expand Down Expand Up @@ -267,9 +269,10 @@ const WazuhDiscoverComponent = (props: WazuhDiscoverProps) => {
{inspectedHit && (
<EuiFlyout onClose={() => setInspectedHit(undefined)} size='m'>
<EuiFlyoutHeader>
<EuiTitle>
<h2>Document Details</h2>
</EuiTitle>
<DocDetailsHeader
doc={inspectedHit}
indexPattern={dataSource?.indexPattern}
/>
</EuiFlyoutHeader>
<EuiFlyoutBody>
<EuiFlexGroup direction='column'>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useMemo } from 'react';
import { getPlugins, getWazuhCorePlugin } from '../../../../kibana-services';
import { getPlugins, getWazuhCorePlugin, getCore } from '../../../../kibana-services';
import { ViewMode } from '../../../../../../../src/plugins/embeddable/public';
import { SearchResponse } from '../../../../../../../src/core/server';
import { IndexPattern } from '../../../../../../../src/plugins/data/common';
Expand All @@ -19,6 +19,7 @@ import {
EuiFlyoutHeader,
EuiTitle,
EuiButtonEmpty,
EuiLink
} from '@elastic/eui';
import {
ErrorFactory,
Expand Down Expand Up @@ -55,6 +56,8 @@ import { useReportingCommunicateSearchContext } from '../../../common/hooks/use-
import { wzDiscoverRenderColumns } from '../../../common/wazuh-discover/render-columns';
import { WzSearchBar } from '../../../common/search-bar';

import DocDetailsHeader from '../../../common/wazuh-discover/components/doc-details-header';

const plugins = getPlugins();

const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer;
Expand Down Expand Up @@ -228,11 +231,10 @@ const DashboardTH: React.FC = () => {
<DiscoverNoResults />
) : null}
<div
className={`th-container ${
!isDataSourceLoading && dataSource && results?.hits?.total > 0
? ''
: 'wz-no-display'
}`}
className={`th-container ${!isDataSourceLoading && dataSource && results?.hits?.total > 0
? ''
: 'wz-no-display'
}`}
>
<SampleDataWarning />
<div className='th-dashboard-responsive'>
Expand Down Expand Up @@ -293,20 +295,20 @@ const DashboardTH: React.FC = () => {
<HitsCounter
hits={results?.hits?.total}
showResetButton={false}
onResetQuery={() => {}}
onResetQuery={() => { }}
tooltip={
results?.hits?.total &&
results?.hits?.total > MAX_ENTRIES_PER_QUERY
results?.hits?.total > MAX_ENTRIES_PER_QUERY
? {
ariaLabel: 'Warning',
content: `The query results has exceeded the limit of ${formatNumWithCommas(
MAX_ENTRIES_PER_QUERY,
)} hits. To provide a better experience the table only shows the first ${formatNumWithCommas(
MAX_ENTRIES_PER_QUERY,
)} hits.`,
iconType: 'alert',
position: 'top',
}
ariaLabel: 'Warning',
content: `The query results has exceeded the limit of ${formatNumWithCommas(
MAX_ENTRIES_PER_QUERY,
)} hits. To provide a better experience the table only shows the first ${formatNumWithCommas(
MAX_ENTRIES_PER_QUERY,
)} hits.`,
iconType: 'alert',
position: 'top',
}
: undefined
}
/>
Expand All @@ -332,9 +334,10 @@ const DashboardTH: React.FC = () => {
{inspectedHit && (
<EuiFlyout onClose={() => setInspectedHit(undefined)} size='m'>
<EuiFlyoutHeader>
<EuiTitle>
<h2>Document details</h2>
</EuiTitle>
<DocDetailsHeader
doc={inspectedHit}
indexPattern={dataSource?.indexPattern}
/>
</EuiFlyoutHeader>
<EuiFlyoutBody>
<EuiFlexGroup direction='column'>
Expand Down

0 comments on commit 30a98e2

Please sign in to comment.