Commit 051b428
authored
* feat(admin-groups): render per-group server cards with live-hostname hydration (#1406)
Closes #1406. The Server Groups list (?p=admin&c=groups) used to ship
a per-card hydration surface (`<div id="servers_{gid}">` + a legacy
`LoadServerHostPlayersList(...)` script feeder) that was silently dead
post-#1123 D1 — every page load raised ReferenceError once per group,
and admins saw a literal "Servers populate via the legacy ... hook."
placeholder forever. Cleanup PR #1404 dropped the dead echo + slot +
placeholder; this is the additive replacement.
Each group card now emits one `[data-testid="server-tile"]` per bound
server inside a `[data-server-hydrate="auto"]` container, picked up by
the shared `server-tile-hydrate.js` helper (the same one the public
Server List #1311 / admin Server Management #1313 / dashboard widget
fallback inside `[data-testid="server-host"]`.
Implementation:
- `web/pages/admin.groups.php`: INNER JOIN `:prefix_servers_groups`
against `:prefix_servers` per group so each `$server_list` row
carries a `servers` array of (sid, ip, port). Dangling membership
rows from deleted servers silently drop instead of surfacing
broken tiles. ORDER BY S.sid keeps the render order stable across
page loads.
- `web/includes/View/AdminGroupsListView.php`: docblock update for
the new `servers` shape.
- `web/themes/default/page_admin_groups_list.tpl`: per-group
`<ul data-server-hydrate="auto">` with one `<li
data-testid="server-tile" data-id="{$server.sid}">` per bound
server. `data-trunchostname="40"` matches the dashboard widget's
cramped-card tuning. Empty-state arm gates on
`empty($group.servers)` to show a `[data-testid="server-group-empty"]`
one-liner instead of an inert hydration container.
- No new JSON action: the existing `Actions.ServersHostPlayers` is
what the shared hydration helper fires per tile, same as every
other surface that rides this helper.
Tests:
- `web/tests/integration/AdminServerGroupsServerCardsRenderTest.php`
pins the static contract (mirror of `ServerMapImageRenderTest`):
handler JOIN + column list + `$row['servers']` assignment,
template testids + data-fallback shape + hydration helper script
include, hydration helper's `server-host` wiring, and the
"dead shape stays dead" sister contract (no
`LoadServerHostPlayersList`, no `<div id="servers_{gid}">`, no
placeholder copy).
- `web/tests/e2e/specs/flows/admin-groups-server-cards-hydration.spec.ts`
drives the runtime observable: seeds a server group with two
bound servers via the new `seedServerGroupWithServersE2e` shim,
stalls `Actions.ServersHostPlayers` per tile via `page.route`,
asserts the SSR IP:port fallback paints, releases the stub, and
asserts each `[data-testid="server-host"]` flips to its canned
live hostname.
- `web/tests/e2e/scripts/seed-server-group-e2e.php` + the matching
`seedServerGroupWithServersE2e` helper in
`web/tests/e2e/fixtures/db.ts`: shells out to write the three
rows (`:prefix_groups (type=3)` + N `:prefix_servers` + N
`:prefix_servers_groups`) directly. There is no JSON action to
wire a server into a server-group's membership, so the seed has
to go via SQL. Same e2e-only guardrails as the sister
`seed-comms-e2e.php` / `set-setting-e2e.php` shims (refuses any
DB other than the e2e schema).
Docs: AGENTS.md "Hydrate server-tile cards…" row in "Where to find
what" updated to enumerate the Server Groups card stack alongside
the public/admin/dashboard surfaces, with the per-group `servers`
array + INNER JOIN composition documented.
Refs #1404, #1311, #1313, #1375, #1405.
* chore(admin-groups): skip disabled-server probes + extend e2e coverage (review)
Adversarial reviewer findings on PR #1413 (issue #1406):
1. Disabled servers were rendered AND probed by server-tile-hydrate.
Mirror the sibling page_admin_servers_list.tpl's contract by
propagating S.enabled into the View DTO + tagging disabled
<li>s with data-server-skip="1" (the helper's loadTile()
short-circuits on that) AND a visible "Disabled" pill so the
admin sees the bound-but-disabled relationship without
wondering why no hostname appeared. Saves N pointless
Actions.ServersHostPlayers round-trips per page-load on
installs with disabled servers in groups.
2. Extended the e2e spec with two arms - disabled-server (asserts
probe is skipped + the Disabled pill renders) and
dangling-membership-row (deletes the bound server via a new
e2e SQL-shim that bypasses api_servers_remove's cleanup,
asserts the INNER JOIN drops the orphaned row). The latter
locks in the worker's documented INNER-JOIN-over-LEFT-JOIN
choice operationally, not just structurally.
Skipped reviewer findings 2/3 (N+1, missing index - pre-existing),
4 (empty-state inline shape - defensible in cramped per-card body;
added an inline rationale comment for future maintainers),
6 (hydration concurrency - pre-existing pattern), 7 (perm boundary
- intentional per issue body), and all 8 NITs (cosmetic).
1 parent 3c9b703 commit 051b428
9 files changed
Lines changed: 1642 additions & 31 deletions
File tree
- web
- includes/View
- pages
- tests
- e2e
- fixtures
- scripts
- specs/flows
- integration
- themes/default
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
56 | 67 | | |
57 | 68 | | |
58 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
162 | 187 | | |
163 | | - | |
164 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
165 | 200 | | |
166 | 201 | | |
167 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| |||
399 | 403 | | |
400 | 404 | | |
401 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
402 | 583 | | |
403 | 584 | | |
404 | 585 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
0 commit comments