-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[SIEM] Replace Eui chart with elastic charts for siem kpis #36660
Conversation
💔 Build Failed |
💔 Build Failed |
Pinging @elastic/secops |
💔 Build Failed |
it('should render a customized y-asix', () => { | ||
expect(wrapper.find('EuiYAxis')).toHaveLength(1); | ||
it('should render Chart', () => { | ||
expect(wrapper.find('Chart')).toHaveLength(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing further testing for charts' detail here because
- It is render by canvas so not able to be tested from outside of the library. - Make the chart testable from outside elastic-charts#215
- Most of the cases have been tested inside elastic-charts.
LINE = 'line', | ||
} | ||
|
||
export const getSeriesStyle = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reference: Customise series color in elastic-charts
return value.toLocaleString && value.toLocaleString(); | ||
}; | ||
|
||
export enum SeriesType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align with the seriesType mentioned in elastic-charts overview
💔 Build Failed |
reset please |
retest this |
1 similar comment
retest this |
💚 Build Succeeded |
💔 Build Failed |
reset this |
1 similar comment
reset this |
💔 Build Failed |
💚 Build Succeeded |
Temporary close this as a problem was found on IE crashes the app. |
Reopening this PR as the problem has been fixed in @elastic-charts 4.2.6: |
💚 Build Succeeded |
💚 Build Succeeded |
package.json
Outdated
@@ -434,4 +434,4 @@ | |||
"node": "10.15.2", | |||
"yarn": "^1.10.1" | |||
} | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new line here. That's weird your IDE didn't auto-add it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow it allowed a new line for all the files but this one (It was not only not adding it, but removing it if I added) lol. Thanks for notice, just upgrade my VSCode and added a rule for it :D
)} | ||
</AutoSizer> | ||
) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really clean and great code! For these pure
functions I would recommend changing them to use React.Memo
like so:
export const AreaChart = React.memo<{ areaChart: AreaChartData[] | null | undefined }>(
({ areaChart }) => (
<AutoSizer detectAnyWindowResize={false} content>
{({ measureRef, content: { height, width } }) => (
<WrappedByAutoSizer innerRef={measureRef}>
<AreaChartWithCustomPrompt data={areaChart} height={height} width={width} />
</WrappedByAutoSizer>
)}
</AutoSizer>
)
);
For new code moving forward I think we can remove our usage of recompose and just utilize React when we write new code which is pretty awesome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing, thanks! I am happy to move away from pure component. I'll have another PR for enhancing kpi network, and do the cleanup for it as well.
<FlexGroup justifyContent="center" alignItems="center"> | ||
<EuiFlexItem grow={false}> | ||
<EuiText size="s" textAlign="center" color="subdued"> | ||
Chart Data Not Available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need a i18n key here for Chart Data Not Available
. It doesn't have to be a new separate file if you don't want it to be. Some people prefer to use i18n inline within their files and I think that's fine.
@@ -49,28 +36,10 @@ export interface StatItem { | |||
description?: string; | |||
value: number | undefined | null; | |||
color?: string; | |||
icon?: 'storage' | 'cross' | 'check' | 'visMapCoordinate'; | |||
icon?: 'storage' | 'cross' | 'check' | 'visMapCoordinate' | 'globe'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this just be better as the exported Icon Type from EUI?:
import { IconType } from '@elastic/eui';
icon?: IconType
Then you don't have to retype it for each new icon you want to add here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, that makes the code much easier to maintain! Thanks!
💔 Build Failed |
💔 Build Failed |
💚 Build Succeeded |
@@ -349,7 +349,7 @@ | |||
"dedent": "^0.7.0", | |||
"delete-empty": "^2.0.0", | |||
"enzyme": "^3.7.0", | |||
"enzyme-adapter-react-16": "^1.9.0", | |||
"enzyme-adapter-react-16": "^1.10.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrade enzyme-adapter-react-16 to support React.memo
enzymejs/enzyme#1914
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked it out, played with it, and really appreciate the upgrade for enzyme for everyone so we can use Rect.memo
.
Looks great to me!
…6660) * move charts to separate components * replace areachart * apply custom styles * customize barchart color * customize color for areachart * move reusable functions into common * exchange x & y value in barchart dataset * replace pure component with react memo and upgrade enzyme adapter
…37317) * move charts to separate components * replace areachart * apply custom styles * customize barchart color * customize color for areachart * move reusable functions into common * exchange x & y value in barchart dataset * replace pure component with react memo and upgrade enzyme adapter
…6660) * move charts to separate components * replace areachart * apply custom styles * customize barchart color * customize color for areachart * move reusable functions into common * exchange x & y value in barchart dataset * replace pure component with react memo and upgrade enzyme adapter
Summary
This PR is to isolate charts from stat items component and replace Eui-chart with elastic-charts for siem kpis. (https://github.com/elastic/ingest-dev/issues/445)
Currently with Elastic Charts:
With Win8 IE11
Previously with EUI chart:
Known issue:
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] This was checked for cross-browser compatibility, including a check against IE11- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support- [ ] Documentation was added for features that require explanation or tutorials- [ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers
- [ ] This was checked for breaking API changes and was labeled appropriately- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately