[NP] Move visTypeXy plugin (#63449)
* Move vis_type_xy into NP * Substitute usage in vis_type_vislib * Disable plugin by default
This commit is contained in:
parent
02bcc8e78b
commit
afb48bceca
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -13,7 +13,7 @@
|
||||||
/src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
|
/src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
|
||||||
/src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/kibana-app
|
/src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/kibana-app
|
||||||
/src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app
|
/src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app
|
||||||
/src/legacy/core_plugins/vis_type_xy/ @elastic/kibana-app
|
/src/plugins/vis_type_xy/ @elastic/kibana-app
|
||||||
/src/plugins/kibana_legacy/ @elastic/kibana-app
|
/src/plugins/kibana_legacy/ @elastic/kibana-app
|
||||||
/src/plugins/timelion/ @elastic/kibana-app
|
/src/plugins/timelion/ @elastic/kibana-app
|
||||||
/src/plugins/dashboard/ @elastic/kibana-app
|
/src/plugins/dashboard/ @elastic/kibana-app
|
||||||
|
|
|
@ -30,6 +30,7 @@ const setupPlugins: Readonly<VisTypeVislibPluginSetupDependencies> = {
|
||||||
expressions: npSetup.plugins.expressions,
|
expressions: npSetup.plugins.expressions,
|
||||||
visualizations: npSetup.plugins.visualizations,
|
visualizations: npSetup.plugins.visualizations,
|
||||||
charts: npSetup.plugins.charts,
|
charts: npSetup.plugins.charts,
|
||||||
|
visTypeXy: npSetup.plugins.visTypeXy,
|
||||||
};
|
};
|
||||||
|
|
||||||
const startPlugins: Readonly<VisTypeVislibPluginStartDependencies> = {
|
const startPlugins: Readonly<VisTypeVislibPluginStartDependencies> = {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import {
|
||||||
PluginInitializerContext,
|
PluginInitializerContext,
|
||||||
} from 'kibana/public';
|
} from 'kibana/public';
|
||||||
|
|
||||||
|
import { VisTypeXyPluginSetup } from 'src/plugins/vis_type_xy/public';
|
||||||
import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public';
|
import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public';
|
||||||
import { VisualizationsSetup } from '../../../../plugins/visualizations/public';
|
import { VisualizationsSetup } from '../../../../plugins/visualizations/public';
|
||||||
import { createVisTypeVislibVisFn } from './vis_type_vislib_vis_fn';
|
import { createVisTypeVislibVisFn } from './vis_type_vislib_vis_fn';
|
||||||
|
@ -39,7 +40,6 @@ import {
|
||||||
createGoalVisTypeDefinition,
|
createGoalVisTypeDefinition,
|
||||||
} from './vis_type_vislib_vis_types';
|
} from './vis_type_vislib_vis_types';
|
||||||
import { ChartsPluginSetup } from '../../../../plugins/charts/public';
|
import { ChartsPluginSetup } from '../../../../plugins/charts/public';
|
||||||
import { ConfigSchema as VisTypeXyConfigSchema } from '../../vis_type_xy';
|
|
||||||
import { DataPublicPluginStart } from '../../../../plugins/data/public';
|
import { DataPublicPluginStart } from '../../../../plugins/data/public';
|
||||||
import { setFormatService, setDataActions } from './services';
|
import { setFormatService, setDataActions } from './services';
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ export interface VisTypeVislibPluginSetupDependencies {
|
||||||
expressions: ReturnType<ExpressionsPublicPlugin['setup']>;
|
expressions: ReturnType<ExpressionsPublicPlugin['setup']>;
|
||||||
visualizations: VisualizationsSetup;
|
visualizations: VisualizationsSetup;
|
||||||
charts: ChartsPluginSetup;
|
charts: ChartsPluginSetup;
|
||||||
|
visTypeXy?: VisTypeXyPluginSetup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
|
@ -68,7 +69,7 @@ export class VisTypeVislibPlugin implements Plugin<void, void> {
|
||||||
|
|
||||||
public async setup(
|
public async setup(
|
||||||
core: VisTypeVislibCoreSetup,
|
core: VisTypeVislibCoreSetup,
|
||||||
{ expressions, visualizations, charts }: VisTypeVislibPluginSetupDependencies
|
{ expressions, visualizations, charts, visTypeXy }: VisTypeVislibPluginSetupDependencies
|
||||||
) {
|
) {
|
||||||
const visualizationDependencies: Readonly<VisTypeVislibDependencies> = {
|
const visualizationDependencies: Readonly<VisTypeVislibDependencies> = {
|
||||||
uiSettings: core.uiSettings,
|
uiSettings: core.uiSettings,
|
||||||
|
@ -86,12 +87,8 @@ export class VisTypeVislibPlugin implements Plugin<void, void> {
|
||||||
];
|
];
|
||||||
const vislibFns = [createVisTypeVislibVisFn(), createPieVisFn()];
|
const vislibFns = [createVisTypeVislibVisFn(), createPieVisFn()];
|
||||||
|
|
||||||
const visTypeXy = core.injectedMetadata.getInjectedVar('visTypeXy') as
|
|
||||||
| VisTypeXyConfigSchema['visTypeXy']
|
|
||||||
| undefined;
|
|
||||||
|
|
||||||
// if visTypeXy plugin is disabled it's config will be undefined
|
// if visTypeXy plugin is disabled it's config will be undefined
|
||||||
if (!visTypeXy || !visTypeXy.enabled) {
|
if (!visTypeXy) {
|
||||||
const convertedTypes: any[] = [];
|
const convertedTypes: any[] = [];
|
||||||
const convertedFns: any[] = [];
|
const convertedFns: any[] = [];
|
||||||
|
|
||||||
|
|
|
@ -1,56 +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';
|
|
||||||
|
|
||||||
import { LegacyPluginApi, LegacyPluginInitializer } from '../../types';
|
|
||||||
|
|
||||||
export interface ConfigSchema {
|
|
||||||
visTypeXy: {
|
|
||||||
enabled: boolean;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const visTypeXyPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) =>
|
|
||||||
new Plugin({
|
|
||||||
id: 'visTypeXy',
|
|
||||||
require: ['kibana', 'elasticsearch', 'visualizations', 'interpreter'],
|
|
||||||
publicDir: resolve(__dirname, 'public'),
|
|
||||||
uiExports: {
|
|
||||||
hacks: [resolve(__dirname, 'public/legacy')],
|
|
||||||
injectDefaultVars(server): ConfigSchema {
|
|
||||||
const config = server.config();
|
|
||||||
|
|
||||||
return {
|
|
||||||
visTypeXy: {
|
|
||||||
enabled: config.get('visTypeXy.enabled') as boolean,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config(Joi: any) {
|
|
||||||
return Joi.object({
|
|
||||||
enabled: Joi.boolean().default(false),
|
|
||||||
}).default();
|
|
||||||
},
|
|
||||||
} as Legacy.PluginSpecOptions);
|
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
|
||||||
export default visTypeXyPluginInitializer;
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"name": "visTypeXy",
|
|
||||||
"version": "kibana"
|
|
||||||
}
|
|
|
@ -22,6 +22,7 @@ import { IScope } from 'angular';
|
||||||
import { UiActionsStart, UiActionsSetup } from 'src/plugins/ui_actions/public';
|
import { UiActionsStart, UiActionsSetup } from 'src/plugins/ui_actions/public';
|
||||||
import { EmbeddableStart, EmbeddableSetup } from 'src/plugins/embeddable/public';
|
import { EmbeddableStart, EmbeddableSetup } from 'src/plugins/embeddable/public';
|
||||||
import { createBrowserHistory } from 'history';
|
import { createBrowserHistory } from 'history';
|
||||||
|
import { VisTypeXyPluginSetup } from 'src/plugins/vis_type_xy/public';
|
||||||
import { DashboardStart } from '../../../../plugins/dashboard/public';
|
import { DashboardStart } from '../../../../plugins/dashboard/public';
|
||||||
import { setSetupServices, setStartServices } from './set_services';
|
import { setSetupServices, setStartServices } from './set_services';
|
||||||
import {
|
import {
|
||||||
|
@ -93,6 +94,7 @@ export interface PluginsSetup {
|
||||||
savedObjectsManagement: SavedObjectsManagementPluginSetup;
|
savedObjectsManagement: SavedObjectsManagementPluginSetup;
|
||||||
mapsLegacy: MapsLegacyPluginSetup;
|
mapsLegacy: MapsLegacyPluginSetup;
|
||||||
indexPatternManagement: IndexPatternManagementSetup;
|
indexPatternManagement: IndexPatternManagementSetup;
|
||||||
|
visTypeXy?: VisTypeXyPluginSetup;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PluginsStart {
|
export interface PluginsStart {
|
||||||
|
|
7
src/plugins/vis_type_xy/kibana.json
Normal file
7
src/plugins/vis_type_xy/kibana.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"id": "visTypeXy",
|
||||||
|
"version": "kibana",
|
||||||
|
"server": true,
|
||||||
|
"ui": true,
|
||||||
|
"requiredPlugins": ["charts", "expressions", "visualizations"]
|
||||||
|
}
|
|
@ -17,9 +17,11 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { PluginInitializerContext } from '../../../../core/public';
|
import { PluginInitializerContext } from '../../../core/public';
|
||||||
import { VisTypeXyPlugin as Plugin } from './plugin';
|
import { VisTypeXyPlugin as Plugin } from './plugin';
|
||||||
|
|
||||||
|
export { VisTypeXyPluginSetup } from './plugin';
|
||||||
|
|
||||||
export function plugin(initializerContext: PluginInitializerContext) {
|
export function plugin(initializerContext: PluginInitializerContext) {
|
||||||
return new Plugin(initializerContext);
|
return new Plugin(initializerContext);
|
||||||
}
|
}
|
|
@ -25,18 +25,18 @@ import {
|
||||||
PluginInitializerContext,
|
PluginInitializerContext,
|
||||||
} from 'kibana/public';
|
} from 'kibana/public';
|
||||||
|
|
||||||
import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public';
|
import { Plugin as ExpressionsPublicPlugin } from '../../expressions/public';
|
||||||
import {
|
import { VisualizationsSetup, VisualizationsStart } from '../../visualizations/public';
|
||||||
VisualizationsSetup,
|
import { ChartsPluginSetup } from '../../charts/public';
|
||||||
VisualizationsStart,
|
|
||||||
} from '../../../../plugins/visualizations/public';
|
|
||||||
import { ChartsPluginSetup } from '../../../../plugins/charts/public';
|
|
||||||
|
|
||||||
export interface VisTypeXyDependencies {
|
export interface VisTypeXyDependencies {
|
||||||
uiSettings: IUiSettingsClient;
|
uiSettings: IUiSettingsClient;
|
||||||
charts: ChartsPluginSetup;
|
charts: ChartsPluginSetup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||||
|
export interface VisTypeXyPluginSetup {}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export interface VisTypeXyPluginSetupDependencies {
|
export interface VisTypeXyPluginSetupDependencies {
|
||||||
expressions: ReturnType<ExpressionsPublicPlugin['setup']>;
|
expressions: ReturnType<ExpressionsPublicPlugin['setup']>;
|
||||||
|
@ -53,7 +53,7 @@ export interface VisTypeXyPluginStartDependencies {
|
||||||
type VisTypeXyCoreSetup = CoreSetup<VisTypeXyPluginStartDependencies, void>;
|
type VisTypeXyCoreSetup = CoreSetup<VisTypeXyPluginStartDependencies, void>;
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export class VisTypeXyPlugin implements Plugin<void, void> {
|
export class VisTypeXyPlugin implements Plugin<VisTypeXyPluginSetup, void> {
|
||||||
constructor(public initializerContext: PluginInitializerContext) {}
|
constructor(public initializerContext: PluginInitializerContext) {}
|
||||||
|
|
||||||
public async setup(
|
public async setup(
|
||||||
|
@ -77,6 +77,8 @@ export class VisTypeXyPlugin implements Plugin<void, void> {
|
||||||
visTypeDefinitions.forEach((vis: any) =>
|
visTypeDefinitions.forEach((vis: any) =>
|
||||||
visualizations.createBaseVisualization(vis(visualizationDependencies))
|
visualizations.createBaseVisualization(vis(visualizationDependencies))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
public start(core: CoreStart, deps: VisTypeXyPluginStartDependencies) {
|
public start(core: CoreStart, deps: VisTypeXyPluginStartDependencies) {
|
|
@ -17,24 +17,13 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { npSetup, npStart } from 'ui/new_platform';
|
import { schema } from '@kbn/config-schema';
|
||||||
import { PluginInitializerContext } from 'kibana/public';
|
|
||||||
|
|
||||||
import { plugin } from '.';
|
export const config = {
|
||||||
import { VisTypeXyPluginSetupDependencies, VisTypeXyPluginStartDependencies } from './plugin';
|
schema: schema.object({ enabled: schema.boolean({ defaultValue: false }) }),
|
||||||
|
|
||||||
const setupPlugins: Readonly<VisTypeXyPluginSetupDependencies> = {
|
|
||||||
expressions: npSetup.plugins.expressions,
|
|
||||||
visualizations: npSetup.plugins.visualizations,
|
|
||||||
charts: npSetup.plugins.charts,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const startPlugins: Readonly<VisTypeXyPluginStartDependencies> = {
|
export const plugin = () => ({
|
||||||
expressions: npStart.plugins.expressions,
|
setup() {},
|
||||||
visualizations: npStart.plugins.visualizations,
|
start() {},
|
||||||
};
|
});
|
||||||
|
|
||||||
const pluginInstance = plugin({} as PluginInitializerContext);
|
|
||||||
|
|
||||||
export const setup = pluginInstance.setup(npSetup.core, setupPlugins);
|
|
||||||
export const start = pluginInstance.start(npStart.core, startPlugins);
|
|
Loading…
Reference in a new issue