mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Security Solution] Risk score area chart displayed error (#155597)
## Summary Risk score area chart displayed error on host details page: /app/security/hosts/name/{hostName}/hostRisk Before:  After: <img width="834" alt="Screenshot 2023-04-24 at 10 21 55" src="https://user-images.githubusercontent.com/6295984/233961617-b78e1c05-6b9f-406a-8264-e615cf8e4848.png"> Relevant changes: https://github.com/elastic/kibana/pull/152506/files#diff-260dbbbd965ff10673ef7670e2cb819173662b51bb353b7ad702a60334e874ff ### Checklist Delete any items that are not applicable to this PR. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
f5034e60a5
commit
d0642f75d8
3 changed files with 41 additions and 2 deletions
|
@ -184,7 +184,7 @@ Object {
|
|||
"color": "#aa6556",
|
||||
"fill": "none",
|
||||
"forAccessor": "1dd5663b-f062-43f8-8688-fc8166c2ca8e",
|
||||
"icon": "warning",
|
||||
"icon": "alert",
|
||||
"iconPosition": "left",
|
||||
"lineWidth": 2,
|
||||
"textVisibility": true,
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import type { XYState } from '@kbn/lens-plugin/public';
|
||||
import { wrapper } from '../../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../../use_lens_attributes';
|
||||
|
@ -56,4 +57,42 @@ describe('getRiskScoreOverTimeAreaAttributes', () => {
|
|||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should render a Reference Line with an Alert icon', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
getLensAttributes: getRiskScoreOverTimeAreaAttributes,
|
||||
stackByField: 'host',
|
||||
extraOptions: {
|
||||
spaceId: 'mockSpaceId',
|
||||
},
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(
|
||||
(result?.current?.state.visualization as XYState).layers.find(
|
||||
(layer) => layer.layerType === 'referenceLine'
|
||||
)
|
||||
).toEqual(
|
||||
expect.objectContaining({
|
||||
layerId: '1dd5663b-f062-43f8-8688-fc8166c2ca8e',
|
||||
layerType: 'referenceLine',
|
||||
accessors: ['1dd5663b-f062-43f8-8688-fc8166c2ca8e'],
|
||||
yConfig: [
|
||||
{
|
||||
forAccessor: '1dd5663b-f062-43f8-8688-fc8166c2ca8e',
|
||||
axisMode: 'left',
|
||||
lineWidth: 2,
|
||||
color: '#aa6556',
|
||||
icon: 'alert',
|
||||
textVisibility: true,
|
||||
fill: 'none',
|
||||
iconPosition: 'left',
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -56,7 +56,7 @@ export const getRiskScoreOverTimeAreaAttributes: GetLensAttributes = (
|
|||
axisMode: 'left',
|
||||
lineWidth: 2,
|
||||
color: '#aa6556',
|
||||
icon: 'warning',
|
||||
icon: 'alert',
|
||||
textVisibility: true,
|
||||
fill: 'none',
|
||||
iconPosition: 'left',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue