[Enhancement] Record and display errors related to downloading (#610)

* Added last_error to media item table

* Error messages are now persisted to the last_error field

* Minor layout updates

* Added help tooltip to source content view

* Added error information to homepage tables

* Remove unneeded index

* Added docs to tooltip component
This commit is contained in:
Kieran
2025-02-12 10:17:24 -08:00
committed by GitHub
parent fe5c00dbef
commit e7adc9d68f
15 changed files with 298 additions and 70 deletions
@@ -46,10 +46,22 @@ defmodule PinchflatWeb.Sources.MediaItemTableLive do
</div>
</header>
<.table rows={@records} table_class="text-white">
<:col :let={media_item} label="Title" class="truncate max-w-xs">
<.subtle_link href={~p"/sources/#{@source.id}/media/#{media_item.id}"}>
{media_item.title}
</.subtle_link>
<:col :let={media_item} label="Title" class="max-w-xs">
<section class="flex items-center space-x-1">
<.tooltip
:if={media_item.last_error}
tooltip={media_item.last_error}
position="bottom-right"
tooltip_class="w-64"
>
<.icon name="hero-exclamation-circle-solid" class="text-red-500" />
</.tooltip>
<span class="truncate">
<.subtle_link href={~p"/sources/#{@source.id}/media/#{media_item.id}"}>
{media_item.title}
</.subtle_link>
</span>
</section>
</:col>
<:col :let={media_item} :if={@media_state == "other"} label="Manually Ignored?">
<.icon name={if media_item.prevent_download, do: "hero-check", else: "hero-x-mark"} />
@@ -205,6 +217,6 @@ defmodule PinchflatWeb.Sources.MediaItemTableLive do
# Selecting only what we need GREATLY speeds up queries on large tables
defp select_fields do
[:id, :title, :uploaded_at, :prevent_download]
[:id, :title, :uploaded_at, :prevent_download, :last_error]
end
end
@@ -24,16 +24,18 @@
</:tab_append>
<:tab title="Source" id="source">
<div class="flex flex-col gap-10 text-white">
<h3 class="font-bold text-xl mt-6">Raw Attributes</h3>
<div class="flex flex-col text-white gap-10">
<section>
<strong>Media Profile:</strong>
<.subtle_link href={~p"/media_profiles/#{@source.media_profile_id}"}>
{@source.media_profile.name}
</.subtle_link>
</section>
<h3 class="font-bold text-xl mb-2 mt-6">Raw Attributes</h3>
<section>
<strong>Media Profile:</strong>
<.subtle_link href={~p"/media_profiles/#{@source.media_profile_id}"}>
{@source.media_profile.name}
</.subtle_link>
</section>
<.list_items_from_map map={Map.from_struct(@source)} />
<.list_items_from_map map={Map.from_struct(@source)} />
</section>
</div>
</:tab>
<:tab title="Pending" id="pending">