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.search.aggs] Remove service getters from agg types #60333

Closed
4 tasks
Tracked by #60126
lukeelmers opened this issue Mar 16, 2020 · 2 comments · Fixed by #61069
Closed
4 tasks
Tracked by #60126

[data.search.aggs] Remove service getters from agg types #60333

lukeelmers opened this issue Mar 16, 2020 · 2 comments · Fixed by #61069
Assignees
Labels
Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) Feature:NP Migration

Comments

@lukeelmers
Copy link
Member

lukeelmers commented Mar 16, 2020

When aggs were migrated to the new platform data.search service, each of the runtime dependencies in the individual agg types were retrieved using service getters/setters (e.g. getUiSettings or getFieldFormats in src/plugins/data/public/services)

In practice there are very few use cases for these getters/setters, and it is good to get rid of them where we can since it makes testing & mocking more complicated.

We already have one example of how these agg types look without the getters/setters if you look at the filtersBucketAgg in buckets/filters: Basically it gets wrapped in a provider function which accepts the needed dependencies, returning the agg type instance.

  • search/aggs/buckets
  • search/aggs/metrics
  • search/aggs/param_types
  • search/aggs/test_helpers/mock_data_services
    • After updating the above items, see if this mocking helper is still necessary.
    • Most likely calls to mockDataServices() in the various unit tests can be removed and replaced with the simpler mocks provided by mocks.ts

Parent issue: #60126

@lukeelmers lukeelmers added Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) Team:AppArch Feature:NP Migration labels Mar 16, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

alexwizp added a commit to alexwizp/kibana that referenced this issue Mar 24, 2020
alexwizp added a commit that referenced this issue Mar 27, 2020
* [data.search.aggs] Remove service getters from agg types

Part of #60333

* fix JEST

* fix karma:unit

* fix PR commnets

* fix PR comments

* try to fix ci

* fix CI

* fix karma:unit

Co-authored-by: Elastic Machine <[email protected]>
@alexwizp alexwizp reopened this Mar 27, 2020
alexwizp added a commit to alexwizp/kibana that referenced this issue Mar 27, 2020
* [data.search.aggs] Remove service getters from agg types

Part of elastic#60333

* fix JEST

* fix karma:unit

* fix PR commnets

* fix PR comments

* try to fix ci

* fix CI

* fix karma:unit

Co-authored-by: Elastic Machine <[email protected]>
alexwizp added a commit that referenced this issue Mar 27, 2020
…1582)

* [data.search.aggs] Remove service getters from agg types

Part of #60333

* fix JEST

* fix karma:unit

* fix PR commnets

* fix PR comments

* try to fix ci

* fix CI

* fix karma:unit

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
alexwizp added a commit to alexwizp/kibana that referenced this issue Mar 27, 2020
elasticmachine added a commit to alexwizp/kibana that referenced this issue Mar 27, 2020
elasticmachine added a commit to alexwizp/kibana that referenced this issue Mar 27, 2020
elasticmachine added a commit to alexwizp/kibana that referenced this issue Mar 28, 2020
elasticmachine added a commit to alexwizp/kibana that referenced this issue Mar 30, 2020
elasticmachine added a commit to alexwizp/kibana that referenced this issue Apr 1, 2020
elasticmachine added a commit to alexwizp/kibana that referenced this issue Apr 2, 2020
alexwizp added a commit to alexwizp/kibana that referenced this issue Apr 3, 2020
elasticmachine added a commit to alexwizp/kibana that referenced this issue Apr 6, 2020
alexwizp added a commit that referenced this issue Apr 7, 2020
* [data.search.aggs] Remove service getters from agg types

Part of #60333

* new portion of changes

* pass dependencies to MetricAgg Type through constructor

* update docs

* refactoring buckets

* remove unused mockDataServices

* Remove service getters from metrics

* Some fixes

* remove temporary code

* moved notifications to the getInternalStartServices

* fixed karma lock

* update docs

* Fixed tests

* fix broken CI

* fix PR comment

* fix typo

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Uladzislau Lasitsa <[email protected]>
alexwizp added a commit to alexwizp/kibana that referenced this issue Apr 7, 2020
* [data.search.aggs] Remove service getters from agg types

Part of elastic#60333

* new portion of changes

* pass dependencies to MetricAgg Type through constructor

* update docs

* refactoring buckets

* remove unused mockDataServices

* Remove service getters from metrics

* Some fixes

* remove temporary code

* moved notifications to the getInternalStartServices

* fixed karma lock

* update docs

* Fixed tests

* fix broken CI

* fix PR comment

* fix typo

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Uladzislau Lasitsa <[email protected]>
alexwizp added a commit that referenced this issue Apr 7, 2020
…2762)

* [data.search.aggs] Remove service getters from agg types

Part of #60333

* new portion of changes

* pass dependencies to MetricAgg Type through constructor

* update docs

* refactoring buckets

* remove unused mockDataServices

* Remove service getters from metrics

* Some fixes

* remove temporary code

* moved notifications to the getInternalStartServices

* fixed karma lock

* update docs

* Fixed tests

* fix broken CI

* fix PR comment

* fix typo

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Uladzislau Lasitsa <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Uladzislau Lasitsa <[email protected]>
@lukeelmers
Copy link
Member Author

Closed by #61628 and #62548

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) Feature:NP Migration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants