Repository navigation
refactor(admin): one file per tab, instead of three tabs in one - #619
Merged
Merged
Conversation
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
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #432; #442's premises don't hold — reasoning below.
AdminPanel.tsxwas 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.AdminPanel.tsxProcessListTab.tsxServerVariablesTab.tsxServerStatusTab.tsxserverStatus.tsThe status arithmetic moved to
serverStatus.ts. It's the part worth testing, and it was buried among two unrelated tabs; the existingcomputeMetricstest 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_updatesubscription per connection" — and they can't.AdminPanelrenders 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 —
AdminPanelimportsUserManagement, an ordinary parent-child relationship. There's no cycle to break.Still outstanding
UserManagement.tsxis 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.