-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 Mgmt] Implement state service #193660
Conversation
…nto data_view_mgmt_service
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
/ci |
src/plugins/data_view_management/public/management_app/data_view_management_service.ts
Show resolved
Hide resolved
src/plugins/data_view_management/public/management_app/data_view_management_service.ts
Outdated
Show resolved
Hide resolved
src/plugins/data_view_management/public/management_app/data_view_management_service.ts
Show resolved
Hide resolved
dataView, | ||
fields, | ||
indexedFieldTypes, | ||
fieldConflictCount: fields.filter((field) => field.type === 'conflict').length, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can scripted fields cause a conflict?
fieldConflictCount: fields.filter((field) => field.type === 'conflict').length, | |
fieldConflictCount: dataView.fields.filter((field) => field.type === 'conflict').length, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is purposeful as the DataViewLazy field list is a separate object and this code aims to minimize changes from DataView to DataViewLazy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fields
excludes scripted fields when defined in setDataView
. So my question was whether scripted fields still need to be checked for conflicts.
I tested it and it seems like scripted fields "override" normal fields hence we don't report on type conflicts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct, scripted fields override, no conflict possible.
src/plugins/data_view_management/public/management_app/data_view_management_service.ts
Outdated
Show resolved
Hide resolved
src/plugins/data_view_management/public/management_app/data_view_management_service.ts
Show resolved
Hide resolved
src/plugins/data_view_management/public/management_app/data_view_management_service.ts
Show resolved
Hide resolved
src/plugins/data_view_management/public/management_app/data_view_management_service.ts
Show resolved
Hide resolved
src/plugins/data_view_management/public/management_app/data_view_mgmt_selectors.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactoring! Leaving some questions first.
…ew_management_service.ts Co-authored-by: Julia Rechkunova <[email protected]>
…nto data_view_mgmt_service
/ci |
/ci |
this.updateState({ | ||
dataView, | ||
fields, | ||
indexedFieldTypes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side question: should we run uniq
on the resulting indexedFieldTypes
or is it fine to have it with duplicates like conflict
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uniq
is run in UI code but makes more sense in the service - good call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
/ci |
## Summary Intermediate step in converting Data View Management to DataViewLazy. Moved `useCallback` functionality into central service so much of the state functionality is in one place and easier to understand and refactor. Part of elastic#178926 Broken out from elastic#190292 which tried to do everything in one go and became too messy. --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Julia Rechkunova <[email protected]> (cherry picked from commit d772a11)
## Summary Intermediate step in converting Data View Management to DataViewLazy. Moved `useCallback` functionality into central service so much of the state functionality is in one place and easier to understand and refactor. Part of elastic#178926 Broken out from elastic#190292 which tried to do everything in one go and became too messy. --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Julia Rechkunova <[email protected]> (cherry picked from commit d772a11)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Module Count
Async chunks
Page load bundle
Unknown metric groupsESLint disabled line counts
References to deprecated APIs
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @mattkime |
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. |
1 similar comment
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. |
# Backport This will backport the following commits from `main` to `8.x`: - [[Data View Mgmt] Implement state service (#193660)](#193660) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Matthew Kime","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-25T14:37:17Z","message":"[Data View Mgmt] Implement state service (#193660)\n\n## Summary\r\n\r\nIntermediate step in converting Data View Management to DataViewLazy.\r\nMoved `useCallback` functionality into central service so much of the\r\nstate functionality is in one place and easier to understand and\r\nrefactor.\r\n\r\nPart of https://github.com/elastic/kibana/issues/178926\r\n\r\nBroken out from #190292 which\r\ntried to do everything in one go and became too messy.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"d772a11c74af1efd05242516900f06cbeb00dd6f","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Data Views","Feature:Kibana Management","release_note:skip","v9.0.0","Team:DataDiscovery","backport:prev-major"],"title":"[Data View Mgmt] Implement state service","number":193660,"url":"https://github.com/elastic/kibana/pull/193660","mergeCommit":{"message":"[Data View Mgmt] Implement state service (#193660)\n\n## Summary\r\n\r\nIntermediate step in converting Data View Management to DataViewLazy.\r\nMoved `useCallback` functionality into central service so much of the\r\nstate functionality is in one place and easier to understand and\r\nrefactor.\r\n\r\nPart of https://github.com/elastic/kibana/issues/178926\r\n\r\nBroken out from #190292 which\r\ntried to do everything in one go and became too messy.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"d772a11c74af1efd05242516900f06cbeb00dd6f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193660","number":193660,"mergeCommit":{"message":"[Data View Mgmt] Implement state service (#193660)\n\n## Summary\r\n\r\nIntermediate step in converting Data View Management to DataViewLazy.\r\nMoved `useCallback` functionality into central service so much of the\r\nstate functionality is in one place and easier to understand and\r\nrefactor.\r\n\r\nPart of https://github.com/elastic/kibana/issues/178926\r\n\r\nBroken out from #190292 which\r\ntried to do everything in one go and became too messy.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"d772a11c74af1efd05242516900f06cbeb00dd6f"}}]}] BACKPORT--> Co-authored-by: Matthew Kime <[email protected]>
Summary
Intermediate step in converting Data View Management to DataViewLazy. Moved
useCallback
functionality into central service so much of the state functionality is in one place and easier to understand and refactor.Part of #178926
Broken out from #190292 which tried to do everything in one go and became too messy.