Skip to content

Commit

Permalink
empty plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Jun 6, 2017
1 parent b5f18e9 commit d52bc31
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core_plugins/control_visualizations/index.js
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'
]
}
});
}
4 changes: 4 additions & 0 deletions src/core_plugins/control_visualizations/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "terms_vis",
"version": "kibana"
}
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 };
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;
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 */
}
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 };
1 change: 1 addition & 0 deletions src/core_plugins/kibana/public/visualize/wizard/wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.controller('VisualizeWizardStep1', function ($scope, $route, kbnUrl, time

const visTypeCategoryToHumanReadableMap = {
[CATEGORY.BASIC]: 'Basic Charts',
[CATEGORY.CONTROL]: 'Dashboard Controls',
[CATEGORY.DATA]: 'Data',
[CATEGORY.GRAPHIC]: 'Graphic',
[CATEGORY.MAP]: 'Maps',
Expand Down
1 change: 1 addition & 0 deletions src/ui/public/vis/vis_category.js
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',
Expand Down

0 comments on commit d52bc31

Please sign in to comment.