[Infra UI] Honour space when querying TSVB API (#36765)
* Honour active space for requests to TSVB api. * Add privilege necessary to make TSVB requests. * Announce our dependency on TSVB.
This commit is contained in:
parent
9a01a0d69d
commit
df6574590d
|
@ -18,7 +18,7 @@ export function infra(kibana: any) {
|
|||
id: APP_ID,
|
||||
configPrefix: 'xpack.infra',
|
||||
publicDir: resolve(__dirname, 'public'),
|
||||
require: ['kibana', 'elasticsearch'],
|
||||
require: ['kibana', 'elasticsearch', 'metrics'],
|
||||
uiExports: {
|
||||
app: {
|
||||
description: i18n.translate('xpack.infra.infrastructureDescription', {
|
||||
|
|
|
@ -42,7 +42,7 @@ export const initServerWithKibana = (kbnServer: KbnServer) => {
|
|||
api: ['infra'],
|
||||
savedObject: {
|
||||
all: ['infrastructure-ui-source'],
|
||||
read: [],
|
||||
read: ['index-pattern'],
|
||||
},
|
||||
ui: ['show', 'configureSource', 'save'],
|
||||
},
|
||||
|
@ -50,7 +50,7 @@ export const initServerWithKibana = (kbnServer: KbnServer) => {
|
|||
api: ['infra'],
|
||||
savedObject: {
|
||||
all: [],
|
||||
read: ['infrastructure-ui-source'],
|
||||
read: ['infrastructure-ui-source', 'index-pattern'],
|
||||
},
|
||||
ui: ['show'],
|
||||
},
|
||||
|
|
|
@ -149,8 +149,17 @@ export class InfraKibanaBackendFrameworkAdapter implements InfraBackendFramework
|
|||
) {
|
||||
const internalRequest = req[internalInfraFrameworkRequest];
|
||||
const server = internalRequest.server;
|
||||
|
||||
let url = '/api/metrics/vis/data';
|
||||
if (server.plugins.spaces) {
|
||||
const spaceId = server.plugins.spaces.getSpaceId(internalRequest);
|
||||
if (spaceId !== 'default') {
|
||||
url = `/s/${spaceId}${url}`;
|
||||
}
|
||||
}
|
||||
|
||||
const request = {
|
||||
url: '/api/metrics/vis/data',
|
||||
url,
|
||||
method: 'POST',
|
||||
headers: internalRequest.headers,
|
||||
payload: {
|
||||
|
|
Loading…
Reference in a new issue