Developing dashboard plugins

I am currently developing a few small dashboard plugins for our OOD instance. The main idea is to natively show the user some information on their account quota and system metrics on the dashboard.

I have read through the information that I could find on this topic (e.g. Passenger App inside dashboard? - #2 by jeff.ohrstrom ) and have found the good25 examples referenced there to help a lot.

While currently undocumented it seems to work to put plugins at /etc/ood/config/plugins in production to deploy plugins. However I am struggling to do something similar for dashboard development. Here I need to scatter my plugin files to the different folders to the dashboard app to find them. Is this the expected behavior or am I missing something?

Hi and welcome!

You may be looking for Custom Dashboard Layouts, specifically the section at the bottom where it talks about developing custom widgets to include on the landing page. These custom widgets are rails partials that you can place in /etc/ood/config/apps/dashboard/views/widgets/. If your plugins depend on ruby code, you can load this into the environment from a custom initializer in /etc/ood/config/apps/dashboard/initializers/. That way you can keep your plugin code together and separate from OnDemand source code.

Let me know if this works or if you have any questions, and if you want to provide more details about the plugin code you are using I could give suggestions on what those files might look like.

You also can check out the quota widget added in add a file quota widget by johrstrom · Pull Request #4206 · OSC/ondemand · GitHub and the System Status Dashboard Widget by jmeddick · Pull Request #4532 · OSC/ondemand · GitHub to see how closely they meet your needs. Both will be included in the upcoming 4.1 release, which should be out around the end of the month.

Thanks Braeden for the quick response. I was aware of the Custom Layouts in the Dashboard documentation but this requires splitting my codebase and putting stuff in different locations. Jeff mentions the ability to colocate these files in a plugin directory at /etc/ood/config/plugins which indeed seems to work (although I think is still undocumented).

While I can use /etc/ood/config/plugins well for production deployments this doesn’t work during development. I like the idea of developing the dashboard and it’s widgets through OnDemand through the production instance in a sandbox as described in Developing the OOD dashboard, but this requires me to split the code again into a million different paths. Is there a way to make a plugins directory work there as well?

I think I see what you mean. Since you can’t edit the production plugins as a developer, you can pass a new plugins path using the OOD_PLUGINS_DIRECTORY environment variable (in a .env.local file), or by setting plugins_directory: /path/to/plugins in your dashboard config YAMLs. You would have to copy over your existing (production) plugins to your new plugins directory, but be able to keep everything in one place.

1 Like