diff --git a/lib/mv_web/live/import_export_live.ex b/lib/mv_web/live/import_export_live.ex index cdbc332..f844305 100644 --- a/lib/mv_web/live/import_export_live.ex +++ b/lib/mv_web/live/import_export_live.ex @@ -40,7 +40,9 @@ defmodule MvWeb.ImportExportLive do on_mount {MvWeb.LiveHelpers, :ensure_user_role_loaded} - # CSV Import configuration constants + # Maximum number of errors to collect per import to prevent memory issues + # and keep error display manageable. Additional errors are silently dropped + # after this limit is reached. @max_errors 50 @impl true @@ -93,204 +95,11 @@ defmodule MvWeb.ImportExportLive do <%= if Authorization.can?(@current_user, :create, Mv.Membership.Member) do %> <%!-- CSV Import Section --%> <.form_section title={gettext("Import Members (CSV)")}> -
- {gettext( - "Use the data field name as the CSV column header in your file. Data fields must exist in Mila before importing, so they must be listed in the list of memberdate (like e-mail or first name). Unknown data field columns will be ignored with a warning." - )} -
-- <.link - href={~p"/settings#custom_fields"} - class="link" - data-testid="custom-fields-link" - > - {gettext("Manage Memberdata")} - -
-- {gettext("Download CSV templates:")} -
-- {gettext("Processing chunk %{current} of %{total}...", - current: @import_progress.current_chunk, - total: @import_progress.total_chunks - )} -
- <% end %> - - <%= if @import_progress.status == :done do %> -- <.icon - name="hero-check-circle" - class="size-4 inline mr-1" - aria-hidden="true" - /> - {gettext("Successfully inserted: %{count} member(s)", - count: @import_progress.inserted - )} -
- <%= if @import_progress.failed > 0 do %> -- <.icon - name="hero-exclamation-circle" - class="size-4 inline mr-1" - aria-hidden="true" - /> - {gettext("Failed: %{count} row(s)", count: @import_progress.failed)} -
- <% end %> - <%= if @import_progress.errors_truncated? do %> -- <.icon - name="hero-information-circle" - class="size-4 inline mr-1" - aria-hidden="true" - /> - {gettext("Error list truncated to %{count} entries", - count: @max_errors - )} -
- <% end %> -+ {gettext( + "Use the data field name as the CSV column header in your file. Data fields must exist in Mila before importing, so they must be listed in the list of member data (like e-mail or first name). Unknown data field columns will be ignored with a warning." + )} +
++ <.link + href={~p"/settings#custom_fields"} + class="link" + data-testid="custom-fields-link" + > + {gettext("Manage Member Data")} + +
++ {gettext("Download CSV templates:")} +
++ {gettext("CSV files only, maximum %{size} MB", size: @csv_import_max_file_size_mb)} +
++ {gettext("Processing chunk %{current} of %{total}...", + current: @import_progress.current_chunk, + total: @import_progress.total_chunks + )} +
+ <% end %> + + <%= if @import_progress.status == :done do %> + <%= import_results(assigns) %> + <% end %> ++ <.icon + name="hero-check-circle" + class="size-4 inline mr-1" + aria-hidden="true" + /> + {gettext("Successfully inserted: %{count} member(s)", + count: @import_progress.inserted + )} +
+ <%= if @import_progress.failed > 0 do %> ++ <.icon + name="hero-exclamation-circle" + class="size-4 inline mr-1" + aria-hidden="true" + /> + {gettext("Failed: %{count} row(s)", count: @import_progress.failed)} +
+ <% end %> + <%= if @import_progress.errors_truncated? do %> ++ <.icon + name="hero-information-circle" + class="size-4 inline mr-1" + aria-hidden="true" + /> + {gettext("Error list truncated to %{count} entries", count: @max_errors)} +
+ <% end %> +