OSC / ondemand

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

How to add Shell app Targets #861

Closed gagandaroach closed 2 years ago

gagandaroach commented 3 years ago

Hello.

How may I add additional shortcuts in the navbar Cluster -> shell to log in submenu?

image

For example, in the above screenshot I would like to add 2 new ssh options against other nodes with specific options.

image I have been able to add custom options to the file menu with the /etc/ood/config/apps/dashboard/initializers/ood.rb

┆Issue is synchronized with this Asana task by Unito

johrstrom commented 3 years ago

The comment on this ticket may help. Essentially what you want to do is add a cluster file, but it's only got data for SSH. So you can't submit jobs to it, but it'll show up in the navbar there.

https://github.com/OSC/ondemand/issues/835#issuecomment-756303393

gagandaroach commented 3 years ago

image

Okay very nice, I was able to add a separate ssh login target as I was looking for.

[root@dh-ood clusters.d]# cat mgmt2.yml 
---
v2:
  metadata:
    title: "Management Node"
    url: "https://dh-mgmt2.hpc.msoe.edu"
    hidden: false
  login:
    host: "dh-mgmt2.hpc.msoe.edu"

Question Is it possible I could remove the "shell access" text from the link? Or to set the link order?

johrstrom commented 3 years ago

Neither is possible out of the box. For the first question, I opened the ticket linked above because it's fairly straightforward to change.

For the second question, the list is sorted alphabetically by title, so M before R. If you changed the cluster.title you change the order.

You could change both of these through a Rails initializer, overriding this function. You can see here that both the "Shell Access" and the sorting are defined here.

https://github.com/OSC/ondemand/blob/d5b4fbdb14657c42e9990b12ef15cfec56054ac0/apps/dashboard/app/apps/ood_app.rb#L62-L131

If you're unfamiliar with Rails initializers, you'd do this, make a file like so and copy/paste that function above into it and modify it as appropriate. For the string "Shell Access" - just remove that bit. I don't know what sorting scheme, you want, the line you're looking for is 115 where the shell links get sorted.

# /etc/ood/config/apps/dashboard/initializers/shell_reconfig.rb
class OodApp
  # drop that modified 'links' function here. and remember indendation is important.
end
johrstrom commented 2 years ago

Hi i'm closing this as it's solved in #867