dawarich/app/views/imports/index.html.erb

91 lines
4 KiB
Text
Raw Normal View History

2024-06-12 15:10:53 -04:00
<% content_for :title, 'Imports' %>
2024-11-28 09:54:36 -05:00
<div class="w-full my-5">
<div class="flex justify-between items-center">
2024-03-15 18:27:31 -04:00
<h1 class="font-bold text-4xl">Imports</h1>
<%= link_to "New import", new_import_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
<% if current_user.safe_settings.immich_url && current_user.safe_settings.immich_api_key %>
<%= link_to 'Import Immich data', settings_background_jobs_path(job_name: 'start_immich_import'), method: :post, data: { confirm: 'Are you sure?', turbo_confirm: 'Are you sure?', turbo_method: :post }, class: 'rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium' %>
<% else %>
<a href='' class="rounded-lg py-3 px-5 bg-blue-900 text-gray block font-medium tooltip cursor-not-allowed" data-tip="You need to provide your Immich instance data in the Settings">Import Immich data</a>
<% end %>
<% if current_user.safe_settings.photoprism_url && current_user.safe_settings.photoprism_api_key %>
<%= link_to 'Import Photoprism data', settings_background_jobs_path(job_name: 'start_photoprism_import'), method: :post, data: { confirm: 'Are you sure?', turbo_confirm: 'Are you sure?', turbo_method: :post }, class: 'rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium' %>
<% else %>
<a href='' class="rounded-lg py-3 px-5 bg-blue-900 text-gray block font-medium tooltip cursor-not-allowed" data-tip="You need to provide your Photoprism instance data in the Settings">Import Photoprism data</a>
<% end %>
2024-03-15 18:27:31 -04:00
</div>
<div id="imports" class="min-w-full">
2024-06-12 15:02:42 -04:00
<% if @imports.empty? %>
<div class="hero min-h-80 bg-base-200 my-5">
2024-06-12 15:02:42 -04:00
<div class="hero-content text-center">
<div class="max-w-md">
<h1 class="text-5xl font-bold">Hello there!</h1>
<p class="py-6">
Here you'll find your imports, but now there are none. Let's <%= link_to 'create one', new_import_path, class: 'link' %>!
2024-06-12 15:02:42 -04:00
</p>
</div>
</div>
</div>
<% else %>
<div class="flex justify-center my-5">
<div class='flex'>
<%= paginate @imports %>
</div>
</div>
2024-06-12 15:02:42 -04:00
<div class="overflow-x-auto">
<table class="table">
<thead>
2024-03-23 08:36:09 -04:00
<tr>
2024-06-12 15:02:42 -04:00
<th>Name</th>
2025-06-26 13:24:40 -04:00
<th>File size</th>
2024-06-30 06:52:06 -04:00
<th>Imported points</th>
<% if DawarichSettings.store_geodata? %>
<th>Reverse geocoded points</th>
<% end %>
2024-06-12 15:02:42 -04:00
<th>Created at</th>
2024-03-23 08:36:09 -04:00
</tr>
2024-06-12 15:02:42 -04:00
</thead>
<tbody
data-controller="imports"
data-imports-target="index"
data-user-id="<%= current_user.id %>"
>
2024-06-12 15:02:42 -04:00
<% @imports.each do |import| %>
<tr data-import-id="<%= import.id %>"
id="import-<%= import.id %>"
data-points-total="<%= import.processed %>">
2024-06-12 15:02:42 -04:00
<td>
<%= link_to import.name, import, class: 'underline hover:no-underline' %>
(<%= import.source %>)
&nbsp;
<%= link_to '🗺️', map_path(import_id: import.id) %>
&nbsp;
<%= link_to '📋', points_path(import_id: import.id) %>
2024-06-12 15:02:42 -04:00
</td>
2025-06-26 13:24:40 -04:00
<td><%= number_to_human_size(import.file.byte_size) || 'N/A' %></td>
<td data-points-count>
<%= number_with_delimiter import.processed %>
2024-06-12 15:02:42 -04:00
</td>
<% if DawarichSettings.store_geodata? %>
<td data-reverse-geocoded-points-count>
<%= number_with_delimiter import.reverse_geocoded_points_count %>
</td>
<% end %>
2025-04-04 14:15:05 -04:00
<td><%= human_datetime(import.created_at) %></td>
2024-06-12 15:02:42 -04:00
</tr>
<% end %>
</tbody>
</table>
</div>
2025-04-04 14:15:05 -04:00
<div class="flex justify-center my-5">
<div class='flex'>
<%= paginate @imports %>
</div>
</div>
2024-06-12 15:02:42 -04:00
<% end %>
2024-03-15 18:27:31 -04:00
</div>
</div>