Compare commits

...

2 Commits

Author SHA1 Message Date
ae8c99272f Fixed job number to work with broadcast in jobs#index 2025-07-23 15:52:55 +02:00
d09dea8c5f Bundle update 2025-07-23 15:48:16 +02:00
7 changed files with 43 additions and 24 deletions

View File

@@ -90,7 +90,7 @@ GEM
bindex (0.8.1)
bootsnap (1.18.6)
msgpack (~> 1.2)
brakeman (7.0.2)
brakeman (7.1.0)
racc
builder (3.3.0)
capybara (3.40.0)
@@ -138,7 +138,7 @@ GEM
image_processing (1.14.0)
mini_magick (>= 4.9.5, < 6)
ruby-vips (>= 2.0.17, < 3)
importmap-rails (2.1.0)
importmap-rails (2.2.0)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
@@ -153,7 +153,7 @@ GEM
jbuilder (2.13.0)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
json (2.12.2)
json (2.13.0)
kamal (2.7.0)
activesupport (>= 7.0)
base64 (~> 0.2)
@@ -209,18 +209,18 @@ GEM
net-protocol
net-ssh (7.3.0)
nio4r (2.7.4)
nokogiri (1.18.8)
nokogiri (1.18.9)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.18.8-aarch64-linux-gnu)
nokogiri (1.18.9-aarch64-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.8-arm-linux-gnu)
nokogiri (1.18.9-arm-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.8-arm64-darwin)
nokogiri (1.18.9-arm64-darwin)
racc (~> 1.4)
nokogiri (1.18.8-x86_64-darwin)
nokogiri (1.18.9-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.18.8-x86_64-linux-gnu)
nokogiri (1.18.9-x86_64-linux-gnu)
racc (~> 1.4)
ostruct (0.6.3)
pagy (9.3.5)
@@ -296,12 +296,12 @@ GEM
rdoc (6.14.2)
erb
psych (>= 4.0.0)
redis (5.4.0)
redis (5.4.1)
redis-client (>= 0.22.0)
redis-client (0.25.1)
connection_pool
regexp_parser (2.10.0)
reline (0.6.1)
reline (0.6.2)
io-console (~> 0.5)
rexml (3.4.1)
rubocop (1.78.0)
@@ -370,12 +370,12 @@ GEM
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
sqlite3 (2.7.2-aarch64-linux-gnu)
sqlite3 (2.7.2-arm-linux-gnu)
sqlite3 (2.7.2-arm64-darwin)
sqlite3 (2.7.2-x86-linux-gnu)
sqlite3 (2.7.2-x86_64-darwin)
sqlite3 (2.7.2-x86_64-linux-gnu)
sqlite3 (2.7.3-aarch64-linux-gnu)
sqlite3 (2.7.3-arm-linux-gnu)
sqlite3 (2.7.3-arm64-darwin)
sqlite3 (2.7.3-x86-linux-gnu)
sqlite3 (2.7.3-x86_64-darwin)
sqlite3 (2.7.3-x86_64-linux-gnu)
sshkit (1.24.0)
base64
logger
@@ -476,4 +476,4 @@ DEPENDENCIES
web-console
BUNDLED WITH
2.5.17
2.7.1

View File

@@ -1,7 +1,7 @@
class JobsController < ApplicationController
skip_before_action :authenticate_user!, only: [ :index, :cancel_button ]
skip_before_action :authenticate_user!, only: [ :index, :cancel_button, :badge ]
skip_before_action :verified_user!, only: [ :index ]
skip_verify_authorized only: [ :index, :new, :create, :cancel_button ]
skip_verify_authorized only: [ :index, :new, :create, :cancel_button, :badge]
# GET /jobs or /jobs.json
def index
@@ -53,6 +53,12 @@ class JobsController < ApplicationController
render partial: "jobs/cancel_button", locals: { job: @job }
end
def badge
@job = Job.find(params[:id])
render partial: "jobs/badge", locals: { job: @job }
end
private
def broadcast_update_status_cards_and_start_next_job_button

View File

@@ -0,0 +1,3 @@
<%= turbo_frame_tag dom_id(job, :badge) do %>
<%= link_to_if user_signed_in? && allowed_to?(:show, job, namespace: :Operator), job.id, operator_job_path(job) %>
<% end %>

View File

@@ -1,13 +1,22 @@
<tr id="<%= dom_id job %>" class="bg-status-<%= job.status %>-light odd:bg-opacity-25 even:bg-opacity-15 text-hsrm-gray whitespace-nowrap hover:bg-opacity-30" data-stream-enter-class="animate-flash-increase">
<td class="p-2 py-3 text-center">
<span class="badge badge-xl text-status-<%= job.status %> bg-status-<%= job.status %>-light rounded-lg shadow">
<%= link_to_if user_signed_in? && allowed_to?(:show, job, namespace: :Operator), job.id, operator_job_path(job) %>
<% # TODO: Refactor to helper function %>
<% if defined?(no_turbo_stream) && no_turbo_stream %>
<%= turbo_frame_tag dom_id(job, :badge) do %>
<%= render partial: "jobs/badge", locals: { job: job } %>
<% end %>
<% else %>
<%= turbo_frame_tag dom_id(job, :badge), src: badge_job_path(job), loading: 'lazy' do %>
<%= icon("ellipsis-horizontal-circle", class: "icon icon-disabled size-10", title: "Loading...") %>
<% end %>
<% end %>
</span>
</td>
<td class="p-2 py-3 text-center">
<% if job.pdf.attached? && job.pdf.previewable? %>
<%= image_tag(url_for(job.pdf.blob.preview(resize_to_limit: [100, 100])), class: "shadow") %>
<%#= image_tag job.pdf.preview(resize_to_limit: [50, 50]), class: "mx-auto" %>
<%# = image_tag job.pdf.preview(resize_to_limit: [50, 50]), class: "mx-auto" %>
<% end %>
</td>
<td class="p-2 py-3">

View File

@@ -23,7 +23,7 @@
<th class="w-1 p-2 py-3 text-center">Action</th>
</tr>
</thead>
<tbody id='jobs' class="divide-y divivde-gray-300">
<tbody id="jobs" class="divide-y divivde-gray-300">
<%= render partial: "job_tr", collection: @jobs, as: :job, locals: { no_turbo_stream: @no_turbo_stream } %>
</tbody>
</table>

View File

@@ -14,6 +14,7 @@ Rails.application.routes.draw do
member do
patch "cancel"
get "cancel_button"
get "badge"
end
end
resource :profile, only: [ :show, :edit, :destroy ]

2
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.2].define(version: 2024_08_26_144016) do
ActiveRecord::Schema[8.0].define(version: 2024_08_26_144016) do
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false