From c583567b17b4f53aa15d4a6fb345eb8a3a62cfe9 Mon Sep 17 00:00:00 2001
From: Claudio Ortolina
Date: Mon, 3 Nov 2025 17:28:55 +0000
Subject: [PATCH] Add confirmations to maintenance actions
---
.../live/maintenance_live/index.html.heex | 42 +++++++++++++++++--
priv/gettext/default.pot | 20 +++++++++
priv/gettext/en/LC_MESSAGES/default.po | 20 +++++++++
3 files changed, 78 insertions(+), 4 deletions(-)
diff --git a/lib/music_library_web/live/maintenance_live/index.html.heex b/lib/music_library_web/live/maintenance_live/index.html.heex
index 0b4a7638..0c013a6d 100644
--- a/lib/music_library_web/live/maintenance_live/index.html.heex
+++ b/lib/music_library_web/live/maintenance_live/index.html.heex
@@ -13,10 +13,26 @@
-
- <.button type="button" phx-click="refresh_records_musicbrainz_data">
+ <.button
+ type="button"
+ phx-click="refresh_records_musicbrainz_data"
+ data-confirm={
+ gettext(
+ "Are you sure you want to refresh MusicBrainz data for all records? This operation can take a long time to complete."
+ )
+ }
+ >
{gettext("Refresh MusicBrainz data")}
- <.button type="button" phx-click="generate_record_embeddings">
+ <.button
+ type="button"
+ phx-click="generate_record_embeddings"
+ data-confirm={
+ gettext(
+ "Are you sure you want to regenerate embeddings for all records? This operation can take a long time to complete."
+ )
+ }
+ >
{gettext("Regenerate record embeddings")}
@@ -31,10 +47,28 @@
-
- <.button disabled type="button" phx-click="refresh_artists_musicbrainz_data">
+ <.button
+ disabled
+ type="button"
+ phx-click="refresh_artists_musicbrainz_data"
+ data-confirm={
+ gettext(
+ "Are you sure you want to refresh MusicBrainz data for all artists? This operation can take a long time to complete."
+ )
+ }
+ >
{gettext("Refresh MusicBrainz data")}
- <.button disabled type="button" phx-click="refresh_artists_discogs_data">
+ <.button
+ disabled
+ type="button"
+ phx-click="refresh_artists_discogs_data"
+ data-confirm={
+ gettext(
+ "Are you sure you want to refresh Discogs data for all artists? This operation can take a long time to complete."
+ )
+ }
+ >
{gettext("Refresh Discogs data")}
diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot
index 0e031740..079c8ab6 100644
--- a/priv/gettext/default.pot
+++ b/priv/gettext/default.pot
@@ -1573,3 +1573,23 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Vacuum"
msgstr ""
+
+#: lib/music_library_web/live/maintenance_live/index.html.heex
+#, elixir-autogen, elixir-format
+msgid "Are you sure you want to refresh Discogs data for all artists? This operation can take a long time to complete."
+msgstr ""
+
+#: lib/music_library_web/live/maintenance_live/index.html.heex
+#, elixir-autogen, elixir-format
+msgid "Are you sure you want to refresh MusicBrainz data for all artists? This operation can take a long time to complete."
+msgstr ""
+
+#: lib/music_library_web/live/maintenance_live/index.html.heex
+#, elixir-autogen, elixir-format
+msgid "Are you sure you want to refresh MusicBrainz data for all records? This operation can take a long time to complete."
+msgstr ""
+
+#: lib/music_library_web/live/maintenance_live/index.html.heex
+#, elixir-autogen, elixir-format
+msgid "Are you sure you want to regenerate embeddings for all records? This operation can take a long time to complete."
+msgstr ""
diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po
index d9fba4ff..b73eac20 100644
--- a/priv/gettext/en/LC_MESSAGES/default.po
+++ b/priv/gettext/en/LC_MESSAGES/default.po
@@ -1573,3 +1573,23 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Vacuum"
msgstr ""
+
+#: lib/music_library_web/live/maintenance_live/index.html.heex
+#, elixir-autogen, elixir-format
+msgid "Are you sure you want to refresh Discogs data for all artists? This operation can take a long time to complete."
+msgstr ""
+
+#: lib/music_library_web/live/maintenance_live/index.html.heex
+#, elixir-autogen, elixir-format
+msgid "Are you sure you want to refresh MusicBrainz data for all artists? This operation can take a long time to complete."
+msgstr ""
+
+#: lib/music_library_web/live/maintenance_live/index.html.heex
+#, elixir-autogen, elixir-format
+msgid "Are you sure you want to refresh MusicBrainz data for all records? This operation can take a long time to complete."
+msgstr ""
+
+#: lib/music_library_web/live/maintenance_live/index.html.heex
+#, elixir-autogen, elixir-format
+msgid "Are you sure you want to regenerate embeddings for all records? This operation can take a long time to complete."
+msgstr ""