How to customize text in the noVNC launch button?

novnc-launch-button
feature-request

#1

By default the launch button for noVNC displays “Launch noVNC in New Tab”. I located the _novnc.html.erb file where this is set and can change the text to something more generic like “Launch in New Tab” but I’m wondering if there is a way to set an erb connection variable (e.g. named launch_label) that could be used. This would allow applications that leverage the vnc template to have a customized (and more intuitive) launch button — for example, in the simple “xclock” example that I attached it could say “Launch xclock in new tab”. Is there a way to do this already or would this require a change to Open OnDemand?


#2

Not yet.

There is the view.html.erb for creating this button for server apps like RStudio and Jupyter https://osc.github.io/ood-documentation/master/app-development/interactive/view.html. But this doesn’t work well for the VNC app. In fact, the documentation I’ve shared has a warning:

If developing a VNC Interactive App, DO NOT include the view.html.erb file. The Dashboard has internal logic in place for displaying connection information of VNC sessions to the user.

I will mark this as a feature request. Is modifying only the text sufficient or also the icon necessary?


#3

Note that this partial you mention, the _novnc.html.erb partial, has a single local variable session.connect passed to it, which is an OpenStruct representation of the Hash returned from the YAML key value pairs in the connection.yml file written by the job to the job directory. So it is possible to do what you suggest if you do these steps.

The submit.yml.erb of any interactive app could have this added to it:

batch_connect:
  conn_params: [launch_label]
script:
  job_environment:
    launch_label: "'Your launch button text'"

Finally, you would still have to modify the _novnc.html.erb partial directly like this:

-<%= link_to icon('fas', 'eye', 'Launch noVNC in New Tab'), novnc_link(connect), class: 'btn btn-primary', target: '_blank' %>
+<%= link_to icon('fas', 'eye', (connect.launch_label || 'Launch noVNC in New Tab')), novnc_link(connect), class: 'btn btn-pri

#4

Actually while what I suggested there is possible based on your request, if what you are really wanting to do is just vary the name of the Launch button to include the title of the app that is being launched, it might be better and easier to just fix the button to include the title of the app.

For example it could say: “Launch xclock via noVNC in New Tab”

You can do that using this diff: https://github.com/OSC/ood-dashboard/pull/455/files

That change will be in the next release. Feel free to comment on the PR if you have an opinion on the naming.


#5

The “session.connect” approach that you outlined worked nicely - thanks!