Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[uiSettings] make service request based #12243

Merged
merged 19 commits into from
Jun 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
817d261
[server/uiSettings] make uiSettings service request based
spalger Jun 8, 2017
04a543d
[server/uiSettings] disambiguate UiSettings/Service
spalger Jun 8, 2017
a0b7f1f
[server/uiSettings] link to PR in removal error
spalger Jun 8, 2017
f3221b8
[server/uiSettings] await _read before hydrating
spalger Jun 8, 2017
c583035
[server/uiSettings] focus tests, remove server integration
spalger Jun 8, 2017
04a1658
[server/uiSettings] add tests for readInterceptor() arg
spalger Jun 8, 2017
bd38111
[server/uiSettings] add server integration tests
spalger Jun 8, 2017
b74e71e
[server/uiExports] fix replaceInjectedVars tests
spalger Jun 8, 2017
c8a410e
[server/uiSettings] convert all methods to use async/await
spalger Jun 8, 2017
885791d
Merge branch 'master' of github.com:elastic/kibana into ui-settings/r…
spalger Jun 12, 2017
19279f3
[uiSettings/serviceFactory] fix doc block
spalger Jun 12, 2017
099964c
[uiSettings/service] fix doc block
spalger Jun 12, 2017
1ae25cd
[uiSettings/tests/callClusterStub] stop tracking state needlessly
spalger Jun 12, 2017
3c141b4
[uiSettings/tests] remove invalid tests and pointless promise helpers
spalger Jun 12, 2017
c3e330a
[uiSettings/forRequest] fix typo
spalger Jun 12, 2017
452393a
[uiSettings/tests] remove mixture of arrow and function expressions
spalger Jun 12, 2017
993ed24
[uiSettings/tests/callClusterStub] leverage sinon.calledWithExactly
spalger Jun 12, 2017
381fd49
[uiSettings/mixin/tests] add exception for eslint import/no-duplicates
spalger Jun 12, 2017
c58dbfa
[uiSettings/mixin/tests] wrap single args in parens
spalger Jun 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ export default function registerDelete(server) {
method: 'DELETE',
handler: function (req, reply) {
const { key } = req.params;
const uiSettings = server.uiSettings();
const uiSettings = req.getUiSettingsService();

uiSettings
.remove(req, key)
.remove(key)
.then(() => uiSettings
.getUserProvided(req)
.getUserProvided()
.then(settings => reply({ settings }).type('application/json'))
)
.catch(err => reply(Boom.wrap(err, err.statusCode)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export default function registerGet(server) {
path: '/api/kibana/settings',
method: 'GET',
handler: function (req, reply) {
server
.uiSettings()
.getUserProvided(req)
req
.getUiSettingsService()
.getUserProvided()
.then(settings => reply({ settings }).type('application/json'))
.catch(err => reply(Boom.wrap(err, err.statusCode)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ export default function registerSet(server) {
handler: function (req, reply) {
const { key } = req.params;
const { value } = req.payload;
const uiSettings = server.uiSettings();
const uiSettings = req.getUiSettingsService();

uiSettings
.set(req, key, value)
.set(key, value)
.then(() => uiSettings
.getUserProvided(req)
.getUserProvided()
.then(settings => reply({ settings }).type('application/json'))
)
.catch(err => reply(Boom.wrap(err, err.statusCode)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ export default function registerSet(server) {
method: 'POST',
handler: function (req, reply) {
const { changes } = req.payload;
const uiSettings = server.uiSettings();
const uiSettings = req.getUiSettingsService();

uiSettings
.setMany(req, changes)
.setMany(changes)
.then(() => uiSettings
.getUserProvided(req)
.getUserProvided()
.then(settings => reply({ settings }).type('application/json'))
)
.catch(err => reply(Boom.wrap(err, err.statusCode)));
Expand Down
2 changes: 1 addition & 1 deletion src/core_plugins/timelion/server/routes/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function (server) {
path: '/api/timelion/run',
handler: async (request, reply) => {
try {
const uiSettings = await server.uiSettings().getAll(request);
const uiSettings = await request.getUiSettingsService().getAll();

const tlConfig = require('../handlers/lib/tl_config.js')({
server,
Expand Down
2 changes: 1 addition & 1 deletion src/core_plugins/timelion/server/routes/validate_es.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default function (server) {
method: 'GET',
path: '/api/timelion/validate/es',
handler: function (request, reply) {
return server.uiSettings().getAll(request).then((uiSettings) => {
return request.getUiSettingsService().getAll().then((uiSettings) => {
const { callWithRequest } = server.plugins.elasticsearch.getCluster('data');

const timefield = uiSettings['timelion:es.timefield'];
Expand Down
4 changes: 2 additions & 2 deletions src/server/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ export default async function (kbnServer, server, config) {
const url = await shortUrlLookup.getUrl(request.params.urlId, request);
shortUrlAssertValid(url);

const uiSettings = server.uiSettings();
const stateStoreInSessionStorage = await uiSettings.get(request, 'state:storeInSessionStorage');
const uiSettings = request.getUiSettingsService();
const stateStoreInSessionStorage = await uiSettings.get('state:storeInSessionStorage');
if (!stateStoreInSessionStorage) {
reply().redirect(config.get('server.basePath') + url);
return;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/__tests__/ui_exports_replace_injected_vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('UiExports', function () {

await kbnServer.ready();
kbnServer.status.get('ui settings').state = 'green';
kbnServer.server.decorate('server', 'uiSettings', () => {
kbnServer.server.decorate('request', 'getUiSettingsService', () => {
return { getDefaults: noop, getUserProvided: noop };
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default async (kbnServer, server, config) => {
});

async function getKibanaPayload({ app, request, includeUserProvidedConfig, injectedVarsOverrides }) {
const uiSettings = server.uiSettings();
const uiSettings = request.getUiSettingsService();
const translations = await uiI18n.getTranslationsForRequest(request);

return {
Expand All @@ -82,7 +82,7 @@ export default async (kbnServer, server, config) => {
translations: translations,
uiSettings: await props({
defaults: uiSettings.getDefaults(),
user: includeUserProvidedConfig && uiSettings.getUserProvided(request)
user: includeUserProvidedConfig && uiSettings.getUserProvided()
}),
vars: await reduceAsync(
uiExports.injectedVarsReplacers,
Expand Down
Loading