Fix search profiler (#27326)

* fix logic for when license error shows

* fix API route to work with latest hapi API
This commit is contained in:
Bill McConaghy 2018-12-17 14:39:46 -05:00 committed by GitHub
parent faa57fd7a9
commit b0c6b52b45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -18,7 +18,7 @@
</tabset> </tabset>
<!-- License error notice --> <!-- License error notice -->
<div class="kuiNotice" ng-hide="!licenseEnabled"> <div class="kuiNotice" ng-hide="licenseEnabled">
<h2 <h2
class="kuiTitle kuiVerticalRhythmSmall" class="kuiTitle kuiVerticalRhythmSmall"
i18n-id="xpack.searchProfiler.licenseErrorMessageTitle" i18n-id="xpack.searchProfiler.licenseErrorMessageTitle"

View file

@ -21,7 +21,7 @@ export function profileRoute(server, commonRouteConfig) {
}).required() //Joi validation }).required() //Joi validation
} }
}, },
handler: (request) => { handler: async (request) => {
const { callWithRequest } = server.plugins.elasticsearch.getCluster('data'); const { callWithRequest } = server.plugins.elasticsearch.getCluster('data');
let parsed = request.payload.query; let parsed = request.payload.query;
@ -33,18 +33,18 @@ export function profileRoute(server, commonRouteConfig) {
type: request.payload.type, type: request.payload.type,
body: parsed body: parsed
}; };
try {
callWithRequest(request, 'search', body).then((resp) => { const resp = await callWithRequest(request, 'search', body);
return { return {
ok: true, ok: true,
resp: resp resp: resp
}; };
}).catch((err) => { } catch (err) {
return { return {
ok: false, ok: false,
err: err err: err
}; };
}); }
} }
}); });