Skip to content

refactor(admin): one file per tab, instead of three tabs in one - #619

Merged
EVWorth merged 1 commit into
mainfrom
refactor/admin-panel-split
Sep 10, 2026
Merged

EVWorth merged 1 commit into
mainfrom
refactor/admin-panel-split

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Part of #432; #442's premises don't hold — reasoning below.

AdminPanel.tsx was 793 lines: a tab shell plus three tabs that had nothing to do with each other and shared only the file they were in. Each is its own file now, and the shell is 65 lines — a tab bar and a content area, which is all it ever was.

Before After
AdminPanel.tsx 793 65
ProcessListTab.tsx — 235
ServerVariablesTab.tsx — 212
ServerStatusTab.tsx — 160
serverStatus.ts — 108

The status arithmetic moved to serverStatus.ts. It's the part worth testing, and it was buried among two unrelated tabs; the existing computeMetrics test now imports from a module named after what it does.

No admin store, against what #442 asks for

Its case rests on tabs sharing polling state — "one process_list_update subscription per connection" — and they can't. AdminPanel renders the active tab only (activeSubTab === "processes" && <ProcessListTab/>), so there's one poller at a time and nothing to share. A store per tab would be indirection with a single consumer each, which is what #448 turned out to be.

The file records where that reasoning would change: something outside this panel wanting the process list.

#442's other premise

It says the two components import each other. They don't — AdminPanel imports UserManagement, an ordinary parent-child relationship. There's no cycle to break.

Still outstanding

UserManagement.tsx is 1135 lines and is the rest of #432. Next PR.

Verification

A pure move, so the existing 96 admin tests passing is the signal. Unit 2127, browser 297, 0 lint errors.

AdminPanel.tsx was 793 lines: a tab shell plus three tabs that had nothing
to do with each other and shared only the file they were in (#432). Each is
its own file now, and the shell is 65 lines — a tab bar and a content area,
which is all it ever was.

The status arithmetic moved to serverStatus.ts. It is the part worth
testing, and it was a function buried among two unrelated tabs; the existing
computeMetrics test now imports from a module named after what it does.
RefreshInterval lives there too, since two tabs use it.

No admin store, deliberately, against what #442 asks for. Its case rests on
tabs sharing polling state — "one process_list_update subscription per
connection" — and they cannot: AdminPanel renders the active tab only, so
there is one poller at a time and nothing to share. A store per tab would be
indirection with a single consumer each, which is the mistake #448 turned
out to be. The file says where the reasoning would change: something outside
this panel wanting the process list.

#442 also says the two components import each other. They do not. AdminPanel
imports UserManagement, which is an ordinary parent-child relationship, and
there is no cycle to break.

UserManagement is still 1135 lines and is the rest of #432.

Co-Authored-By: Claude Opus 5 <[email protected]>
@EVWorth
EVWorth merged commit 528a5a4 into main Sep 10, 2026
12 checks passed
@EVWorth
EVWorth deleted the refactor/admin-panel-split branch September 10, 2026 12:28
EVWorth added a commit that referenced this pull request Sep 10, 2026
1135 lines in one file: the user list, the detail pane, a 500-line
privileges editor, and the reporting for a partly-applied grant change
(#432). Nothing shared but the file.

UserManagement is 309 lines and is now the list and its dialogs.
UserDetail carries the detail pane and its grant views. PrivilegesEditor is
its own file. grantReporting holds describePartialFailure and setsEqual —
the part that explains a half-applied change, which is worth finding
without scrolling past five hundred lines of checkbox grid.

PrivilegesEditor is still 519 lines, and that is deliberate rather than
overlooked. It is one coherent thing — a grid of privileges with a diff and
a preview — and splitting it further would need a reason beyond the line
count. The file-per-concern boundary is where the seams actually were.

A pure move: no behaviour changed, and the 96 existing admin tests passing
is what says so.

With #619, AdminPanel is 65 lines and no admin file is over 520.

Closes #432

Co-Authored-By: Claude Opus 5 <[email protected]>
EVWorth added a commit that referenced this pull request Sep 10, 2026
1135 lines in one file: the user list, the detail pane, a 500-line
privileges editor, and the reporting for a partly-applied grant change
(#432). Nothing shared but the file.

UserManagement is 309 lines and is now the list and its dialogs.
UserDetail carries the detail pane and its grant views. PrivilegesEditor is
its own file. grantReporting holds describePartialFailure and setsEqual —
the part that explains a half-applied change, which is worth finding
without scrolling past five hundred lines of checkbox grid.

PrivilegesEditor is still 519 lines, and that is deliberate rather than
overlooked. It is one coherent thing — a grid of privileges with a diff and
a preview — and splitting it further would need a reason beyond the line
count. The file-per-concern boundary is where the seams actually were.

A pure move: no behaviour changed, and the 96 existing admin tests passing
is what says so.

With #619, AdminPanel is 65 lines and no admin file is over 520.

Closes #432

Co-authored-by: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant