feat(users): show API Only in the user list at a glance - #1331
Merged
Conversation
Following #1330. The flag was only visible by opening an account, which is the wrong shape for the question people actually bring to a user list: which of these are service accounts. Its own column rather than folded into API?, because the two are independent and every combination is real. API? is whether fog-user-token works for the account; this is whether the account can sign in at all. A service account reachable only through an issued Bearer token is API-only with API? OFF, and one cell cannot say that. Deliberately NOT the check/cross pair the API? column uses. A red cross there means "switched off", a state somebody may want to change. Neither value here is a fault -- an API-only account is not broken, it is a different kind of account -- so the pair is "stands out" against "ordinary": bg-warning/fa-key against bg-secondary/fa-user. Same two-badge shape as the protected column on images and snapins. fa-key rather than a robot because the bundled Font Awesome is 4.7.0, which has no fa-robot; an icon it does not carry renders as an empty box with nothing logged. tests/user-list-columns.test.php checks the icon names against the stylesheet that is actually served rather than against a list kept in the test, so it stays true if the bundle is ever changed. 10 checks, three mutation-verified: an icon FA 4.7.0 lacks, a header cell the JS has no column for, and a renderer pointed at the wrong target index. That first check is worth its own note -- the version before it scanned the whole JS file and failed on a comment naming the icon it had chosen NOT to use, a gate tripping on prose about itself. Header/column drift is loud in a browser (DataTables throws and renders no rows) and completely invisible to source review and CI, which is why it is pinned. Not generalized across all eighteen list pages: task and host set headerData five and seven times for different sub-grids and storagenode builds its header without _(), so counting _() calls reports 1 header against 6 columns for a page that is correct. A gate that cannot tell a real mismatch from its own parse failure is worse than none. Verified on a live 1.6 install: an API-only account renders bg-warning/fa-key and an ordinary one bg-secondary/fa-user, in a grid that loads its rows without a DataTables warning. FOG_BCACHE_VER bumped so the changed JS is actually served. Co-Authored-By: Claude <noreply@anthropic.com>
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.
Follows #1330. The API-only flag was only visible by opening an account,
which is the wrong shape for the question people actually bring to a user
list: which of these are service accounts.
Its own column, not folded into API?
The two flags are independent and every combination is real.
API?iswhether
fog-user-tokenworks for the account; this is whether the accountcan sign in at all. A service account reachable only through an issued
Bearer token is API-only with
API?off, and one cell cannot say that.Not the check/cross pair
API?uses green check / red cross, where a cross means "switched off" — astate somebody may want to change. Neither value here is a fault: an API-only
account is not broken, it is a different kind of account. So the pair is
"stands out" against "ordinary":
bg-warning+fa-keybg-secondary+fa-userSame two-badge shape as the
protectedcolumn on images and snapins, whichis the established pattern in these grids.
fa-keyrather than a robot because the bundled Font Awesome is 4.7.0,which has no
fa-robot; an icon the bundle does not carry renders as an emptybox with nothing logged. The test checks icon names against the stylesheet
that is actually served rather than against a list kept in the test, so it
stays true if the bundle is ever changed.
Tests
tests/user-list-columns.test.php, 10 checks, three mutation-verified: anicon FA 4.7.0 lacks, a header cell the JS has no column for, and a renderer
pointed at the wrong target index.
Header/column drift is worth pinning because it is loud in a browser and
silent everywhere else — DataTables throws a warning dialog and renders no
rows, while source review, the rest of the suite and CI all pass.
The first version of the icon check scanned the whole JS file and failed on a
comment naming the icon it had chosen not to use — a gate tripping on prose
about itself. It strips comments now.
Not generalized across all eighteen list pages, though fourteen map
cleanly to one js file by their
$node.taskandhostsetheaderDatafive and seven times for different sub-grids, and
storagenodebuilds itsheader without
_(), so counting_()calls reports 1 header cell against 6columns for a page that is entirely correct. A gate that cannot tell a real
mismatch from its own parse failure is worse than no gate; doing it properly
needs the header parsed rather than pattern-counted.
Verified live
On a 1.6 install: an API-only account renders
bg-warning/fa-keyand anordinary one
bg-secondary/fa-user, in a grid that loads its rows with noDataTables warning.
FOG_BCACHE_VERbumped so the changed JS is actuallyserved.
Downstream
None.