[uiSettings] support overriding uiSettings from the config file#21628
[uiSettings] support overriding uiSettings from the config file#21628spalger merged 18 commits intoelastic:masterfrom
Conversation
💔 Build Failed |
4446556 to
7328d6a
Compare
💚 Build Succeeded |
💔 Build Failed |
|
@spalger I must be missing something. We already have 2 ways for tests to set whatever things they want in the .kibana config doc which I think is where all the advanced settings are stored.
These seems like a pretty large change (25 files) without a great explanation for what problem it solves over and above the other ways we already have to set things. |
|
Aren't these uiSettings.overrides stored in the config doc? If they are, then each test that replaces the .kibana index would wipe them out anyway. If they're not, please explain. |
Yeah all of those options are for mutating the uiSettings stored in elasticsearch, but this change doesn't not try to solve that problem. Instead it makes a uiSetting immutable, and forces the API to use a specific value for that setting. The value is not persisted to Elasticsearch, it is only found in the config file, and if you try to change that value from the API you will get an error because the value is overridden. This way users of Kibana can choose to enforce certain uiSettings from the config file without having to interact with Kibana to change the setting. |
The overrides are not stored in the config document, they are stored in the kibana.yml file and merged with the values from the config document when it is read within the uiSettings service/API. |
💚 Build Succeeded |
There was a problem hiding this comment.
LGTM! My only suggestions were about consistent terminology, either overridden or isControlledByServer.
And I do have an idea about this, though feel free to reject it if you're sick of the whole thing. What do you think of using the term isBakedIn instead? It conveys the idea to me that Kibana's been unalterably configured with certain settings. And we can use it to describe the feature in the release notes: "Administrators can now bake settings into Kibana for their users."
| if (setting.isControlledByServer) { | ||
| return ( | ||
| <EuiText size="xs"> | ||
| This setting is overriden by the Kibana server and can not be changed. |
There was a problem hiding this comment.
How about "An administrator has baked this setting into Kibana's configuration"? I don't think we need to explain that it can't be changed since the UI makes that clear.
There was a problem hiding this comment.
I'm really not a huge fan of the "baked" terminology. It implies to me that the values are set by some "baking" process, like if they were baked into the build or something. I think if we wanted to get away from the "controlled" terminology I would prefer something like "forced", but then I feel like we come back around to "overridden"... I think I'm most comfortable with the idea of the UI/API representing these config values as "controlled by the server", and the server seeing them as overrides that it applies to the config values.
There was a problem hiding this comment.
Someone reading it might think you're getting "baked" while coding ;-)
| set: () => {}, | ||
| remove: () => {}, | ||
| isCustom: (setting) => setting.isCustom, | ||
| isControlledByServer: (key) => key.startsWith('test:overridden'), |
There was a problem hiding this comment.
Maybe references to overridden should be replaced by isControlledByServer here?
| checked={!!unsavedValue} | ||
| onChange={this.onFieldChange} | ||
| disabled={loading} | ||
| disabled={loading || setting.isControlledByServer} |
There was a problem hiding this comment.
Maybe destructure isControlledByServer along with the other setting properties on line 322?
| const config = await Config.withDefaultSchema({ | ||
| uiSettings: { enabled } | ||
| uiSettings: { | ||
| overrides: { |
There was a problem hiding this comment.
Do we still need the overrides "namespace"? If we still need a namespace, maybe "controlledByServer" would be more consistent?
There was a problem hiding this comment.
I'd like to leave the option for custom defaults: down the road, and I feel like controlledByServer makes more sense from the UI perspective, but less sense in the server config itself.
|
|
||
| assertUpdateAllowed(key) { | ||
| if (this.isControlledByServer(key)) { | ||
| throw new Error(`Unable to update "${key}" because it is overridden by the Kibana server`); |
There was a problem hiding this comment.
Maybe it's more consistent to say "because it is controlled by the Kibana server"?
💔 Build Failed |
💚 Build Succeeded |
|
retest |
💚 Build Succeeded |
bmcconaghy
left a comment
There was a problem hiding this comment.
Code looks good to me, but the naming here still seems off. The variable is "inControlledByServer" but the word overridden is used all over the place. The relationship between the two concepts is murky. Maybe it could be "isLockedByServer" and we could just use locked everywhere. We need to settle on a single term to represent what is happening here.
|
I'm OK with overrides as the consistent term. Just want there to be a single term for what this is. |
ba7e2fa to
ae7f738
Compare
ae7f738 to
ef3c14f
Compare
This comment has been minimized.
This comment has been minimized.
💚 Build Succeeded |
…tic#21628) This PR implements the `uiSettings.overrides` setting which [when stored in kibana.yml or passed as config args when starting Kibana] allows forcing some uiSettings to always have a specific value. This setting accepts a map of uiSetting keys to values that will always be used to override whatever is stored in the config saved object.  When users view the settings in the advanced settings UI they are disabled and describe why they can't be changed.  Attempting to change these values from the uiSettings client/service/api is also prevented, causing a 400 error to be thrown and/or sent as the response.
|
6.5/6.x: c175c04 |
This PR implements the
uiSettings.overridessetting which [when stored in kibana.yml or passed as config args when starting Kibana] allows forcing some uiSettings to always have a specific value. This setting accepts a map of uiSetting keys to values that will always be used to override whatever is stored in the config saved object.When users view the settings in the advanced settings UI they are disabled and describe why they can't be changed.
Attempting to change these values from the uiSettings client/service/api is also prevented, causing a 400 error to be thrown and/or sent as the response.