Skip to content

Commit

Permalink
7.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
IIIEII committed Apr 6, 2020
1 parent c190858 commit 6373272
Show file tree
Hide file tree
Showing 24 changed files with 2,527 additions and 1,214 deletions.
10 changes: 10 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
extends: "@elastic/kibana"

settings:
import/resolver:
'@elastic/eslint-import-resolver-kibana':
rootPackageName: 'transform_vis'

rules:
'@kbn/eslint/require-license-header': 'off'
21 changes: 0 additions & 21 deletions index.js

This file was deleted.

26 changes: 26 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { resolve } from 'path';
import { Legacy } from 'kibana';

import { LegacyPluginApi, LegacyPluginInitializer } from '../../src/legacy/types';

const transformPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) =>
new Plugin({
id: 'transform_vis',
require: ['elasticsearch'],
publicDir: resolve(__dirname, 'public'),
uiExports: {
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
hacks: [resolve(__dirname, 'public/legacy')],
injectDefaultVars: server => ({ transformVisOptions: server.config().get('transform_vis') }),
},
init: (server: Legacy.Server) => ({}),
config(Joi: any) {
return Joi.object({
enabled: Joi.boolean().default(true),
allow_unsafe: Joi.boolean().default(false),
}).default();
},
} as Legacy.PluginSpecOptions);

// eslint-disable-next-line import/no-default-export
export default transformPluginInitializer;
48 changes: 30 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,53 @@
{
"name": "transform_vis",
"version": "7.3.0.1",
"version": "7.6.1.0",
"description": "Transform Visualization",
"main": "index.js",
"kibana": {
"version": "7.3.0",
"version": "7.6.1",
"templateVersion": "1.0.0"
},
"license": "Apache-2.0",
"contributors": [
"Alexander Shepel <[email protected]>"
],
"keywords": [
"kibana",
"transform_vis",
"plugin"
],
"scripts": {
"preinstall": "node ../../kibana/preinstall_check",
"kbn": "node ../../kibana/scripts/kbn",
"preinstall": "node ../../preinstall_check",
"kbn": "node ../../scripts/kbn",
"es": "node ../../scripts/es",
"lint": "eslint .",
"start": "plugin-helpers start",
"test:server": "plugin-helpers test:server",
"test:browser": "plugin-helpers test:browser",
"build": "plugin-helpers build"
},
"devDependencies": {
"@elastic/eslint-config-kibana": "link:../../kibana/packages/eslint-config-kibana",
"@elastic/eslint-import-resolver-kibana": "link:../../kibana/packages/kbn-eslint-import-resolver-kibana",
"@kbn/plugin-helpers": "link:../../kibana/packages/kbn-plugin-helpers",
"babel-eslint": "^8.0.2",
"eslint": "^4.11.0",
"eslint-plugin-babel": "^4.1.1",
"eslint-plugin-import": "^2.3.0",
"eslint-plugin-jest": "^21.3.2",
"eslint-plugin-mocha": "^4.9.0",
"@elastic/eslint-config-kibana": "link:../../packages/eslint-config-kibana",
"@elastic/eslint-import-resolver-kibana": "link:../../packages/kbn-eslint-import-resolver-kibana",
"@kbn/expect": "link:../../packages/kbn-expect",
"@kbn/plugin-helpers": "link:../../packages/kbn-plugin-helpers",
"@types/babel__standalone": "^7.1.2",
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jest": "^22.4.1",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-mocha": "^5.3.0",
"eslint-plugin-no-unsanitized": "^3.0.2",
"eslint-plugin-prefer-object-spread": "^1.2.1",
"eslint-plugin-react": "^7.0.1",
"expect.js": "^0.3.1"
"eslint-plugin-react": "^7.12.4"
},
"dependencies": {
"@babel/standalone": "^7.0.0-beta.56",
"brace": "^0.11.1",
"@babel/standalone": "7.9.4",
"mustache": "2.3.0",
"react-shadow": "^16.3.2",
"@webcomponents/shadydom": "^1.6.0"
"@webcomponents/shadydom": "^1.6.0",
"@elastic/filesaver": "^1.1.2"
}
}
33 changes: 33 additions & 0 deletions public/_transform_vis.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.visEditor--transform {
vis-editor-vis-options, vis-options-react-wrapper {
flex-grow: 1;
display: flex;
flex-direction: column;
}

.visEditor--transform__textarea {
flex-grow: 1;
}

.transformEditor {
height: 100%;
}
}

.transform-vis-editor {
display: flex;
flex-direction: column;
height: 100%;
min-height: 100%;
}

.transform-vis-editor [role="tabpanel"] {
display: flex;
flex-direction: column;
flex: 1;
overflow: auto;
}

.output-vis {
width: 100%;
}
20 changes: 2 additions & 18 deletions public/index.scss
Original file line number Diff line number Diff line change
@@ -1,18 +1,2 @@
.transform-vis-editor {
display: flex;
flex-direction: column;
height: 100%;
min-height: 100%;
}

.transform-vis-editor [role="tabpanel"] {
display: flex;
flex-direction: column;
flex: 1;
overflow: auto;
}

.output-vis {
width: 100%;
}

@import '../../../src/legacy/ui/public/styles/styling_constants';
@import './transform_vis';
6 changes: 6 additions & 0 deletions public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { PluginInitializerContext } from 'kibana/public';
import { TransformPlugin as Plugin } from './plugin';

export function plugin(initializerContext: PluginInitializerContext) {
return new Plugin(initializerContext);
}
16 changes: 16 additions & 0 deletions public/legacy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart } from 'ui/new_platform';

import { setup as visualizationsSetup } from '../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy';
import { TransformPluginSetupDependencies } from './plugin';
import { plugin } from '.';

const plugins: Readonly<TransformPluginSetupDependencies> = {
expressions: npSetup.plugins.expressions,
visualizations: visualizationsSetup,
};

const pluginInstance = plugin({} as PluginInitializerContext);

export const setup = pluginInstance.setup(npSetup.core, plugins);
export const start = pluginInstance.start(npStart.core);
22 changes: 0 additions & 22 deletions public/on_mount.js

This file was deleted.

32 changes: 32 additions & 0 deletions public/on_mount.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { Ref } from 'react';

interface OnMountComponentProps {
onMount: () => {};
onUpdate: () => {};
dangerouslySetInnerHTML: {
__html: string;
};
forwardedRef: Ref<HTMLDivElement>;
}

class OnMount extends React.Component<OnMountComponentProps> {
componentDidMount() {
this.props.onMount();
}
componentDidUpdate() {
this.props.onUpdate();
}
render() {
return (
// eslint-disable-next-line react/no-danger,prettier/prettier
<div ref={this.props.forwardedRef} dangerouslySetInnerHTML={this.props.dangerouslySetInnerHTML} />
);
}
}

// eslint-disable-next-line import/no-default-export
export default React.forwardRef<HTMLDivElement, Omit<OnMountComponentProps, 'forwardedRef'>>(
(props, ref) => {
return <OnMount {...props} forwardedRef={ref} />;
}
);
37 changes: 37 additions & 0 deletions public/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'kibana/public';
import chrome from 'ui/chrome';
import { Plugin as ExpressionsPublicPlugin } from '../../../src/plugins/expressions/public';
import { VisualizationsSetup } from '../../../src/legacy/core_plugins/visualizations/public';

import { createTransformVisDefinition } from './transform_vis';
import { createTransformVisFn } from './transform_fn';

/** @internal */
export interface TransformPluginSetupDependencies {
expressions: ReturnType<ExpressionsPublicPlugin['setup']>;
visualizations: VisualizationsSetup;
}

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

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

public async setup(
core: CoreSetup,
{ expressions, visualizations }: TransformPluginSetupDependencies
) {
const $injector = await chrome.dangerouslyGetActiveInjector();
visualizations.types.createReactVisualization(
createTransformVisDefinition({ uiSettings: core.uiSettings, es: $injector.get('es') })
);
expressions.registerFunction(() =>
createTransformVisFn({ uiSettings: core.uiSettings, es: $injector.get('es') })
);
}

public async start(core: CoreStart) {}
}
Loading

0 comments on commit 6373272

Please sign in to comment.