From 654a09c0725ecfaac9caf4e06bffbfd01040041d Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Wed, 15 Apr 2020 10:35:33 +0200 Subject: [PATCH] Add ConfigSchema, Server, rename visTypeMetrics to visTypeMetric --- src/plugins/vis_type_metric/config.ts | 26 +++++++++++++++ src/plugins/vis_type_metric/kibana.json | 4 +-- src/plugins/vis_type_metric/public/plugin.ts | 5 +-- src/plugins/vis_type_metric/server/index.ts | 34 ++++++++++++++++++++ 4 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 src/plugins/vis_type_metric/config.ts create mode 100644 src/plugins/vis_type_metric/server/index.ts diff --git a/src/plugins/vis_type_metric/config.ts b/src/plugins/vis_type_metric/config.ts new file mode 100644 index 0000000000000..6749bd83de39f --- /dev/null +++ b/src/plugins/vis_type_metric/config.ts @@ -0,0 +1,26 @@ +/* + * 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 { schema, TypeOf } from '@kbn/config-schema'; + +export const configSchema = schema.object({ + enabled: schema.boolean({ defaultValue: true }), +}); + +export type ConfigSchema = TypeOf; diff --git a/src/plugins/vis_type_metric/kibana.json b/src/plugins/vis_type_metric/kibana.json index 21ed9e3ce93d6..24135d257b317 100644 --- a/src/plugins/vis_type_metric/kibana.json +++ b/src/plugins/vis_type_metric/kibana.json @@ -1,8 +1,8 @@ { - "id": "visTypeMetrics", + "id": "visTypeMetric", "version": "8.0.0", "kibanaVersion": "kibana", - "server": false, + "server": true, "ui": true, "requiredPlugins": ["data", "visualizations", "charts","expressions"] } diff --git a/src/plugins/vis_type_metric/public/plugin.ts b/src/plugins/vis_type_metric/public/plugin.ts index 38b972716fe7f..a3951fa46c21c 100644 --- a/src/plugins/vis_type_metric/public/plugin.ts +++ b/src/plugins/vis_type_metric/public/plugin.ts @@ -26,6 +26,7 @@ import { createMetricVisTypeDefinition } from './metric_vis_type'; import { ChartsPluginSetup } from '../../charts/public'; import { DataPublicPluginStart } from '../../data/public'; import { setFormatService } from './services'; +import { ConfigSchema } from '../config'; /** @internal */ export interface MetricVisPluginSetupDependencies { @@ -41,9 +42,9 @@ export interface MetricVisPluginStartDependencies { /** @internal */ export class MetricVisPlugin implements Plugin { - initializerContext: PluginInitializerContext; + initializerContext: PluginInitializerContext; - constructor(initializerContext: PluginInitializerContext) { + constructor(initializerContext: PluginInitializerContext) { this.initializerContext = initializerContext; } diff --git a/src/plugins/vis_type_metric/server/index.ts b/src/plugins/vis_type_metric/server/index.ts new file mode 100644 index 0000000000000..ce550dc81dd85 --- /dev/null +++ b/src/plugins/vis_type_metric/server/index.ts @@ -0,0 +1,34 @@ +/* + * 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 { PluginConfigDescriptor } from 'kibana/server'; + +import { configSchema, ConfigSchema } from '../config'; + +export const config: PluginConfigDescriptor = { + schema: configSchema, + deprecations: ({ renameFromRoot }) => [ + renameFromRoot('metric_vis.enabled', 'vis_type_metric.enabled'), + ], +}; + +export const plugin = () => ({ + setup() {}, + start() {}, +});