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

[data view editor] Fix data view timestamp validation #150398

Merged
merged 13 commits into from
Jun 30, 2023

Conversation

mattkime
Copy link
Contributor

@mattkime mattkime commented Feb 6, 2023

Summary

Previously - If you changed a data view's index pattern AND the new pattern didn't contain the timestamp field, you'd see a blank timestamp field and it would let you save. The data view would have been saved with the previous timestamp field which doesn't exist.

Now - The timestamp validator checks to make sure the selected timestamp field is in the list of available options. This is helpful because it keeps the previous timestamp value in case you do select an index pattern that contains it.

Closes: #150219

Checklist

@mattkime mattkime changed the title Fix data view timestamp validation [data view editor] Fix data view timestamp validation Feb 7, 2023
@mattkime mattkime marked this pull request as ready for review February 7, 2023 04:28
@mattkime mattkime requested a review from a team as a code owner February 7, 2023 04:28
@mattkime mattkime added Feature:Data Views Data Views code and UI - index patterns before 8.0 Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages backport:prev-minor Backport to the previous minor version (i.e. one version back from main) bug Fixes for quality problems that affect the customer experience backport:skip This commit does not require backporting Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) labels Feb 7, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@mattkime mattkime added the release_note:skip Skip the PR/issue when compiling release notes label Feb 7, 2023
@jughosta
Copy link
Contributor

jughosta commented Feb 7, 2023

Hi @mattkime,
Looks like the issue with time field validation is still present.

Please check this scenario:

  • create a data view without selecting a time field for an index without @timestamp field
  • open Edit flyout for it
  • see that Time field input is not filled <= a separate bug?
  • change index pattern to kibana*
  • change back to the index patter which does not have @timestamp field <= it will allow to submit the form although it's incorrect and the user should get a validation error.

Feb-07-2023 10-12-09

@kertal kertal added release_note:fix and removed bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes labels Apr 13, 2023
@kertal kertal marked this pull request as draft May 26, 2023 16:07
@mattkime mattkime marked this pull request as ready for review June 27, 2023 20:02
@kibana-ci
Copy link
Collaborator

💚 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
dataViewEditor 40.2KB 40.3KB +109.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 14 16 +2
securitySolution 413 417 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 15 17 +2
securitySolution 492 496 +4
total +6

History

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

cc @mattkime

Copy link
Contributor

@jughosta jughosta left a comment

Choose a reason for hiding this comment

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

LGTM 👍
Thanks for addressing the comment.

@mattkime mattkime removed the backport:skip This commit does not require backporting label Jun 30, 2023
@mattkime mattkime merged commit 646539c into elastic:main Jun 30, 2023
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 30, 2023
## Summary

Previously - If you changed a data view's index pattern AND the new
pattern didn't contain the timestamp field, you'd see a blank timestamp
field and it would let you save. The data view would have been saved
with the previous timestamp field which doesn't exist.

Now - The timestamp validator checks to make sure the selected timestamp
field is in the list of available options. This is helpful because it
keeps the previous timestamp value in case you do select an index
pattern that contains it.

Closes: elastic#150219
(cherry picked from commit 646539c)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.9

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jun 30, 2023
…#160990)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[data view editor] Fix data view timestamp validation
(#150398)](#150398)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Matthew
Kime","email":"matt@mattki.me"},"sourceCommit":{"committedDate":"2023-06-30T12:29:44Z","message":"[data
view editor] Fix data view timestamp validation (#150398)\n\n##
Summary\r\n\r\nPreviously - If you changed a data view's index pattern
AND the new\r\npattern didn't contain the timestamp field, you'd see a
blank timestamp\r\nfield and it would let you save. The data view would
have been saved\r\nwith the previous timestamp field which doesn't
exist.\r\n\r\nNow - The timestamp validator checks to make sure the
selected timestamp\r\nfield is in the list of available options. This is
helpful because it\r\nkeeps the previous timestamp value in case you do
select an index\r\npattern that contains it.\r\n\r\nCloses:
#150219
Views","Feature:Kibana
Management","Team:DataDiscovery","backport:prev-minor","v8.10.0"],"number":150398,"url":"#150398
view editor] Fix data view timestamp validation (#150398)\n\n##
Summary\r\n\r\nPreviously - If you changed a data view's index pattern
AND the new\r\npattern didn't contain the timestamp field, you'd see a
blank timestamp\r\nfield and it would let you save. The data view would
have been saved\r\nwith the previous timestamp field which doesn't
exist.\r\n\r\nNow - The timestamp validator checks to make sure the
selected timestamp\r\nfield is in the list of available options. This is
helpful because it\r\nkeeps the previous timestamp value in case you do
select an index\r\npattern that contains it.\r\n\r\nCloses:
#150219
view editor] Fix data view timestamp validation (#150398)\n\n##
Summary\r\n\r\nPreviously - If you changed a data view's index pattern
AND the new\r\npattern didn't contain the timestamp field, you'd see a
blank timestamp\r\nfield and it would let you save. The data view would
have been saved\r\nwith the previous timestamp field which doesn't
exist.\r\n\r\nNow - The timestamp validator checks to make sure the
selected timestamp\r\nfield is in the list of available options. This is
helpful because it\r\nkeeps the previous timestamp value in case you do
select an index\r\npattern that contains it.\r\n\r\nCloses:
#150219"}}]}]
BACKPORT-->

Co-authored-by: Matthew Kime <matt@mattki.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to the previous minor version (i.e. one version back from main) Feature:Data Views Data Views code and UI - index patterns before 8.0 Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages release_note:fix Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) v8.9.0 v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataViews] Data view editor allows saving with a blank 'Timestamp field' when editing the index pattern
6 participants