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

[SIEM] Add timeline id in url + refactor code #43943

Merged
merged 12 commits into from
Aug 29, 2019

Conversation

XavierM
Copy link
Contributor

@XavierM XavierM commented Aug 25, 2019

Summary

  • Add Timeline Id in url
  • Only keep in url object who are relevant to the page
  • Refactor component to only update redux store at global initialization
  • Fix unit testing, old's @XavierM messed up everything here ( I am ashamed of it but it happened) but new's @XavierM realizes his mistakes and fix it.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@XavierM XavierM added review Team:SIEM v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.4.0 labels Aug 25, 2019
@XavierM XavierM self-assigned this Aug 25, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/siem

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@XavierM XavierM changed the title Add timeline id in url + refactor code [SIEM] Add timeline id in url + refactor code Aug 26, 2019
Copy link
Contributor

@angorayc angorayc left a comment

Choose a reason for hiding this comment

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

Thanks @XavierM, nicely done! I like the changes, it really makes the flow easier to follow!
Some minor things found but happy to ship it as so and do them as bug fixing:

  • The queryLocation on link address you just copy doesn't match to what it suppose to be
    Steps for reproduce:
  1. Go to Hosts page
  2. Choose a host name and click on filter for value
  3. Right click on Network tab and click copu link address
  • Kqlbar is not refreshing after user input:
    steps to reproduce:
  1. Click on http://localhost:5601/app/siem#/hosts/?kqlQuery=(filterQuery:(expression:'host.name:%20%22beats-ci-immutable-centos-7-1566828754401694040%22',kind:kuery),queryLocation:hosts.page)&timelineId=c8bec320-a7f2-11e9-8950-0f78dfe8d3c9&timerange=(global:(linkTo:!(),timerange:(from:1566829069303,kind:absolute,to:1566829957589)),timeline:(linkTo:!(),timerange:(from:1563304238802,kind:absolute,to:1563305138803)))
  2. Update kqlbar and hit refresh
  3. The url remains the same

@XavierM
Copy link
Contributor Author

XavierM commented Aug 26, 2019

Thanks @XavierM, nicely done! I like the changes, it really makes the flow easier to follow!
Some minor things found but happy to ship it as so and do them as bug fixing:

  • The queryLocation on link address you just copy doesn't match to what it suppose to be
    Steps for reproduce:
  1. Go to Hosts page
  2. Choose a host name and click on filter for value
  3. Right click on Network tab and click copu link address
  • Kqlbar is not refreshing after user input:
    steps to reproduce:
  1. Click on http://localhost:5601/app/siem#/hosts/?kqlQuery=(filterQuery:(expression:'host.name:%20%22beats-ci-immutable-centos-7-1566828754401694040%22',kind:kuery),queryLocation:hosts.page)&timelineId=c8bec320-a7f2-11e9-8950-0f78dfe8d3c9&timerange=(global:(linkTo:!(),timerange:(from:1566829069303,kind:absolute,to:1566829957589)),timeline:(linkTo:!(),timerange:(from:1563304238802,kind:absolute,to:1563305138803)))
  2. Update kqlbar and hit refresh
  3. The url remains the same

Yes, it is making sense. I will work on it right now to improve that

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@stephmilovic
Copy link
Contributor

  • old's @XavierM messed up everything here ( I am ashamed of it but it happened) but new's @XavierM realizes his mistakes and fix it.
    🤣

@stephmilovic
Copy link
Contributor

I'm seeing this console warning on page load:

Warning: Failed prop type: Invalid prop `component` of type `object` supplied to `Route`, expected `function`.

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

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

Something is wrong with the timeline/global lock. When I visit this url: /app/siem#/network?timerange=(global:(linkTo:!(timeline),timerange:(from:1564689809186,kind:absolute,to:1564691609186)),timeline:(linkTo:!(global),timerange:(from:1564689809186,kind:absolute,to:1564691609186))) it gets changed to this on pageload: /app/siem#/network?timerange=(global:(linkTo:!(),timerange:(from:1564689809186,kind:absolute,to:1564691609186)),timeline:(linkTo:!(timeline),timerange:(from:1564689809186,kind:absolute,to:1564691609186)))

queryLocation: CONSTANTS.hostsDetails,
type: hostsModel.HostsType.details,
});
const result = isKqlForRoute('/hosts', CONSTANTS.hostsDetails);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@XavierM
Copy link
Contributor Author

XavierM commented Aug 27, 2019

@stephmilovic These Cypress tests were great, I now feel comfortable with this PR. Thanks a lot for working hard on these tests. (so Useful!!!) 🍸 🎈

@elasticmachine
Copy link
Contributor

💔 Build Failed

@XavierM
Copy link
Contributor Author

XavierM commented Aug 28, 2019

I'm seeing this console warning on page load:

Warning: Failed prop type: Invalid prop `component` of type `object` supplied to `Route`, expected `function`.

This was a fun one to figure it out, the problem was that I changed the HomePage component to be a memo but the props from Route component only accept pure function. Therefore, we will need to update our react-route-dom library to let Route accept memo components.
I decide to put it back as a pure function, I do not think we should upgrade the library just before FF.

remix-run/react-router#6471

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

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

AMAZING work here @XavierM. Great cleanups, and so happy to see those cypress tests running smoothly. Gives me great confidence in our work! LGTM 🚀

@angorayc
Copy link
Contributor

Awesome! I played around with it and it works as expected. Thanks for fixing it,
I am happy to ship it 🚢 🚢 🚢

@spalger
Copy link
Contributor

spalger commented Aug 28, 2019

retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

savedObjectId: duplicate ? null : timelineModel.savedObjectId,
version: duplicate ? null : timelineModel.version,
title: duplicate ? '' : timelineModel.title || '',
} as TimelineModel,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no more AS

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@tsg tsg merged commit 0be4cf9 into elastic:master Aug 29, 2019
XavierM added a commit to XavierM/kibana that referenced this pull request Aug 29, 2019
* Add timelineId in URL + refactor url_state to only update redux store at global initialization

* add/fix unit test

* remove async

* wip

* new tests for timeline url state

* fix tests

* rm unused

* Add the expected  href around global tab

* fix conflict

* fix console error about Route

* fix type + test -- needed to refactor to default the value of the timline because of nasty type loop

* add href on detail tab to match
XavierM added a commit to XavierM/kibana that referenced this pull request Aug 30, 2019
* Add timelineId in URL + refactor url_state to only update redux store at global initialization

* add/fix unit test

* remove async

* wip

* new tests for timeline url state

* fix tests

* rm unused

* Add the expected  href around global tab

* fix conflict

* fix console error about Route

* fix type + test -- needed to refactor to default the value of the timline because of nasty type loop

* add href on detail tab to match
XavierM added a commit to XavierM/kibana that referenced this pull request Aug 30, 2019
* Add timelineId in URL + refactor url_state to only update redux store at global initialization

* add/fix unit test

* remove async

* wip

* new tests for timeline url state

* fix tests

* rm unused

* Add the expected  href around global tab

* fix conflict

* fix console error about Route

* fix type + test -- needed to refactor to default the value of the timline because of nasty type loop

* add href on detail tab to match
XavierM added a commit that referenced this pull request Aug 30, 2019
* Add timelineId in URL + refactor url_state to only update redux store at global initialization

* add/fix unit test

* remove async

* wip

* new tests for timeline url state

* fix tests

* rm unused

* Add the expected  href around global tab

* fix conflict

* fix console error about Route

* fix type + test -- needed to refactor to default the value of the timline because of nasty type loop

* add href on detail tab to match
XavierM added a commit that referenced this pull request Aug 30, 2019
* Add timelineId in URL + refactor url_state to only update redux store at global initialization

* add/fix unit test

* remove async

* wip

* new tests for timeline url state

* fix tests

* rm unused

* Add the expected  href around global tab

* fix conflict

* fix console error about Route

* fix type + test -- needed to refactor to default the value of the timline because of nasty type loop

* add href on detail tab to match
clintandrewhall pushed a commit to clintandrewhall/kibana that referenced this pull request Sep 3, 2019
* Add timelineId in URL + refactor url_state to only update redux store at global initialization

* add/fix unit test

* remove async

* wip

* new tests for timeline url state

* fix tests

* rm unused

* Add the expected  href around global tab

* fix conflict

* fix console error about Route

* fix type + test -- needed to refactor to default the value of the timline because of nasty type loop

* add href on detail tab to match
@XavierM XavierM deleted the siem-url-timeline-id branch June 4, 2020 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes review Team:SIEM v7.4.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants