Skip to content

Commit

Permalink
Merge pull request #7333 from ycombinator/gh-7318
Browse files Browse the repository at this point in the history
If user settings cannot be found for installed version of Kibana, turn Kibana plugin red
  • Loading branch information
ycombinator committed Jun 2, 2016
2 parents ef1fb42 + 484e45f commit 6e46c0e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ui/settings/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defaultsDeep } from 'lodash';
import { defaultsDeep, partial } from 'lodash';
import defaultsProvider from './defaults';

export default function setupSettings(kbnServer, server, config) {
Expand All @@ -23,12 +23,19 @@ export default function setupSettings(kbnServer, server, config) {
return Promise.resolve(defaultsProvider());
}

function userSettingsNotFound(kibanaVersion) {
const message = 'Could not find user-provided settings for this version of Kibana (' + kibanaVersion + ')';
server.plugins.kibana.status.red(message);
return {};
}

function getUserProvided() {
const { client } = server.plugins.elasticsearch;
const clientSettings = getClientSettings(config);
return client
.get({ ...clientSettings })
.then(res => res._source)
.catch(partial(userSettingsNotFound, clientSettings.id))
.then(user => hydrateUserSettings(user));
}

Expand Down

0 comments on commit 6e46c0e

Please sign in to comment.