From ced2a21de30043d6e7f418009ff8ac549a60e911 Mon Sep 17 00:00:00 2001 From: spalger Date: Tue, 14 Jun 2016 19:06:44 -0700 Subject: [PATCH] [ui/settings] go red when settings are not found, otherwise mimic es status --- src/ui/settings/index.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ui/settings/index.js b/src/ui/settings/index.js index 7ee9ef504e1a6..806a3d127e07a 100644 --- a/src/ui/settings/index.js +++ b/src/ui/settings/index.js @@ -2,6 +2,7 @@ import { defaultsDeep, partial } from 'lodash'; import defaultsProvider from './defaults'; export default function setupSettings(kbnServer, server, config) { + const status = kbnServer.status.create('ui settings'); const uiSettings = { getAll, getDefaults, @@ -12,6 +13,7 @@ export default function setupSettings(kbnServer, server, config) { }; server.decorate('server', 'uiSettings', () => uiSettings); + kbnServer.ready().then(mirrorEsStatus); function getAll() { return Promise @@ -24,7 +26,7 @@ export default function setupSettings(kbnServer, server, config) { } function userSettingsNotFound(kibanaVersion) { - server.plugins.elasticsearch.status.yellow(`Could not find user-provided settings for this version of Kibana (${kibanaVersion})`); + status.red(`Could not find user-provided settings for Kibana ${kibanaVersion}`); return {}; } @@ -56,6 +58,18 @@ export default function setupSettings(kbnServer, server, config) { function remove(key) { return set(key, null); } + + function mirrorEsStatus() { + const esStatus = kbnServer.status.getForPluginId('elasticsearch'); + + copyStatus(); + esStatus.on('change', copyStatus); + + function copyStatus() { + const { state } = esStatus; + status[state](state === 'green' ? 'Ready' : `Elasticsearch plugin is ${state}`); + } + } } function hydrateUserSettings(user) {