Skip to content

Commit

Permalink
adding interpreter uiExports (#33391) (#33547)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar authored Mar 20, 2019
1 parent f8fb3eb commit aa75ce4
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/legacy/core_plugins/interpreter/public/interpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/

import 'uiExports/interpreter';
import { register, registryFactory } from '@kbn/interpreter/common';
import { initializeInterpreter } from './lib/interpreter';
import { registries } from './registries';
Expand Down
1 change: 1 addition & 0 deletions src/legacy/ui/ui_exports/ui_export_types/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export {
visResponseHandlers,
visRequestHandlers,
visEditorTypes,
interpreter,
savedObjectTypes,
embeddableFactories,
fieldFormats,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const search = appExtension;
export const shareContextMenuExtensions = appExtension;
// Add a visualize app extension that should be used for visualize specific stuff
export const visualize = appExtension;
export const interpreter = appExtension;

// aliases visTypeEnhancers to the visTypes group
export const visTypeEnhancers = wrap(alias('visTypes'), appExtension);
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/canvas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function canvas(kibana) {
euiIconType: 'canvasApp',
main: 'plugins/canvas/app',
},
interpreter: ['plugins/canvas/browser_functions', 'plugins/canvas/renderers'],
styleSheetPaths: resolve(__dirname, 'public/style/index.scss'),
hacks: [
// window.onerror override
Expand Down
14 changes: 14 additions & 0 deletions x-pack/plugins/canvas/public/browser_functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { functionsRegistry } from 'plugins/interpreter/registries';
import { functions } from '../canvas_plugin_src/functions/browser';

functions.forEach(fn => {
functionsRegistry.register(fn);
});

export default functions;
6 changes: 1 addition & 5 deletions x-pack/plugins/canvas/public/components/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ import { elementsRegistry } from '../../lib/elements_registry';
import { templatesRegistry } from '../../lib/templates_registry';
import { tagsRegistry } from '../../lib/tags_registry';
import { elementSpecs } from '../../../canvas_plugin_src/elements';
import { renderFunctions } from '../../../canvas_plugin_src/renderers';
import { transformSpecs } from '../../../canvas_plugin_src/uis/transforms';
import { modelSpecs } from '../../../canvas_plugin_src/uis/models';
import { viewSpecs } from '../../../canvas_plugin_src/uis/views';
import { datasourceSpecs } from '../../../canvas_plugin_src/uis/datasources';
import { args as argSpecs } from '../../../canvas_plugin_src/uis/arguments';
import { tagSpecs } from '../../../canvas_plugin_src/uis/tags';
import { functions as browserFunctions } from '../../../canvas_plugin_src/functions/browser';
import { functions as commonPluginFunctions } from '../../../canvas_plugin_src/functions/common';
import { templateSpecs } from '../../../canvas_plugin_src/templates';
import { clientFunctions } from '../../functions';

Expand Down Expand Up @@ -60,13 +57,12 @@ addRegistries(registries, {

register(registries, {
elements: elementSpecs,
renderers: renderFunctions,
transformUIs: transformSpecs,
modelUIs: modelSpecs,
viewUIs: viewSpecs,
datasourceUIs: datasourceSpecs,
argumentUIs: argSpecs,
browserFunctions: browserFunctions.concat(clientFunctions).concat(commonPluginFunctions),
browserFunctions: clientFunctions,
templates: templateSpecs,
tagUIs: tagSpecs,
});
Expand Down
14 changes: 14 additions & 0 deletions x-pack/plugins/canvas/public/renderers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { renderersRegistry } from 'plugins/interpreter/registries';
import { renderFunctions } from '../canvas_plugin_src/renderers';

renderFunctions.forEach(r => {
renderersRegistry.register(r);
});

export default renderFunctions;

0 comments on commit aa75ce4

Please sign in to comment.