Hello everyone!
I’ve a question that concern the adding of a navbar button via a plugin. I read some source code of other plugins but my code doesn’t work: no error with mvn package but the .jar doesn’t show my new button when I add it to my plugin/ folder.
I thought it was just the index.jsx file to change. Here my folder architecture (taken from https://github.com/Graylog2/graylog-plugin-sample):
And here the content of my index.jsx:
import webpackEntry from 'webpack-entry';
import { PluginManifest, PluginStore } from 'graylog-web-plugin/plugin';
import packageJson from '../../package.json';
import LocalDoc from 'documentation/LocalDoc';
const manifest = new PluginManifest(packageJson, {
/* This is the place where you define which entities you are providing to the web interface.
Right now you can add routes and navigation elements to it.
Examples: */
// Adding a route to /sample, rendering YourReactComponent when called:
routes: [
{ path: '/localdoc', component: LocalDoc},
],
// Adding an element to the top navigation pointing to /sample named "Sample":
navigation: [
{ path: '/localdoc', description: 'Documentation' },
]
});
PluginStore.register(manifest);
if (module.hot) {
module.hot.accept();
module.hot.dispose(() => PluginStore.unregister(manifest));
}
And then the content of documentation/LocalDoc.jsx:
import React from 'react';
import { Row, Col } from 'react-bootstrap';
import { PageHeader } from 'components/common';
const LocalDoc = React.createClass({
render() {
return (
<PageHeader title="Sample Plugin">
<span>
Hello from the Sample plugin!
</span>
</PageHeader>
);
}
});
export default LocalDoc;
My goal is just to expose a new button in a navbar to have a new documentation (or document) page which is contain in the plugin. What am I missing ?
Regards.