mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
* add HttpResources basic implementation * expose http resources to plugins * add mocks * move http resources to a separate service * hide rendering service * adopt internal types * expose HttpResources service to plugins * update platform mocks * plugins start using HttpResources API * remove RenderingServiceSetup export * RenderingServiceSetup --> InternalRenderingServiceSetup * improve types * remove httpRespources leftovers from http service * remove rendering types from RequestHanlderContext * fix security plugin tests * add unit tests for httpResources service * add unit tests * remove outdated cache-control header * restructure http resources service * merge getUiPlugins and discover * static route declaration shouldnt require auth & validate * update docs * use HttpResources service instad of rendering * address comments * update docs * roll back unnecessary changes * use getVars for rendering * dont pass app. it is not public API * remove static registers * update migration guide
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
/*
|
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
* license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright
|
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
* not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing,
|
|
* software distributed under the License is distributed on an
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
* KIND, either express or implied. See the License for the
|
|
* specific language governing permissions and limitations
|
|
* under the License.
|
|
*/
|
|
|
|
import { Plugin, CoreSetup } from 'kibana/server';
|
|
|
|
import { schema } from '@kbn/config-schema';
|
|
|
|
export class RenderingPlugin implements Plugin {
|
|
public setup(core: CoreSetup) {
|
|
core.http.resources.register(
|
|
{
|
|
path: '/render/{id}',
|
|
validate: {
|
|
query: schema.object(
|
|
{
|
|
includeUserSettings: schema.boolean({ defaultValue: true }),
|
|
},
|
|
{ unknowns: 'allow' }
|
|
),
|
|
params: schema.object({
|
|
id: schema.maybe(schema.string()),
|
|
}),
|
|
},
|
|
},
|
|
async (context, req, res) => {
|
|
const { includeUserSettings } = req.query;
|
|
|
|
if (includeUserSettings) {
|
|
return res.renderCoreApp();
|
|
}
|
|
return res.renderAnonymousCoreApp();
|
|
}
|
|
);
|
|
}
|
|
|
|
public start() {}
|
|
|
|
public stop() {}
|
|
}
|