remove legacy kibana plugin (#76064)

* remove legacy kibana plugin

* as ES as a dependency to security instead of kibana

* remove 'kibana' plugin presence check in so mixin

* moved the `kibana` config section to the server
This commit is contained in:
Pierre Gayvallet 2020-09-03 10:20:20 +02:00 committed by GitHub
parent 182e0de18f
commit 593298ee31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 11 additions and 103 deletions

View file

@ -1,39 +0,0 @@
/*
* 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 { getUiSettingDefaults } from './server/ui_setting_defaults';
export default function (kibana) {
return new kibana.Plugin({
id: 'kibana',
config: function (Joi) {
return Joi.object({
enabled: Joi.boolean().default(true),
index: Joi.string().default('.kibana'),
autocompleteTerminateAfter: Joi.number().integer().min(1).default(100000),
// TODO Also allow units here like in elasticsearch config once this is moved to the new platform
autocompleteTimeout: Joi.number().integer().min(1).default(1000),
}).default();
},
uiExports: {
uiSettingDefaults: getUiSettingDefaults(),
},
});
}

View file

@ -1,9 +0,0 @@
{
"name": "kibana",
"version": "kibana",
"config": {
"@elastic/eslint-import-resolver-kibana": {
"projectRoot": false
}
}
}

View file

@ -1,7 +0,0 @@
// Elastic charts
@import '@elastic/charts/dist/theme';
@import '@elastic/eui/src/themes/charts/theme';
// Public UI styles
@import 'src/legacy/ui/public/index';

View file

@ -1,23 +0,0 @@
/*
* 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.
*/
export function getUiSettingDefaults() {
// wrapped in provider so that a new instance is given to each app/test
return {};
}

View file

@ -231,6 +231,15 @@ export default () =>
locale: Joi.string().default('en'),
}).default(),
// temporarily moved here from the (now deleted) kibana legacy plugin
kibana: Joi.object({
enabled: Joi.boolean().default(true),
index: Joi.string().default('.kibana'),
autocompleteTerminateAfter: Joi.number().integer().min(1).default(100000),
// TODO Also allow units here like in elasticsearch config once this is moved to the new platform
autocompleteTimeout: Joi.number().integer().min(1).default(1000),
}).default(),
savedObjects: Joi.object({
maxImportPayloadBytes: Joi.number().default(10485760),
maxImportExportSize: Joi.number().default(10000),

View file

@ -39,14 +39,6 @@ export function savedObjectsMixin(kbnServer, server) {
server.decorate('server', 'kibanaMigrator', migrator);
const warn = (message) => server.log(['warning', 'saved-objects'], message);
// we use kibana.index which is technically defined in the kibana plugin, so if
// we don't have the plugin (mainly tests) we can't initialize the saved objects
if (!kbnServer.pluginSpecs.some((p) => p.getId() === 'kibana')) {
warn('Saved Objects uninitialized because the Kibana plugin is disabled.');
return;
}
const serializer = kbnServer.newPlatform.start.core.savedObjects.createSerializer();
const createRepository = (callCluster, includedHiddenTypes = []) => {

View file

@ -161,21 +161,6 @@ describe('Saved Objects Mixin', () => {
};
});
describe('no kibana plugin', () => {
it('should not try to create anything', () => {
mockKbnServer.pluginSpecs.some = () => false;
savedObjectsMixin(mockKbnServer, mockServer);
expect(mockServer.log).toHaveBeenCalledWith(expect.any(Array), expect.any(String));
expect(mockServer.decorate).toHaveBeenCalledWith(
'server',
'kibanaMigrator',
expect.any(Object)
);
expect(mockServer.decorate).toHaveBeenCalledTimes(1);
expect(mockServer.route).not.toHaveBeenCalled();
});
});
describe('Saved object service', () => {
let service;

View file

@ -11,7 +11,7 @@ export const security = (kibana: Record<string, any>) =>
new kibana.Plugin({
id: 'security',
publicDir: resolve(__dirname, 'public'),
require: ['kibana'],
require: ['elasticsearch'],
configPrefix: 'xpack.security',
config: (Joi: Root) =>
Joi.object({ enabled: Joi.boolean().default(true) })

View file

@ -16,7 +16,7 @@ export const spaces = (kibana: Record<string, any>) =>
id: 'spaces',
configPrefix: 'xpack.spaces',
publicDir: resolve(__dirname, 'public'),
require: ['kibana', 'elasticsearch', 'xpack_main'],
require: ['elasticsearch', 'xpack_main'],
config(Joi: any) {
return Joi.object({
enabled: Joi.boolean().default(true),