Interactive Apps cluster-dependent fields

Hello,

I’ve been trying to deploy the Jupyter interactive app to Open OnDemand with an added “version”-field. This way users can select their preferred version from the list of installed versions. This field is however dependent on which cluster they select as certain clusters may not have all versions available. What would be the best way to achieve this? One option would be to add some javascript to the page that checks for an update to the “cluster”-field and updates the “version”-field accordingly.

Thanks in advance
Robbe Van Herck

Welcome! I think JavaScript may be the only way to get the dynamic behavior you’re looking for. You could initialize everything the way you want but as soon as the user changes the cluster list the version list wouldn’t change.

Lets us know if you need help adding interactivity to forms! We’ve been chatting a lot about it lately in other topics.

Thanks for your answer. I’m trying to implement this with the html_options tag in form.yml.erb and adding an onchange javascript-function that filters the version list. This will probably work, but it isn’t ideal…

What I currently need to know is if it is possible to set the cluster value after the erb has been rendered.

It’s possible to set it with a jquery or javascript function for sure. Just listen for a jquery $('document').ready or pure javascript window.onload.

I think you’re on the right path with the onchange listener where you listen for the cluster to change to then change the list of versions available.

Is it possible to add javascript to to the HTML of the form without changing ood-code? I currently add <script>-tags to the help- and onload-fields in form.yml.erb. Is there a more clean way of doing this?

Yes, see this topic. You can simply add a form.js file in the same directory as the form.yml. You can also see the project on github that he’s linked in that topic as an example.

Actually while you could modify the form to include a cluster dropdown, the batch connect plugin currently doesn’t support this. We will address this limitation with an updated plugin architecture in the next 3-6 months.

To clarify, there are server side assumptions that a single “app” works with only 1 specified cluster.

I had made an attempt to quickly update the code to support a user selecting multiple clusters, but that work is incomplete. We are in the process of designing an updated plugin architecture that will address these and other issues.