Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide fixed attributes #3745

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions apps/dashboard/app/models/launcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,21 @@ def update(params)
end

def submit(options)
adapter = adapter(options[:auto_batch_clusters]).job_adapter
cluster_id = if options.has_key?(:auto_batch_clusters)
options[:auto_batch_clusters]
else
smart_attributes.find { |sm| sm.id == 'auto_batch_clusters' }.value.to_sym
end
adapter = adapter(cluster_id).job_adapter

render_format = adapter.class.name.split('::').last.downcase

job_script = OodCore::Job::Script.new(**submit_opts(options, render_format))

job_id = Dir.chdir(project_dir) do
adapter.submit(job_script)
end
update_job_log(job_id, options[:auto_batch_clusters].to_s)
update_job_log(job_id, cluster_id.to_s)
write_job_options_to_cache(options)

job_id
Expand Down Expand Up @@ -345,7 +351,7 @@ def job_log_file

def submit_opts(options, render_format)
smart_attributes.map do |sm|
sm.value = options[sm.id.to_sym]
sm.value = options[sm.id.to_sym] unless sm.fixed?
sm
end.map do |sm|
sm.submit(fmt: render_format)
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/app/views/launchers/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<%= bootstrap_form_for(@script, url: submit_project_launcher_path) do |f| %>
<% @script.smart_attributes.each do |attrib| %>
<%# TODO generate render_format %>
<%= create_widget(f, attrib, format: nil, hide_fixed: false) %>
<%= create_widget(f, attrib, format: nil) %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd have to check on this - but does using hide_fixed: true fix this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hide_fixed: true will remove all of the fixed attributes, but that also causes them to get removed from the form and not submitted.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hide_fixed: true will remove all of the fixed attributes, but that also causes them to get removed from the form and not submitted.

That's too bad... Hmmmm... batch connect applications work this way. Without looking or remembering completely - they must merge what's given in the http form with the form.yml, so anything that's fixed and wasn't in the http form is present after the merge.

Can you take a look at how batch connect apps use fixed? Seems like we should do the same thing.

<% end %>

<div class="d-grid gap-2">
Expand Down
Loading