Skip to content

Commit

Permalink
Merge pull request #8 from kylekeesling/main
Browse files Browse the repository at this point in the history
stub out a retry button
  • Loading branch information
virolea authored Jan 4, 2024
2 parents 298007c + 95e05f5 commit 87ca7b3
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 20 deletions.
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ GEM

PLATFORMS
arm64-darwin-22
arm64-darwin-23

DEPENDENCIES
panoptic!
Expand Down
12 changes: 12 additions & 0 deletions app/controllers/panoptic/jobs/retries_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module Panoptic
class Jobs::RetriesController < ApplicationController
def create
@job = SolidQueue::Job.find(params[:job_id])

@job.retry
redirect_to jobs_path, notice: "Successfully retried Job ##{@job.id}"
end
end
end
33 changes: 20 additions & 13 deletions app/views/layouts/panoptic/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>Panoptic</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<head>
<title>Panoptic</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
</head>
<body class="pb-4">
<%= render "shared/navbar" %>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
</head>
<body class="pb-4">

<main class="container mt-2">
<%= content_for?(:content) ? yield(:content) : yield %>
</main>
<%= render "shared/navbar" %>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body>
<% flash.each do |type, message| %>
<div class="alert alert-info mb-3" role="alert">
<%= message %>
</div>
<% end %>

<main class="container mt-2">
<%= content_for?(:content) ? yield(:content) : yield %>
</main>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body>
</html>
5 changes: 4 additions & 1 deletion app/views/panoptic/jobs/failed/_job.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<td scope="col" class="font-monospace"><%= job.exception_class %></td>
<td scope="col"><%= safe_time_tag job.enqueued_at %></td>
<td scope="col">
<%= link_to "Details", failed_job_path(job) %>
<%= link_to "Details", failed_job_path(job), class: "btn btn-link" %>
<%= button_to "Retry Job", job_retry_path(job),
class: "btn btn-link",
form_class: "d-inline" %>
</td>
</tr>
2 changes: 2 additions & 0 deletions app/views/panoptic/jobs/failed/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

<h1><%= @job.class_name %></h1>

<%= button_to "Retry Job", job_retry_path(@job), class: "btn btn-primary mb-3" %>

<div class="alert alert-danger" role="alert">
<h4 class="alert-heading"><%= @job.exception_class %></h4>
<p class="font-monospace mb-0">
Expand Down
12 changes: 6 additions & 6 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

resources :queues, only: [:index]

scope "jobs" do
get "all", to: "jobs#index", as: "jobs"
resources :jobs, only: :index do
resource :retry, only: :create, module: :jobs
end

scope module: "jobs" do
resources :scheduled, only: :index, as: :scheduled_jobs
resources :failed, only: [:index, :show], as: :failed_jobs
end
scope module: :jobs do
resources :scheduled, only: :index, as: :scheduled_jobs
resources :failed, only: [:index, :show], as: :failed_jobs
end
end

0 comments on commit 87ca7b3

Please sign in to comment.