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] Fix link on overview page #60348

Merged
merged 7 commits into from
Mar 17, 2020
Merged

Conversation

XavierM
Copy link
Contributor

@XavierM XavierM commented Mar 17, 2020

Summary

We were missing the query parameters on all links of the overview pages.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@XavierM XavierM added bug Fixes for quality problems that affect the customer experience Team:SIEM v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v7.6.2 labels Mar 17, 2020
@XavierM XavierM self-assigned this Mar 17, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/siem (Team:SIEM)

@@ -113,42 +108,13 @@ export const getTitle = (
return navTabs[pageName] != null ? navTabs[pageName].name : '';
};

export const getCurrentLocation = (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI -> It was not used @stephmilovic told me and when I went in this files, I had to delete it ;)

export const makeMapStateToProps = () => {
const getInputsSelector = inputsSelectors.inputsSelector();
const getGlobalQuerySelector = inputsSelectors.globalQuerySelector();
const getGlobalFiltersQuerySelector = inputsSelectors.globalFiltersQuerySelector();
const getGlobalSavedQuerySelector = inputsSelectors.globalSavedQuerySelector();
const getTimelines = timelineSelectors.getTimelines();
const mapStateToProps = (state: State, { pageName, detailName }: UrlStateContainerPropTypes) => {
const mapStateToProps = (state: State) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

pageName and detailName are not used in the function

export const getDetectionEngineAlertUrl = () =>
`${baseDetectionEngineUrl}/${DetectionEngineTab.alerts}`;
export const getDetectionEngineUrl = (search?: string) =>
`${baseDetectionEngineUrl}${search != null ? `?${search}` : ''}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider creating a utility function for ${search != null ? ?${search} : ''}, because there are six instances of it in this PR, and likely additional instances in the future

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if it's possible / valid to change the type signatures of the functions that take (search?: string) to something like (search: string | null), but an advantage of such a change is the type checker would force the caller to always handle this case by passing search or an explicit null when search should not be provided.

For example, making this parameter non-optional makes the type checker flag the following code in x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/index.tsx:

        <DetectionEngineHeaderPage
          backOptions={{
            href: getDetectionEngineUrl(),
            text: i18n.BACK_TO_DETECTION_ENGINE,
          }}
          title={i18n.PAGE_TITLE}
        >
  • If the above code really should be passing search, then the type checker just found a bug
  • If the above code is a valid case to not pass search, we would be forced to explicitly pass null, which feels OK to me
  • Making search non-optional also causes the type checker to flag getBreadcrumbs in x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/utils.ts because it uses a slight variation of the "search checking pattern", where in this case it's using search[0] instead:
${!isEmpty(search[0]) ? search[0] : ''}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's why I did it like that because I just wanted to focus this PR on the overview page. Also, I remember that we made a decision that we did not want the breadcrumb to follow the url state for some reason. (maybe we can discuss it in one of our meetings)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but I mean you are correct, we should have a follow-up PRs to get all link through the app corrected and discussed breadcrumb.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like all breadcrumbs have the URL state, so that resolved the question above. I will go over in another PR to make everything following the same pattern. so the breadcrumb's URL can be also simplified from this PR.

Copy link
Contributor

@andrew-goldstein andrew-goldstein left a comment

Choose a reason for hiding this comment

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

Thanks for fixing #60076 @XavierM! 🙏

Desk tested:

  • via the repro steps steps in the issue
  • the following buttons and links: View signals, View alerts, View events, View hosts, View network, View all timelines
  • using both single-click and "middle-click / open-in-new-tab"-style navigation
  • in the following browsers: Chrome 80.0.3987.132, Firefox 74.0, and Safari 13.0.5
    LGTM 🚀 🔗

@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / kibana-xpack-agent / sets the flyout button background to euiColorSuccess with a 10% alpha channel when the user starts dragging a host, but is not hovering over the flyout button.timeline flyout button sets the flyout button background to euiColorSuccess with a 10% alpha channel when the user starts dragging a host, but is not hovering over the flyout button

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has failed 2 times on tracked branches: https://github.com/elastic/kibana/issues/60369


Stack Trace

CypressError: Timed out retrying: expected '<button.euiButton.euiButton--primary.euiButton--iconRight.not-ready-to-drop>' to have CSS property 'background' with the value 'rgba(1, 125, 115, 0.1) none repeat scroll 0% 0% / auto padding-box border-box', but the value was 'rgb(255, 255, 255) none repeat scroll 0% 0% / auto padding-box border-box'
    at cypressErr (http://elastic:changeme@localhost:61121/__cypress/runner/cypress_runner.js:149934:9)
    at throwErr (http://elastic:changeme@localhost:61121/__cypress/runner/cypress_runner.js:149867:11)
    at Object.throwErrByPath (http://elastic:changeme@localhost:61121/__cypress/runner/cypress_runner.js:149915:3)
    at retry (http://elastic:changeme@localhost:61121/__cypress/runner/cypress_runner.js:144197:19)
    at onFailFn (http://elastic:changeme@localhost:61121/__cypress/runner/cypress_runner.js:132448:16)
    at tryCatcher (http://elastic:changeme@localhost:61121/__cypress/runner/cypress_runner.js:167415:23)
    at Promise._settlePromiseFromHandler (http://elastic:changeme@localhost:61121/__cypress/runner/cypress_runner.js:165351:31)
    at Promise._settlePromise (http://elastic:changeme@localhost:61121/__cypress/runner/cypress_runner.js:165408:18)
    at Promise._settlePromise0 (http://elastic:changeme@localhost:61121/__cypress/runner/cypress_runner.js:165453:10)
    at Promise._settlePromises (http://elastic:changeme@localhost:61121/__cypress/runner/cypress_runner.js:165528:18)
    at Async../node_modules/bluebird/js/release/async.js.Async._drainQueue (http://elastic:changeme@localhost:61121/__cypress/runner/cypress_runner.js:162140:16)
    at Async../node_modules/bluebird/js/release/async.js.Async._drainQueues (http://elastic:changeme@localhost:61121/__cypress/runner/cypress_runner.js:162150:10)
    at Async.drainQueues (http://elastic:changeme@localhost:61121/__cypress/runner/cypress_runner.js:162024:14)

History

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

@XavierM XavierM merged commit 0f9f81c into elastic:master Mar 17, 2020
XavierM added a commit to XavierM/kibana that referenced this pull request Mar 17, 2020
* Fix link on overview page

* no needs of useMemo

* clean up

* review I

* review II

* review III
gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 17, 2020
* master:
  [SIEM] Adds 'Closes one signal when more than one opened signals are selected' test again (elastic#60380)
  [SIEM][Detections Engine] - Add rule markdown field to rule create, detail, and edit flows (elastic#60108)
  [Fleet] Add config revision to fleet agents (elastic#60292)
  Allow kbn-config-schema to ignore unknown keys (elastic#59560)
  [ML] Functional tests - disable df analytics clone tests
  skip flaky suite (elastic#58643) (elastic#58991)
  [FTR] Add support for --include and --exclude files via tags (elastic#60123)
  [SIEM] Fix link on overview page (elastic#60348)
  skip flaky test (elastic#60369)
  [Endpoint] Adds take action dropdown and tests to alert details flyout (elastic#59242)
  [Lens] Simplify state management from visualization (elastic#58279)
  Changing default type to start and allowing it to be configured by the event category (elastic#60323)
  [ML] Adds the class_assignment_objective to classification (elastic#60358)
XavierM added a commit that referenced this pull request Mar 17, 2020
* Fix link on overview page

* no needs of useMemo

* clean up

* review I

* review II

* review III
gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 17, 2020
* master: (51 commits)
  do not update cell background if is label cell (elastic#60308)
  FTR configurable test users (elastic#52431)
  [Reporting] Wholesale moves client to newest-platform (elastic#58945)
  [Ingest] Support `show_user` package registry flag (elastic#60338)
  [SIEM] Adds 'Closes one signal when more than one opened signals are selected' test again (elastic#60380)
  [SIEM][Detections Engine] - Add rule markdown field to rule create, detail, and edit flows (elastic#60108)
  [Fleet] Add config revision to fleet agents (elastic#60292)
  Allow kbn-config-schema to ignore unknown keys (elastic#59560)
  [ML] Functional tests - disable df analytics clone tests
  skip flaky suite (elastic#58643) (elastic#58991)
  [FTR] Add support for --include and --exclude files via tags (elastic#60123)
  [SIEM] Fix link on overview page (elastic#60348)
  skip flaky test (elastic#60369)
  [Endpoint] Adds take action dropdown and tests to alert details flyout (elastic#59242)
  [Lens] Simplify state management from visualization (elastic#58279)
  Changing default type to start and allowing it to be configured by the event category (elastic#60323)
  [ML] Adds the class_assignment_objective to classification (elastic#60358)
  [TSVB] fix text color when using custom background color (elastic#60261)
  Fix import to timefilter from in TSVB (elastic#60296)
  [NP] Get rid of usage redirectWhenMissing service (elastic#59777)
  ...
gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 17, 2020
* alerting/view-in-app: (53 commits)
  fixed typo
  handle optional alerting plugin
  do not update cell background if is label cell (elastic#60308)
  FTR configurable test users (elastic#52431)
  [Reporting] Wholesale moves client to newest-platform (elastic#58945)
  [Ingest] Support `show_user` package registry flag (elastic#60338)
  [SIEM] Adds 'Closes one signal when more than one opened signals are selected' test again (elastic#60380)
  [SIEM][Detections Engine] - Add rule markdown field to rule create, detail, and edit flows (elastic#60108)
  [Fleet] Add config revision to fleet agents (elastic#60292)
  Allow kbn-config-schema to ignore unknown keys (elastic#59560)
  [ML] Functional tests - disable df analytics clone tests
  skip flaky suite (elastic#58643) (elastic#58991)
  [FTR] Add support for --include and --exclude files via tags (elastic#60123)
  [SIEM] Fix link on overview page (elastic#60348)
  skip flaky test (elastic#60369)
  [Endpoint] Adds take action dropdown and tests to alert details flyout (elastic#59242)
  [Lens] Simplify state management from visualization (elastic#58279)
  Changing default type to start and allowing it to be configured by the event category (elastic#60323)
  [ML] Adds the class_assignment_objective to classification (elastic#60358)
  [TSVB] fix text color when using custom background color (elastic#60261)
  ...
@XavierM XavierM removed the v7.6.2 label Mar 17, 2020
@XavierM XavierM deleted the overview-link branch June 4, 2020 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:SIEM v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants