Skip to content

Commit

Permalink
pass project instead of using safe navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
ashton22305 committed Oct 28, 2024
1 parent 6a3cb34 commit 815fbb9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions apps/dashboard/app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ def job_details
hpc_job = project.job(job_details_params[:jobid].to_s, cluster_str)

@project = project
render(partial: 'job_details', locals: { job: hpc_job })

render(partial: 'job_details', locals: { job: hpc_job, project: @project })
end

# DELETE /projects/:project_id/jobs/:cluster/:jobid
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/app/helpers/projects_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def render_readme(readme_location)
end
end

def job_details_buttons(status, job)
locals = { project_id: @project&.id, id: job&.id, cluster: job&.cluster }
def job_details_buttons(status, job, project)
locals = { project_id: project.id, id: job.id, cluster: job.cluster }
button_partial = button_category(status)
render(partial: "projects/buttons/#{button_category(status)}_buttons", locals: locals) unless button_partial.nil?
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

<turbo-stream action="replace" target="<%= id %>" data-job-status="<%= job.status %>">
<template>
<%= render(partial: 'job_details_content', locals: { job: job }, :formats=>[:html]) %>
<%= render(partial: 'job_details_content', locals: { job: job, project: project }, :formats=>[:html]) %>
</template>
</turbo-stream>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<% end %>
</table>
<div class="d-flex flex-row-reverse mt-2 mx-2">
<%= job_details_buttons(job.status.to_s, job) %>
<%= job_details_buttons(job.status.to_s, job, project) %>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/app/views/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@
<div class="col-md-8">
<div class="row">
<h2 class="h3 d-flex justify-content-center">Active Jobs</h2>
<%= render(partial: 'job_details', collection: @project.active_jobs, as: :job ) %>
<%= render(partial: 'job_details', collection: @project.active_jobs, as: :job, locals: { project: @project }) %>
</div>

<div class="row">
<h2 class="h3 d-flex justify-content-center">Completed Jobs</h2>
<div id="completed_jobs" class="row">
<%- @project.completed_jobs.each do |job| -%>
<div class="col-md-4" id="<%= "job_#{job.cluster}_#{job.id}" %>">
<%= render(partial: 'job_details_content', locals: { job: job }) %>
<%= render(partial: 'job_details_content', locals: { job: job, project: @project }) %>
</div>
<%- end -%>
</div>
Expand Down

0 comments on commit 815fbb9

Please sign in to comment.