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

Add view single document and surrounding documents #6831

Merged
merged 12 commits into from
Jul 26, 2024
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ All notable changes to the Wazuh app project will be documented in this file.

### Changed

- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792)
- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6752](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) [#6753](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6753) [#6756](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6756) [#6771](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6771) [#6792](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6792) [#6831](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6831)
- Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250)
- Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573)
- Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
EuiTitle,
EuiFlyoutBody,
EuiFlexGroup,
EuiLink,
Machi3mfl marked this conversation as resolved.
Show resolved Hide resolved
} 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
@@ -0,0 +1,50 @@
import React from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiTitle, EuiLink } from '@elastic/eui';
import { RedirectAppLinks } from '../../../../../../../src/plugins/opensearch_dashboards_react/public';
import { getCore } from '../../../../kibana-services';

const DocDetailsHeader = ({ doc, indexPattern }) => {
return (
<EuiFlexGroup>
<EuiFlexItem>
<EuiTitle>
<h2>Document Details</h2>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup>
<EuiFlexItem>
<RedirectAppLinks application={getCore().application}>
<EuiLink
href={getCore().application.getUrlForApp('discover', {
Desvelao marked this conversation as resolved.
Show resolved Hide resolved
path: `#/context/${indexPattern?.id}/${doc?._id}`,
})}
target='_blank'
rel='noopener noreferrer'
external
>
View surrounding documents
</EuiLink>
</RedirectAppLinks>
</EuiFlexItem>
<EuiFlexItem>
<RedirectAppLinks application={getCore().application}>
<EuiLink
href={getCore().application.getUrlForApp('discover', {
Desvelao marked this conversation as resolved.
Show resolved Hide resolved
path: `#/doc/${indexPattern?.id}/${doc?._index}?id=${doc?._id}`,
})}
target='_blank'
rel='noopener noreferrer'
external
>
View single document
</EuiLink>
</RedirectAppLinks>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
);
};

export default DocDetailsHeader;
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
EuiFlyoutHeader,
EuiTitle,
EuiPanel,
EuiLink,
Machi3mfl marked this conversation as resolved.
Show resolved Hide resolved
} 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,9 @@
import React, { useState, useEffect, useMemo } from 'react';
import { getPlugins, getWazuhCorePlugin } from '../../../../kibana-services';
import {
getPlugins,
getWazuhCorePlugin,
getCore,
Machi3mfl marked this conversation as resolved.
Show resolved Hide resolved
} 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 +23,7 @@ import {
EuiFlyoutHeader,
EuiTitle,
EuiButtonEmpty,
EuiLink,
Machi3mfl marked this conversation as resolved.
Show resolved Hide resolved
} from '@elastic/eui';
import {
ErrorFactory,
Expand Down Expand Up @@ -55,6 +60,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 @@ -332,9 +339,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
Loading