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

Display cron schedules args in dashboard #396

Merged
merged 1 commit into from
Oct 3, 2021
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
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