Skip to content

Commit

Permalink
[6.x] [uiSettings] support overriding uiSettings from the config file (
Browse files Browse the repository at this point in the history
…#21628) (#21983)

Backports the following commits to 6.x:
 - [uiSettings] support overriding uiSettings from the config file  (#21628)
  • Loading branch information
Spencer authored Aug 15, 2018
1 parent 3be8c2c commit c175c04
Show file tree
Hide file tree
Showing 25 changed files with 1,561 additions and 117 deletions.
3 changes: 1 addition & 2 deletions src/cli_plugin/install/kibana.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ export async function rebuildCache(settings, logger) {
'--env.name=production',
'--optimize.useBundleCache=false',
'--server.autoListen=false',
'--plugins.initialize=false',
'--uiSettings.enabled=false'
'--plugins.initialize=false'
];

const proc = execa(process.execPath, kibanaArgs, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ exports[`AdvancedSettings should render normally 1`] = `
categoryCounts={
Object {
"elasticsearch": 2,
"general": 7,
"general": 11,
}
}
clear={[Function]}
Expand All @@ -96,6 +96,7 @@ exports[`AdvancedSettings should render normally 1`] = `
"description": "Description for Test array setting",
"displayName": "Test array setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:array:setting",
"options": undefined,
"readonly": false,
Expand All @@ -111,6 +112,7 @@ exports[`AdvancedSettings should render normally 1`] = `
"description": "Description for Test boolean setting",
"displayName": "Test boolean setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:boolean:setting",
"options": undefined,
"readonly": false,
Expand All @@ -128,6 +130,7 @@ exports[`AdvancedSettings should render normally 1`] = `
"description": "Description for Test custom string setting",
"displayName": "Test custom string setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:customstring:setting",
"options": undefined,
"readonly": false,
Expand All @@ -143,12 +146,83 @@ exports[`AdvancedSettings should render normally 1`] = `
"description": "Description for Test image setting",
"displayName": "Test image setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:image:setting",
"options": undefined,
"readonly": false,
"type": "image",
"value": undefined,
},
Object {
"ariaName": "test is overridden json",
"category": Array [
"general",
],
"defVal": "{
\\"foo\\": \\"bar\\"
}",
"description": "Description for overridden json",
"displayName": "An overridden json",
"isCustom": undefined,
"isOverridden": true,
"name": "test:isOverridden:json",
"options": undefined,
"readonly": false,
"type": "json",
"value": undefined,
},
Object {
"ariaName": "test is overridden number",
"category": Array [
"general",
],
"defVal": 1234,
"description": "Description for overridden number",
"displayName": "An overridden number",
"isCustom": undefined,
"isOverridden": true,
"name": "test:isOverridden:number",
"options": undefined,
"readonly": false,
"type": "number",
"value": undefined,
},
Object {
"ariaName": "test is overridden select",
"category": Array [
"general",
],
"defVal": "orange",
"description": "Description for overridden select setting",
"displayName": "Test overridden select setting",
"isCustom": undefined,
"isOverridden": true,
"name": "test:isOverridden:select",
"options": Array [
"apple",
"orange",
"banana",
],
"readonly": false,
"type": "select",
"value": undefined,
},
Object {
"ariaName": "test is overridden string",
"category": Array [
"general",
],
"defVal": "foo",
"description": "Description for overridden string",
"displayName": "An overridden string",
"isCustom": undefined,
"isOverridden": true,
"name": "test:isOverridden:string",
"options": undefined,
"readonly": false,
"type": "string",
"value": undefined,
},
Object {
"ariaName": "test json setting",
"category": Array [
Expand All @@ -158,6 +232,7 @@ exports[`AdvancedSettings should render normally 1`] = `
"description": "Description for Test json setting",
"displayName": "Test json setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:json:setting",
"options": undefined,
"readonly": false,
Expand All @@ -173,6 +248,7 @@ exports[`AdvancedSettings should render normally 1`] = `
"description": "Description for Test markdown setting",
"displayName": "Test markdown setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:markdown:setting",
"options": undefined,
"readonly": false,
Expand All @@ -188,6 +264,7 @@ exports[`AdvancedSettings should render normally 1`] = `
"description": "Description for Test number setting",
"displayName": "Test number setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:number:setting",
"options": undefined,
"readonly": false,
Expand All @@ -203,6 +280,7 @@ exports[`AdvancedSettings should render normally 1`] = `
"description": "Description for Test select setting",
"displayName": "Test select setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:select:setting",
"options": Array [
"apple",
Expand All @@ -222,6 +300,7 @@ exports[`AdvancedSettings should render normally 1`] = `
"description": "Description for Test string setting",
"displayName": "Test string setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:string:setting",
"options": undefined,
"readonly": false,
Expand Down Expand Up @@ -329,7 +408,7 @@ exports[`AdvancedSettings should render specific setting if given setting key 1`
categoryCounts={
Object {
"elasticsearch": 2,
"general": 7,
"general": 11,
}
}
clear={[Function]}
Expand All @@ -347,6 +426,7 @@ exports[`AdvancedSettings should render specific setting if given setting key 1`
"description": "Description for Test string setting",
"displayName": "Test string setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:string:setting",
"options": undefined,
"readonly": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class AdvancedSettings extends Component {
name: setting[0],
value: setting[1].userValue,
isCustom: config.isCustom(setting[0]),
isOverridden: config.isOverridden(setting[0]),
});
})
.filter((c) => !c.readonly)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import React from 'react';
import { shallow } from 'enzyme';
import dedent from 'dedent';

import { AdvancedSettings } from './advanced_settings';

Expand All @@ -44,6 +45,7 @@ const config = {
set: () => {},
remove: () => {},
isCustom: (setting) => setting.isCustom,
isOverridden: (key) => Boolean(config.getAll()[key].isOverridden),
getAll: () => {
return {
'test:array:setting': {
Expand Down Expand Up @@ -109,6 +111,39 @@ const config = {
type: 'string',
isCustom: true,
},
'test:isOverridden:string': {
isOverridden: true,
value: 'foo',
name: 'An overridden string',
description: 'Description for overridden string',
type: 'string',
},
'test:isOverridden:number': {
isOverridden: true,
value: 1234,
name: 'An overridden number',
description: 'Description for overridden number',
type: 'number',
},
'test:isOverridden:json': {
isOverridden: true,
value: dedent`
{
"foo": "bar"
}
`,
name: 'An overridden json',
description: 'Description for overridden json',
type: 'json',
},
'test:isOverridden:select': {
isOverridden: true,
value: 'orange',
name: 'Test overridden select setting',
description: 'Description for overridden select setting',
type: 'select',
options: ['apple', 'orange', 'banana'],
},
};
}
};
Expand Down
Loading

0 comments on commit c175c04

Please sign in to comment.