-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution][Endpoint] New endpoint policy response UI and fleet UI for integrations in agent details page #133405
Conversation
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.
This is looking awesome, so much better than what we have now 🤩 I have a couple of suggestions and mostly nits.
Also, I suggested this to @joeypoon as well on his PR. Is there a way to expand all the error item logs when you click on the needsAttention
button? I think it's useful to see all the errors with a single click vs drilling down individually. Currently, it expands only the top-level accordion as seen in the PR screenshot. How about something like this below. I took a screen grab as the state persists once you drill down to inner levels.
Maybe out of scope or maybe we can do this in a new PR. Maybe we don't want to do it. Let me know what you think.
...t/sections/agents/agent_details_page/components/agent_details/agent_details_integrations.tsx
Outdated
Show resolved
Hide resolved
...t/sections/agents/agent_details_page/components/agent_details/agent_details_integrations.tsx
Outdated
Show resolved
Hide resolved
...t/sections/agents/agent_details_page/components/agent_details/agent_details_integrations.tsx
Outdated
Show resolved
Hide resolved
...k/plugins/security_solution/public/management/components/policy_response/policy_response.tsx
Show resolved
Hide resolved
...s/security_solution/public/management/components/policy_response/policy_response_wrapper.tsx
Show resolved
Hide resolved
...urity_solution/public/management/components/policy_response/policy_response_wrapper.test.tsx
Outdated
Show resolved
Hide resolved
// FIXME: for some reason it is not getting all messages items from DOM even those are rendered. | ||
it.skip('should show an actions section for each configuration', async () => { | ||
runMock(); | ||
const actionAccordions = await render().findAllByTestId( | ||
'endpointDetailsPolicyResponseActionsAccordion' | ||
const component = await renderOpenedTree(); | ||
|
||
const configs = await component.findAllByTestId('endpointPolicyResponseConfig'); | ||
const actions = await component.findAllByTestId('endpointPolicyResponseAction'); | ||
const statusAttentionHealth = await component.findAllByTestId( | ||
'endpointPolicyResponseStatusAttentionHealth' | ||
); | ||
const action = await render().findAllByTestId('policyResponseAction'); | ||
const statusHealth = await render().findAllByTestId('policyResponseStatusHealth'); | ||
const message = await render().findAllByTestId('policyResponseMessage'); | ||
const statusSuccessHealth = await component.findAllByTestId( | ||
'endpointPolicyResponseStatusSuccessHealth' | ||
); | ||
const messages = await component.findAllByTestId('endpointPolicyResponseMessage'); | ||
|
||
let expectedActionAccordionCount = 0; | ||
Object.keys(commonPolicyResponse.Endpoint.policy.applied.response.configurations).forEach( | ||
(key) => { | ||
expectedActionAccordionCount += | ||
commonPolicyResponse.Endpoint.policy.applied.response.configurations[ | ||
key as keyof HostPolicyResponse['Endpoint']['policy']['applied']['response']['configurations'] | ||
].concerned_actions.length; | ||
} | ||
const configurationKeys = Object.keys( | ||
commonPolicyResponse.Endpoint.policy.applied.response.configurations | ||
); | ||
configurationKeys.forEach((key) => { | ||
expectedActionAccordionCount += | ||
commonPolicyResponse.Endpoint.policy.applied.response.configurations[ | ||
key as keyof HostPolicyResponse['Endpoint']['policy']['applied']['response']['configurations'] | ||
].concerned_actions.length; | ||
}); | ||
|
||
expect(configs).toHaveLength(configurationKeys.length); | ||
expect(actions).toHaveLength(expectedActionAccordionCount); | ||
expect(messages).toHaveLength(expectedActionAccordionCount); | ||
expect([...statusSuccessHealth, ...statusAttentionHealth]).toHaveLength( | ||
expectedActionAccordionCount + configurationKeys.length + 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.
Looks like one of the endpointPolicyResponseStatusAttentionHealth
may not be expanded here and that's why the count is off by 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.
Not exactly, the +1
here is for the top one Policy response
. I'm still looking on this test
… iterate the array only one time
This is not possible right now because an |
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.
Thanks for the changes. 🙏 There's a color bit that needs a change.
children: packagePolicy.inputs.reduce( | ||
(acc: Array<{ label: JSX.Element; id: string }>, current) => { |
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.
Nice 🔥 . No need to change but for TS you can also do .reduce<Array<{ label: JSX.Element; id: string }>>(acc, current)
.
...t/sections/agents/agent_details_page/components/agent_details/agent_details_integrations.tsx
Outdated
Show resolved
Hide resolved
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.
Awesome! Thanks for the changes again. Looking good to 🚢!
Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt) |
@elasticmachine merge upstream |
…ee_a_policy_response_section-3863
Pinging @elastic/fleet (Team:Fleet) |
// actionButtonLabel="Do something" // TODO | ||
// actionButtonOnClick={() => {}} // TODO |
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.
??
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.
This is going to be used in future pr's but is useless at this point. I can remove those comments if can create any confusion
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.
fine to leave it in
// FIXME: for some reason it is not getting all messages items from DOM even those are rendered. | ||
// expect(messages).toHaveLength(expectedActionAccordionCount); | ||
// expect([...statusSuccessHealth, ...statusAttentionHealth]).toHaveLength( | ||
// expectedActionAccordionCount + configurationKeys.length + 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.
👌
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.
Fleet changes LGTM, could you actually see any log entries under one of the View logs
links?
@juliaElastic Thanks for taking a look! I'm using data generated by the generators. Do you have any generator I can use for that? |
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
History
To update your PR or re-run it, just comment with: |
I'm not familiar with generators, do we have documentation on them? |
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.
🚀
@dasansol92 check it out and tried it with a real Agent/Endpoint - looks great! I also verified @juliaElastic question - we can see logs when we navigate with real data: |
Merged with @dasansol92 permission |
Summary
Needs attention
button label when it's needed.policyResponseInFleetEnabled
Fleet changes without FF:
Fleet changes with FF:
Endpoint policy response changes in endpoint details flyout:
For maintainers