aglinxinyuan opened a new pull request, #7318:
URL: https://github.com/apache/texera/pull/7318
### What changes were proposed in this PR?
The admin user-quota modal (`UserQuotaComponent` opened from the admin user
list) fails to load its "created datasets" panel: the request 404s.
**Root cause:** `AdminUserService.getCreatedDatasets()` targets
`/admin/user/created_datasets`, but `AdminUserResource` never exposed that
endpoint. The only `created_datasets` endpoint lives on `UserQuotaResource`
(`/quota/created_datasets`), and it derives the uid from the authenticated
session (`@Auth current_user`) with no `user_id` parameter — so it cannot serve
"datasets of the user an admin is inspecting" (it would return the admin's own
datasets instead).
| | Before | After |
|---|---|---|
| Frontend request | `GET /admin/user/created_datasets` (no params) | `GET
/admin/user/created_datasets?user_id=<uid>` |
| Backend | no such route → 404 |
`AdminUserResource.getCreatedDatasets(user_id)` → datasets owned by `user_id` |
```
admin quota modal ──> AdminUserService.getCreatedDatasets(uid)
│ before: GET /admin/user/created_datasets
──> 404 (route missing)
│ after: GET
/admin/user/created_datasets?user_id=N ──> AdminUserResource
│
└─> DatasetStatisticsUtils.getUserCreatedDatasets(N)
```
Changes:
- `AdminUserResource.scala`: add `GET
/admin/user/created_datasets?user_id=N` (ADMIN-only, like the sibling
`created_workflows` / `access_workflows` / `user_quota_size` endpoints),
delegating to `DatasetStatisticsUtils.getUserCreatedDatasets`.
- `admin-user.service.ts`: `getCreatedDatasets(uid)` now sends the uid as
the `user_id` query param (it previously accepted the uid and silently dropped
it).
### Any related issues, documentation, discussions?
Closes #7317
### How was this PR tested?
Written test-first (both new tests were confirmed failing before the fix):
- `AdminUserResourceSpec`: two new tests for `getCreatedDatasets` — empty
list for a user with no datasets, and only the queried user's datasets are
returned (a second user's dataset is excluded).
- `admin-user.service.spec.ts`: the `getCreatedDatasets` test now asserts
the `user_id` query param is sent (previously asserted no params were sent).
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 5)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]