-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Closed
Labels
Feature:Data ViewsData Views code and UI - index patterns before 8.0Data Views code and UI - index patterns before 8.0Meta
Description
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:
- index pattern creation (fetching fields, talking to kibana api)
- saving (talking to kibana api_
- loading
- refreshing field list
[ ] 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 wants -
create: 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
- inside index_pattern.ts
- inside field.ts
- inside index_patterns.ts
at this point IndexPattern class should not need any dependencies passed in and can be exported statically.
Metadata
Metadata
Assignees
Labels
Feature:Data ViewsData Views code and UI - index patterns before 8.0Data Views code and UI - index patterns before 8.0Meta