-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
8 changed files
with
115 additions
and
0 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,9 @@ | ||
export default function (kibana) { | ||
return new kibana.Plugin({ | ||
uiExports: { | ||
visTypes: [ | ||
'plugins/terms_vis/terms_vis/terms_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,4 @@ | ||
{ | ||
"name": "terms_vis", | ||
"version": "kibana" | ||
} |
33 changes: 33 additions & 0 deletions
33
src/core_plugins/control_visualizations/public/terms_vis/editor_controller.js
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 @@ | ||
import { VisController } from './vis_controller'; | ||
|
||
class EditorController { | ||
constructor(el) { | ||
this.el = el; | ||
this.editorDiv = document.createElement('div'); | ||
this.visDiv = document.createElement('div'); | ||
this.el.appendChild(this.editorDiv); | ||
this.el.appendChild(this.visDiv); | ||
this.visualization = new VisController(this.visDiv); | ||
} | ||
|
||
render(vis, visData) { | ||
return new Promise(resolve => { | ||
console.log('rendering editor'); | ||
this.editorDiv.innerHTML = 'my editor'; | ||
// we probably want to render the visualization as well ? | ||
this.visualization.render(vis, visData).then(() => { | ||
resolve('when done rendering'); | ||
}); | ||
}); | ||
} | ||
|
||
resize() { | ||
return this.visualization.resize(); | ||
} | ||
|
||
destroy() { | ||
this.visualization.destroy(); | ||
} | ||
} | ||
|
||
export { EditorController }; |
37 changes: 37 additions & 0 deletions
37
src/core_plugins/control_visualizations/public/terms_vis/terms_vis.js
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 './terms_vis.less'; | ||
import { CATEGORY } from 'ui/vis/vis_category'; | ||
import { VisFactoryProvider } from 'ui/vis/vis_factory'; | ||
import { VisTypesRegistryProvider } from 'ui/registry/vis_types'; | ||
import { VisController } from './vis_controller'; | ||
import { EditorController } from './editor_controller'; | ||
|
||
function TermsVisProvider(Private) { | ||
const VisFactory = Private(VisFactoryProvider); | ||
|
||
// return the visType object, which kibana will use to display and configure new Vis object of this type. | ||
return VisFactory.createBaseVisualization({ | ||
name: 'terms_vis', | ||
title: 'Terms Control', | ||
icon: 'fa fa-gear', | ||
description: 'Terms Control', | ||
category: CATEGORY.CONTROL, | ||
visualization: VisController, | ||
visConfig: { | ||
defaults: { | ||
// add default parameters | ||
fontSize: '50' | ||
}, | ||
}, | ||
editor: EditorController, | ||
editorConfig: { | ||
}, | ||
requestHandler: 'none', | ||
responseHandler: 'none', | ||
}); | ||
} | ||
|
||
// register the provider with the visTypes registry | ||
VisTypesRegistryProvider.register(TermsVisProvider); | ||
|
||
// export the provider so that the visType can be required with Private() | ||
export default TermsVisProvider; |
5 changes: 5 additions & 0 deletions
5
src/core_plugins/control_visualizations/public/terms_vis/terms_vis.less
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,5 @@ | ||
@import (reference) "~ui/styles/mixins.less"; | ||
|
||
.terms_vis { | ||
/* add your styles here */ | ||
} |
25 changes: 25 additions & 0 deletions
25
src/core_plugins/control_visualizations/public/terms_vis/vis_controller.js
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,25 @@ | ||
|
||
class VisController { | ||
constructor(el) { | ||
this.el = el; | ||
} | ||
|
||
render(vis, visData) { | ||
return new Promise(resolve => { | ||
console.log('rendering visualization'); | ||
console.log('visData', visData); | ||
this.el.innerHTML = 'my new visualization'; | ||
resolve('when done rendering'); | ||
}); | ||
} | ||
|
||
resize() { | ||
console.log('resizing visualization'); | ||
} | ||
|
||
destroy() { | ||
console.log('destroying vis'); | ||
} | ||
} | ||
|
||
export { VisController }; |
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
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,5 +1,6 @@ | ||
export const CATEGORY = { | ||
BASIC: 'basic', | ||
CONTROL: 'control', | ||
DATA: 'data', | ||
MAP: 'map', | ||
OTHER: 'other', | ||
|