mirror of
https://github.com/netfun2000/hipudding-teslamate.git
synced 2026-02-27 09:44:28 +08:00
* feat: update to Phenix HTML 4.1 * fix: updating to the new Gettext.Backend approach * chore: update pot files ro locale version 45.0.0 * fix: downgrade cloack back to 1.1.2 * revert: merge of mix.lock * fix: new syntax for field name generation for phx-feedback-for * Revert "fix: new syntax for field name generation for phx-feedback-for" This reverts commit 4d95e4f1c9367d2d5c606ced2190ab23edcb971b. * fix: downgrade floki back to 0.35.2 * Revert "fix: downgrade floki back to 0.35.2" This reverts commit a4f0b6bf4b32099d89003c3d20f72333d510e109. * fix: ensure floki nil is handled * style: linter findings * Revert "fix: ensure floki nil is handled" * fix: new syntax for field name generation for phx-feedback-for * debug: floki paramter error * Revert "debug: floki paramter error" This reverts commit 61920267edf5186b593920bde7d87e8b30af55aa. * fix: Remove unnecessary code in settings_test.exs which breaks floki 0.36+
105 lines
3.5 KiB
Plaintext
105 lines
3.5 KiB
Plaintext
<nav class="breadcrumb" aria-label="breadcrumbs">
|
|
<ul>
|
|
<li><.link navigate={~p"/"}><%= gettext("Home") %></.link></li>
|
|
<li class="is-active"><.link navigate=""><%= gettext("TeslaFi Import") %></.link></li>
|
|
</ul>
|
|
</nav>
|
|
|
|
<div class="container is-flex mb-3" style="align-items: center; justify-content: space-between;">
|
|
<h2 class="title is-4 is-marginless">
|
|
<%= ngettext(
|
|
"Found %{count} file",
|
|
"Found %{count} files",
|
|
length(@status.files),
|
|
count: length(@status.files)
|
|
) %>
|
|
</h2>
|
|
<%= link(raw("<span class='icon'><span class='mdi mdi-reload'></span></span>"),
|
|
to: "#",
|
|
type: "button",
|
|
class: "button is-text is-inverted",
|
|
phx_click: "reload",
|
|
disabled: @status.state != :idle
|
|
) %>
|
|
</div>
|
|
|
|
<div class="table-container">
|
|
<table class="table is-narrow is-hoverable is-fullwidth">
|
|
<thead></thead>
|
|
<tbody>
|
|
<%= for %{path: path, date: date, complete: complete} <- @status.files do %>
|
|
<% {year, month} =
|
|
with [year, month] <- date,
|
|
month = month |> to_string() |> String.pad_leading(2, "0") do
|
|
{year, month}
|
|
else
|
|
_ -> {"????", "??"}
|
|
end %>
|
|
<tr>
|
|
<td style="font-variant-numeric: tabular-nums;"><%= "#{month}/#{year}" %></td>
|
|
<td><%= Path.absname(path) %></td>
|
|
<td class="has-text-centered" style="min-width: 30px;">
|
|
<span class="spinner">
|
|
<%= case {@status.state, complete} do %>
|
|
<% {:running, true} -> %>
|
|
<span class="icon has-text-success">
|
|
<span class="mdi mdi-check-bold"></span>
|
|
</span>
|
|
<% {:running, false} -> %>
|
|
<%= content_tag(:span, nil, class: "is-loading") %>
|
|
<% {:error, true} -> %>
|
|
<span class="icon has-text-success">
|
|
<span class="mdi mdi-check-bold"></span>
|
|
</span>
|
|
<% {:error, false} -> %>
|
|
<span class="icon has-text-danger">
|
|
<span class="mdi mdi-alert-circle"></span>
|
|
</span>
|
|
<% {:complete, true } -> %>
|
|
<span class="icon has-text-success">
|
|
<span class="mdi mdi-check-bold"></span>
|
|
</span>
|
|
<% {:complete, false} -> %>
|
|
<span class="icon has-text-info">
|
|
<span class="mdi mdi-debug-step-over"></span>
|
|
</span>
|
|
<% {:idle, _} -> %>
|
|
<% end %>
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<%= if @status.state == :idle do %>
|
|
<.form :let={f} for={@changeset} phx-change="change" phx-submit="import">
|
|
<div class="field mb-6">
|
|
<%= label(f, :timezone, gettext("Time zone"), class: "label is-medium ") %>
|
|
<div class="control">
|
|
<div class="select is-fullwidth">
|
|
<%= select(f, :timezone, @timezones, disabled: @status.state != :idle) %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="field">
|
|
<div class="control">
|
|
<%= submit(gettext("Import"),
|
|
class: "button is-success is-fullwidth",
|
|
disabled: !@changeset.valid? or length(@status.files) < 1,
|
|
phx_disable_with: "Saving...",
|
|
phx_loading_class: "is-loading"
|
|
) %>
|
|
</div>
|
|
</div>
|
|
</.form>
|
|
<% end %>
|
|
|
|
<%= if @status.state == :error do %>
|
|
<code class="box has-text-danger">
|
|
<%= inspect(@status.message, pretty: true) %>
|
|
</code>
|
|
<% end %>
|