Skip to content

Commit

Permalink
Display cron schedules args in dashboard (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
aried3r committed Oct 3, 2021
1 parent 9aa9fb4 commit 07335d6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
30 changes: 26 additions & 4 deletions engine/app/views/good_job/cron_schedules/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
Set 
<%= tag.button "Toggle", type: "button", class: "btn btn-sm btn-outline-primary", role: "button",
data: { bs_toggle: "collapse", bs_target: ".job-properties" },
aria: { expanded: false, controls: @cron_schedules.map { |job_key, _| "##{job_key.to_param}" }.join(" ") }
aria: { expanded: false, controls: @cron_schedules.map { |job_key, _| "#{job_key.to_param}-properties" }.join(" ") }
%>
</th>
<th>
Args&nbsp;
<%= tag.button "Toggle", type: "button", class: "btn btn-sm btn-outline-primary", role: "button",
data: { bs_toggle: "collapse", bs_target: ".job-args" },
aria: { expanded: false, controls: @cron_schedules.map { |job_key, _| "#{job_key.to_param}-args" }.join(" ") }
%>
</th>
<th>Class</th>
Expand All @@ -30,9 +37,24 @@
"Lambda/Callable"
when Hash
tag.button("Preview", type: "button", class: "btn btn-sm btn-outline-primary", role: "button",
data: { bs_toggle: "collapse", bs_target: "##{job_key.to_param}" },
aria: { expanded: false, controls: job_key.to_param }) +
tag.pre(JSON.pretty_generate(job[:set]), id: job_key.to_param, class: "collapse job-properties")
data: { bs_toggle: "collapse", bs_target: "##{job_key.to_param}-properties" },
aria: { expanded: false, controls: "#{job_key.to_param}-properties" }) +
tag.pre(JSON.pretty_generate(job[:set]), id: "#{job_key.to_param}-properties", class: "collapse job-properties")
end
%>
</td>
<td>
<%=
case job[:args]
when NilClass
"None"
when Proc
"Lambda/Callable"
when Hash
tag.button("Preview", type: "button", class: "btn btn-sm btn-outline-primary", role: "button",
data: { bs_toggle: "collapse", bs_target: "##{job_key.to_param}-args" },
aria: { expanded: false, controls: "#{job_key.to_param}-args" }) +
tag.pre(JSON.pretty_generate(job[:args]), id: "#{job_key.to_param}-args", class: "collapse job-args")
end
%>
</td>
Expand Down
3 changes: 2 additions & 1 deletion spec/test_app/config/environments/demo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
description: "Delete old jobs.",
cron: "*/15 * * * *",
class: "CleanupJob",
}
args: { limit: 1_000 },
},
}
end

0 comments on commit 07335d6

Please sign in to comment.