elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.78k stars 8.19k forks source link

Observability plugin useKibanaUiSettings only typed to data plugin's UI settings #99016

Open smith opened 3 years ago

smith commented 3 years ago

In https://github.com/elastic/kibana/blob/master/x-pack/plugins/observability/public/hooks/use_kibana_ui_settings.tsx, the UI_SETTINGS imported there that specifies the types allowed for using a kibana UI setting are only those from the data plugin.

This works fine for now, but if you were to try to use this hook to use any other UI setting the type check would fail.

The kibanaReact plugin exports a useUiSetting already, so we could use that instead. You can give it a type parameter but it does not check the type of the key parameter against a known list of UI settings.

Lists of all the advanced settings keys are in the usageCollection plugin for the purpose of telemetry:

So you could add the typing to the kibanaReact hook, but usageCollection is not currently a dependency of kibanaReact, so it might just be best to leave it.

elasticmachine commented 3 years ago

Pinging @elastic/apm-ui (Team:apm)