Skip to content

Commit

Permalink
Add ConfigSchema, Server, rename visTypeMetrics to visTypeMetric
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Apr 15, 2020
1 parent 92f4ee4 commit 654a09c
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 4 deletions.
26 changes: 26 additions & 0 deletions src/plugins/vis_type_metric/config.ts
Original file line number Diff line number Diff line change
@@ -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<typeof configSchema>;
4 changes: 2 additions & 2 deletions src/plugins/vis_type_metric/kibana.json
Original file line number Diff line number Diff line change
@@ -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"]
}
5 changes: 3 additions & 2 deletions src/plugins/vis_type_metric/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -41,9 +42,9 @@ export interface MetricVisPluginStartDependencies {

/** @internal */
export class MetricVisPlugin implements Plugin<void, void> {
initializerContext: PluginInitializerContext;
initializerContext: PluginInitializerContext<ConfigSchema>;

constructor(initializerContext: PluginInitializerContext) {
constructor(initializerContext: PluginInitializerContext<ConfigSchema>) {
this.initializerContext = initializerContext;
}

Expand Down
34 changes: 34 additions & 0 deletions src/plugins/vis_type_metric/server/index.ts
Original file line number Diff line number Diff line change
@@ -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<ConfigSchema> = {
schema: configSchema,
deprecations: ({ renameFromRoot }) => [
renameFromRoot('metric_vis.enabled', 'vis_type_metric.enabled'),
],
};

export const plugin = () => ({
setup() {},
start() {},
});

0 comments on commit 654a09c

Please sign in to comment.