Repository navigation
Conversation
The gateway has routes for the administrators of an organization
(`/user/organization/*`) and returns the organization of an account in
`GET /user/me`. The console did not read them.
- `lib/api/organization.ts` has one function for each route. A monthly
limit goes out in the USD field on a USD ledger and as a native amount
with its currency on another ledger.
- `useOrganization.ts` has one query hook for each read. The ledger
currency is part of each key. A write reads every cached answer of the
organization again before it reports success.
- The session keeps `organization {id, name, role}` from the profile.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
An administrator of an organization had no page to see the members of the organization or to manage them. The gateway routes existed without a console. The console now has an organization area at `/dashboard/organization`, with five pages: - Overview: spend, requests, tokens and active members of a period, the month against the organization limit, two series and spend by model. - Members: one row for each member with its usage and its month against its limit. A row opens in place with the details of the member. From there the administrator sets the monthly limit, removes the member or restores a removed member. - Usage: the requests of the members, and the totals by model and by member. The gateway sends no request content, and the page shows none. - Audit log: the management actions of the organization. - Settings: the record, the SSO connections and the administrators, which the platform administrator controls, and the default monthly limit of a member, which the organization administrator sets. The navigation shows one entry, named after the organization, to an account that is an administrator of its organization. The area is translated (zh-CN), follows the ledger currency, and works at phone width. The gateway decides who can read each page; the console only selects what to show. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The translation guide says that administration pages stay in English. The organization console looks like the Admin area, but its readers are the staff of an organization. The guide now says that it is translated. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The Usage page keeps the rows of the page before on screen while the next page loads. A second click on "Older" in that time asked for the same page again and put its cursor on the way back twice. "Older" and "Newer" now wait for the page. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The details of a member opened in the row of the member. The prototype of the organization console shows them in a panel at the right side of the window, with the list behind it. A click on a row now opens that panel. It has the status of the member, the actions, the figures, the spend for each of the last 30 days, the models and the last requests. The panel is a modal layer: focus moves into it and back to the row, Tab stays inside, and Escape, Close and a click on the dimmed list close it. A confirmation that opens over the panel has the keys while it is open. On a phone the panel has the width of the screen. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The list of members showed a limit of a member and the default limit of the organization in the same way. After a change of the default, the list did not show which rows the change moved. - A row whose limit is the default now has the word "default" under the figure. The word hangs below the line, so it moves no bar and no figure. - The bar of a limit draws its whole track in a color that shows in the light and in the dark theme. Thus every bar of the list has one length, and only the filled part differs. - The bar and the figure have fixed places, so they line up down the list. - An amount that rounds to 0% still shows a filled part. No spend shows none. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The two charts of spend, in the overview and in the panel of a member, read their amounts from the answer but took the currency from the site configuration of the page. A page that stayed open while the ledger changed from USD to CNY wrote 70 yuan as $70, under the title "Spend per day (USD)", beside cards that showed yuan. The title and each amount of a chart now use the currency that the gateway sent with the points of the series. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The list of requests and the list by member kept their position together with the filters it was reached with, and only hid it when the filters changed. Older, then Errors, then All statuses showed the older page again and not the newest requests. The second page of the members came back after 7d, 30d, 7d. The position is now dropped when the filters change. The two lists share one hook for it, useListPosition. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… models - The axis of a spend chart wrote each amount in full, and an amount of 1,000 or more was cut at the edge of the chart. The axis now has the short form, 1.35K. The tooltip and the table keep the amount in full. - A line of one point drew nothing. One point is now a dot. - Each row of the spend by model was a grid of its own. The bars ended at different edges, and they were not on one scale. The list is now one grid. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- The organization routes were read with jsonOrThrow, which reads each 409 as "This email is already registered". A dialog showed that text for a removal, a restore or a limit that the gateway refused. The routes are now read with readJson, which keeps the sentence of the gateway. - The panel offered a limit and a removal for a member that is an administrator of the platform, and the gateway refused both. The panel now has no action for a member that the gateway marks as protected. - A typed limit is now plain digits with at most four decimal places. Number() read 0x10 as 16 and 1e3 as 1000. - The same amount typed another way, 40.0 for 40, is no change. The default limit kept Save active for it and sent it again on each click. - The limit dialog opens with the cursor in the amount. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- The member list and the audit log went back to the first page on each change of the search text, also when the search itself did not change, and 300 ms after the page opened. The page now starts again only when a filter changes. - On a later page that had become empty, the usage by member and the audit log said that there was nothing, with no pager. They now go to the last page that has rows, as the member list does. - While the total of a new period loaded, the usage by member gave each member a share of the total of the period before. It now gives none. A total that cannot be read shows its error with a retry. - A click on the header "Monthly limit" ordered the members by the spend of the month. It now orders by the share of the limit, which is what the column shows. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…organization - A press that began in the panel of a member and ended on the dimmed list closed the panel, as the end of a selection of text does. Only a press on the dimmed list itself now closes it. - After a rename of the organization, the header, the navigation entry and the audit log kept the old name until a reload. The area now reads the organization, shows its name, and reads the profile again when the name differs. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Upstream dev gained six commits after this branch was cut: MCP tools in the playground chat, a retry of the failed requests of a batch, the effective concurrency cap in GET /v1/key, and three dependency and deploy changes. The merge has no conflict, and no file of the console changed on both sides. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
1a1a11a
left a comment
There was a problem hiding this comment.
The console side looks solid to me. The guard only picks what to show (the gateway enforces access), the query cache is cleared on account change in AuthProvider so org data doesn't leak between accounts, writes invalidate the whole ['organization'] prefix, and memberActions matches the gateway's protected/removed rules. Test coverage of the views and the API client is good.
Most of my feedback depends on how the limit-ownership questions on #1840 are resolved:
- The limit dialog edits the account quota, which can be a platform-set quota.
monthly_limit_source === 'member'covers anyaccount_quotasvalue, including one a platform admin set in Admin → Users (MemberDialogs.tsx:49-50). An org admin then sees it as "the member's own limit" and can clear or raise it. If #1840 keeps that behaviour, the dialog should at least say so. If #1840 separates the two, this needs to follow. - The default-limit hint is incomplete. "Applies at once to each member that has no monthly limit of its own" (SettingsView.tsx:183). In #1840 the default also binds org admins and platform admins who are members, whose limits this console otherwise says it can't set. Either the gateway excludes them (my preference), or the copy should say it.
- The ceiling check is skipped silently before the organization loads.
ceiling = moneyAmount(organization, 'monthly_limit')isnullwhileorganizationisundefined(MemberDialogs.tsx:57), soreadLimitskips the above-limit check. The gateway still returns 400, so this is only UX, but disabling Save until the organization has loaded would be cleaner. Relatedly, the typed currency comes from the member row while the ceiling is read from the organization; a mismatch there would compare amounts in different currencies.
CI: no check runs or statuses are reported on 974e5cf.
| const own = | ||
| member.monthly_limit_source === 'member' ? moneyAmount(member, 'monthly_limit') : null; |
There was a problem hiding this comment.
'member' here includes a monthly quota the platform admin set in Admin → Users (the gateway writes the same account_quotas row). So this dialog lets an org admin clear or raise it. Depending on the outcome in #1840, either surface where the limit came from, or block editing a platform-set quota.
| // The dialog is for one amount: the field has the cursor when it opens. | ||
| const fieldRef = useRef<HTMLInputElement>(null); | ||
|
|
||
| const ceiling = moneyAmount(organization, 'monthly_limit'); |
There was a problem hiding this comment.
While organization is still undefined this is null, so readLimit skips the above-limit check, and the user gets the gateway's 400 instead. Consider disabling Save until the organization has loaded. Also, currency comes from the member row while the ceiling comes from the organization, so it may be worth asserting they match.
| <p id={noteId} className={FIELD_HINT}> | ||
| {t( | ||
| 'organization.settings.default_hint', | ||
| 'Applies at once to each member that has no monthly limit of its own. Leave empty for no default.', |
There was a problem hiding this comment.
In #1840 the default also applies to org admins and platform admins who are members (_ACCOUNT_MONTHLY_QUOTA has no role check). Elsewhere this console says the org sets no limit for those. Either the gateway excludes them, or this hint should say it covers administrators too.
…istrator's The gateway now keeps two limits for a member: the one its organization sets, and the monthly quota that the platform administrator sets for the account. The lower one applies. - The limit dialog edits the limit of the organization only. It opens with that limit, and says what the platform administrator set when there is such a quota. - A limit that is the platform administrator's has the word "platform" under it in the member list, as a default has "default", and the member panel names it. - The hint of the default limit says that it does not apply to administrators. - Save is off until the organization is read, because its limit is the ceiling. An organization read in another currency gives no ceiling: the gateway then decides. - An organization has no status field. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
All three points are addressed in e9c7a3c, after the changes in #1840.
|
1a1a11a
left a comment
There was a problem hiding this comment.
Re-reviewed e9c7a3c against the backend change in #1840 (a20e46e). It lines up:
- The limit dialog now edits only
own_monthly_limit(the org's own limit, on the membership row) and shows the platform admin's quota read-only. That's the fix for my earlier point about this dialog editing the platform quota. - Save waits for the organization, so the above-limit check can't be skipped while it's loading. The ceiling is dropped when the org was read in a different currency, and the gateway's 400 covers that case.
- The
'platform'source is handled inLimitMeter,MemberDetailPaneland the type, and matches the backendLiteral. The default-limit hint now says it doesn't apply to administrators.
One small UX point inline. Nothing blocking from me on this delta.
No CI check runs are reported on this head commit.
| cancelLabel={t('common.cancel', 'Cancel')} | ||
| busyLabel={t('common.loading', 'Loading...')} | ||
| busy={save.isPending} | ||
| confirmDisabled={!organization} |
There was a problem hiding this comment.
With confirmDisabled={!organization}, if the organization query fails (rather than just loading), Save stays disabled with no explanation in the dialog. A short "couldn't read the organization" line when organization is undefined and the query has errored (or passing the error down) would avoid a silently dead button. Minor.
The limit dialog keeps Save off until the organization is read, because its limit is the ceiling. When that read failed, the button stayed off with no reason. The dialog now says that the organization could not be read, and has a Retry that reads it again. A read in progress shows nothing more, and an organization that was read before stays in use. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Addressed in 5c35136. Changed. When the read of the organization failed, the dialog now says that the organization could not be read, with a Retry that reads it again. Save stays disabled until the organization is read. Tested in the component tests, and on the page with the request failed in the browser. |
1a1a11a
left a comment
There was a problem hiding this comment.
Re-review at 5c35136 (full head 5c35136c102be9119d04726f2e4ab2e10743e65a), since my review at e9c7a3c.
One commit since then. It addresses my inline point about Save staying disabled with no explanation:
- When the organization read has failed,
MembersViewpassesonRetryOrganization(MembersView.tsx:316, gated onorganization.isError). The limit dialog then shows an alert that the organization couldn't be read, plus a Retry (MemberDialogs.tsx:187-203). Save stays disabled throughconfirmDisabled={!organization}. - The notice only appears when there's no data and the read errored. So a load in progress, or a background refetch that failed while an earlier read is still in hand, shows nothing and keeps Save enabled. The second component test pins that down, and the
MembersViewtest covers the wiring end to end. Theorganization.retrykey already exists inzh-CN.json, and the new string is translated.
One small UX point inline, about what Retry looks like while it runs. Nothing blocking from me.
CI: no check runs or statuses are reported on 5c35136 (combined status is pending with 0 statuses).
| </form> | ||
| {/* Save is off without the organization. A read that failed gives the | ||
| reason and the way to try again; a read in progress needs neither. */} | ||
| {!organization && onRetryOrganization ? ( |
There was a problem hiding this comment.
Minor: with @tanstack/react-query v5 (^5.17.0 here), a query that errored keeps status: 'error', so isError stays true while the refetch from Retry runs (only fetchStatus goes to 'fetching'). As written, clicking Retry changes nothing on screen until the refetch succeeds (the notice disappears) or fails again (no change at all). A second click is just deduped. To show that something is happening, you could pass isFetching down and disable Retry (or swap the text to "Reading...") while it's true, or gate onRetryOrganization in MembersView.tsx on organization.isError && !organization.isFetching.
…onsoles The search box, the status pill, the summary card, the spend cells with the trend line and the threshold filter move to components/features/console-shared. Each takes its data and its actions as props. The Users tab and the organization's Members page use them, and look as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The list that the Users tab shows in the details of an account moves to components/features/console-shared. The caller reads the projects and writes each line of figures, and decides if a reader sees the masked key. A key can carry a control at the end of its line. The Users tab looks as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The figures of a lookback window (requests, ok, failed, average latency) move to components/features/console-shared. The Requests tab adds its own lines and its bars to the card, and looks as before. The four copies of the latency format in the Admin Console become one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ed components The one-line summary of a change, the opened entry with each field in full, and the mark of a row that opens move out of the Audit tab to components/features/console-shared. The caller chooses the lines of the record that a reader sees. The per-model token table of the Token usage section moves there too, with a choice of columns. Both Admin pages look as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…component The tooltip box, the axis text and the grid lines were three copies: in the analytics cards, in the growth card and in the chart of the organization pages. They are one set of values in components/features/console-shared. The series chart of the organization pages moves there too. No chart changes its look. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…wo member actions The API module and the query hooks get what the gateway added: the spend of a member today, in 7 days and in all time, the two summary cards, the limit-state and threshold filters, the projects, keys and models of a member, the request volume, an hourly series, the member filter of the audit log, and the calls that set the models of a member and revoke one of its API keys. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…sers has Members: two cards above the list (near or over the limit, top spenders today) that open the list on their filter and order; filters for the use of the limit and for a least spend of today and of the month; the spend columns today, 7-day trend, this month and all-time, in place of the 1d / 7d / 30d switch. Member panel: whether the account has an API key, a second factor and a verified email; its projects and keys by name with their spend, and a Revoke action on an active key; the models that are off, with a Models dialog. A protected member gets neither action. The bar of a limit turns amber from 80%, the mark that the filter and the card use. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…bers of an organization Usage: four cards with the requests of the last hour, day, week and month, how many ended well and how many failed, and the average latency. Audit log: a row opens on every field that the action recorded, and on no source address; the member of a row narrows the log to that member; the category Access, with the two new events in words. Overview: the members with the highest spend, a table of the tokens of each model (input, output, cached, requests), and a choice of hours or days for the series of 1d and 7d. Hours of several days have their day in the label. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The Users tab gets an Organization column after the status, a filter (any organization, none, or one of them) that it keeps in the address, and the organization with the role in the details of an account. A deployment that has no organization shows neither the column nor the filter. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…gh SSO only The gateway marks such an account with sso_only on GET /user/me and refuses a password for it. The personal Settings page then shows no section to change or to set one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The gateway sends the five that lead each card. The shared summary card takes how many of its accounts to show; the Users tab keeps three. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…beside it The shared table kept the Admin console's classes on the organization's overview, where its frame and its lines stood out from the panels next to it. A caller now names the classes of the parts that differ, and the Admin console names none. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Settings named the only way in of an account with "Set a password before disconnecting it". An account that signs in through single sign-on only now reads that it belongs to an organization. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Members: a failed read of the two cards is said, with a retry, and is no longer two zeros. The 7-day total is also text for a screen reader. A threshold below the least value is not sent, and its field is marked. The share of a limit is decided on the ratio itself, as the gateway compares it, and is rounded down: 79.6% reads 79% and is not near, 99.6% reads 99% and is not over. Member panel: a key with no time of use was "not used since the account joined", not "never used". The note for an administrator names the models and the API keys too. Audit log: a change of models says what the action turned off and what it turned on again, not the whole list after it. Settings: the two refusals of a disconnect are told apart, and each has its own sentence. A member of an organization is not told to set a password to add an authenticator, and confirms the deleting of its account at its identity provider, not with a phone code. The tests of the organization hooks cover the three new reads and the two new writes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The gateway no longer counts from the day an account became a member. The all-time card of the member panel says nothing under its figure, and a key without a time of use is a key that was never used. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… signs in through SSO only Login: when a password is refused for an address that an organization's single sign-on answers for, a line under the error says so, with a "Log in with SSO" action that starts the sign-in for the address that was typed. The step that asks to connect a waiting identity, and the form in Settings that connects one, say before the action that the account then signs in through that provider only and that its password is removed. Each shows only with the field the gateway sends for it: sso_sign_in on the refused sign-in, sso_only_after_link on the waiting identity, and sso_only_provider on the identities of the account. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…nd read the profile again after a link After a link on the sign-in page, the console went on with the profile it had read before the link. Settings then still offered "Change Password" to an account that had just become a member and had no password any more. The sign-in page now reads the profile again before it goes on. The two notices were easy to overlook: - On the sign-in page, the action of the notice was a line of bold text under the sentence. It is a filled button now. - In Settings, the sentence was small print between the last field and the buttons. It is a warning box at the top of the form now. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…re, and a page style the heading of projects and keys Two options on components that the Admin console and the organization console share. The Admin console does not use them, and looks as it did. - `SpendCells` takes `week`: the total of the last days. With it, the cell is that figure, like the cells beside it, and no line is drawn. - `ProjectsAndKeys` takes `headingClass`, for a page whose other headings look another way. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…d models and the request volume of the organization console
Members:
- The two cards above the list are lists with bars now, without an accent
color. Each says in words how many members it holds ("13 members spent
today"), where it had a bare figure beside five names.
- A card is a switch. A second press puts the list back, and the card says
which of the two a press does. "Clear filters" puts the list back from any
filter, order or search.
- The 7-day column is an amount, as the three columns beside it are.
Member panel:
- Status, joined, last sign-in, API key, two-factor and email are one panel
of named facts, on the columns of the figures below it. They were two lines
of small text.
- "Disabled models" lists the models one to a line, and marks those of the
platform administrator. The audit log says "Disabled" and "Enabled again".
Usage:
- The request volume cards have no heading and no explanation above them.
Each card has its window, the count, a bar of how the requests ended, and
the two counts and the average latency under it.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… name of the organization The sentence said that the account signs in "through Example University only". A person signs in through single sign-on, and a member can sign in through each identity that is linked. The sentence now says "through single sign-on only", in the two places that have it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
The pages for the second part of #1840 are here, as new commits. No pushed commit is rewritten.
Three points where the result is not the request word for word:
Before and afterThe pages at the first review (2026-11-20) and now. The description has the screenshots of the parts that are new. The organization and its members are synthetic.
Beside the Admin console. The cards, the 7-day column and the request volume cards are the three parts that do not have the look of Admin.
|
||||||||||||||||||||||||||||||
…page uses `SpendCells` had `trendTitle`, the total of the trend as a title and as hidden text, for the member list of the organization console. That list now shows the total as a figure. `SummaryCard` had `shown`, for a card with five names; the organization console has its own cards now. The Users tab of the Admin console passed neither, and looks as it did. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…he sign-in notice - A module's look gets its own link for the action of the sign-in notice again. The filled button is for the console's own look only: a module styles that action itself. - After a link, a profile read that fails is made once more before the page goes on. `refreshUser` now resolves to whether the profile was read. - A window with one request says "1 request". - "Clear filters" and a card also empty a threshold field that holds a number the list does not take. - The line at the foot of a member card is for the eye. The card keeps one name for a screen reader, and its state is the state of the switch. - A member card uses the bar colors of a limit, and a share of zero draws no fill, as on the bar of a limit. - Tests: a search that is applied, with a card and with "Clear filters"; the look of the action in both looks; what `refreshUser` resolves to. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
1a1a11a
left a comment
There was a problem hiding this comment.
Re-review at 02ac77f, covering the 22 commits since my last pass at 5c35136 (04550a9..02ac77f), read against the #1840 head 38cac90.
The new pages follow the gateway closely:
- Member actions.
memberActionsstill hides every action for protected members and admins. Revoke is only offered foractivekeys, and the 409/404 answers from #1840 come back as the dialog error. The models dialog never offers a platform-disabled model as toggleable. It keeps an org-disabled model visible after the platform stops offering it, so it can still be turned back on. It also sends only real changes, which matches theknownfilter on the gateway side. - SSO-only accounts. The password section, the 2FA setup and the delete-account proof all key off
sso_only/sso_reauth_provider, the same way the gateway decides.refreshUsernow returns whether the read succeeded, andconfirmLinkre-reads the profile after a link, so Settings doesn't flash a password form for a fresh member. - Login notice. The SSO line only shows for the address that was actually refused (
ssoHintcompares against the field), it's suppressed while a link is waiting, andjsonOrThrowonly keepssso_sign_inwhenprovider_nameis a non-empty string. The provider name is rendered as text, so there's no markup injection there. - Shared components. Moving them into
console-shared/looks behavior-neutral for the Admin pages as far as I can tell. The amber threshold changing from 90% to 80% is called out in the description.
A few things:
unlinkRefusaltells the two 409s apart by comparingerror.messagewith the gateway's English sentences (SsoIdentities.tsxL125-140). Today they matchsso_routes.pyin #1840 exactly. But any wording change on the gateway, or a gateway that ever localizes itsdetail, silently drops a member back to the generic text. Since #1840 is still open, a machine-readable code on those two refusals (anerror/codefield, likesso_sign_ingot) would be sturdier than string equality.- The Retry point from my last review is still open (MemberDialogs.tsx, the organization-read notice). With react-query v5,
isErrorstays true while the refetch runs, so Retry gives no feedback until it resolves. Minor, mentioning it only so it isn't lost. - Small cleanup: in
SsoIdentities.tsxthe old JSDoc forlastMethod("Why the account's only way in stays...", L116-120) now sits orphaned above the refusal constants.function lastMethoditself has no comment.
One thing to keep in mind from my #1840 review: the org console now shows the whole account's history, including requests from before the account joined. That's consistent with the gateway and documented there, so nothing needs to change here.
CI: GitHub reports no check runs on 02ac77f, so I'm relying on the local results in the description.
| */ | ||
| export function unlinkRefusal(error: unknown, t: Translate, ssoOnly: boolean): string { | ||
| if (error instanceof APIError && error.statusCode === 409) { | ||
| if (error.message === ORGANIZATION_IDENTITY_REFUSAL) { |
There was a problem hiding this comment.
This only works while the gateway's detail stays byte-identical to these constants. Right now it matches sso_routes.py in #1840. Since both PRs are still open, could the gateway add a small code to these two 409s (e.g. {"code": "organization_identity"} / "last_sign_in") and could this switch on that instead? Otherwise a copy edit on the backend quietly changes what members see.
| /** Why the account's only way in stays: said before it is tried, and when it is refused. */ | ||
| function lastMethod(t: Translate): string { | ||
| /** | ||
| * Why the account's only way in stays: said before it is tried, and when it is |
There was a problem hiding this comment.
Nit: this doc block belonged to lastMethod and is now stranded above the refusal constants, right before a second JSDoc. Move it down to function lastMethod, or drop it.
The comment had stayed above the two refusal constants when they were added before the function. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1a1a11a
left a comment
There was a problem hiding this comment.
Re-review at e2b7608, since my pass at 02ac77f.
One commit since then, touching only SsoIdentities.tsx: the JSDoc for lastMethod moves from above the refusal constants to directly above function lastMethod (now L142-146). That resolves my cleanup point 3. It's a comment-only move with no behavior change, and the ORGANIZATION_IDENTITY_REFUSAL / LAST_SIGN_IN_REFUSAL block now carries only its own comment, which reads correctly.
The other two points from my last review are unchanged at this head and haven't had a reply yet, so I'm restating them briefly so they don't get lost:
unlinkRefusalstill matches the two 409s by exact English text (error.message === ORGANIZATION_IDENTITY_REFUSAL/LAST_SIGN_IN_REFUSAL, L126-139). If the gateway's wording changes, or itsdetailis ever localized, it quietly falls back to the generic message. Since #1840 is still open, I'd still prefer a machine-readable code on those two refusals. If you'd rather keep string matching, a test on the gateway side that pins those two sentences would at least make a drift fail loudly.- Retry feedback in the organization-read notice of the limit dialog (
MemberDialogs.tsxL195-203): the button gives no pending state while the refetch runs. This is minor and doesn't block.
Nothing new to flag in this delta.
CI: GitHub reports no check runs on e2b7608.












What this changes
This PR adds the console part of the organization console of #1829. #1840 has the gateway part. The two pull requests change no file in common.
/dashboard/organizationhas the frame of the Admin area and five pages:components/features/console-shared/. The first five commits move them and add no feature. The Admin pages look and work as before. Three parts of the organization console have a look of their own: the two cards on Members, the 7-day column, which is an amount, and the request volume cards on Usage.zh-CN.json. It shows amounts in the ledger currency.console-translations.mdsays that this area is translated. The operator guide of feat(orgs): organizations with their own administrators and a monthly limit, gateway #1840 names the pages.The Admin pages that make an organization are not in this PR. They are in #1830.
Why
#1840 gives an organization administrator the routes below
/user/organization. Without these pages, the administrator must call the routes with a script.Compatibility and upgrade notes
organizationfield inGET /user/me, and the console then shows no entry.How it was verified
Tests on this branch alone:
npm run format:check,npm run lint,npm run type-check,npm run i18n:checknpm run testnext buildmake docs-verifyManual test with the gateway of #1840 from source, Keycloak 26 in Docker and the console from source. The organization had 14 synthetic members, two organization administrators and approximately 15,000 synthetic requests of the last 30 days:
The tests of the limit dialog, the remove dialog and the default limit are from an earlier revision of this branch.
Screenshots
The organization and its members in the screenshots are synthetic.
Overview. The totals of the last 7 days and the month against the limit of the organization. Below them: two series, the spend and the tokens for each model, and the top members.
Members. The two cards, the filters, and one row for each member.
Member panel. The facts and the figures of the member, its projects and API keys by name, the disabled models, and the last requests.
Member actions. The dialog that disables models for a member, and the dialog that revokes one API key. The dialogs for the monthly limit and for the removal are as before.
Usage. The request volume, and the requests of the members, newest first.
Audit log. The management actions of the organization, with one entry open.
Settings. The record, the SSO connection, the administrators and the limits.
Admin → Users. The Organization column and the organization filter.
Notice of single sign-on only. The sign-in page after a failed password sign-in, the step that confirms a link, and the connect form in Settings.
Language and theme. The Members page and the member panel in Simplified Chinese and in the light theme.
dev, notmainmake formatandmake testpass🤖 Generated with Claude Code