Skip to content

fix(admin-servers): surface copyable Server ID on server cards (#1504)#1523

Merged
rumblefrog merged 1 commit into
mainfrom
fix/1504-server-id-on-admin-cards
Jul 5, 2026
Merged

fix(admin-servers): surface copyable Server ID on server cards (#1504)#1523
rumblefrog merged 1 commit into
mainfrom
fix/1504-server-id-on-admin-cards

Conversation

@rumblefrog

Copy link
Copy Markdown
Member

Summary

Fixes #1504.

The SourceMod plugin's sourcebans.cfg ServerID field carries the inline comment "Check in the admin panel -> servers to find the ID of this server", and the setup docs tell operators to note the ID after adding a server. But the v2.0 card-grid rewrite of page_admin_servers_list.tpl never printed the sid anywhere an operator could read it (it only lived inside RCON/Edit/Admins hrefs and a muted no-icon fallback glyph). Operators had no way to find the value the plugin needs.

This adds a labelled, copyable Server ID row to each server card:

  • web/themes/default/page_admin_servers_list.tpl — a Server ID <dt>/<dd> as the first row of each card's <dl>, with a monospace value span and a copy button that rides the existing document-level [data-copy] delegate in theme.js (secure-context clipboard + execCommand fallback). Button chrome uses the compliant btn btn--ghost btn--icon btn--xs chain, matching the sibling refresh button. Also swapped a pre-existing emdash in the "Disabled" pill title for parens (user-facing-text rule).
  • docssetup/adding-server.md + getting-started/quickstart.mdx now point at the card's Server ID (previously referenced a nonexistent "ID column"/"row") and mention the copy button. Corrected the admin nav label to Servers (the actual nav entry; was "Server Settings").

No backend/schema change: sid is the existing int PK already carried through AdminServersListView to the template, and it's not user-controlled (Smarty global auto-escape covers the attribute/value renders regardless).

Test plan

  • PHPUnit AdminServersListHydrationTest::testTileRendersCopyableServerId — asserts the server-id testid, the numeric value span, the data-copy="<sid>" copy button (order-independent regex), and the visible <dt>Server ID</dt> label across both enabled and disabled tiles.
  • E2E flows/admin-server-id.spec.ts — seeds a server via the servers.add JSON API, then asserts the populated card renders the labelled Server ID row + value + copy-button payload, and runs the critical-axe gate on the populated card (the existing smoke spec only axe-checks the empty state).
  • ./sbpp.sh phpstan — clean (includes SmartyTemplateRule).
  • ./sbpp.sh test tests/integration/AdminServersListHydrationTest.php tests/integration/ButtonClassChainTest.php — green.
  • ./sbpp.sh ts-check + tsc --noEmit on the E2E suite — clean for the touched files.
  • Adversarial review pass — no blockers/majors; actionable findings (docs nav label, tightened label assertion, emdash, populated-card axe coverage) addressed in-branch.

Follow-ups (out of scope)

  • The Edit-server page could also surface the labelled sid (operators land there too); the plugin comment points at the list, which this PR covers.

The v2.0 card-grid rewrite of the admin Servers list dropped the
numeric Server ID from view, but the SourceMod plugin's
sourcebans.cfg and the setup docs both tell operators to find it
"in the admin panel -> servers". Add a labelled, copyable
"Server ID" row to each server card so operators can wire the
plugin's ServerID field without guessing.

- page_admin_servers_list.tpl: labelled Server ID row + copy button
  (rides the existing document-level [data-copy] delegate in theme.js)
- docs: point adding-server.md + quickstart.mdx at the card's Server
  ID (was a nonexistent "ID column"); fix the admin nav label
  (Servers, not Server Settings)
- tests: PHPUnit markup contract (enabled + disabled tiles) + E2E
  render + critical-a11y coverage of the populated card
Copilot AI review requested due to automatic review settings July 4, 2026 23:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@rumblefrog
rumblefrog enabled auto-merge July 5, 2026 00:10
@rumblefrog
rumblefrog disabled auto-merge July 5, 2026 00:10
@rumblefrog
rumblefrog added this pull request to the merge queue Jul 5, 2026
Merged via the queue into main with commit c5c5c54 Jul 5, 2026
6 of 7 checks passed
@rumblefrog
rumblefrog deleted the fix/1504-server-id-on-admin-cards branch July 5, 2026 00:11
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Didn't see any "Server ID" in Admin->Server Page

2 participants