Fix heex template formatting

Use new HEEx syntax with curly braces for expressions and fix line
length issues with multi-line attribute formatting.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Daniel Da Cunha 2026-01-18 22:21:15 +08:00
parent f9f52187ab
commit 907766f29f

View file

@ -13,19 +13,19 @@
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<div class="bg-meta-4 rounded-lg p-4">
<p class="text-sm text-bodydark">Pending Downloads</p>
<p class="text-2xl font-bold text-white"><%= stats.total_pending_downloads %></p>
<p class="text-2xl font-bold text-white">{stats.total_pending_downloads}</p>
</div>
<div class="bg-meta-4 rounded-lg p-4">
<p class="text-sm text-bodydark">Downloaded Media</p>
<p class="text-2xl font-bold text-white"><%= stats.total_downloaded %></p>
<p class="text-2xl font-bold text-white">{stats.total_downloaded}</p>
</div>
<div class="bg-meta-4 rounded-lg p-4">
<p class="text-sm text-bodydark">Total Sources</p>
<p class="text-2xl font-bold text-white"><%= stats.total_sources %></p>
<p class="text-2xl font-bold text-white">{stats.total_sources}</p>
</div>
<div class="bg-meta-4 rounded-lg p-4">
<p class="text-sm text-bodydark">Database Size</p>
<p class="text-2xl font-bold text-white"><%= stats.database_size %></p>
<p class="text-2xl font-bold text-white">{stats.database_size}</p>
</div>
</div>
</div>
@ -44,27 +44,29 @@
<%= for stats <- queue_stats() do %>
<div class={"rounded-lg border-2 p-4 #{queue_health_class(stats)}"}>
<div class="flex justify-between items-start mb-2">
<h4 class="font-semibold text-white"><%= format_queue_name(stats.name) %></h4>
<h4 class="font-semibold text-white">{format_queue_name(stats.name)}</h4>
<span class={"text-xs px-2 py-1 rounded #{if stats.paused, do: "bg-yellow-500", else: "bg-meta-4"}"}>
<%= queue_status_text(stats) %>
{queue_status_text(stats)}
</span>
</div>
<div class="grid grid-cols-2 gap-2 text-sm">
<div>
<span class="text-bodydark">Running:</span>
<span class="text-white ml-1"><%= stats.running %>/<%= stats.limit %></span>
<span class="text-white ml-1">{stats.running}/{stats.limit}</span>
</div>
<div>
<span class="text-bodydark">Available:</span>
<span class="text-white ml-1"><%= stats.available %></span>
<span class="text-white ml-1">{stats.available}</span>
</div>
<div>
<span class="text-bodydark">Scheduled:</span>
<span class="text-white ml-1"><%= stats.scheduled %></span>
<span class="text-white ml-1">{stats.scheduled}</span>
</div>
<div>
<span class={"#{if stats.retryable > 0, do: "text-red-400", else: "text-bodydark"}"}>Retryable:</span>
<span class={"ml-1 #{if stats.retryable > 0, do: "text-red-400 font-bold", else: "text-white"}"}><%= stats.retryable %></span>
<span class={"ml-1 #{if stats.retryable > 0, do: "text-red-400 font-bold", else: "text-white"}"}>
{stats.retryable}
</span>
</div>
</div>
</div>
@ -78,10 +80,13 @@
<div class="rounded-sm border border-stroke bg-white px-5 py-5 shadow-default dark:border-strokedark dark:bg-boxdark sm:px-7.5 mb-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold text-white">
<.icon name="hero-exclamation-triangle" class="h-5 w-5 text-yellow-500 mr-2" />
Stuck Jobs (<%= length(stuck) %>)
<.icon name="hero-exclamation-triangle" class="h-5 w-5 text-yellow-500 mr-2" /> Stuck Jobs ({length(stuck)})
</h3>
<.link href={~p"/diagnostics/reset_stuck_jobs"} method="post" data-confirm="This will reset all stuck jobs. They will be retried. Continue?">
<.link
href={~p"/diagnostics/reset_stuck_jobs"}
method="post"
data-confirm="This will reset all stuck jobs. They will be retried. Continue?"
>
<.button color="bg-yellow-600" rounding="rounded-lg" class="text-sm">
<.icon name="hero-arrow-path" class="h-4 w-4 mr-1" /> Reset All Stuck Jobs
</.button>
@ -104,15 +109,24 @@
<tbody>
<%= for job <- stuck do %>
<tr class="border-b border-strokedark/50">
<td class="py-2 text-white">#<%= job.id %></td>
<td class="py-2 text-white"><%= job.queue %></td>
<td class="py-2 text-white"><%= format_worker_name(job.worker) %></td>
<td class="py-2 text-white"><%= format_datetime(job.attempted_at) %></td>
<td class="py-2 text-white">#{job.id}</td>
<td class="py-2 text-white">{job.queue}</td>
<td class="py-2 text-white">{format_worker_name(job.worker)}</td>
<td class="py-2 text-white">{format_datetime(job.attempted_at)}</td>
<td class="py-2">
<.link href={~p"/diagnostics/reset_job/#{job.id}"} method="post" class="text-primary hover:underline mr-3">
<.link
href={~p"/diagnostics/reset_job/#{job.id}"}
method="post"
class="text-primary hover:underline mr-3"
>
Reset
</.link>
<.link href={~p"/diagnostics/cancel_job/#{job.id}"} method="post" class="text-red-400 hover:underline" data-confirm="Cancel this job?">
<.link
href={~p"/diagnostics/cancel_job/#{job.id}"}
method="post"
class="text-red-400 hover:underline"
data-confirm="Cancel this job?"
>
Cancel
</.link>
</td>
@ -129,11 +143,14 @@
<div class="rounded-sm border border-stroke bg-white px-5 py-5 shadow-default dark:border-strokedark dark:bg-boxdark sm:px-7.5">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold text-white">
<.icon name="hero-exclamation-circle" class="h-5 w-5 text-red-500 mr-2" />
Failed Jobs (<%= length(retryable) %>)
<.icon name="hero-exclamation-circle" class="h-5 w-5 text-red-500 mr-2" /> Failed Jobs ({length(retryable)})
</h3>
<%= if length(retryable) > 0 do %>
<.link href={~p"/diagnostics/reset_retryable_jobs"} method="post" data-confirm="This will reset all failed jobs and clear their error history. They will be retried from scratch. Continue?">
<.link
href={~p"/diagnostics/reset_retryable_jobs"}
method="post"
data-confirm="This will reset all failed jobs and clear their error history. They will be retried from scratch. Continue?"
>
<.button color="bg-red-600" rounding="rounded-lg" class="text-sm">
<.icon name="hero-arrow-path" class="h-4 w-4 mr-1" /> Reset All Failed Jobs
</.button>
@ -162,18 +179,27 @@
<tbody>
<%= for job <- retryable do %>
<tr class="border-b border-strokedark/50">
<td class="py-2 text-white">#<%= job.id %></td>
<td class="py-2 text-white"><%= job.queue %></td>
<td class="py-2 text-white"><%= format_worker_name(job.worker) %></td>
<td class="py-2 text-white"><%= job.attempt %>/<%= job.max_attempts %></td>
<td class="py-2 text-white">#{job.id}</td>
<td class="py-2 text-white">{job.queue}</td>
<td class="py-2 text-white">{format_worker_name(job.worker)}</td>
<td class="py-2 text-white">{job.attempt}/{job.max_attempts}</td>
<td class="py-2 text-red-400 max-w-xs truncate" title={extract_last_error(job.errors)}>
<%= extract_last_error(job.errors) %>
{extract_last_error(job.errors)}
</td>
<td class="py-2">
<.link href={~p"/diagnostics/reset_job/#{job.id}"} method="post" class="text-primary hover:underline mr-3">
<.link
href={~p"/diagnostics/reset_job/#{job.id}"}
method="post"
class="text-primary hover:underline mr-3"
>
Reset
</.link>
<.link href={~p"/diagnostics/cancel_job/#{job.id}"} method="post" class="text-red-400 hover:underline" data-confirm="Cancel this job?">
<.link
href={~p"/diagnostics/cancel_job/#{job.id}"}
method="post"
class="text-red-400 hover:underline"
data-confirm="Cancel this job?"
>
Cancel
</.link>
</td>