mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Merge pull request #8769 from elastic/jasper/backport/8764/5.0
[backport] PR #8764 to 5.0 - UI Settings should be disabled when elasticsearch is not available
This commit is contained in:
commit
342bf5c9ad
4 changed files with 22 additions and 1 deletions
|
@ -18,6 +18,7 @@ module.exports = class ClusterManager {
|
|||
const serverArgv = [];
|
||||
const optimizerArgv = [
|
||||
'--plugins.initialize=false',
|
||||
'--uiSettings.enabled=false',
|
||||
'--server.autoListen=false',
|
||||
];
|
||||
|
||||
|
|
|
@ -145,6 +145,14 @@ module.exports = () => Joi.object({
|
|||
reuseTiles: Joi.boolean(),
|
||||
bounds: Joi.array().items(Joi.array().items(Joi.number()).min(2).required()).min(2)
|
||||
}).default()
|
||||
}).default()
|
||||
}).default(),
|
||||
|
||||
uiSettings: Joi.object({
|
||||
// this is used to prevent the uiSettings from initializing. Since they
|
||||
// require the elasticsearch plugin in order to function we need to turn
|
||||
// them off when we turn off the elasticsearch plugin (like we do in the
|
||||
// optimizer half of the dev server)
|
||||
enabled: Joi.boolean().default(true)
|
||||
}).default(),
|
||||
|
||||
}).default();
|
||||
|
|
|
@ -322,6 +322,7 @@ function instantiate({ getResult } = {}) {
|
|||
const configGet = sinon.stub();
|
||||
configGet.withArgs('kibana.index').returns('.kibana');
|
||||
configGet.withArgs('pkg.version').returns('1.2.3-test');
|
||||
configGet.withArgs('uiSettings.enabled').returns(true);
|
||||
const config = {
|
||||
get: configGet
|
||||
};
|
||||
|
|
|
@ -3,6 +3,12 @@ import defaultsProvider from './defaults';
|
|||
|
||||
export default function setupSettings(kbnServer, server, config) {
|
||||
const status = kbnServer.status.create('ui settings');
|
||||
|
||||
if (!config.get('uiSettings.enabled')) {
|
||||
status.disabled('uiSettings.enabled config is set to `false`');
|
||||
return;
|
||||
}
|
||||
|
||||
const uiSettings = {
|
||||
// returns a Promise for the value of the requested setting
|
||||
get,
|
||||
|
@ -99,6 +105,11 @@ export default function setupSettings(kbnServer, server, config) {
|
|||
function mirrorEsStatus() {
|
||||
const esStatus = kbnServer.status.getForPluginId('elasticsearch');
|
||||
|
||||
if (!esStatus) {
|
||||
status.red('UI Settings requires the elasticsearch plugin');
|
||||
return;
|
||||
}
|
||||
|
||||
copyStatus();
|
||||
esStatus.on('change', copyStatus);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue