Skip to content

Commit

Permalink
Run erb_lint against all the views and partials
Browse files Browse the repository at this point in the history
  • Loading branch information
bensheldon committed Apr 20, 2024
1 parent 4fd5ac4 commit 63728cf
Show file tree
Hide file tree
Showing 9 changed files with 224 additions and 214 deletions.
14 changes: 10 additions & 4 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
glob: "**/*.erb"
linters:
HardCodedString:
enabled: false
Expand All @@ -9,6 +10,10 @@ linters:
rubocop_config:
inherit_from:
- .rubocop.yml
Layout/ArgumentAlignment:
Enabled: false
Layout/FirstHashElementIndentation:
Enabled: false
Layout/InitialIndentation:
Enabled: false
Layout/LeadingEmptyLines:
Expand All @@ -17,12 +22,13 @@ linters:
Enabled: false
Layout/TrailingWhitespace:
Enabled: false
Naming/FileName:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Lint/UselessAssignment:
Enabled: false
Naming/FileName:
Enabled: false
Rails/OutputSafety:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false


44 changes: 23 additions & 21 deletions app/views/good_job/batches/_jobs.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<div class="list-group list-group-flush text-nowrap table-jobs" role="table">
<header class="list-group-item bg-body-tertiary">
<div class="row small text-muted text-uppercase align-items-center">
<div class="col-4"><%=t "good_job.models.batch.jobs" %></div>
<div class="d-none d-lg-block col-lg-1 text-lg-center"><%=t "good_job.models.job.queue" %></div>
<div class="d-none d-lg-block col-lg-1 text-lg-end"><%=t "good_job.models.job.priority" %></div>
<div class="d-none d-lg-block col-lg-1 text-lg-end"><%=t "good_job.models.job.attempts" %></div>
<div class="col-4"><%= t("good_job.models.batch.jobs") %></div>
<div class="d-none d-lg-block col-lg-1 text-lg-center"><%= t "good_job.models.job.queue" %></div>
<div class="d-none d-lg-block col-lg-1 text-lg-end"><%= t "good_job.models.job.priority" %></div>
<div class="d-none d-lg-block col-lg-1 text-lg-end"><%= t "good_job.models.job.attempts" %></div>
<div class="col text-end">
<%= tag.button type: "button", class: "btn btn-sm text-muted", role: "button",
data: { bs_toggle: "collapse", bs_target: ".job-params" },
aria: { expanded: false, controls: jobs.map { |job| "##{dom_id(job, "params")}" }.join(" ") } do %>
aria: { expanded: false, controls: jobs.map { |job| "##{dom_id(job, 'params')}" }.join(" ") } do %>
<%= render_icon "info" %>
<span class="visually-hidden">Inspect</span>
<% end %>
Expand All @@ -26,22 +26,24 @@
<%= tag.h5 tag.code(link_to(job.display_name, job_path(job), class: "text-reset text-decoration-none")), class: "text-reset mb-0" %>
</div>
<div class="col-4 col-lg-1 text-lg-center">
<div class="d-lg-none small text-muted mt-1"><%=t "good_job.models.job.queue" %></div>
<div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.job.queue" %></div>
<span class="badge bg-primary text-dark font-monospace"><%= job.queue_name %></span>
</div>
<div class="col-4 col-lg-1 text-lg-end">
<div class="d-lg-none small text-muted mt-1"><%=t "good_job.models.job.priority" %>Priority</div>
<div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.job.priority" %>Priority</div>
<span class="font-monospace fw-bold"><%= job.priority %></span>
</div>
<div class="col-4 col-lg-1 text-lg-end">
<div class="d-lg-none small text-muted mt-1"><%=t "good_job.models.job.attempts" %></div>
<div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.job.attempts" %></div>
<% if job.executions_count > 0 && job.status != :finished %>
<%= tag.span job.executions_count, class: "badge rounded-pill bg-danger", data: {
bs_toggle: "popover",
bs_trigger: "hover focus click",
bs_placement: "bottom",
bs_content: job.recent_error
} %>
<%= tag.span job.executions_count, class: "badge rounded-pill bg-danger",
data: {
bs_toggle: "popover",
bs_trigger: "hover focus click",
bs_placement: "bottom",
bs_content: job.recent_error,
}
%>
<% else %>
<span class="badge bg-secondary rounded-pill"><%= job.executions_count %></span>
<% end %>
Expand All @@ -53,33 +55,33 @@
<div class="dropdown float-end">
<button class="d-flex align-items-center btn btn-sm" type="button" id="<%= dom_id(job, :actions) %>" data-bs-toggle="dropdown" aria-expanded="false">
<%= render_icon :dots %>
<span class="visually-hidden"><%=t ".actions.title" %></span>
<span class="visually-hidden"><%= t ".actions.title" %></span>
</button>
<ul class="dropdown-menu shadow" aria-labelledby="<%= dom_id(job, :actions) %>">
<li>
<% job_reschedulable = job.status.in? [:scheduled, :retried, :queued] %>
<%= link_to reschedule_job_path(job.id), method: :put, class: "dropdown-item #{'disabled' unless job_reschedulable}", title: t(".actions.reschedule"), data: { confirm: t(".actions.confirm_reschedule"), disable: true } do %>
<%= render_icon "skip_forward" %>
<%=t "good_job.actions.reschedule" %>
<%= t "good_job.actions.reschedule" %>
<% end %>
</li>
<li>
<% job_discardable = job.status.in? [:scheduled, :retried, :queued] %>
<%= link_to discard_job_path(job.id), method: :put, class: "dropdown-item #{'disabled' unless job_discardable}", title: t(".actions.discard"), data: { confirm: t(".actions.confirm_discard"), disable: true } do %>
<%= render_icon "stop" %>
<%=t "good_job.actions.discard" %>
<%= t "good_job.actions.discard" %>
<% end %>
</li>
<li>
<%= link_to retry_job_path(job.id), method: :put, class: "dropdown-item #{'disabled' unless job.status == :discarded}", title: t(".actions.retry"), data: { confirm: t(".actions.confirm_retry"), disable: true } do %>
<%= render_icon "arrow_clockwise" %>
<%=t "good_job.actions.retry" %>
<%= t "good_job.actions.retry" %>
<% end %>
</li>
<li>
<%= link_to job_path(job.id), method: :delete, class: "dropdown-item #{'disabled' unless job.status.in? [:discarded, :finished]}", title: t(".actions.destroy"), data: { confirm: t(".actions.confirm_destroy"), disable: true } do %>
<%= render_icon "trash" %>
<%=t "good_job.actions.destroy" %>
<%= t "good_job.actions.destroy" %>
<% end %>
</li>

Expand All @@ -89,7 +91,7 @@
data: { bs_toggle: "collapse" },
aria: { expanded: false, controls: dom_id(job, "params") } do %>
<%= render_icon "info" %>
<%=t "good_job.actions.inspect" %>
<%= t "good_job.actions.inspect" %>
<% end %>
</li>
</ul>
Expand All @@ -103,7 +105,7 @@
<% end %>
<% else %>
<div class="list-group-item py-4 text-center text-muted">
<%=t ".no_jobs_found" %>
<%= t ".no_jobs_found" %>
</div>
<% end %>
</div>
Expand Down
30 changes: 15 additions & 15 deletions app/views/good_job/batches/_table.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<div class="list-group list-group-flush text-nowrap table-batches" role="table">
<header class="list-group-item bg-body-tertiary">
<div class="row small text-muted text-uppercase align-items-center">
<div class="col-4"><%=t "good_job.models.batch.name" %></div>
<div class="col-lg-1 d-none d-lg-block"><%=t "good_job.models.batch.created" %></div>
<div class="col-lg-1 d-none d-lg-block"><%=t "good_job.models.batch.enqueued" %></div>
<div class="col-lg-1 d-none d-lg-block"><%=t "good_job.models.batch.discarded" %></div>
<div class="col-lg-1 d-none d-lg-block"><%=t "good_job.models.batch.finished" %></div>
<div class="col-lg-1 d-none d-lg-block"><%=t "good_job.models.batch.jobs" %></div>
<div class="col-4"><%= t "good_job.models.batch.name" %></div>
<div class="col-lg-1 d-none d-lg-block"><%= t "good_job.models.batch.created" %></div>
<div class="col-lg-1 d-none d-lg-block"><%= t "good_job.models.batch.enqueued" %></div>
<div class="col-lg-1 d-none d-lg-block"><%= t "good_job.models.batch.discarded" %></div>
<div class="col-lg-1 d-none d-lg-block"><%= t "good_job.models.batch.finished" %></div>
<div class="col-lg-1 d-none d-lg-block"><%= t "good_job.models.batch.jobs" %></div>
<div class="col text-end">
<%= tag.button type: "button", class: "btn btn-sm text-muted", role: "button",
data: { bs_toggle: "collapse", bs_target: ".batch-properties" },
aria: { expanded: false, controls: batches.map { |batch| "##{dom_id(batch, "params")}" }.join(" ") } do %>
aria: { expanded: false, controls: batches.map { |batch| "##{dom_id(batch, 'params')}" }.join(" ") } do %>
<%= render_icon "info" %>
<span class="visually-hidden"><%=t "good_job.actions.inspect" %></span>
<span class="visually-hidden"><%= t "good_job.actions.inspect" %></span>
<% end %>
</div>
</div>
Expand All @@ -33,29 +33,29 @@
<% end %>
</div>
<div class="col-6 col-lg-1 text-wrap">
<div class="d-lg-none small text-muted mt-1"><%=t "good_job.models.batch.created_at" %></div>
<div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.batch.created_at" %></div>
<%= relative_time(batch.created_at) %>
</div>
<div class="col-6 col-lg-1 text-wrap">
<% if batch.enqueued_at %>
<div class="d-lg-none small text-muted mt-1"><%=t "good_job.models.batch.enqueued_at" %></div>
<div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.batch.enqueued_at" %></div>
<%= relative_time(batch.enqueued_at) %>
<% end %>
</div>
<div class="col-6 col-lg-1 text-wrap">
<% if batch.discarded_at %>
<div class="d-lg-none small text-muted mt-1"><%=t "good_job.models.batch.discarded_at" %></div>
<div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.batch.discarded_at" %></div>
<%= relative_time(batch.discarded_at) %>
<% end %>
</div>
<div class="col-6 col-lg-1 text-wrap">
<% if batch.finished_at %>
<div class="d-lg-none small text-muted mt-1"><%=t "good_job.models.batch.finished_at" %></div>
<div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.batch.finished_at" %></div>
<%= relative_time(batch.finished_at) %>
<% end %>
</div>
<div class="col-6 col-lg-1">
<div class="d-lg-none small text-muted mt-1"><%=t "good_job.models.batch.jobs" %></div>
<div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.batch.jobs" %></div>
<%= batch.jobs.count %>
</div>
<div class="col text-end">
Expand All @@ -64,7 +64,7 @@
data: { bs_toggle: "collapse", bs_target: "##{dom_id(batch, 'properties')}" },
aria: { expanded: false, controls: dom_id(batch, "state") } do %>
<%= render_icon "info" %>
<span class="visually-hidden"><%=t "good_job.actions.inspect" %></span>
<span class="visually-hidden"><%= t "good_job.actions.inspect" %></span>
<% end %>
</div>
</div>
Expand All @@ -75,7 +75,7 @@
<% end %>
<% else %>
<div class="list-group-item py-4 text-center text-muted">
<%=t ".no_batches_found" %>
<%= t ".no_batches_found" %>
</div>
<% end %>
</div>
Expand Down
14 changes: 7 additions & 7 deletions app/views/good_job/jobs/_executions.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h5><%=t ".title" %></h5>
<h5><%= t ".title" %></h5>
<div class="card mb-4" data-live-poll-region="executions-table">
<div class="list-group list-group-flush">
<% executions.each do |execution| %>
Expand All @@ -10,12 +10,12 @@
</div>
<div class="col-md-2 small">
<% if execution.queue_latency %>
<%= format_duration execution.queue_latency %> <span class="text-muted"><%=t ".in_queue" %></span>
<%= format_duration execution.queue_latency %> <span class="text-muted"><%= t ".in_queue" %></span>
<% end %>
</div>
<div class="col-md-2 small">
<% if execution.runtime_latency %>
<%= format_duration execution.runtime_latency %> <span class="text-muted"><%=t ".runtime" %></span>
<%= format_duration execution.runtime_latency %> <span class="text-muted"><%= t ".runtime" %></span>
<% end %>
</div>
<div class="col">
Expand All @@ -28,20 +28,20 @@
data: { bs_toggle: "collapse", bs_target: "##{dom_id(execution, 'params')}" },
aria: { expanded: false, controls: dom_id(execution, "params") } do %>
<%= render_icon "info" %>
<span class="visually-hidden"><%=t "good_job.actions.inspect" %></span>
<span class="visually-hidden"><%= t "good_job.actions.inspect" %></span>
<% end %>
</div>
</div>
</div>
<% if execution.error %>
<div class="mt-3 small">
<strong class="small text-danger"><%=t "good_job.shared.error" %>:</strong>
<strong class="small text-danger"><%= t "good_job.shared.error" %>:</strong>
<code class="text-wrap text-break m-0 text-secondary-emphasis"><%= execution.error %></code>
</div>
<% if GoodJob::DiscreteExecution.backtrace_migrated? && execution.error_backtrace&.any? %>
<%= tag.ul class: "nav nav-tabs small w-fit-content", id: dom_id(execution, :tab), role:"tablist" do %>
<%= tag.ul class: "nav nav-tabs small w-fit-content", id: dom_id(execution, :tab), role: "tablist" do %>
<li class="nav-item" role="presentation">
<%= tag.button t(".application_trace"), class: "nav-link active p-1", id: dom_id(execution, :application), data: { bs_toggle: "tab", bs_target: dom_id(execution, :"#application_pane") }, type: "button", role: "tab", aria: { controls: dom_id(execution, :application_pane), selected: true } %>
<%= tag.button t(".application_trace"), class: "nav-link active p-1", id: dom_id(execution, :application), data: { bs_toggle: "tab", bs_target: dom_id(execution, :"#application_pane") }, type: "button", role: "tab", aria: { controls: dom_id(execution, :application_pane), selected: true } %>
</li>
<li class="nav-item" role="presentation">
<%= tag.button t(".full_trace"), class: "nav-link p-1", id: dom_id(execution, :full), data: { bs_toggle: "tab", bs_target: dom_id(execution, :"#full_pane") }, type: "button", role: "tab", aria: { controls: dom_id(execution, :full_pane), selected: false } %>
Expand Down

0 comments on commit 63728cf

Please sign in to comment.