# Plugin development - UI navigation bar

**URL:** <https://community.graylog.org/t/plugin-development-ui-navigation-bar/5474>\
**Category:** Development\
**Created:** [June 5, 2018, 12:29pm UTC](https://community.graylog.org/t/plugin-development-ui-navigation-bar/5474 "2018-06-05T12:29:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sarro](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@Sarro](https://community.graylog.org/u/Sarro)\
**Post date:** [June 5, 2018, 12:29pm UTC](https://community.graylog.org/t/plugin-development-ui-navigation-bar/5474/1 "2018-06-05T12:29:30Z")

</div>

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](https://github.com/Graylog2/graylog-plugin-sample)):

![Capture](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/c/c37a81f7ab13093a71097607748be745d0fbadb7.PNG)

And here the content of my index.jsx:

```auto
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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![Sarro](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@Sarro](https://community.graylog.org/u/Sarro)\
**Post date:** [June 6, 2018, 8:13am UTC](https://community.graylog.org/t/plugin-development-ui-navigation-bar/5474/2 "2018-06-06T08:13:17Z")

</div>

Mmm it seems all the maven archetypes or the sample plugin are not up-to-date.  
Here my solution to make it work:

1. Don’t take the pom.xml or package.json of the sample plugin (an issue is currently open, I didn’t see it. My bad.)
2. You need to take the latest non-alpha release of graylog-server on GitHub. Be carreful, `git clone` take you on the master branch with the 3.0.0 ALPHA. So get the project here: [https://github.com/Graylog2/graylog2-server/releases](https://github.com/Graylog2/graylog2-server/releases), it’s simplier
3. Unzip and go to the main directory
4. Fetch the plugin archetype: `mvn archetype:generate -DarchetypeGroupId=org.graylog -DarchetypeArtifactId=graylog-plugin-archetype -DarchetypeVersion=2.4.5`
5. And here the files you need to modify:

**package.json** : the devdependencies section.

```auto
  "devDependencies": {
    "webpack": "^3.4.1",
    "react": "^0.14.9",
    "react-dom": "^0.14.9",
    "react-addons-test-utils": "0.14.8",
    "graylog-web-plugin": "file:../graylog2-web-interface/packages/graylog-web-plugin"
  }

```

**pom.xml** : you need to add a parent, otherwise the web part of your plugin (like a new button in the nav bar) won’t be compiled.

```auto
    <parent>
        <artifactId>graylog-plugin-web-parent</artifactId>
        <groupId>org.graylog.plugins</groupId>
        <version>2.4.5</version>
    </parent>

```

**build.config.js** : the default relative path to graylog2-web-interface is wrong.

```auto
const path = require('path');

module.exports = {
  // Make sure that this is the correct path to the web interface part of the Graylog server repository.
  web_src_path: path.resolve(__dirname, '..', 'graylog2-web-interface'),
};

```

Aaaand it’s all! After these modifications and with the index.jsx in my precedent post I was able too add a new button in the navbar.

I hope this will help,

Regards

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/3X/c/7/c7c09c6b5099570133d6502b83f50ba4430de5b6.png) [@system](https://community.graylog.org/u/system)\
**Post date:** [June 20, 2018, 8:24am UTC](https://community.graylog.org/t/plugin-development-ui-navigation-bar/5474/3 "2018-06-20T08:24:42Z")

</div>

Closed on June 20, 2018, 8:24am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
