Skip to content

Commit

Permalink
Add ConfigSchema, server, rename markdown_vis to visTypeMarkdown
Browse files Browse the repository at this point in the history
  • Loading branch information
maryia-lapata committed Apr 16, 2020
1 parent b009866 commit bf072eb
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/src/plugins/dashboard/ @elastic/kibana-app
/src/plugins/discover/ @elastic/kibana-app
/src/plugins/vis_type_timeseries/ @elastic/kibana-app
/src/plugins/vis_type_markdown/ @elastic/kibana-app

# Core UI
# Exclude tutorials folder for now because they are not owned by Kibana app and most will move out soon
Expand Down
26 changes: 26 additions & 0 deletions src/plugins/vis_type_markdown/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>;
3 changes: 2 additions & 1 deletion src/plugins/vis_type_markdown/kibana.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"id": "markdown_vis",
"id": "visTypeMarkdown",
"version": "kibana",
"ui": true,
"server": true,
"requiredPlugins": ["expressions", "visualizations"]
}
5 changes: 3 additions & 2 deletions src/plugins/vis_type_markdown/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { VisualizationsSetup } from '../../visualizations/public';

import { markdownVisDefinition } from './markdown_vis';
import { createMarkdownVisFn } from './markdown_fn';
import { ConfigSchema } from '../config';

import './index.scss';

Expand All @@ -34,9 +35,9 @@ export interface MarkdownPluginSetupDependencies {

/** @internal */
export class MarkdownPlugin 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_markdown/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('markdown_vis.enabled', 'vis_type_markdown.enabled'),
],
};

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

0 comments on commit bf072eb

Please sign in to comment.