Custom menu entries and page

Hello,
I am working on a plugin that will add a menu entry on the left menu and will display a page with custom functionalities. Can anyone share how to achieve this, and if you have any example templates and code, to share it?
I didn’t find any custom plugin examples related to the rendering of a new page and menu item.
Thanks in advance!

@Todor Take a look at the blog post I wrote about plugins and how to build them: Introduction to OpenSearch Dashboard Plugins · OpenSearch

You will have to do 2 things to get what you want:

  1. Create a new plugin to add the functionality that you want. i.e. the new page
  2. Register your plugin with the core application to let it know how to render your app. OpenSearch-Dashboards/plugin.ts at 2.6 · opensearch-project/OpenSearch-Dashboards · GitHub

Also look at the example plugins found in the repo for more insights on how to write a plugin. They are minimal examples that can get help you understand a lot of the fundamentals easily.

3 Likes

@ashwinpc Thank you! How can I then add these plugins to my docker project? I managed to run them only on the OpenSearchDashboards repo?

Thats actually a good question. Considering that there are a few ways you can setup the application to use docker, can you tell me a little more about your docker setup? how exactly are you running the project using docker?

1 Like

Yes. I am using a docker compose file, and I want to set up the yarn watcher with it, but it seems that with docker it runs in production mode, without the -dev in the yarn command. Could you give me a hint on how to run the image in development mode? I have created a volume for my custom plugin in the docker compose file, but nothing happens when I modify the plugin files.

@ashwinpc Hello,
I am still having problems integrating the yarn watch of the plugins in docker.
What I want is to run OpenSearch Dashboards as a docker image and have my custom plugin watched. I want to mimic the yarn watch in the OSD repo in the docker image so I can watch every change in the plugin, located locally.

Do you have any ideas on how to resolve this because it is urgent?

Okay so it looks like you are using the Dashboards production image to setup your plugin. Unfortunately building plugins on OSD can only work with the Dashboards source code. This becomes a little tricky when you want o develop using docker. You can refer to this guide on how to develop in OSD using docker. The only change you need to make here for plugin development is to add your plugin to the folder inside the docker containers volume. You can also modify the compose file to point to an existing volume on your file system, but the guide does not cover that. Hope this helps.

I use a docker compose file with an opensearch-dashboards config there, along with two opensearch nodes. The goal is to make a custom config on start of opensearch-dashboards which will watch the plugin in my repo. Do you know how to do that?

Dashboards optimizer should automatically watch the files in the plugin folder without any additional configuration. As for a custom config, you can simply replace the config file present in ./config/opensearch_dashboards.yml