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][Detections] Pre-refactoring for the rule management table #91302

Merged
merged 5 commits into from
Feb 18, 2021

Conversation

banderror
Copy link
Contributor

Related to: #89877

Summary

This is based on #89877 and the kind of pre-refactoring that has been done there.

Mainly this:

  • consolidates application logic in a single place (moves the reducer and the side effects close to each other, etc)
  • removes some of the redundant state, leverages the reducer as the source of truth for state
  • makes it easier to dispatch events, removes some of the noise

While this refactoring is a totally unfinished work, and might look not good enough (or at all), still I'd like to merge it because of the logic consolidation. I'm going to finalize the refactoring later when I start implementing new filters and other table UX improvements. So the code is going to become better and maybe even quite different from what it is right now. (Btw because of that, I'm not adding or removing any tests here because this is an intermediate kind of state of the code).

Checklist

@banderror banderror added refactoring v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Feature:Detection Rules Security Solution rules and Detection Engine v7.12.0 Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v7.13.0 labels Feb 12, 2021
@banderror banderror self-assigned this Feb 12, 2021
@banderror banderror requested a review from a team as a code owner February 12, 2021 17:26
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@banderror banderror requested a review from a team February 12, 2021 17:26
@banderror banderror force-pushed the rule-management-table-refactoring branch 2 times, most recently from 1a1d115 to 691cca6 Compare February 17, 2021 11:54
@banderror banderror force-pushed the rule-management-table-refactoring branch from 691cca6 to f3e4aba Compare February 17, 2021 14:14
@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / general / "before all" hook for "should contain notes".Timeline notes tab "before all" hook for "should contain notes"

Link to Jenkins

Stack Trace

Failed Tests Reporter:
  - Test has not failed recently on tracked branches

AssertionError: Timed out retrying after 60000ms: Expected to find element: `[data-test-subj="title-19d7f1c0-7135-11eb-ae22-8be1da9a1bee"]`, but never found it.

Because this error occurred during a `before all` hook we are skipping the remaining tests in the current suite: `Timeline notes tab`

Although you have test retries enabled, we do not retry tests when `before all` or `after all` hooks fail
    at Object.openTimelineById (http://localhost:6111/__cypress/tests?p=cypress/integration/timelines/notes_tab.spec.ts:16007:15)
    at Context.eval (http://localhost:6111/__cypress/tests?p=cypress/integration/timelines/notes_tab.spec.ts:15041:24)

Kibana Pipeline / general / "after all" hook for "should contain notes".Timeline notes tab "after all" hook for "should contain notes"

Link to Jenkins

Stack Trace

Failed Tests Reporter:
  - Test has not failed recently on tracked branches

CypressError: `cy.filter()` failed because it requires a DOM element.

The subject received was:

  > `undefined`

The previous command that ran was:

  > `cy.get()`

All 2 subject validations failed on this subject.

Because this error occurred during a `after all` hook we are skipping the remaining tests in the current suite: `Timeline notes tab`

Although you have test retries enabled, we do not retry tests when `before all` or `after all` hooks fail
    at ensureElement (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:161322:24)
    at validateType (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:161159:16)
    at Object.ensureSubjectByType (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:161195:9)
    at pushSubjectAndValidate (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:169888:15)
    at Context.<anonymous> (http://elastic:changeme@localhost:6111/__cypress/runner/cypress_runner.js:170225:18)
From Your Spec Code:
    at Object.closeTimeline (http://localhost:6111/__cypress/tests?p=cypress/integration/timelines/notes_tab.spec.ts:15960:43)
    at Context.eval (http://localhost:6111/__cypress/tests?p=cypress/integration/timelines/notes_tab.spec.ts:15051:20)

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 2205 2208 +3

Async chunks

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

id before after diff
securitySolution 7.7MB 7.7MB +2.0KB

History

  • 💔 Build #107241 failed 691cca65cefca8802a0528452147d79c08bb5cf9
  • 💛 Build #106533 was flaky 1a1d115bda74cdb451ddb178ddc87d5d8433a95e
  • 💔 Build #106384 failed 0243c5c720e9339b011499164648497e7085fee8

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

Comment on lines +56 to +60
if (
tableRef != null &&
tableRef.current != null &&
tableRef.current.changeSelection != null
) {
Copy link
Contributor

@dhurley14 dhurley14 Feb 17, 2021

Choose a reason for hiding this comment

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

Nit: can we consolidate this into just

if(tableRef?.current?.changeSelection != null){...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do it in #91925, thank you.

Copy link
Contributor

@dhurley14 dhurley14 left a comment

Choose a reason for hiding this comment

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

LGTM! Nice small cleanup here.

@spong spong merged commit 2c111c6 into elastic:master Feb 18, 2021
@spong spong added the auto-backport Deprecated - use backport:version if exact versions are needed label Feb 18, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 18, 2021
…nt table (elastic#91302)

**Related to:** elastic#89877

## Summary

This is based on elastic#89877 and the kind of pre-refactoring that has been done there.

Mainly this:

- consolidates application logic in a single place (moves the reducer and the side effects close to each other, etc)
- removes some of the redundant state, leverages the reducer as the source of truth for state
- makes it easier to dispatch events, removes some of the noise

While this refactoring is a totally unfinished work, and might look not good enough (or at all), still I'd like to merge it because of the logic consolidation. I'm going to finalize the refactoring later when I start implementing new filters and other table UX improvements. So the code is going to become better and maybe even quite different from what it is right now. (Btw because of that, I'm not adding or removing any tests here because this is an intermediate kind of state of the code).

### Checklist

- [ ] [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
@kibanamachine
Copy link
Contributor

💔 Backport failed

7.x / #91777
❌ 7.13: The branch "7.13" is invalid or doesn't exist

Successful backport PRs will be merged automatically after passing CI.

To backport manually, check out the target branch and run:
node scripts/backport --pr 91302

@spong spong removed the v7.13.0 label Feb 18, 2021
kibanamachine added a commit that referenced this pull request Feb 18, 2021
…nt table (#91302) (#91777)

**Related to:** #89877

## Summary

This is based on #89877 and the kind of pre-refactoring that has been done there.

Mainly this:

- consolidates application logic in a single place (moves the reducer and the side effects close to each other, etc)
- removes some of the redundant state, leverages the reducer as the source of truth for state
- makes it easier to dispatch events, removes some of the noise

While this refactoring is a totally unfinished work, and might look not good enough (or at all), still I'd like to merge it because of the logic consolidation. I'm going to finalize the refactoring later when I start implementing new filters and other table UX improvements. So the code is going to become better and maybe even quite different from what it is right now. (Btw because of that, I'm not adding or removing any tests here because this is an intermediate kind of state of the code).

### Checklist

- [ ] [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: Georgii Gorbachev <georgii.gorbachev@elastic.co>
@banderror banderror deleted the rule-management-table-refactoring branch February 18, 2021 16:51
banderror added a commit to banderror/kibana that referenced this pull request Feb 24, 2021
…nt table (elastic#91302)

**Related to:** elastic#89877

## Summary

This is based on elastic#89877 and the kind of pre-refactoring that has been done there.

Mainly this:

- consolidates application logic in a single place (moves the reducer and the side effects close to each other, etc)
- removes some of the redundant state, leverages the reducer as the source of truth for state
- makes it easier to dispatch events, removes some of the noise

While this refactoring is a totally unfinished work, and might look not good enough (or at all), still I'd like to merge it because of the logic consolidation. I'm going to finalize the refactoring later when I start implementing new filters and other table UX improvements. So the code is going to become better and maybe even quite different from what it is right now. (Btw because of that, I'm not adding or removing any tests here because this is an intermediate kind of state of the code).

### Checklist

- [ ] [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

# Conflicts:
#	x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/rules_tables.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Detection Rules Security Solution rules and Detection Engine refactoring release_note:skip Skip the PR/issue when compiling release notes Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v7.12.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants