diff --git a/bin/SHA256SUMS b/bin/SHA256SUMS index f0ff213..60988eb 100644 --- a/bin/SHA256SUMS +++ b/bin/SHA256SUMS @@ -1,4 +1,4 @@ dcb137ae6a3f6a59465f2772215d48f98fd303dd1c266645b20ec70194ab7915 control-api b7a6068db1d095ae7b73cbd9b7273d6a1629ae017e9c3c9601e103432894a247 validator-agent be8e9576c6fbe5e5798b5d4b758a5617b63bea6abe80e326998d10583edbbf5c prober -8c8b41a0f1f2103bef7181fdd9c6741b09ad638955310698e1fd4793e328f39c admin-dashboard +cec482fb92246210108261cfc02c10ef9829ce3c7d7c174cf935976baa42fd2c admin-dashboard diff --git a/bin/admin-dashboard b/bin/admin-dashboard index 38ff5fc..061bcd0 100755 Binary files a/bin/admin-dashboard and b/bin/admin-dashboard differ diff --git a/internal/dashboard/handlers_test.go b/internal/dashboard/handlers_test.go index c4e6e18..ffefa86 100644 --- a/internal/dashboard/handlers_test.go +++ b/internal/dashboard/handlers_test.go @@ -156,13 +156,27 @@ func TestIPsDeleteSelected(t *testing.T) { } func TestIPsPagePollsForFragment(t *testing.T) { - _, caURL := newFakeControlAPI(t) + fake, caURL := newFakeControlAPI(t) + now := time.Now() + fake.ips = []ipQueueItem{ + {IPAddress: "1.1.1.1", State: "done", OverallResult: "pass", AggregatedAt: &now, UpdatedAt: now, CreatedAt: now}, + } ts := newTestServer(t, caURL) body := get(t, ts, "/ips") if !strings.Contains(body, `hx-get="/ips/fragment"`) || !strings.Contains(body, `hx-trigger="every 5s"`) { t.Fatalf("expected ips-table-wrap to auto-poll every 5s, got:\n%s", body) } + // hx-sync must coordinate the poll with every action that also swaps + // #ips-table-wrap (bulk buttons, per-row buttons, the add-address + // form) so a slow mutation and a poll tick can never race and let a + // stale response clobber a just-applied action (recheck-selected + // appearing to silently fail with many rows selected) — 1 wrapper div + // + 1 add-address form + 3 bulk buttons + 2 per-row buttons (one + // terminal row: "Перепроверить" + "Удалить") = 7. + if got := strings.Count(body, `hx-sync="#ips-table-wrap:queue last"`); got != 7 { + t.Fatalf("expected 7 elements to declare hx-sync, got %d in:\n%s", got, body) + } } func TestIPsFragment(t *testing.T) { diff --git a/internal/dashboard/templates/ips.html b/internal/dashboard/templates/ips.html index b6cecc4..1dcb4fd 100644 --- a/internal/dashboard/templates/ips.html +++ b/internal/dashboard/templates/ips.html @@ -24,7 +24,7 @@
-
+
@@ -38,7 +38,7 @@
-
+
{{template "ips_table" .}}
{{end}} @@ -47,9 +47,9 @@
- - - + + +
@@ -68,11 +68,11 @@
{{if $terminal}} - + {{else}} - + {{end}} - +