Staff admin page for organizations and instances #526

Merged
tobru merged 10 commits from staff-admin-ui into main 2026-05-28 08:46:48 +00:00
Owner
No description provided.
Move the decommission logic out of OrganizationAdmin into a shared
Organization.decommission(user) method that raises DecommissionError on
partial failure. Admin action becomes a thin wrapper. No user-visible
behavior change.
feat: staff admin UI for organizations and instances
All checks were successful
Tests / test (push) Successful in 50s
c59aa3de62
Adds /staff/ section gated on is_staff for cross-tenant ops:
- Organization list (filter, sort, Odoo SO link) and detail page
- Limit profile change with validate_profile_assignment validation
- Single-org decommission via shared Organization.decommission()
- Instance list with filtering and collapsible grouping (500-row cap)
- Top-level Staff submenu in the main navbar

Adds django-filter dependency. Staff URLs bypass org scoping in
middleware.
Apply form-select class to all django-filter dropdowns so they render
consistently. Move the instances "Group by" control out of the filter
form into a separate toolbar above the table, aligning the Filter
button position with the organizations page (Search col-md-3, four
selects col-md-2, button col-md-1).
Add OdooSanityChecker service that compares portal-held Odoo
references (sale order, company partner, invoice partner) against the
actual Odoo records.

- Organization list shows an inline severity icon per row (3 existence
  checks, cached 5 min). "Check Odoo (this page)" button bulk-runs all
  18 checks on the current page and updates the cache.
- Organization detail has an "Odoo health" card at the top with HTMX
  "Check Odoo" / "Re-run" buttons (Re-run bypasses cache and overwrites).
- Four fix actions wired and ready: recreate_company_partner,
  recreate_invoice_partner, recreate_sale_order, add_portal_tag. Each
  mirrors the payload shape from the sync_odoo management command and
  logs to auditlog. The remaining 14 finding types render a disabled
  Fix button until per-action handlers are added.

Also includes staff-list UI polish that landed alongside the sanity
work: instance count column, namespace inlined under the org name,
archived orgs shown via strikethrough (no separate column), billing
entity linked to its Odoo partner, sortable column headers toggle
between ascending and descending with arrow indicators, organizations
list supports grouping by Limit profile / Origin / Billing entity.
feat: dedicated Odoo check results page + better Fix feedback
All checks were successful
Tests / test (push) Successful in 1m11s
6dcb034dcb
Clicking "Check Odoo (this page)" now renders a results page with a
severity summary and per-org cards listing the failing findings, rather
than redirecting back to the list with a flash message. Fix buttons on
that page take the user to the affected org's detail page after the fix
succeeds.

The Fix button on the detail-page Odoo health card was also surfacing
the "Applied fix" success message only on the next page load, because
the HTMX-swapped partial did not include the messages container. Inline
a messages block at the top of the card so the swap brings the alert
along, and route non-HTMX Fix submissions (from the results page) via
a PRG redirect to the detail page so the alert renders there.
When the org's limit profile has a validity_days set, render the
computed expiration date under the limit profile cell. Future
expirations are muted by default, switch to warning color within the
last 7 days, and become a red "expired YYYY-MM-DD" marker after the
expiration date has passed.
style: align staff org detail cards with create-page Mazer pattern
All checks were successful
Tests / test (push) Successful in 51s
adc0b3e235
Each card on the staff organization detail page now uses the
card > card-content > card-header (h4.card-title) + card-body
structure used by the organization create view. Restyle the
decommission card with a neutral header, a danger-coloured title,
extra spacing around the explanation, and an icon on the destructive
button so it no longer feels cramped. Apply the same chrome to the
Odoo health card for consistency.
tobru changed title from WIP: Initial Staff Admin to Staff admin page for organizations and instances 2026-05-26 15:48:11 +00:00
feat: instance sanity checks against control planes
All checks were successful
Tests / test (push) Successful in 52s
414c5ab74d
Mirrors the Odoo sanity check pattern for ServiceInstance <-> K8s drift.
Adds InstanceSanityChecker with per-instance drift detection (display
name, billing annotations, deprecated annotations, hardcoded params,
compute plan size, secret name) and a lightweight existence check used
by the staff instance list to render a health icon. Bulk scan also
surfaces K8s resources with no matching DB record. Report-only for now.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tobru merged commit 7479d82d51 into main 2026-05-28 08:46:48 +00:00
tobru deleted branch staff-admin-ui 2026-05-28 08:46:48 +00:00
Sign in to join this conversation.
No description provided.