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

[8.9] [Lens] Relax counter field checks for saved visualizations with unsupported operations (#163515) - manual backport #164191

Merged
merged 3 commits into from
Aug 21, 2023

Conversation

dej611
Copy link
Contributor

@dej611 dej611 commented Aug 17, 2023

Backport

This will backport the following commits from main to 8.9:

This is a manual backport which adds a missing mock function, not available in the automated backport cherry-pick of the PR.
The extra code is here: x-pack/plugins/lens/public/datasources/form_based/mocks.ts

Questions ?

Please refer to the Backport tool documentation

dej611 and others added 2 commits August 17, 2023 16:36
…ported operations (elastic#163515)

## Summary

Fix elastic#163473

This PR relaxes a bit the checks on the Lens side for old/saved
visualizations with unsupported operations for the `counter` field type,
while preserving those checks for newer visualizations.

Dashboards with "meaningless" operations will now show a warning
message:
<img width="556" alt="Screenshot 2023-08-09 at 18 31 21"
src="https://github.com/elastic/kibana/assets/924948/7c8f3739-4957-4d1d-8aaa-e9457b8a4426">

When in editor the warning is shown at the top-right corner as well:
<img width="845" alt="Screenshot 2023-08-09 at 18 30 31"
src="https://github.com/elastic/kibana/assets/924948/c52a7823-d4b9-4efd-9c5d-ca654f3f03a0">

New visualizations still prevent the user from using the unsupported
operations:
<img width="410" alt="Screenshot 2023-08-09 at 18 30 55"
src="https://github.com/elastic/kibana/assets/924948/d2364a01-0dc3-409a-9c0b-3e3a77cb2566">
<img width="848" alt="Screenshot 2023-08-09 at 18 31 48"
src="https://github.com/elastic/kibana/assets/924948/086a7360-6b1a-40a2-90d9-f4e8c7bf3f3a">

There's theoretically a last case where users in old SOs might create a
new metric dimension trying to force to use a unsupported operation for
a counter field: in this case the logic for a "new" visualization will
kick-in, clean the data in the workspace and show a full error.
Cancelling such metric dimension will lead to the previous "relaxed"
state.

Messages are grouped by field and by top referencing column (i.e. a
formula): this means that if a formula uses the same `counter` field
with two different dimensions (i.e. `sum(counter_field) +
median(counter_field)` as `myFormula`) will show up as a single column
(`myFormula`).

The wording of the message mimics the same documentation copy provided
in the ES documentation. Ref:
elastic/elasticsearch#97974

Testing SO:


[export.ndjson.txt](https://github.com/elastic/kibana/files/12304924/export.ndjson.txt)


### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [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: Stratoula Kalafateli <[email protected]>
@dej611 dej611 marked this pull request as ready for review August 17, 2023 15:12
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #33 / Actions and Triggers app Connectors Opsgenie alerts page "after each" hook for "should not preserve the alias when switching run when to recover"
  • [job] [logs] FTR Configs #33 / Actions and Triggers app Connectors Opsgenie alerts page "before each" hook for "should not preserve the alias when switching run when to recover"

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
lens 1.2MB 1.2MB +1.9KB
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 13 15 +2
securitySolution 416 420 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 14 16 +2
securitySolution 497 501 +4
total +6

History

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

@dej611 dej611 merged commit 01f486e into elastic:8.9 Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants