Is there a way to debug, or lint form.yml syntax? Sometimes I manage to somehow mess one of the “select” widgets that then ignores all the options and comes as a text input.
is it possible to inline files in form.yml or form.yml.erb? Some code there, like partition selection, is very repetitive and can be shared between different apps.
University of Manitoba
Interesting you should ask these two things given some recent changes we’ve made.
We’ve actually done some work on the backend to handle the linting for those
selects for this type of problem and will likely be in the next release. The relevant PR: Catching missing select options in app yaml. by Oglopf · Pull Request #1455 · OSC/ondemand · GitHub
For this, I believe some changes we are making with the JS will handle this. Basically when you make certain selections on the page, you want other form fields to react and offer choices based on that selection. This is something we have on the Projects page and are working towards building out currently. automatic js handlers for hidden form items · Issue #1432 · OSC/ondemand · GitHub
If you have any more thoughts or any of these aren’t quite what you had in mind just let us know.
You can define variables in the cluster’s .yml file in /etc/ood/… and refer to those from your applications, if that helps.
I guess that helps. But for form help: and such I will still have to copy paste.
A step beyond this, you can actually make initializers that have some more advanced functionality. I have a special initializer on one cluster set in:
class CustomQueues ### GET PARTITIONS FOR THIS USER ###
@queues ||= begin
sinfo_cmd = "sinfo"
args = ["--noheader","-o=\"%R\""]
@partitions_available = 
o, e, s = Open3.capture3(sinfo_cmd , *args)
o.each_line do |v|
This defines a function to populate all of the partitions a user has access to that I can call on the fly to populate a partition select widget.
This is then whats in my form.yml.erb to generate the select box list of available partitions.
<%- CustomQueues.queues.each do |g| -%>
- "<%= g.strip -%>"
<%- end %>
You could also define a widget in a file and use something like
<%= File.read("/etc/ood/config/apps/dashboard/batch_connect/partials/reservation.yml").indent(2) %>
In your form.yml.erb to “paste” the contents as it were.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.