mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Update imports table
This commit is contained in:
parent
432e1d2669
commit
5a85a56897
3 changed files with 12 additions and 4 deletions
|
|
@ -22,6 +22,7 @@ class Imports::Create
|
||||||
import.source
|
import.source
|
||||||
end
|
end
|
||||||
|
|
||||||
|
import.update!(source: source)
|
||||||
importer(source).new(import, user.id, temp_file_path).call
|
importer(source).new(import, user.id, temp_file_path).call
|
||||||
|
|
||||||
schedule_stats_creating(user.id)
|
schedule_stats_creating(user.id)
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="overflow-x-auto">
|
<div class="overflow-x-auto">
|
||||||
<table class="table overflow-x-auto">
|
<table class="table table-zebra overflow-x-auto">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
|
@ -55,7 +55,8 @@
|
||||||
<% @imports.each do |import| %>
|
<% @imports.each do |import| %>
|
||||||
<tr data-import-id="<%= import.id %>"
|
<tr data-import-id="<%= import.id %>"
|
||||||
id="import-<%= import.id %>"
|
id="import-<%= import.id %>"
|
||||||
data-points-total="<%= import.processed %>">
|
data-points-total="<%= import.processed %>"
|
||||||
|
class="hover">
|
||||||
<td>
|
<td>
|
||||||
<%= link_to import.name, import, class: 'underline hover:no-underline' %>
|
<%= link_to import.name, import, class: 'underline hover:no-underline' %>
|
||||||
(<%= import.source %>)
|
(<%= import.source %>)
|
||||||
|
|
@ -72,9 +73,9 @@
|
||||||
<td><%= human_datetime(import.created_at) %></td>
|
<td><%= human_datetime(import.created_at) %></td>
|
||||||
<td class="whitespace-nowrap">
|
<td class="whitespace-nowrap">
|
||||||
<% if import.file.present? %>
|
<% if import.file.present? %>
|
||||||
<%= link_to 'Download', rails_blob_path(import.file, disposition: 'attachment'), class: "px-4 py-2 bg-blue-500 text-white rounded-md", download: import.name %>
|
<%= link_to 'Download', rails_blob_path(import.file, disposition: 'attachment'), class: "btn btn-outline btn-sm btn-info", download: import.name %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to 'Delete', import, data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?", turbo_method: :delete }, method: :delete, class: "px-4 py-2 bg-red-500 text-white rounded-md" %>
|
<%= link_to 'Delete', import, data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?", turbo_method: :delete }, method: :delete, class: "btn btn-outline btn-sm btn-error" %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,12 @@ RSpec.describe Imports::Create do
|
||||||
expect(import.reload.status).to eq('processing').or eq('completed')
|
expect(import.reload.status).to eq('processing').or eq('completed')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'updates the import source' do
|
||||||
|
service.call
|
||||||
|
|
||||||
|
expect(import.reload.source).to eq('owntracks')
|
||||||
|
end
|
||||||
|
|
||||||
context 'when import succeeds' do
|
context 'when import succeeds' do
|
||||||
it 'sets status to completed' do
|
it 'sets status to completed' do
|
||||||
service.call
|
service.call
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue