Skip to content
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] Asset criticality UI #173512

Merged
merged 17 commits into from
Dec 27, 2023

Conversation

tiansivive
Copy link
Contributor

@tiansivive tiansivive commented Dec 18, 2023

Summary

This PR adds the UI to assign asset criticality in the old host flyout. #8086

demoUI.mov

NOTE:
This introduces the changes from the closed PR #173011

Checklist

Delete any items that are not applicable to this PR.

@tiansivive tiansivive added Team:Entity Analytics Security Entity Analytics Team release_note:feature Makes this part of the condensed release notes v8.13.0 labels Dec 18, 2023
tags: ['@ess', '@serverless'],
env: {
ftrConfig: {
enableExperimental: ['entityAnalyticsAssetCriticalityEnabled'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick questions: I noticed that you enabled entityAnalyticsAssetCriticalityEnabled on Serverless and ESS cypress configs files.

Do you also need to enable it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah!
I'm not sure exactly.
I talked with Mark about this. I think this flag here is required for running in CI. But locally, it doesnt get picked up, so I need the other one. I'm not sure if the other one is required for CI or if it's just local

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in this thread, I think @elastic/security-engineering-productivity would prefer that you remove the configuration from the broader config files before merging this.

@tiansivive tiansivive marked this pull request as ready for review December 18, 2023 14:25
@tiansivive tiansivive requested review from a team as code owners December 18, 2023 14:25
@@ -80,7 +82,9 @@ export const HostDetailsPanel: React.FC<HostDetailsProps> = React.memo(
<StyledEuiFlyoutBody>
<EuiSpacer size="m" />
<ExpandableHostDetailsPageLink hostName={hostName} />
<EuiSpacer size="m" />
<EuiHorizontalRule />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both EuiHorizontalRule will render when asset criticality flag is disabled, or the user doesn't have the privileges.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -43,7 +44,9 @@ export const UserDetailsFlyout = ({
<StyledEuiFlyoutBody>
<EuiSpacer size="m" />
<ExpandableUserDetailsPageLink userName={userName} />
<EuiSpacer size="m" />
<EuiHorizontalRule />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Member

@machadoum machadoum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I desk-tested the feature and it looks good to me.
Thank you for the amazing job 🔥 🚀

@tiansivive
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the Threat Hunting Investigations team


describe('Host flyout', () => {
beforeEach(() => {
expandFirstAlertHostFlyout();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Why not moving this to the above beforeEach?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, good one! Originally it was because there were other flyouts to test, but that got scrapped. I should move it yes, thanks!

cy.log('asset criticality update');

toggleAssetCriticalityModal();
cy.get(HOST_DETAILS_FLYOUT_ASSET_CRITICALITY_MODAL_SELECT).should('be.visible').click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Wrap it into a meaningful task method. You don't need to check for the element to be visible, cypress makes sure the element is actionable before performing the click.

.contains('Important')
.click();

cy.get(HOST_DETAILS_FLYOUT_ASSET_CRITICALITY_MODAL_SAVE_BTN).should('be.visible').click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Wrap it into a meaningful task method. You don't need to check for the element to be visible, cypress makes sure the element is actionable before performing the click.

toggleAssetCriticalityModal();
cy.get(HOST_DETAILS_FLYOUT_ASSET_CRITICALITY_MODAL_SELECT).should('be.visible').click();

cy.get(HOST_DETAILS_FLYOUT_ASSET_CRITICALITY_MODAL_SELECT_OPTION)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Wrap it into a meaningful task method.

*/
export const toggleAssetCriticalityAccordion = () => {
cy.get(HOST_DETAILS_FLYOUT_ASSET_CRITICALITY_SELECTOR).scrollIntoView();
cy.get(HOST_DETAILS_FLYOUT_ASSET_CRITICALITY_SELECTOR).should('be.visible').click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Cypress automatically performs different checks and actions before doing a click into an element when we are not forcing it as it is the case:

  • Scroll the element into view.
  • Ensure the element is not hidden.
  • Ensure the element is not disabled.
  • Ensure the element is not detached
  • Ensure the element is not readonly.
  • Ensure the element is not animating.
  • Ensure the element is not covered
  • Scroll the page if still covered by an element with fixed position.

So it should not be needed to do the the scrollIntoView or the implicit check on visibility.

export const toggleAssetCriticalityModal = () => {
toggleAssetCriticalityAccordion();

cy.get(HOST_DETAILS_FLYOUT_ASSET_CRITICALITY_BUTTON).should('be.visible').click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: No need for checking that the element is visible before clicking on it.

Copy link
Member

@MadameSheema MadameSheema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some nit comments that would be great to follow up when you have the chance :)

@tiansivive
Copy link
Contributor Author

@MadameSheema Done!
Thanks for the help

@tiansivive
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

merge conflict between base and head

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 4838 4842 +4

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 11.3MB 11.3MB +12.0KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
securitySolution 64.2KB 64.2KB +69.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @machadoum

@tiansivive tiansivive merged commit 121fb3a into elastic:main Dec 27, 2023
37 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:feature Makes this part of the condensed release notes Team:Entity Analytics Security Entity Analytics Team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants