mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
remove logs link and alerts count (#70282)
This commit is contained in:
parent
43bfa4ab66
commit
04b8d108d5
3 changed files with 1 additions and 65 deletions
|
@ -19,7 +19,7 @@ import React, { memo, useMemo } from 'react';
|
|||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { HostMetadata } from '../../../../../../common/endpoint/types';
|
||||
import { useHostSelector, useHostLogsUrl, useAgentDetailsIngestUrl } from '../hooks';
|
||||
import { useHostSelector, useAgentDetailsIngestUrl } from '../hooks';
|
||||
import { useNavigateToAppEventHandler } from '../../../../../common/hooks/endpoint/use_navigate_to_app_event_handler';
|
||||
import { policyResponseStatus, uiQueryParams } from '../../store/selectors';
|
||||
import { POLICY_STATUS_TO_HEALTH_COLOR } from '../host_constants';
|
||||
|
@ -51,7 +51,6 @@ const LinkToExternalApp = styled.div`
|
|||
const openReassignFlyoutSearch = '?openReassignFlyout=true';
|
||||
|
||||
export const HostDetails = memo(({ details }: { details: HostMetadata }) => {
|
||||
const { url: logsUrl, appId: logsAppId, appPath: logsAppPath } = useHostLogsUrl(details.host.id);
|
||||
const agentId = details.elastic.agent.id;
|
||||
const {
|
||||
url: agentDetailsUrl,
|
||||
|
@ -78,12 +77,6 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => {
|
|||
}),
|
||||
description: <FormattedDateAndTime date={new Date(details['@timestamp'])} />,
|
||||
},
|
||||
{
|
||||
title: i18n.translate('xpack.securitySolution.endpoint.host.details.alerts', {
|
||||
defaultMessage: 'Alerts',
|
||||
}),
|
||||
description: '0',
|
||||
},
|
||||
];
|
||||
}, [details]);
|
||||
|
||||
|
@ -251,22 +244,6 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => {
|
|||
listItems={detailsResultsLower}
|
||||
data-test-subj="hostDetailsLowerList"
|
||||
/>
|
||||
<EuiHorizontalRule margin="m" />
|
||||
<LinkToExternalApp>
|
||||
<LinkToApp
|
||||
appId={logsAppId}
|
||||
appPath={logsAppPath}
|
||||
href={logsUrl}
|
||||
data-test-subj="hostDetailsLinkToLogs"
|
||||
>
|
||||
<EuiIcon type="logsApp" className="linkToAppIcon" />
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.endpoint.host.details.linkToLogsTitle"
|
||||
defaultMessage="Endpoint Logs"
|
||||
/>
|
||||
<EuiIcon type="popout" className="linkToAppPopoutIcon" />
|
||||
</LinkToApp>
|
||||
</LinkToExternalApp>
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
|
|
@ -21,22 +21,6 @@ export function useHostSelector<TSelected>(selector: (state: HostState) => TSele
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object that contains Kibana Logs app and URL information for a given host id
|
||||
* @param hostId
|
||||
*/
|
||||
export const useHostLogsUrl = (hostId: string): { url: string; appId: string; appPath: string } => {
|
||||
const { services } = useKibana();
|
||||
return useMemo(() => {
|
||||
const appPath = `/stream?logFilter=(expression:'host.id:${hostId}',kind:kuery)`;
|
||||
return {
|
||||
url: `${services.application.getUrlForApp('logs')}${appPath}`,
|
||||
appId: 'logs',
|
||||
appPath,
|
||||
};
|
||||
}, [hostId, services.application]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns an object that contains Ingest app and URL information
|
||||
*/
|
||||
|
|
|
@ -278,7 +278,6 @@ describe('when on the hosts page', () => {
|
|||
agentId = hostDetails.metadata.elastic.agent.id;
|
||||
|
||||
coreStart.http.get.mockReturnValue(Promise.resolve(hostDetails));
|
||||
coreStart.application.getUrlForApp.mockReturnValue('/app/logs');
|
||||
|
||||
reactTestingLibrary.act(() => {
|
||||
history.push({
|
||||
|
@ -433,30 +432,6 @@ describe('when on the hosts page', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('should include the link to logs', async () => {
|
||||
const renderResult = render();
|
||||
const linkToLogs = await renderResult.findByTestId('hostDetailsLinkToLogs');
|
||||
expect(linkToLogs).not.toBeNull();
|
||||
expect(linkToLogs.textContent).toEqual('Endpoint Logs');
|
||||
expect(linkToLogs.getAttribute('href')).toEqual(
|
||||
"/app/logs/stream?logFilter=(expression:'host.id:1',kind:kuery)"
|
||||
);
|
||||
});
|
||||
|
||||
describe('when link to logs is clicked', () => {
|
||||
beforeEach(async () => {
|
||||
const renderResult = render();
|
||||
const linkToLogs = await renderResult.findByTestId('hostDetailsLinkToLogs');
|
||||
reactTestingLibrary.act(() => {
|
||||
reactTestingLibrary.fireEvent.click(linkToLogs);
|
||||
});
|
||||
});
|
||||
|
||||
it('should navigate to logs without full page refresh', () => {
|
||||
expect(coreStart.application.navigateToApp.mock.calls).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when showing host Policy Response panel', () => {
|
||||
let renderResult: ReturnType<typeof render>;
|
||||
beforeEach(async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue