Skip to content

Commit

Permalink
remove hold buttons for now and make stop button functional
Browse files Browse the repository at this point in the history
  • Loading branch information
ashton22305 committed Oct 24, 2024
1 parent 866909a commit 90acf35
Showing 6 changed files with 14 additions and 20 deletions.
10 changes: 5 additions & 5 deletions apps/dashboard/app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
@@ -123,14 +123,14 @@ def delete_job
redirect_to project_path(job_details_params[:project_id])
end

# PATCH /projects/:project_id/jobs/:cluster/:jobid/hold
def hold_job

end

# PATCH /projects/:project_id/jobs/:cluster/:jobid/stop
def stop_job
cluster_str = job_details_params[:cluster].to_s
cluster = OodAppkit.clusters[cluster_str.to_sym]

cluster.job_adapter.delete(job_details_params[:jobid].to_s)

redirect_to project_path(job_details_params[:project_id])
end

private
2 changes: 1 addition & 1 deletion apps/dashboard/app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@ def status_text(status)
'Running'
when 'queued'
'Queued'
when 'qued_held'
when 'queued_held'
'Hold'
when 'suspended'
'Suspend'
9 changes: 8 additions & 1 deletion apps/dashboard/app/helpers/projects_helper.rb
Original file line number Diff line number Diff line change
@@ -22,6 +22,13 @@ def job_details_buttons(status, job)
end

def button_category(status)
status
case status
when 'queued_held'
'held'
when 'suspended'
'held'
else
status
end
end
end
Original file line number Diff line number Diff line change
@@ -3,10 +3,4 @@
project_stop_job_path(project_id: project_id, cluster: cluster, jobid: id),
method: :patch,
class: 'btn btn-danger'
) %>
<%= button_to(
'Hold',
project_hold_job_path(project_id: project_id, cluster: cluster, jobid: id),
method: :patch,
class: 'btn btn-info mx-2'
) %>
Original file line number Diff line number Diff line change
@@ -3,10 +3,4 @@
project_stop_job_path(project_id: project_id, cluster: cluster, jobid: id),
method: :patch,
class: 'btn btn-danger'
) %>
<%= button_to(
'Hold',
project_hold_job_path(project_id: project_id, cluster: cluster, jobid: id),
method: :patch,
class: 'btn btn-info mx-2'
) %>
1 change: 0 additions & 1 deletion apps/dashboard/config/routes.rb
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
root 'projects#index'
get '/jobs/:cluster/:jobid' => 'projects#job_details', :defaults => { :format => 'turbo_stream' }, :as => 'job_details'
delete '/jobs/:cluster/:jobid' => 'projects#delete_job', :as => 'delete_job'
patch '/jobs/:cluster/:jobid/hold' => 'projects#hold_job', :as => 'hold_job'
patch '/jobs/:cluster/:jobid/stop' => 'projects#stop_job', :as => 'stop_job'

resources :launchers do

0 comments on commit 90acf35

Please sign in to comment.