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

[NP] Remove ui/agg_types dependencies and move paginated table to kibana_legacy #60276

Merged
merged 24 commits into from
Mar 20, 2020

Conversation

sulemanof
Copy link
Contributor

@sulemanof sulemanof commented Mar 16, 2020

Summary

Based on #57695 .

This removes all imports from ui/agg_types and uses NP data plugin instead.
This also moves paginated table to kibana_legacy plugin.

For reviewers:

It shouldn't be hard to review this, since the most cases are:

  • use absolute paths src/plugins/data/public instead of ui/agg_types where only types are used;
  • use relative paths ../**/plugins/data/public instead of ui/agg_types where static stuff is used;
  • use data plugin contract to access common data services;

Checklist

Delete any items that are not applicable to this PR.

For maintainers

flash1293 and others added 7 commits February 14, 2020 16:06
# Conflicts:
#	src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts
#	src/legacy/core_plugins/kibana/public/visualize/np_ready/types.d.ts
#	src/legacy/core_plugins/kibana/public/visualize/plugin.ts
#	src/legacy/core_plugins/vis_default_editor/public/components/agg_params.tsx
#	src/legacy/core_plugins/vis_default_editor/public/components/agg_params_helper.test.ts
#	src/legacy/core_plugins/vis_default_editor/public/components/agg_params_helper.ts
#	src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/reducers.ts
#	src/legacy/core_plugins/vis_default_editor/public/default_editor.tsx
#	src/legacy/core_plugins/vis_default_editor/public/legacy_imports.ts
#	src/legacy/core_plugins/vis_type_table/public/legacy_imports.ts
#	src/legacy/core_plugins/vis_type_vislib/public/legacy_imports.ts
#	x-pack/plugins/translations/translations/ja-JP.json
#	x-pack/plugins/translations/translations/zh-CN.json
@sulemanof sulemanof changed the title [NP] Fix agg type shims and move paginated table to kibana_legacy [NP] Remove ui/agg_types dependencies and move paginated table to kibana_legacy Mar 17, 2020
@flash1293 flash1293 mentioned this pull request Mar 17, 2020
69 tasks
# Conflicts:
#	src/legacy/core_plugins/kibana/public/discover/kibana_services.ts
#	src/legacy/core_plugins/vis_type_tagcloud/public/legacy_imports.ts
#	x-pack/plugins/translations/translations/ja-JP.json
#	x-pack/plugins/translations/translations/zh-CN.json
@sulemanof sulemanof requested review from lukeelmers and kertal March 18, 2020 12:31
@sulemanof sulemanof marked this pull request as ready for review March 18, 2020 12:31
@sulemanof sulemanof requested a review from a team March 18, 2020 12:31
@sulemanof sulemanof requested review from a team as code owners March 18, 2020 12:31
@sulemanof sulemanof added Feature:New Platform release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.7.0 v8.0.0 labels Mar 18, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@@ -49,8 +49,6 @@ export default {
'!packages/kbn-ui-framework/src/services/**/*/index.js',
'src/legacy/core_plugins/**/*.{js,jsx,ts,tsx}',
'!src/legacy/core_plugins/**/{__test__,__snapshots__}/**/*',
'src/legacy/ui/public/{agg_types,vis}/**/*.{ts,tsx}',
'!src/legacy/ui/public/{agg_types,vis}/**/*.d.ts',
Copy link
Contributor Author

@sulemanof sulemanof Mar 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no necessity to collect coverage from these folders (agg_types doesn't exist anymore, vis contains only legacy mocka tests since the most of code was moved)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please re-request review from @elastic/kibana-operations when this is passing CI oops, misinterpreted the latest test results

Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from an operations perspective

Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes LGTM for app arch! Reviewed everything other than the paginate directive updates, which I am unfamiliar with.

And thanks for deleting ui/agg_types here. Nice to see that going away 🙂

Comment on lines 74 to 87
data: {
search: {
aggs: {
types: {
getAll: () => [],
},
},
__LEGACY: {
aggTypeFieldFilters: {
filter: () => [],
},
},
},
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - It would probably make maintenance easier if you passed the mocks from src/plugins/data/public/mocks.ts here (assuming that works for these specific tests)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.
Wrapped KibanaContextProvider with dataPluginMock service .

@@ -136,13 +132,14 @@ function getAggParamsToRender({
}

function getAggTypeOptions(
aggTypes: any,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably expose a proper interface for this from the data plugin, because I don't think there's an easy way to type aggTypes otherwise. I've added it to our roadmap list in #60126

siblingPipelineType,
termsAggFilter,
} = search.aggs;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎊

@@ -19,13 +19,10 @@

export { npSetup, npStart } from 'ui/new_platform';
export { getFormat } from 'ui/visualize/loader/pipeline_helpers/utilities';
export { IAggConfig, AggGroupNames, Schemas } from 'ui/agg_types';
// @ts-ignore
export { PaginateDirectiveProvider } from 'ui/directives/paginate';
// @ts-ignore
export { PaginateControlsDirectiveProvider } from 'ui/directives/paginate';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could also adapt imports PaginateDirectiveProvider and PaginateControlsDirectiveProvider from kibana_legacy. then ui/directives/paginate is only used in src/legacy/core_plugins/timelion/public/directives/saved_object_finder.js, so it could be inlined there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a really good catch, removed reference here and completely removed ui/directives/paginate references.

@sulemanof
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@kertal kertal self-requested a review March 20, 2020 15:00
Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, tested locally with chrome, Kibana continues to loose weight, 154 LOC this time 👍

@sulemanof sulemanof merged commit 1a1e2e7 into elastic:master Mar 20, 2020
@sulemanof sulemanof deleted the fix-visualize-shims branch March 20, 2020 15:39
sulemanof added a commit to sulemanof/kibana that referenced this pull request Mar 20, 2020
…ibana_legacy (elastic#60276)

* fix agg type shims and move paginated table to kibana_legacy

* fix types

* fix i18n ids

* fix unit tests

* Update imports

* Remove ui/agg_types imports

* Clean up vis_default_editor plugin

* Remove agg_types imports in vis_type_table

* Clean up x-pack

* Clean up vis_type_vislib

* Last cleanups

* Update docs

* Mock Schemas in vis_type_metric

* Use data plugin mocks

* Remove ui/directives/paginate reference

* Remove snapshot

* Remove shallow

Co-authored-by: Joe Reuter <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
# Conflicts:
#	src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_state.test.ts
gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 20, 2020
* master: (55 commits)
  Update dependency @elastic/charts to v18.1.0 (elastic#60578)
  Only set timezone when user setting is a valid timezone (elastic#57850)
  [NP] Remove `ui/agg_types` dependencies and move paginated table to kibana_legacy (elastic#60276)
  [SIEM] Fix types in rules tests (elastic#60736)
  [Alerting] prevent flickering when fields are updated in an alert (elastic#60666)
  License checks for actions plugin (elastic#59070)
  Implemented ability to clear and properly validate alert interval (elastic#60571)
  WebElementWrapper: add findByTestSubject/findAllByTestSubject to search with data-test-subj (elastic#60568)
  [Maps] Update layer dependencies to NP (elastic#59585)
  [Discover] Remove StateManagementConfigProvider (elastic#60221)
  [ML] Listing all categorization wizard checks (elastic#60502)
  [Upgrade Assistant] First iteration of batch reindex docs (elastic#59887)
  [SIEM] Export timeline (elastic#58368)
  [SIEM] Add support for actions and throttle in Rules (elastic#59641)
  Fix ace a11y listener (elastic#60639)
  Add addInfo toast to core notifications service (elastic#60574)
  fix test description (elastic#60638)
  [SIEM] Cypress screenshots upload to google cloud (elastic#60556)
  [canvas/shareable_runtime] sync sass loaders with kbn/optimizer (elastic#60653)
  [SIEM] Fixes Modification of ML Rules (elastic#60662)
  ...
gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 20, 2020
* master:
  Only set timezone when user setting is a valid timezone (elastic#57850)
  [NP] Remove `ui/agg_types` dependencies and move paginated table to kibana_legacy (elastic#60276)
  [SIEM] Fix types in rules tests (elastic#60736)
  [Alerting] prevent flickering when fields are updated in an alert (elastic#60666)
  License checks for actions plugin (elastic#59070)
  Implemented ability to clear and properly validate alert interval (elastic#60571)
  WebElementWrapper: add findByTestSubject/findAllByTestSubject to search with data-test-subj (elastic#60568)
  [Maps] Update layer dependencies to NP (elastic#59585)
  [Discover] Remove StateManagementConfigProvider (elastic#60221)
sulemanof added a commit that referenced this pull request Mar 20, 2020
…ibana_legacy (#60276) (#60769)

* fix agg type shims and move paginated table to kibana_legacy

* fix types

* fix i18n ids

* fix unit tests

* Update imports

* Remove ui/agg_types imports

* Clean up vis_default_editor plugin

* Remove agg_types imports in vis_type_table

* Clean up x-pack

* Clean up vis_type_vislib

* Last cleanups

* Update docs

* Mock Schemas in vis_type_metric

* Use data plugin mocks

* Remove ui/directives/paginate reference

* Remove snapshot

* Remove shallow

Co-authored-by: Joe Reuter <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
# Conflicts:
#	src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_state.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Feature:New Platform release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants