Add maintenance page
Some actions are missing
This commit is contained in:
@@ -120,6 +120,15 @@
|
|||||||
/>
|
/>
|
||||||
{gettext("Lotus")}
|
{gettext("Lotus")}
|
||||||
</.dropdown_link>
|
</.dropdown_link>
|
||||||
|
<.dropdown_link href={~p"/dev/maintenance"}>
|
||||||
|
<.icon
|
||||||
|
name="hero-wrench-screwdriver"
|
||||||
|
class="h-4 w-4 mr-2"
|
||||||
|
aria-hidden="true"
|
||||||
|
data-slot="icon"
|
||||||
|
/>
|
||||||
|
{gettext("Maintenance")}
|
||||||
|
</.dropdown_link>
|
||||||
<.dropdown_separator />
|
<.dropdown_separator />
|
||||||
<.dropdown_link href={~p"/login"}>
|
<.dropdown_link href={~p"/login"}>
|
||||||
<.icon
|
<.icon
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
defmodule MusicLibraryWeb.MaintenanceLive.Index do
|
||||||
|
use MusicLibraryWeb, :live_view
|
||||||
|
|
||||||
|
require Logger
|
||||||
|
|
||||||
|
alias MusicLibrary.Records.Batch
|
||||||
|
alias MusicLibrary.Repo
|
||||||
|
|
||||||
|
def mount(_params, _session, socket) do
|
||||||
|
{:ok,
|
||||||
|
socket
|
||||||
|
|> assign(
|
||||||
|
page_title: gettext("Maintenance"),
|
||||||
|
current_section: :maintenance
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
def handle_event("refresh_records_musicbrainz_data", _params, socket) do
|
||||||
|
Batch.refresh_musicbrainz_data()
|
||||||
|
|
||||||
|
{:noreply,
|
||||||
|
socket
|
||||||
|
|> put_toast(:info, gettext("Operation started in the background."))}
|
||||||
|
end
|
||||||
|
|
||||||
|
def handle_event("generate_record_embeddings", _params, socket) do
|
||||||
|
Batch.generate_embeddings()
|
||||||
|
|
||||||
|
{:noreply,
|
||||||
|
socket
|
||||||
|
|> put_toast(:info, gettext("Operation started in the background."))}
|
||||||
|
end
|
||||||
|
|
||||||
|
def handle_event("db_vacuum", _params, socket) do
|
||||||
|
case Repo.vacuum() do
|
||||||
|
{:ok, _result} ->
|
||||||
|
{:noreply,
|
||||||
|
socket
|
||||||
|
|> put_toast(:info, gettext("Database vacuumed successfully."))}
|
||||||
|
|
||||||
|
{:error, reason} ->
|
||||||
|
Logger.error("Database vacuum failed: #{inspect(reason)}.")
|
||||||
|
|
||||||
|
{:noreply,
|
||||||
|
socket
|
||||||
|
|> put_toast(:error, "Database vacuum failed: #{inspect(reason)}.")}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<Layouts.app flash={@flash} current_section={@current_section} socket={@socket}>
|
||||||
|
<div>
|
||||||
|
<h1 class="mt-2 text-base lg:text-2xl text-zinc-900 dark:text-zinc-200 font-semibold">
|
||||||
|
{gettext("Maintenance")}
|
||||||
|
</h1>
|
||||||
|
<h3 class="mt-4 text-base font-semibold text-zinc-900 dark:text-white">
|
||||||
|
{gettext("Records")}
|
||||||
|
</h3>
|
||||||
|
<p class="mt-2 max-w-4xl text-sm text-zinc-500 dark:text-zinc-400">
|
||||||
|
{gettext(
|
||||||
|
"Run operations on the entire record database. Monitor execution via the Oban dashboard."
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
<ul class="mt-4">
|
||||||
|
<li>
|
||||||
|
<.button type="button" phx-click="refresh_records_musicbrainz_data">
|
||||||
|
{gettext("Refresh MusicBrainz data")}
|
||||||
|
</.button>
|
||||||
|
<.button type="button" phx-click="generate_record_embeddings">
|
||||||
|
{gettext("Regenerate record embeddings")}
|
||||||
|
</.button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h3 class="mt-4 text-base font-semibold text-zinc-900 dark:text-white">
|
||||||
|
{gettext("Artists")}
|
||||||
|
</h3>
|
||||||
|
<p class="mt-2 max-w-4xl text-sm text-zinc-500 dark:text-zinc-400">
|
||||||
|
{gettext(
|
||||||
|
"Run operations on the entire artist database. Monitor execution via the Oban dashboard."
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
<ul class="mt-4">
|
||||||
|
<li>
|
||||||
|
<.button disabled type="button" phx-click="refresh_artists_musicbrainz_data">
|
||||||
|
{gettext("Refresh MusicBrainz data")}
|
||||||
|
</.button>
|
||||||
|
<.button disabled type="button" phx-click="refresh_artists_discogs_data">
|
||||||
|
{gettext("Refresh Discogs data")}
|
||||||
|
</.button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h3 class="mt-4 text-base font-semibold text-zinc-900 dark:text-white">
|
||||||
|
{gettext("Database")}
|
||||||
|
</h3>
|
||||||
|
<p class="mt-2 max-w-4xl text-sm text-zinc-500 dark:text-zinc-400">
|
||||||
|
{gettext("Run lower-level operations on the database")}
|
||||||
|
</p>
|
||||||
|
<ul class="mt-4">
|
||||||
|
<li>
|
||||||
|
<.button
|
||||||
|
type="button"
|
||||||
|
phx-click="db_vacuum"
|
||||||
|
phx-disable-with={gettext("Running vacuum...")}
|
||||||
|
>
|
||||||
|
{gettext("Vacuum")}
|
||||||
|
</.button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</Layouts.app>
|
||||||
@@ -104,6 +104,8 @@ defmodule MusicLibraryWeb.Router do
|
|||||||
oban_dashboard "/oban"
|
oban_dashboard "/oban"
|
||||||
|
|
||||||
lotus_dashboard("/lotus")
|
lotus_dashboard("/lotus")
|
||||||
|
|
||||||
|
live "/maintenance", MusicLibraryWeb.MaintenanceLive.Index, :index
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -368,6 +368,7 @@ msgstr ""
|
|||||||
msgid "Refresh cover"
|
msgid "Refresh cover"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
#: lib/music_library_web/live/stats_live/index.html.heex
|
#: lib/music_library_web/live/stats_live/index.html.heex
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Records"
|
msgid "Records"
|
||||||
@@ -1498,3 +1499,70 @@ msgstr ""
|
|||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Today"
|
msgid "Today"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Artists"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/components/layouts/app.html.heex
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.ex
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Maintenance"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Refresh Discogs data"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Refresh MusicBrainz data"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Regenerate record embeddings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Run operations on the entire artist database. Monitor execution via the Oban dashboard."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Run operations on the entire record database. Monitor execution via the Oban dashboard."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Database"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.ex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Database vacuumed successfully."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.ex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Operation started in the background."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Run lower-level operations on the database"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Running vacuum..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Vacuum"
|
||||||
|
msgstr ""
|
||||||
|
|||||||
@@ -368,6 +368,7 @@ msgstr ""
|
|||||||
msgid "Refresh cover"
|
msgid "Refresh cover"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
#: lib/music_library_web/live/stats_live/index.html.heex
|
#: lib/music_library_web/live/stats_live/index.html.heex
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Records"
|
msgid "Records"
|
||||||
@@ -1498,3 +1499,70 @@ msgstr ""
|
|||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Today"
|
msgid "Today"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
|
msgid "Artists"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/components/layouts/app.html.heex
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.ex
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Maintenance"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
|
msgid "Refresh Discogs data"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
|
msgid "Refresh MusicBrainz data"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Regenerate record embeddings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Run operations on the entire artist database. Monitor execution via the Oban dashboard."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Run operations on the entire record database. Monitor execution via the Oban dashboard."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Database"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.ex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Database vacuumed successfully."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.ex
|
||||||
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
|
msgid "Operation started in the background."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Run lower-level operations on the database"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Running vacuum..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/music_library_web/live/maintenance_live/index.html.heex
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "Vacuum"
|
||||||
|
msgstr ""
|
||||||
|
|||||||
Reference in New Issue
Block a user