[Data View Mgmt] Implement state service#193660
Conversation
…nto data_view_mgmt_service
|
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
|
/ci |
| dataView, | ||
| fields, | ||
| indexedFieldTypes, | ||
| fieldConflictCount: fields.filter((field) => field.type === 'conflict').length, |
There was a problem hiding this comment.
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.
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.
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.
That's correct, scripted fields override, no conflict possible.
jughosta
left a comment
There was a problem hiding this comment.
Nice refactoring! Leaving some questions first.
…ew_management_service.ts Co-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com>
…nto data_view_mgmt_service
|
/ci |
|
/ci |
| this.updateState({ | ||
| dataView, | ||
| fields, | ||
| indexedFieldTypes, |
There was a problem hiding this comment.
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.
uniq is run in UI code but makes more sense in the service - good call
|
/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 <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com> (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 <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com> (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":"matt@mattki.me"},"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 <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com>","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 <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com>","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 <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com>","sha":"d772a11c74af1efd05242516900f06cbeb00dd6f"}}]}] BACKPORT--> Co-authored-by: Matthew Kime <matt@mattki.me>
Summary
Intermediate step in converting Data View Management to DataViewLazy. Moved
useCallbackfunctionality 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.