OSC / ondemand

Supercomputing. Seamlessly. Open, Interactive HPC Via the Web
https://openondemand.org/
MIT License
281 stars 104 forks source link

Dashboard File Manager Plugins #3319

Open multimeric opened 8 months ago

multimeric commented 8 months ago

Copying from https://discourse.openondemand.org/t/support-dashboard-file-manager-plugins/3218.

This is a feature request for adding custom user plugins to the files app. The motivation for this is that, if you're working on a custom OOD app that focuses on the file system, you will have to re-implement all the file browsing logic that OnDemand already has.

A better solution would be to allow custom plugins that hook into the dashboard. I envisage there being a manifest file that adds new menu items either to the directory menu or to the file menu (circled in red) Screen Shot 2024-01-23 at 6 42 41 pm

I noticed an existing app that kind of tries to do this, but there is some ugly patching of the actual OnDemand codebase required to install it: GitHub - c3se/ood_dashboard_diskquota: OpenOndemand Dashboard App for displaying disk quota 3.

I might have some time to work on this in the short term, but I suspect this would require quite intimate knowledge of OOD and the files app, since a plugin system is more complex than simply tweaking the existing logic.

johrstrom commented 8 months ago

I think the issue with this is the action. Sure we could create a new button through some YAML, but it's not clear to me how to define the action that button takes when it's pressed (or, rather, let the center define the action).

multimeric commented 8 months ago

Could this type of app come with a Rails view and controller definition? This would allow the right level of flexibility. Really the plugin mechanism is just needed to handle the app's discovery and loading of additional routes dynamically, without having to edit the core code base.

johrstrom commented 8 months ago

Could this type of app come with a Rails view and controller definition?

Yea I guess it would have to, especially the controller anyhow. If the site were able the controller then I'd say the rest would fall into place.

multimeric commented 8 months ago

I had another idea which might be more palatable. Rather than create a new type of plugin, we could instead just let passenger apps expose an entry in their manifest for items they add to the files menu, and then the dashboard app just redirects to the passenger app, passing the chosen file as a parameter.

For example, say I wanted to add a "compress this file" plugin to OnDemand. I would then make a new passenger app with a manifest with:

name: File Compresser
description: Compresses a file in OnDemand
files_menu_items:
- icon: file-zipper # Font awesome ID
  text: Compress File
  url: "/compress/{path}" # The file path gets interpolated into the string, and then appended to the app's URL

Then in my passenger app, I make a GUI that lets you configure compression operations (compression level, algorithm etc) as well as the file path, but this is pre-populated using the URL if it's provided, namely if we were sent here from the files app.