-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
make IndexPattern class static #69379
Comments
Pinging @elastic/kibana-app-arch (Team:AppArch) |
@ppisljar Will we need to address dependencies on the FieldFormats registry? Or are those okay? |
Perhaps it would be helpful to list out the methods you'd use so they could be abstracted into a class that would be inherited by the current IndexPatterns class. |
Reposing my comment from the index patterns serialization PR. TLDR I think as part of this issue we should also move the
|
Notes on implementing this -
|
In order to be able to use index patterns inside other plugins without dependency on index patterns runtime contract we should make the IndexPatterns class static. (for example using them inside expressions). We want to use the logic to help working with index patterns field list but we will not be loading, saving or updating the index pattern.
that is possible if all the stateful logic is extracted to the index patterns service:
[ ] these methods should be removed from index pattern class and moved to index patterns service:
init
: move toindexPatternsService.get(indexPatternId: string)
popularizeField
: remove, only used by discover, move it to usesave
, as save will be refactored not to show toasts but rather throw in case of errors, discover can decide to handle that as it wantscreate
: move toindexPatternsService.save(indexPattern: IndexPattern)
save
: move toindexPatternsService.save(indexPattern: IndexPattern)
fetchFields
: move toindexPatternsService.updateFields(indexPattern: IndexPattern)
refreshFields
: remove, move the logic of showing the error message to management app (if updateFields failed)destroy
: move toindexPatternService.delete(indexPatternId: string)
[x] remove all toast notifications or passing in error handlers but rather throw when something goes wrong
at this point IndexPattern class should not need any dependencies passed in and can be exported statically.
The text was updated successfully, but these errors were encountered: