mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Goodbye, legacy data plugin 👋 (#60449)
This commit is contained in:
parent
a790877694
commit
3401ae42e0
23 changed files with 8 additions and 254 deletions
|
@ -69,12 +69,6 @@ module.exports = {
|
|||
'jsx-a11y/no-onchange': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['src/legacy/core_plugins/data/**/*.{js,ts,tsx}'],
|
||||
rules: {
|
||||
'react-hooks/exhaustive-deps': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['src/legacy/core_plugins/expressions/**/*.{js,ts,tsx}'],
|
||||
rules: {
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
"console": "src/plugins/console",
|
||||
"core": "src/core",
|
||||
"dashboard": "src/plugins/dashboard",
|
||||
"data": [
|
||||
"src/legacy/core_plugins/data",
|
||||
"src/plugins/data"
|
||||
],
|
||||
"data": "src/plugins/data",
|
||||
"embeddableApi": "src/plugins/embeddable",
|
||||
"embeddableExamples": "examples/embeddable_examples",
|
||||
"share": "src/plugins/share",
|
||||
|
|
|
@ -1,41 +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 { resolve } from 'path';
|
||||
import { Legacy } from '../../../../kibana';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function DataPlugin(kibana: any) {
|
||||
const config: Legacy.PluginSpecOptions = {
|
||||
id: 'data',
|
||||
require: ['elasticsearch'],
|
||||
publicDir: resolve(__dirname, 'public'),
|
||||
config: (Joi: any) => {
|
||||
return Joi.object({
|
||||
enabled: Joi.boolean().default(true),
|
||||
}).default();
|
||||
},
|
||||
init: (server: Legacy.Server) => ({}),
|
||||
uiExports: {
|
||||
injectDefaultVars: () => ({}),
|
||||
},
|
||||
};
|
||||
|
||||
return new kibana.Plugin(config);
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"name": "data",
|
||||
"version": "kibana"
|
||||
}
|
|
@ -1,26 +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 { DataPlugin as Plugin } from './plugin';
|
||||
|
||||
export function plugin() {
|
||||
return new Plugin();
|
||||
}
|
||||
|
||||
export { DataSetup, DataStart } from './plugin';
|
|
@ -1,44 +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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* New Platform Shim
|
||||
*
|
||||
* In this file, we import any legacy dependencies we have, and shim them into
|
||||
* our plugin by manually constructing the values that the new platform will
|
||||
* eventually be passing to the `setup` method of our plugin definition.
|
||||
*
|
||||
* The idea is that our `plugin.ts` can stay "pure" and not contain any legacy
|
||||
* world code. Then when it comes time to migrate to the new platform, we can
|
||||
* simply delete this shim file.
|
||||
*
|
||||
* We are also calling `setup` here and exporting our public contract so that
|
||||
* other legacy plugins are able to import from '../core_plugins/data/legacy'
|
||||
* and receive the response value of the `setup` contract, mimicking the
|
||||
* data that will eventually be injected by the new platform.
|
||||
*/
|
||||
|
||||
import { npSetup, npStart } from 'ui/new_platform';
|
||||
import { plugin } from '.';
|
||||
|
||||
const dataPlugin = plugin();
|
||||
|
||||
export const setup = dataPlugin.setup(npSetup.core);
|
||||
|
||||
export const start = dataPlugin.start(npStart.core);
|
|
@ -1,58 +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 { CoreSetup, CoreStart, Plugin } from 'kibana/public';
|
||||
|
||||
/**
|
||||
* Interface for this plugin's returned `setup` contract.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface DataSetup {} // eslint-disable-line @typescript-eslint/no-empty-interface
|
||||
|
||||
/**
|
||||
* Interface for this plugin's returned `start` contract.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface DataStart {} // eslint-disable-line @typescript-eslint/no-empty-interface
|
||||
|
||||
/**
|
||||
* Data Plugin - public
|
||||
*
|
||||
* This is the entry point for the entire client-side public contract of the plugin.
|
||||
* If something is not explicitly exported here, you can safely assume it is private
|
||||
* to the plugin and not considered stable.
|
||||
*
|
||||
* All stateful contracts will be injected by the platform at runtime, and are defined
|
||||
* in the setup/start interfaces. The remaining items exported here are either types,
|
||||
* or static code.
|
||||
*/
|
||||
|
||||
export class DataPlugin implements Plugin<DataSetup, DataStart> {
|
||||
public setup(core: CoreSetup) {
|
||||
return {};
|
||||
}
|
||||
|
||||
public start(core: CoreStart): DataStart {
|
||||
return {};
|
||||
}
|
||||
|
||||
public stop() {}
|
||||
}
|
|
@ -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.
|
||||
*/
|
||||
|
||||
import { setup } from './legacy';
|
||||
|
||||
// for backwards compatibility with 7.3
|
||||
export const data = setup;
|
|
@ -25,7 +25,7 @@ import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy
|
|||
const inputControlVisPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) =>
|
||||
new Plugin({
|
||||
id: 'input_control_vis',
|
||||
require: ['kibana', 'elasticsearch', 'visualizations', 'interpreter', 'data'],
|
||||
require: ['kibana', 'elasticsearch', 'visualizations', 'interpreter'],
|
||||
publicDir: resolve(__dirname, 'public'),
|
||||
uiExports: {
|
||||
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
|
||||
|
|
|
@ -43,8 +43,6 @@ function buildRestrictedPaths(shimmedPlugins) {
|
|||
'ui/**/*',
|
||||
'src/legacy/ui/**/*',
|
||||
'src/legacy/core_plugins/kibana/public/**/*',
|
||||
'src/legacy/core_plugins/data/public/**/*',
|
||||
'!src/legacy/core_plugins/data/public/index.ts',
|
||||
`!src/legacy/core_plugins/kibana/public/${shimmedPlugin}/**/*`,
|
||||
],
|
||||
allowSameFolder: false,
|
||||
|
|
|
@ -29,7 +29,7 @@ const experimentalLabel = i18n.translate('timelion.uiSettings.experimentalLabel'
|
|||
|
||||
const timelionPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) =>
|
||||
new Plugin({
|
||||
require: ['kibana', 'elasticsearch', 'data'],
|
||||
require: ['kibana', 'elasticsearch'],
|
||||
config(Joi: any) {
|
||||
return Joi.object({
|
||||
enabled: Joi.boolean().default(true),
|
||||
|
|
|
@ -38,7 +38,6 @@ import 'ui/directives/input_focus';
|
|||
import './directives/saved_object_finder';
|
||||
import 'ui/directives/listen';
|
||||
import './directives/saved_object_save_as_checkbox';
|
||||
import '../../data/public/legacy';
|
||||
import './services/saved_sheet_register';
|
||||
|
||||
import rootTemplate from 'plugins/timelion/index.html';
|
||||
|
|
|
@ -21,11 +21,6 @@ import React from 'react';
|
|||
import { render, mount } from 'enzyme';
|
||||
import { MarkdownVisWrapper } from './markdown_vis_controller';
|
||||
|
||||
// We need Markdown to do these tests, so mock data plugin
|
||||
jest.mock('../../data/public/legacy', () => {
|
||||
return {};
|
||||
});
|
||||
|
||||
describe('markdown vis controller', () => {
|
||||
it('should set html from markdown params', () => {
|
||||
const vis = {
|
||||
|
|
|
@ -25,7 +25,7 @@ import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy
|
|||
const timelionVisPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) =>
|
||||
new Plugin({
|
||||
id: 'timelion_vis',
|
||||
require: ['kibana', 'elasticsearch', 'visualizations', 'data'],
|
||||
require: ['kibana', 'elasticsearch', 'visualizations'],
|
||||
publicDir: resolve(__dirname, 'public'),
|
||||
uiExports: {
|
||||
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
|
||||
|
|
|
@ -20,12 +20,6 @@
|
|||
import React from 'react';
|
||||
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
|
||||
|
||||
jest.mock('plugins/data', () => {
|
||||
return {
|
||||
QueryStringInput: () => <div className="queryStringInput" />,
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('../lib/get_default_query_language', () => ({
|
||||
getDefaultQueryLanguage: () => 'kuery',
|
||||
}));
|
||||
|
|
|
@ -20,12 +20,6 @@ import React from 'react';
|
|||
import { GaugeSeries } from './series';
|
||||
import { mountWithIntl } from 'test_utils/enzyme_helpers';
|
||||
|
||||
jest.mock('plugins/data', () => {
|
||||
return {
|
||||
QueryStringInput: () => <div className="queryStringInput" />,
|
||||
};
|
||||
});
|
||||
|
||||
const defaultProps = {
|
||||
disableAdd: true,
|
||||
disableDelete: true,
|
||||
|
|
|
@ -21,12 +21,6 @@ import React from 'react';
|
|||
import { MetricSeries } from './series';
|
||||
import { mountWithIntl } from 'test_utils/enzyme_helpers';
|
||||
|
||||
jest.mock('plugins/data', () => {
|
||||
return {
|
||||
QueryStringInput: () => <div className="queryStringInput" />,
|
||||
};
|
||||
});
|
||||
|
||||
const defaultProps = {
|
||||
disableAdd: false,
|
||||
disableDelete: true,
|
||||
|
|
|
@ -25,7 +25,7 @@ import { LegacyPluginApi, LegacyPluginInitializer } from '../../types';
|
|||
const visTypeVislibPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) =>
|
||||
new Plugin({
|
||||
id: 'vis_type_vislib',
|
||||
require: ['kibana', 'elasticsearch', 'visualizations', 'interpreter', 'data'],
|
||||
require: ['kibana', 'elasticsearch', 'visualizations', 'interpreter'],
|
||||
publicDir: resolve(__dirname, 'public'),
|
||||
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
|
||||
uiExports: {
|
||||
|
|
|
@ -31,7 +31,7 @@ export interface ConfigSchema {
|
|||
const visTypeXyPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) =>
|
||||
new Plugin({
|
||||
id: 'visTypeXy',
|
||||
require: ['kibana', 'elasticsearch', 'visualizations', 'interpreter', 'data'],
|
||||
require: ['kibana', 'elasticsearch', 'visualizations', 'interpreter'],
|
||||
publicDir: resolve(__dirname, 'public'),
|
||||
uiExports: {
|
||||
hacks: [resolve(__dirname, 'public/legacy')],
|
||||
|
|
|
@ -19,7 +19,7 @@ export const lens: LegacyPluginInitializer = kibana => {
|
|||
id: PLUGIN_ID,
|
||||
configPrefix: `xpack.${PLUGIN_ID}`,
|
||||
// task_manager could be required, but is only used for telemetry
|
||||
require: ['kibana', 'elasticsearch', 'xpack_main', 'interpreter', 'data'],
|
||||
require: ['kibana', 'elasticsearch', 'xpack_main', 'interpreter'],
|
||||
publicDir: resolve(__dirname, 'public'),
|
||||
|
||||
uiExports: {
|
||||
|
|
|
@ -22,7 +22,6 @@ import { dataPluginMock } from '../../../../../../src/plugins/data/public/mocks'
|
|||
const dataStartMock = dataPluginMock.createStartContract();
|
||||
|
||||
import { TopNavMenuData } from '../../../../../../src/plugins/navigation/public';
|
||||
import { DataStart } from '../../../../../../src/legacy/core_plugins/data/public';
|
||||
import { coreMock } from 'src/core/public/mocks';
|
||||
|
||||
jest.mock('ui/new_platform');
|
||||
|
@ -87,7 +86,6 @@ describe('Lens App', () => {
|
|||
editorFrame: EditorFrameInstance;
|
||||
data: typeof dataStartMock;
|
||||
core: typeof core;
|
||||
dataShim: DataStart;
|
||||
storage: Storage;
|
||||
docId?: string;
|
||||
docStorage: SavedObjectStore;
|
||||
|
@ -134,7 +132,6 @@ describe('Lens App', () => {
|
|||
editorFrame: EditorFrameInstance;
|
||||
data: typeof dataStartMock;
|
||||
core: typeof core;
|
||||
dataShim: DataStart;
|
||||
storage: Storage;
|
||||
docId?: string;
|
||||
docStorage: SavedObjectStore;
|
||||
|
@ -332,7 +329,6 @@ describe('Lens App', () => {
|
|||
editorFrame: EditorFrameInstance;
|
||||
data: typeof dataStartMock;
|
||||
core: typeof core;
|
||||
dataShim: DataStart;
|
||||
storage: Storage;
|
||||
docId?: string;
|
||||
docStorage: SavedObjectStore;
|
||||
|
@ -648,7 +644,6 @@ describe('Lens App', () => {
|
|||
editorFrame: EditorFrameInstance;
|
||||
data: typeof dataStartMock;
|
||||
core: typeof core;
|
||||
dataShim: DataStart;
|
||||
storage: Storage;
|
||||
docId?: string;
|
||||
docStorage: SavedObjectStore;
|
||||
|
|
|
@ -34,12 +34,6 @@ jest.mock('ui/new_platform');
|
|||
jest.mock('../loader');
|
||||
jest.mock('../state_helpers');
|
||||
|
||||
// Used by indexpattern plugin, which is a dependency of a dependency
|
||||
jest.mock('ui/chrome');
|
||||
// Contains old and new platform data plugins, used for interpreter and filter ratio
|
||||
jest.mock('ui/new_platform');
|
||||
jest.mock('plugins/data/setup', () => ({ data: { query: { ui: {} } } }));
|
||||
|
||||
const expectedIndexPatterns = {
|
||||
1: {
|
||||
id: '1',
|
||||
|
|
|
@ -12,13 +12,9 @@ import {
|
|||
getDatasourceSuggestionsFromCurrentState,
|
||||
} from './indexpattern_suggestions';
|
||||
|
||||
jest.mock('ui/new_platform');
|
||||
jest.mock('./loader');
|
||||
jest.mock('../id_generator');
|
||||
// chrome, notify, storage are used by ./plugin
|
||||
jest.mock('ui/chrome');
|
||||
// Contains old and new platform data plugins, used for interpreter and filter ratio
|
||||
jest.mock('ui/new_platform');
|
||||
jest.mock('plugins/data/setup', () => ({ data: { query: { ui: {} } } }));
|
||||
|
||||
const expectedIndexPatterns = {
|
||||
1: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue