Fix 404 error on deleted rule alert view (#103491) (#103522)

Co-authored-by: Dmitry Shevchenko <dmshevch@gmail.com>
This commit is contained in:
Kibana Machine 2021-06-28 16:03:05 -04:00 committed by GitHub
parent 0b288bf84d
commit 6ad84e709f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -11,7 +11,7 @@ import { waitFor } from '@testing-library/react';
import { AlertSummaryView } from './alert_summary_view';
import { mockAlertDetailsData } from './__mocks__';
import { TimelineEventsDetailsItem } from '../../../../common/search_strategy';
import { useRuleAsync } from '../../../detections/containers/detection_engine/rules/use_rule_async';
import { useRuleWithFallback } from '../../../detections/containers/detection_engine/rules/use_rule_with_fallback';
import { TestProviders } from '../../mock';
import { mockBrowserFields } from '../../containers/source/mock';
@ -19,9 +19,9 @@ import { useMountAppended } from '../../utils/use_mount_appended';
jest.mock('../../lib/kibana');
jest.mock('../../../detections/containers/detection_engine/rules/use_rule_async', () => {
jest.mock('../../../detections/containers/detection_engine/rules/use_rule_with_fallback', () => {
return {
useRuleAsync: jest.fn(),
useRuleWithFallback: jest.fn(),
};
});
@ -37,7 +37,7 @@ describe('AlertSummaryView', () => {
beforeEach(() => {
jest.clearAllMocks();
(useRuleAsync as jest.Mock).mockReturnValue({
(useRuleWithFallback as jest.Mock).mockReturnValue({
rule: {
note: 'investigation guide',
},
@ -64,7 +64,7 @@ describe('AlertSummaryView', () => {
});
test("render no investigation guide if it doesn't exist", async () => {
(useRuleAsync as jest.Mock).mockReturnValue({
(useRuleWithFallback as jest.Mock).mockReturnValue({
rule: {
note: null,
},

View file

@ -35,7 +35,7 @@ import {
import { DESTINATION_IP_FIELD_NAME, SOURCE_IP_FIELD_NAME } from '../../../network/components/ip';
import { SummaryView } from './summary_view';
import { AlertSummaryRow, getSummaryColumns, SummaryRow } from './helpers';
import { useRuleAsync } from '../../../detections/containers/detection_engine/rules/use_rule_async';
import { useRuleWithFallback } from '../../../detections/containers/detection_engine/rules/use_rule_with_fallback';
import { LineClamp } from '../line_clamp';
import { endpointAlertCheck } from '../../utils/endpoint_alert_check';
@ -207,7 +207,7 @@ const AlertSummaryViewComponent: React.FC<{
? item?.originalValue[0]
: item?.originalValue ?? null;
}, [data]);
const { rule: maybeRule } = useRuleAsync(ruleId);
const { rule: maybeRule } = useRuleWithFallback(ruleId);
return (
<>