forked from PhaedrusTheGreek/transform_vis
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
2,527 additions
and
1,214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} />; | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) {} | ||
} |
Oops, something went wrong.