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] Migrate uiSettings owned by Kibana app #64321

Merged
merged 25 commits into from
May 15, 2020

Conversation

maryia-lapata
Copy link
Contributor

@maryia-lapata maryia-lapata commented Apr 23, 2020

Summary

Fixes #63597.

This PR migrates the following ui settings to the new platform:

  • to discover:
    • defaultColumns
    • discover:sampleSize
    • discover:aggs:terms:size
    • discover:sort:defaultOrder
    • discover:searchOnPageLoad
    • doc_table:hideTimeColumn
    • fields:popularLimit
    • context:defaultSize
    • context:step
    • context:tieBreakerFields
  • to data:
    • metaFields
    • doc_table:highlight
  • to charts:
    • visualization:colorMapping
  • to vis_type_vislib:
    • visualization:dimmingOpacity
    • visualization:heatmap:maxBuckets
  • to saved_objects:
    • savedObjects:perPage
    • savedObjects:listingLimit
  • to vis_type_timeseries:
    • metrics:max_buckets
  • remove visualization:loadingDelay since it's unused.

i18n IDs were updated respectively.

@maryia-lapata maryia-lapata added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Feature:NP Migration v7.8.0 labels Apr 23, 2020
@maryia-lapata
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

merge conflict between base and head

@kertal
Copy link
Member

kertal commented Apr 27, 2020

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

merge conflict between base and head

@kertal kertal self-assigned this Apr 28, 2020
@kertal
Copy link
Member

kertal commented Apr 28, 2020

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

merge conflict between base and head

@kertal kertal marked this pull request as ready for review April 28, 2020 13:27
@kertal kertal requested a review from a team April 28, 2020 13:27
@kertal kertal requested review from a team as code owners April 28, 2020 13:27
@kertal kertal requested a review from flash1293 April 28, 2020 13:28
Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

Maps changes LGTM
code review

@joshdover
Copy link
Contributor

I agree with that plugins should only have access to the settings that either (1) Core exposes (2) plugins they depend on expose (3) they own themselves.

I also think that to accomplish that we need a much larger change to how this service works in order to enforce those boundaries. Same goes for saved object types. We probably shouldn't allow arbitrary access to any SO type.

So maybe for now we try to follow the pattern @pgayvallet laid out above where it's easy & feasible, but if there are some cases that don't fit nicely into that pattern we can solve that separately later?

@kertal
Copy link
Member

kertal commented May 11, 2020

So maybe for now we try to follow the pattern @pgayvallet laid out above where it's easy & feasible, but if there are some cases that don't fit nicely into that pattern we can solve that separately later?

I do agree and I'm currently adapting the PR to the pattern @pgayvallet suggested, where possible

src/plugins/discover/server/ui_settings.ts Outdated Show resolved Hide resolved
Comment on lines +36 to +37
schema: schema.arrayOf(schema.string()),
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional: I'm wondering whether we know all of them to declare validation as a union of well-known strings.

Copy link
Member

Choose a reason for hiding this comment

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

here are mapping fields. but not all e.g. _score of the query context is missing, think it should stay flexible, just in case
https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-fields.html

src/plugins/dashboard/public/application/legacy_app.js Outdated Show resolved Hide resolved
src/plugins/saved_objects/server/plugin.ts Outdated Show resolved Hide resolved
src/plugins/vis_type_vislib/server/plugin.ts Outdated Show resolved Hide resolved
@kertal kertal requested a review from mattkime May 14, 2020 15:43
Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Tested against current master and all settings are still there. LGTM.

While looking through the code I noticed we need to do the same thing for a bunch of timelion settings, I will create a separate issue for that.

src/plugins/charts/server/plugin.ts Outdated Show resolved Hide resolved
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@@ -33,6 +33,7 @@ import { i18n } from '@kbn/i18n';
import { fieldWildcardMatcher } from '../../../../../../../../../plugins/kibana_utils/public';
import { IndexPatternManagementStart } from '../../../../../../../../../plugins/index_pattern_management/public';
import { IndexPattern, IndexPatternField } from '../../../../../../../../../plugins/data/public';
import { META_FIELDS_SETTING } from '../../../../../../../../../plugins/data/common';
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm not wrong we are trying to avoid imports from /common folder.

Also I think that this approach introduce a lot of fields in our static contract which also not good.

Maybe we can move all into one variable:

const UI_SETTINGS = {
  META_FIELDS_SETTING: 'meta_field',
  DEFAULT_QUERY_LANGUAGE: 'kuery',
  META_FIELDS_SETTING: `'metaFields',`
}

Copy link
Member

Choose a reason for hiding this comment

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

sorry, seems we had a comment/merge race condition. seen this comment after the merge. since this part of Kibana was in the legacy world, and it's currently migrated, this could be done in or after #65026

@kertal kertal merged commit 7c8eea1 into elastic:master May 15, 2020
@kertal kertal added v7.9.0 and removed v7.8.0 labels May 15, 2020
kertal pushed a commit to kertal/kibana that referenced this pull request May 15, 2020
* Move META_FIELDS_SETTING, DOC_HIGHLIGHT_SETTING to data plugin.ts

* Refactor table_list_view.tsx to no longer get PER_PAGE_SETTING by uiSettings

* Migrate graph, visualize, dashboard usage of saved_objects module constants to accessor functions

* Remove redundant logging in plugins start and setup methods

Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>

# Conflicts:
#	src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts
kertal added a commit that referenced this pull request May 15, 2020
* Move META_FIELDS_SETTING, DOC_HIGHLIGHT_SETTING to data plugin.ts

* Refactor table_list_view.tsx to no longer get PER_PAGE_SETTING by uiSettings

* Migrate graph, visualize, dashboard usage of saved_objects module constants to accessor functions

* Remove redundant logging in plugins start and setup methods

Co-authored-by: Maryia Lapata <mary.lopato@gmail.com>
Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
gmmorris added a commit to gmmorris/kibana that referenced this pull request May 15, 2020
* master: (191 commits)
  [Maps] Get number of categories from palette (elastic#66454)
  move oss features registration to KP (elastic#66524)
  [kbn/plugin-helpers] typescript-ify (elastic#66513)
  Add kibana-operations as codeowners for .ci/es-snapshots and vars/ (elastic#66746)
  FTR: move basic services under common folder (elastic#66563)
  Migrate Beats Management UI to KP (elastic#65791)
  [CI] Add 20 minutes to overall build timeout
  lint import from restricted zones for export exressions (elastic#66588)
  [SIEM][Detection Engine] Add validation for Rule Actions (elastic#63332)
  KP plugins shouldn't need package.json (elastic#66654)
  Replace agent metrics link with the new one (elastic#66632)
  [CI] Add one retry to setup step (elastic#66638)
  [CI] Add slack alerts to tracked branch jobs, change default channel, change formatting (elastic#66580)
  [docLinks] Add docLinks to CoreSetup. (elastic#66631)
  [DOCS] Rename monitoring collection from internal to legacy (elastic#65781)
  unskip newsfeed tests (elastic#66562)
  [NP] Migrate uiSettings owned by Kibana app (elastic#64321)
  [ML] Functional tests - stabilize typing in DFA mml input (elastic#66706)
  [Map] return bounding box for static feature collection without joins (elastic#66607)
  remove trailing slash in graph sample data links (elastic#66358)
  ...
@kertal kertal added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label May 25, 2020
@elasticmachine
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:NP Migration release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[uiSettings]: Migrate items owned by Kibana app to new platform