Skip to content

feat: admin sidebar everywhere, several departments at once, small usage trends - #62

Open
brtydse100 wants to merge 9 commits into
mainfrom
feat/admin-layout-multi-dept-charts
Open

brtydse100 wants to merge 9 commits into
mainfrom
feat/admin-layout-multi-dept-charts

Conversation

@brtydse100

@brtydse100 brtydse100 commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Do not merge yet: the requester is still trying it out.

What changes

Admin sidebar everywhere

  • Anyone with admin access (system or organization administrators) keeps the sidebar on My key and Analytics. Switching the demo to Admin shows the admin navigation immediately. Ordinary users keep the top bar; its Admin link is gone.

Several departments at once

  • The department picker is multi-select, with All. Cards, Needs attention, the spend split, the group table and the usage report combine the selection.
  • Backend: GET /api/v1/organization/users and /usage accept a repeated node parameter (up to 50 groups, each scope-checked). One group breaks down by its children, several by the groups themselves.

Usage report

  • Four small cards replace the large chart: Spend history and Requests history (weekly rounded bars), Tokens by department/group/member (most tokens first) and Spend by model (donut). Each has two figures, such as busiest week, daily average, top user and total. A ranked list below still lets you open a group or copy a member's email.
  • Hover, tap or arrow keys read a chart: bars show a tooltip with the exact figure and the others fade; the donut shows the slice's model, spend and share in its centre.
  • The report can be closed: Usage report toggles to Hide report, and the report has a close button (a selected group's report closes with the group). This was already broken on main.
  • The usage API adds an additive daily array to each by_group entry to support this.

Team owners

  • The demo role switch adds Owner, with People (owns Platform, a team of people) and Teams (owns Infrastructure, a team of teams). The demo API scopes organization data the same way delegated access does.
  • Owners get the same sidebar and Organization page as administrators. A team without sub-teams lists its own row, and its usage report opens only on request. A single team is named where the department picker would be. A Team budget card replaces the admin-only gateway status, and the Spend card uses the planned budget as its target.
  • Owners no longer briefly see the top-bar layout while their access is checked, and the sidebar labels them "Team owner".
  • The demo turns on budget planning (src/demo/budgets.ts) with the backend's rules. Owners split their team's budget among sub-teams and members, but can't raise their own team's total, their own allowance or per-person limits. Platform gains two synthetic teammates so there is something to split.

People and budgets in place

  • A People list (members, spend, allowance) replaces the separate Budget planning section. A team of people opens on it. Choosing any team shows everyone in it, sub-teams included, beneath the group table, so owners of several teams never switch views. Allowances save in place. Team budgets stay in the edit panel, which now says who sets a read-only total.
  • The group budget field's focus ring now surrounds the whole field. A global :focus-visible colour had turned the input's transparent outline blue, and it crossed the "$".
  • The sidebar has a visible theme switch.
  • The real-Keycloak specs (sso-budget-authority, sso-large-org, sso-restart) now edit budgets and limits through the group panel, via the shared e2e/organizationPanel.ts helper. I checked the helper's three paths against the demo locally; Docker isn't available here, so those specs run in CI only.

Small fix: level names pluralise correctly ("2 branches").

Preview image

Built from head 14eaba08b5a0f95b624680489d8de89d306be5a1. The image's org.opencontainers.image.revision label matches; linux/amd64 and linux/arm64.

docker pull ghcr.io/brtydse100/litegate:test-pr-62-14eaba0

Validation

  • Backend: pytest 921 passed, 5 skipped; ruff format --check clean. Tests cover combining groups, per-group validation, repeated node parameters and per-group daily usage.
  • Frontend: Prettier, ESLint and tsc clean; Vitest 246 passed (the old Budget planning tests moved to PeopleTable.test.tsx).
  • Playwright: 13 API-mocked and 22 demo specs passed, including the admin sidebar, both owner roles and the tokens card.

🤖 Generated with Claude Code

brtydse100 and others added 9 commits November 20, 2026 10:26
…age trends

- Anyone with admin access keeps the sidebar on My key and Analytics, so
  switching the demo to Admin shows the admin navigation at once; the
  top-bar Admin link is gone.
- The Organization page can combine any number of top-level departments
  (or All): cards, Needs attention, spend split, group table and the usage
  report add up the selection. The users and usage endpoints accept a
  repeated `node` parameter (up to 50 groups, each scope-checked); several
  groups break down by group in the report.
- The usage report shows three compact spend, request and token cards,
  each with its total, a small daily trend, the daily average and the peak
  day, instead of one large chart with a metric picker.
- Level names pluralise correctly ("2 branches").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each trend card shows one bar per day (hover for that day's value)
instead of a continuous line, and the Daily values tables are removed to
keep the cards light.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The usage report adds a contribution-style grid: one row per group,
  ranked by tokens, one square per day shaded by tokens, with each row's
  total. The usage API adds an additive `daily` array to every `by_group`
  entry for this.
- The demo role switch adds Owner (People: owns Platform, a team of
  people; Teams: owns Infrastructure, a team of teams). The demo API
  scopes organization data like delegated access does.
- A single team without sub-teams opens straight on its report and
  members instead of an empty group table; its cards and report name the
  team rather than "all groups" or "+ all sub-groups".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the three daily bar cards and the team-by-day grid with one
contribution history: Spend / Requests / Tokens tabs with their totals,
chips ranking groups by the chosen metric (tokens first), and a calendar
of weekly columns with one square per day, month labels and a Less-More
legend. Choosing a group shows its own history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the contribution calendar with compact cards: weekly spend and
request bars, tokens by group or member, and spend by model as a donut,
each with two summary figures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bars show a tooltip with the exact figure and turn solid while the rest
fade; the donut reads the hovered slice in its centre and highlights its
legend row. Charts take keyboard focus and step with the arrow keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Usage report button only ever opened the report and the report had
no close control. The button now toggles (reading "Hide report" while
open) and the report has a close button; a selected group's report
closes with the group. A childless team's report stays, as it is the
whole view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…plitting

- A team without sub-teams lists its own row; the usage report opens only
  on request, as for administrators.
- A single team is named where the department picker would be, and owners
  get a Team budget card in place of the admin-only gateway status.
- Owners wait for their access check instead of flashing the top bar, and
  the sidebar labels them "Team owner".
- The demo enables budget planning with the backend's rules: owners split
  their team's budget among teams and members, but cannot raise their own
  team's total, their own allowance or per-person limits. Platform gains
  two synthetic teammates so there is something to split.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A People list (members, spend and allowance) replaces the separate Budget
  planning section: a team of people opens on it, and choosing any team
  shows everyone in it beneath the group table. Allowances save in place;
  team budgets stay in the edit panel, now noting who sets a read-only total.
- The group budget's focus ring surrounds the whole field. A global
  :focus-visible colour turned the input's transparent outline blue, so it
  crossed the "$" prefix.
- The sidebar has a visible theme switch.
- The report and the People list no longer share a React key, which left
  stale member lists on screen.
- Real-Keycloak specs edit budgets and limits through the group panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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