diff --git a/public/app.scss b/public/app.scss index 9c4535b3b..1682d852e 100644 --- a/public/app.scss +++ b/public/app.scss @@ -11,6 +11,9 @@ $euiColorGhost: #FFF !default; $euiColorInk: #000 !default; $euiTextColor: $euiColorDarkestShade !default; +@import "./components/Charts/ChartContainer.scss"; +@import "./pages/Overview/components/Widgets/WidgetContainer.scss"; + .selected-radio-panel { background-color: tintOrShade($euiColorPrimary, 90%, 70%); border-color: $euiColorPrimary; @@ -45,5 +48,71 @@ $euiTextColor: $euiColorDarkestShade !default; text-decoration: none; } -@import "./components/Charts/ChartContainer.scss"; -@import "./pages/Overview/components/Widgets/WidgetContainer.scss"; +.vg-tooltip { + background-color: #404040 !important; + border-radius: 4px !important; + color: #FFFFFF !important; + border: none !important; + padding: 0 !important; + font-family: "Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol" !important; + font-weight: 600 !important; + font-size: 12px !important; + + .vg-tooltip-innerContainer { + .vg-tooltip-header { + padding: 4px; + border-bottom: 1px solid gray; + + table tr:nth-child(odd) { + background-color: #535353 !important; + } + + td:nth-child(1) { + position: relative; + width: 6px; + padding: 0 0 0 2px !important; + + .vg-tooltip-color { + width: 4px; + position: absolute; + top: 2px; + height: calc(100% - 4px); + } + } + + td:nth-child(3) { + padding-right: 8px !important; + text-align: right; + } + } + + .vg-tooltip-body { + padding: 4px; + + table tr:nth-child(even) { + background-color: #535353 !important; + } + + td:nth-child(2) { + text-align: right; + } + } + + table { + width: 100%; + + tbody tr { + td { + height: 28px; + padding: 4px !important; + vertical-align: middle !important; + } + + td:nth-child(1) { + padding-right: 10px !important; + font-weight: 400 !important; + } + } + } + } +} diff --git a/public/pages/Detectors/components/UpdateAlertConditions/UpdateAlertConditions.test.tsx b/public/pages/Detectors/components/UpdateAlertConditions/UpdateAlertConditions.test.tsx index d0a558471..f7f51a0b9 100644 --- a/public/pages/Detectors/components/UpdateAlertConditions/UpdateAlertConditions.test.tsx +++ b/public/pages/Detectors/components/UpdateAlertConditions/UpdateAlertConditions.test.tsx @@ -4,14 +4,28 @@ */ import React from 'react'; -import { render } from '@testing-library/react'; import props from '../../../../../test/mocks/Detectors/components/UpdateAlertConditions/UpdateAlertConditions.mock'; import { expect } from '@jest/globals'; import UpdateAlertConditions from './UpdateAlertConditions'; +import { act } from 'react-dom/test-utils'; +import { mount } from 'enzyme'; +import { contextServicesMock } from '../../../../../test/mocks/useContext.mock'; + +jest.mock( + '../../../CreateDetector/components/ConfigureAlerts/containers/ConfigureAlerts.tsx', + () => () => { + return ; + } +); describe(' spec', () => { - it('renders the component', () => { - const view = render(); - expect(view).toMatchSnapshot(); + it('renders the component', async () => { + let wrapper; + await act(async () => { + UpdateAlertConditions.contextType = React.createContext(contextServicesMock); + wrapper = await mount(); + }); + wrapper.update(); + expect(wrapper).toMatchSnapshot(); }); }); diff --git a/public/pages/Detectors/components/UpdateAlertConditions/__snapshots__/UpdateAlertConditions.test.tsx.snap b/public/pages/Detectors/components/UpdateAlertConditions/__snapshots__/UpdateAlertConditions.test.tsx.snap index b8882eeb1..c991a985f 100644 --- a/public/pages/Detectors/components/UpdateAlertConditions/__snapshots__/UpdateAlertConditions.test.tsx.snap +++ b/public/pages/Detectors/components/UpdateAlertConditions/__snapshots__/UpdateAlertConditions.test.tsx.snap @@ -1,3634 +1,1153 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[` spec renders the component 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
-
-
-

- Edit alert triggers -

-
-
- Get notified when specific rule conditions are found by the detector. -
-
-
-
-
-
-
- -
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-

- If a detection rule matches -

-
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-

- Alert and notify -

-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
- -
-
-
- -
-
-
-
-
- EuiIconMock - - Notifications plugin is not installed - -
-
-
-

- Install the notifications plugin in order to create and select channels to send out notifications.  - - Learn more - EuiIconMock - - . -

-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-

- If a detection rule matches -

-
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-

- Alert and notify -

-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
- -
-
-
- -
-
-
-
-
- EuiIconMock - - Notifications plugin is not installed - -
-
-
-

- Install the notifications plugin in order to create and select channels to send out notifications.  - - Learn more - EuiIconMock - - . -

-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
- -
-
- -
-
-
-
- , - "container":
-
-
-

- Edit alert triggers -

-
+
+ + + + +
+
- Get notified when specific rule conditions are found by the detector. -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-

- If a detection rule matches -

-
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-

- Alert and notify -

-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
- -
-
-
- -
-
-
-
-
- EuiIconMock - - Notifications plugin is not installed - -
-
-
-

- Install the notifications plugin in order to create and select channels to send out notifications.  - - Learn more - EuiIconMock - - . -

-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
+ + + +
-
-
-
+ +
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-

- If a detection rule matches -

-
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-

- Alert and notify -

-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
- -
-
-
- -
-
-
-
-
- EuiIconMock - - Notifications plugin is not installed - -
-
-
-

- Install the notifications plugin in order to create and select channels to send out notifications.  - - Learn more - EuiIconMock - - . -

-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
+ + + +
-
-
- -
-
-
- -
-
- -
+
-
-
, - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} + +
+ `; diff --git a/public/pages/Detectors/components/UpdateBasicDetails/UpdateDetectorBasicDetails.test.tsx b/public/pages/Detectors/components/UpdateBasicDetails/UpdateDetectorBasicDetails.test.tsx index 90269884e..004c3fa34 100644 --- a/public/pages/Detectors/components/UpdateBasicDetails/UpdateDetectorBasicDetails.test.tsx +++ b/public/pages/Detectors/components/UpdateBasicDetails/UpdateDetectorBasicDetails.test.tsx @@ -9,7 +9,12 @@ import { expect } from '@jest/globals'; import { UpdateDetectorBasicDetails } from './UpdateBasicDetails'; import { act } from 'react-dom/test-utils'; import { mount } from 'enzyme'; - +jest.mock( + '../../../CreateDetector/components/DefineDetector/components/DetectorDataSource/DetectorDataSource.tsx', + () => () => { + return ; + } +); describe(' spec', () => { it('renders the component', async () => { let wrapper; diff --git a/public/pages/Detectors/components/UpdateBasicDetails/__snapshots__/UpdateDetectorBasicDetails.test.tsx.snap b/public/pages/Detectors/components/UpdateBasicDetails/__snapshots__/UpdateDetectorBasicDetails.test.tsx.snap index 945386b73..5e033074f 100644 --- a/public/pages/Detectors/components/UpdateBasicDetails/__snapshots__/UpdateDetectorBasicDetails.test.tsx.snap +++ b/public/pages/Detectors/components/UpdateBasicDetails/__snapshots__/UpdateDetectorBasicDetails.test.tsx.snap @@ -188,7 +188,377 @@ exports[` spec renders the component 1`] = ` "location": Object { "pathname": "", }, - "replace": [MockFunction], + "replace": [MockFunction] { + "calls": Array [ + Array [ + Object { + "pathname": "/edit-detector-details/detector_id_1", + "state": Object { + "detectorHit": Object { + "_id": "detector_id_1", + "_index": ".windows", + "_source": Object { + "_id": "detector_id_1", + "_index": ".windows", + "_source": Object { + "createdBy": "someone", + "detector_type": "detector_type", + "enabled": true, + "enabled_time": 1, + "id": "detector_id_1", + "inputs": Array [ + Object { + "detector_input": Object { + "custom_rules": Array [ + Object { + "_id": "rule_id_1", + "_index": ".windows", + "_primary_term": 1, + "_source": Object { + "last_update_time": "12/12/2022", + "queries": Array [ + Object { + "value": ".windows", + }, + ], + "rule": "rule_name", + }, + "_version": 1, + "id": "rule_id_1", + }, + ], + "description": "detectorDescription", + "indices": Array [ + ".windows", + ], + "pre_packaged_rules": Array [ + Object { + "_id": "rule_id_1", + "_index": ".windows", + "_primary_term": 1, + "_source": Object { + "last_update_time": "12/12/2022", + "queries": Array [ + Object { + "value": ".windows", + }, + ], + "rule": "rule_name", + }, + "_version": 1, + "id": "rule_id_1", + }, + ], + }, + }, + ], + "last_update_time": 1, + "name": "detector_name", + "schedule": Object { + "period": Object { + "interval": 1, + "unit": "minute", + }, + }, + "triggers": Array [ + Object { + "actions": Array [ + Object { + "destination_id": "some_destination_id_1", + "id": "trigger_id_1_0", + "message_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "name": "some_name", + "subject_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "throttle": Object { + "unit": "minutes", + "value": 1, + }, + "throttle_enabled": true, + }, + Object { + "destination_id": "some_destination_id_1", + "id": "trigger_id_1_1", + "message_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "name": "some_name", + "subject_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "throttle": Object { + "unit": "minutes", + "value": 1, + }, + "throttle_enabled": true, + }, + ], + "id": "trigger_id_0", + "ids": Array [ + "rule_id_1", + ], + "name": "alert_name", + "sev_levels": Array [ + "severity_level_low", + ], + "severity": "1", + "tags": Array [ + "any.tag", + ], + "types": Array [ + "detector_type_1", + ], + }, + Object { + "actions": Array [ + Object { + "destination_id": "some_destination_id_1", + "id": "trigger_id_1_0", + "message_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "name": "some_name", + "subject_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "throttle": Object { + "unit": "minutes", + "value": 1, + }, + "throttle_enabled": true, + }, + Object { + "destination_id": "some_destination_id_1", + "id": "trigger_id_1_1", + "message_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "name": "some_name", + "subject_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "throttle": Object { + "unit": "minutes", + "value": 1, + }, + "throttle_enabled": true, + }, + ], + "id": "trigger_id_1", + "ids": Array [ + "rule_id_1", + ], + "name": "alert_name", + "sev_levels": Array [ + "severity_level_low", + ], + "severity": "1", + "tags": Array [ + "any.tag", + ], + "types": Array [ + "detector_type_1", + ], + }, + ], + "type": "detector", + }, + "createdBy": "someone", + "detector_type": "detector_type", + "enabled": true, + "enabled_time": 1, + "id": "detector_id_1", + "inputs": Array [ + Object { + "detector_input": Object { + "custom_rules": Array [ + Object { + "_id": "rule_id_1", + "_index": ".windows", + "_primary_term": 1, + "_source": Object { + "last_update_time": "12/12/2022", + "queries": Array [ + Object { + "value": ".windows", + }, + ], + "rule": "rule_name", + }, + "_version": 1, + "id": "rule_id_1", + }, + ], + "description": "detectorDescription", + "indices": Array [ + ".windows", + ], + "pre_packaged_rules": Array [ + Object { + "_id": "rule_id_1", + "_index": ".windows", + "_primary_term": 1, + "_source": Object { + "last_update_time": "12/12/2022", + "queries": Array [ + Object { + "value": ".windows", + }, + ], + "rule": "rule_name", + }, + "_version": 1, + "id": "rule_id_1", + }, + ], + }, + }, + ], + "last_update_time": 1, + "name": "detector_name", + "schedule": Object { + "period": Object { + "interval": 1, + "unit": "minute", + }, + }, + "triggers": Array [ + Object { + "actions": Array [ + Object { + "destination_id": "some_destination_id_1", + "id": "trigger_id_1_0", + "message_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "name": "some_name", + "subject_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "throttle": Object { + "unit": "minutes", + "value": 1, + }, + "throttle_enabled": true, + }, + Object { + "destination_id": "some_destination_id_1", + "id": "trigger_id_1_1", + "message_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "name": "some_name", + "subject_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "throttle": Object { + "unit": "minutes", + "value": 1, + }, + "throttle_enabled": true, + }, + ], + "id": "trigger_id_0", + "ids": Array [ + "rule_id_1", + ], + "name": "alert_name", + "sev_levels": Array [ + "severity_level_low", + ], + "severity": "1", + "tags": Array [ + "any.tag", + ], + "types": Array [ + "detector_type_1", + ], + }, + Object { + "actions": Array [ + Object { + "destination_id": "some_destination_id_1", + "id": "trigger_id_1_0", + "message_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "name": "some_name", + "subject_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "throttle": Object { + "unit": "minutes", + "value": 1, + }, + "throttle_enabled": true, + }, + Object { + "destination_id": "some_destination_id_1", + "id": "trigger_id_1_1", + "message_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "name": "some_name", + "subject_template": Object { + "lang": "some_lang", + "source": "some_source", + }, + "throttle": Object { + "unit": "minutes", + "value": 1, + }, + "throttle_enabled": true, + }, + ], + "id": "trigger_id_1", + "ids": Array [ + "rule_id_1", + ], + "name": "alert_name", + "sev_levels": Array [ + "severity_level_low", + ], + "severity": "1", + "tags": Array [ + "any.tag", + ], + "types": Array [ + "detector_type_1", + ], + }, + ], + "type": "detector", + }, + }, + }, + }, + ], + ], + "results": Array [ + Object { + "type": "return", + "value": undefined, + }, + ], + }, } } location={ @@ -199,23 +569,7 @@ exports[` spec renders the component 1`] = ` notifications={ Object { "toasts": Object { - "addDanger": [MockFunction] { - "calls": Array [ - Array [ - Object { - "text": [TypeError: Cannot read property 'setBreadcrumbs' of undefined], - "title": "Failed to retrieve detector:", - "toastLifeTimeMs": 5000, - }, - ], - ], - "results": Array [ - Object { - "type": "return", - "value": undefined, - }, - ], - }, + "addDanger": [MockFunction], }, } } @@ -527,7 +881,7 @@ exports[` spec renders the component 1`] = ` className="euiSpacer euiSpacer--xl" /> - spec renders the component 1`] = ` notifications={ Object { "toasts": Object { - "addDanger": [MockFunction] { - "calls": Array [ - Array [ - Object { - "text": [TypeError: Cannot read property 'setBreadcrumbs' of undefined], - "title": "Failed to retrieve detector:", - "toastLifeTimeMs": 5000, - }, - ], - ], - "results": Array [ - Object { - "type": "return", - "value": undefined, - }, - ], - }, + "addDanger": [MockFunction], }, } } onDetectorInputIndicesChange={[Function]} > - - -
- -
- -
- -

- Data source -

-
-
-
-
-
- -
-
-
- -
- - - } - labelType="label" - > -
-
- - - -
-
- -
- - -
-
-
- - - .windows - - - -
- -
-
- -
- -
- - - - - - - - -
-
-
-
- - -
- -
-
- -
-
- - - + + @@ -1823,20 +1758,20 @@ exports[` spec renders the component 1`] = ` className="euiFlexItem euiFlexItem--flexGrowZero" >