Skip to content

feat: show company storage usage in SaaS admin#4798

Merged
Rockyy174 merged 2 commits into
mainfrom
cursor/saas-admin-storage-column-2a7d
Jul 9, 2026
Merged

feat: show company storage usage in SaaS admin#4798
Rockyy174 merged 2 commits into
mainfrom
cursor/saas-admin-storage-column-2a7d

Conversation

@Rockyy174

@Rockyy174 Rockyy174 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a Storage column to the SaaS admin company table (/admin) on both Active Companies and All Companies tabs, showing each company's total uploaded file storage.

Backend

  • Batch loader Company.load_storage_usage_bytes/1 (list + single) summing uploaded :company_file blobs
  • Admin API :company type extended with storage_usage_bytes
  • Wired into get_companies, get_active_companies, and get_company
  • Regenerated TypeScript admin API client (storageUsageBytes)

Frontend

  • Storage column in SaasAdminPage CompanyTable (after Projects), formatted via formatStorageBytes
  • Storage stat on SaasAdminCompanyPage detail page

Tests

  • Extended get_active_companies_test serialization assertions
  • New coverage that pending blobs are excluded and uploaded sizes are summed
  • New get_companies_test.exs for the all-companies endpoint

Test plan

  • make test FILE=app/ee/test/operately_ee/admin_api/queries/get_active_companies_test.exs (11 passed)
  • make test FILE=app/ee/test/operately_ee/admin_api/queries/get_companies_test.exs (3 passed)
  • /admin → Active Companies and All Companies show Storage column
  • Company with no files shows 0 B
  • Pending blobs excluded from totals
Open in Web Open in Cursor 

@Rockyy174
Rockyy174 marked this pull request as ready for review July 9, 2026 15:50

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In the frontend, storageUsageBytes is declared optional on AdminApi.Company but used directly in formatStorageBytes(company.storageUsageBytes); consider either making it required or defaulting to 0 to avoid potential undefined handling issues.
  • The gridTemplateColumns string in CompanyTable is now shared between header and rows but still redefined on each render; consider hoisting it to a module-level constant to avoid unnecessary reallocation.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the frontend, `storageUsageBytes` is declared optional on `AdminApi.Company` but used directly in `formatStorageBytes(company.storageUsageBytes)`; consider either making it required or defaulting to `0` to avoid potential `undefined` handling issues.
- The `gridTemplateColumns` string in `CompanyTable` is now shared between header and rows but still redefined on each render; consider hoisting it to a module-level constant to avoid unnecessary reallocation.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Add a Storage column to the SaaS admin company table by batch-loading
uploaded company_file blob sizes and exposing storage_usage_bytes
through the admin API.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Adriano Lazzaretti <Rockyy174@users.noreply.github.com>
@Rockyy174
Rockyy174 force-pushed the cursor/saas-admin-storage-column-2a7d branch from 4feeffb to 0cd8365 Compare July 9, 2026 17:00
Signed-off-by: Adriano Lazzaretti <lazzaretti136@gmail.com>
@Rockyy174
Rockyy174 merged commit afca555 into main Jul 9, 2026
4 checks passed
@Rockyy174
Rockyy174 deleted the cursor/saas-admin-storage-column-2a7d branch July 9, 2026 17:24
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.

2 participants