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

UI Settings should have a getWithInternal method #12047

Closed
tsullivan opened this issue May 26, 2017 · 2 comments
Closed

UI Settings should have a getWithInternal method #12047

tsullivan opened this issue May 26, 2017 · 2 comments
Assignees
Labels
enhancement New value added to drive a business result Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@tsullivan
Copy link
Member

Currently, all the methods in src/ui/settings/index.js require a req object to be passed in. There are times when we need to get or set a uiSetting outside of a request, for example if we need to set it to a default at startup time for a plugin, or when we need a background task to read a setting value.

It seems a req parameter is required because the getUserProvided method uses callWithRequest internally: https://github.com/elastic/kibana/blob/v6.0.0-alpha1/src/ui/settings/index.js#L82

There could be additional methods added to src/ui/settings that allow querying ES with callWithInternalUser that would work for reading UI Settings at plugin startup time, or in background tasks.

cc @spalger @kjbekkelund @azasypkin

@spalger
Copy link
Contributor

spalger commented May 26, 2017

if we need to set it to a default at startup time for a plugin

I would hope that this doesn't require writing to elasticsearch

I agree that there should be some way to get the uiSettings out of elasticsearch without a request, but we should be very careful about this.

I've grown rather fond of a pattern we used in the SavedObjectClient, were a partially applied version of callWithRequest is passed in that can be used to make whatever requests are neccessary. Using this pattern we could update uiSettings to read from elasticsearch without having to teach it about the clusters, call with request, or anything like that.

@tsullivan
Copy link
Member Author

tsullivan commented May 27, 2017

if we need to set it to a default at startup time for a plugin

If we have #10863, and could define settings in the uiExport of a plugin, then this isn't a concern

@tsullivan tsullivan added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label May 27, 2017
@spalger spalger self-assigned this May 27, 2017
@epixa epixa added enhancement New value added to drive a business result and removed release_note:enhancement labels May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

3 participants