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

Refines hasAnyData check for alerts #117499

Merged
merged 4 commits into from
Nov 4, 2021
Merged

Conversation

claudiopro
Copy link
Contributor

Summary

This PR fixes #116759 by refining the condition that determines hasAnyData to accommodate for the case when app === 'alerts' whose hasData field is always set to an Array, eventually empty:

Screenshot 2021-11-04 at 12 26 39

Once applied this change, the Alerts page renders fine for a user in a role with the matrix of permissions described in #116759.

Before

Screenshot 2021-11-04 at 13 12 34

After

Screenshot 2021-11-04 at 12 43 44

Checklist

Delete any items that are not applicable to this PR.

@claudiopro claudiopro added v8.0.0 auto-backport Deprecated - use backport:version if exact versions are needed Theme: rac label obsolete v8.1.0 Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" labels Nov 4, 2021
@claudiopro claudiopro added the release_note:skip Skip the PR/issue when compiling release notes label Nov 4, 2021
@afgomez
Copy link
Contributor

afgomez commented Nov 4, 2021

I feel the change that needs to happen is to not use an array for alerts, but I'm not sure why is there. @cauemarcondes The logic seems to have been introdued in https://github.com/elastic/kibana/pull/80644/files#diff-68524697b54a56da17a8561e97878fc82f52d1e5064230c81a9e60568989415dR21. Do you remember the reason to treat alerts differently and store the presence of data as an array?

@claudiopro
Copy link
Contributor Author

claudiopro commented Nov 4, 2021

@afgomez that sounds the cleanest approach, however I wasn't sure it was the correct one. I would be worried if the has data context uses the list of alerts in another call site.

@cauemarcondes
Copy link
Contributor

I feel the change that needs to happen is to not use an array for alerts, but I'm not sure why is there. @cauemarcondes The logic seems to have been introdued in https://github.com/elastic/kibana/pull/80644/files#diff-68524697b54a56da17a8561e97878fc82f52d1e5064230c81a9e60568989415dR21. Do you remember the reason to treat alerts differently and store the presence of data as an array?

@afgomez FWIR alert is handled differently because it is the only plugin that we don't use the standard registration process to get the data.

@afgomez
Copy link
Contributor

afgomez commented Nov 4, 2021

@cauemarcondes but what's the reason to keep the hasData as an array? Do we use any of the array elements anywhere?

@cauemarcondes
Copy link
Contributor

@cauemarcondes but what's the reason to keep the hasData as an array? Do we use any of the array elements anywhere?

I believe that was a mistake on my part, hasData must be a boolean, and we should figure out another way to store the alerts data to be used here https://github.com/elastic/kibana/blob/main/x-pack/plugins/observability/public/pages/overview/index.tsx#L75:L76

@claudiopro
Copy link
Contributor Author

@cauemarcondes nice, sounds like a good follow-up task 😜

Copy link
Contributor

@afgomez afgomez left a comment

Choose a reason for hiding this comment

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

I do think it's worth removing the array from hasData, but it looks like a slightly more convoluted task and it can be done in a separate PR (maybe by @elastic/unified-observability).

We can move forward with this as-is to unblock you @claudiopro

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
observability 375.7KB 375.7KB +55.0B

History

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

@claudiopro claudiopro merged commit debdfd2 into elastic:main Nov 4, 2021
@claudiopro claudiopro deleted the issue_116759 branch November 4, 2021 18:27
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 4, 2021
* Refines hasAnyData check for alerts

* Fixes type refinements

* Applies review feedback

* Naming is hard
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
8.0

This backport PR will be merged automatically after passing CI.

jloleysens added a commit to jloleysens/kibana that referenced this pull request Nov 5, 2021
…ink-to-kibana-app

* 'main' of github.com:elastic/kibana: (290 commits)
  [Connectors][ServiceNow] Remove SN flags (elastic#117511)
  [ML] Functional tests - stabilize and re-enable feature importance tests (elastic#117503)
  [RAC] Disable the actions button if the user has inadequate privileges (elastic#117488)
  [Visualize] [xyChart] filter labels by default (elastic#117288)
  Fix warning when setting description to undefined (elastic#117338)
  [build] Set monitoring.ui.container.elasticsearch.enabled for all containers (elastic#115087)
  fix types
  [Alerting] UX fixes for execution duration chart (elastic#117193)
  [CI] Delete node_modules in between bootstrap attempts (elastic#117588)
  Flaky test fixes (elastic#117028)
  [Security Solution] [Sourcerer] [Feature Branch] Update to use Kibana Data Views  (elastic#114806)
  [ML] Hide anomaly entity filter button tooltips when clicked (elastic#117493)
  adjust the synthetics journey type (elastic#117316)
  Refines hasAnyData check for alerts (elastic#117499)
  [Fleet] Default to APM tutorial (elastic#117421)
  [Maps] update docs for index pattern -> data view rename (elastic#117400)
  [Logs UI][Metrics UI] Remove deprecated config fields from APIs and SavedObjects (elastic#116821)
  [Fleet] Fix agent logs not reading query from URL (elastic#117286)
  Fixing Failing test: Chrome X-Pack UI Functional Tests.x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alert_create_flyout·ts - Actions and Triggers app create alert should successfully test valid es_query alert (elastic#114917)
  [Metrics UI] Add docs link to redundant groupBy detection (elastic#116822)
  ...

# Conflicts:
#	x-pack/plugins/reporting/public/management/__snapshots__/report_listing.test.tsx.snap
#	x-pack/plugins/reporting/public/shared_imports.ts
#	x-pack/plugins/reporting/server/routes/management/jobs.ts
@afgomez
Copy link
Contributor

afgomez commented Nov 5, 2021

it looks like a slightly more convoluted task and it can be done in a separate PR.

I'm tracking this in #117638

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Nov 8, 2021
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@claudiopro
Copy link
Contributor Author

@afgomez I'm confused about the message by @kibanamachine, does it require an action on my end?

@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@afgomez
Copy link
Contributor

afgomez commented Nov 10, 2021

@claudiopro yes. We need to take care of this PR #117578

The backport mechanism replicates PRs on top of different branches, in this case on top of the 8.0 branch. Normally they get merged without any issues but sometimes there are hiccups.

As a first step I'd run elasticmachine merge upstream in that PR and wait for it to build again. The errors I'm seeing don't seem related to your changes, so a merge with the latest commit might be enough to make the CI happy. If it keeps failing we can take a look together.

@claudiopro
Copy link
Contributor Author

Super, thanks! I'll merge and watch the build status.

kibanamachine added a commit that referenced this pull request Nov 10, 2021
* Refines hasAnyData check for alerts

* Fixes type refinements

* Applies review feedback

* Naming is hard

Co-authored-by: Claudio Procida <[email protected]>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Nov 10, 2021
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 release_note:skip Skip the PR/issue when compiling release notes Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" Theme: rac label obsolete v8.0.0 v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RAC][Observability] User with read permissions to observability apps sees the No data screen
5 participants