[Security Solution][Case] ServiceNow ITSM: Add category & subcategory fields#90547
[Security Solution][Case] ServiceNow ITSM: Add category & subcategory fields#90547cnasikas merged 1 commit intoelastic:masterfrom
Conversation
|
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
|
Pinging @elastic/security-solution (Team: SecuritySolution) |
487df89 to
d6bfcef
Compare
YulNaumenko
left a comment
There was a problem hiding this comment.
Alerting related changes LGTM
d6bfcef to
ce779a1
Compare
ce779a1 to
d709227
Compare
|
Pinging @elastic/uptime (Team:uptime) |
1cea661 to
663aa0f
Compare
There was a problem hiding this comment.
We'll want to update our UI to allow users to actually set these without using the API directly. I'm creating a follow-up issue.
There was a problem hiding this comment.
@justinkambic FWIW, there is an API call (subaction) where you can get dynamically all available choices (impact, priority, severity, category, subcategory) for a specific instance. If you are interested to this please ping me on Slack!
663aa0f to
0b8436e
Compare
|
@elasticmachine merge upstream |
c8fe36a to
b745780
Compare
b745780 to
0a794b6
Compare
There was a problem hiding this comment.
nit: I know the other tests here dont follow this and it passes as is without, but the correct way would be:
| test('it should set subcategory to null when changing category', async () => { | |
| await waitFor(() => { | |
| const select = wrapper.find(EuiSelect).filter(`[data-test-subj="categorySelect"]`)!; | |
| select.prop('onChange')!({ | |
| target: { | |
| value: 'network', | |
| }, | |
| } as React.ChangeEvent<HTMLSelectElement>); | |
| }); | |
| wrapper.update(); | |
| expect(onChange).toHaveBeenCalledWith({ | |
| ...fields, | |
| subcategory: null, | |
| category: 'network', | |
| }); | |
| }); | |
| test('it should set subcategory to null when changing category', async () => { | |
| const select = wrapper.find(EuiSelect).filter(`[data-test-subj="categorySelect"]`)!; | |
| select.prop('onChange')!({ | |
| target: { | |
| value: 'network', | |
| }, | |
| } as React.ChangeEvent<HTMLSelectElement>); | |
| wrapper.update(); | |
| await waitFor(() => { | |
| expect(onChange).toHaveBeenCalledWith({ | |
| ...fields, | |
| subcategory: null, | |
| category: 'network', | |
| }); | |
| }); | |
| }); |
There was a problem hiding this comment.
the await waitFor should be surrounding the expect after the async change. it definitely does not always work this way, but alas we're using enzyme with react-testing-library
There was a problem hiding this comment.
I'd do a useCallback here since you have the incident value
There was a problem hiding this comment.
There is no difference if we use the incident or not. The callback function will always be a new reference for the prop no matter what we do inside the function.
stephmilovic
left a comment
There was a problem hiding this comment.
Manual testing went perfectly. Just a few nits on the code, other than that LGTM. very clean, nicely done! 🎸
0a794b6 to
81cfa31
Compare
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
Summary
The PR adds two new fields for the ServiceNow ITSM connector. Specifically,
categoryandsubcategory. It also fixes a bug when changing categories and subcategories in ServiceNow SIR connector.Create Case
ITSM.-.Create.Case.mov
Alerts & Detections
Meta: https://github.com/elastic/security-team/issues/477
Depends on: #88655
Checklist
Delete any items that are not applicable to this PR.
For maintainers