Repository navigation
fix(amber, frontend, v1.2): serve created datasets to the admin quota modal - #7328
github-actions[bot] wants to merge 1 commit into
Conversation
…#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) --------- (backported from commit 0f2cd49) Signed-off-by: Xinyuan Lin <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]>
|
The cherry-pick conflicted and was committed with conflict markers. Resolve the conflicts on this branch, then mark this PR ready for review. Conflicting files:
|
There was a problem hiding this comment.
Pull request overview
Backport of #7318 to release/v1.2, fixing the admin user-quota modal’s “created datasets” panel by adding a missing admin endpoint and ensuring the frontend supplies the inspected user’s uid as a query parameter.
Changes:
- Frontend:
AdminUserService.getCreatedDatasets(uid)now sendsuser_id=<uid>as a query parameter. - Backend (Amber): add
GET /admin/user/created_datasets?user_id=N(ADMIN-only) delegating toDatasetStatisticsUtils.getUserCreatedDatasets. - Tests: add regression coverage for the new backend endpoint behavior and the frontend request parameter.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| frontend/src/app/dashboard/service/admin/user/admin-user.service.ts | Sends user_id query param for the admin “created datasets” request. |
| frontend/src/app/dashboard/service/admin/user/admin-user.service.spec.ts | Adds/updates unit tests asserting the user_id query param is sent and errors propagate. |
| amber/src/main/scala/org/apache/texera/web/resource/dashboard/admin/user/AdminUserResource.scala | Adds ADMIN-only created_datasets endpoint with required user_id query param. |
| amber/src/test/scala/org/apache/texera/web/resource/dashboard/admin/user/AdminUserResourceSpec.scala | Adds tests for empty result, missing user_id handling, and user-scoped dataset filtering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Yicong-Huang
left a comment
There was a problem hiding this comment.
Is this a feature??
No. It's fixing a missing endpoint. |
|
The endpoint was introduced in #2680 , and deleted by mistake in later refactors. |
This pr is a back port of #7318? Even if it was introduced before, the pr to remove it should also be a feature, and the pr to reintroduce it should also be a feature. I still don't see how this is a fix of an existing behavior/functionality |
|
You can make the call. I don't have a strong opinion on this one. |
|
I agree that this is better classified as a new feature rather than a fix, so we will not backport it. I will close this backport PR. The |
What changes were proposed in this PR?
Automated backport of #7318 to
release/v1.2.Source: 0f2cd49 · automation run
Any related issues, documentation, discussions?
Backport of #7318. Originally linked #7317.
How was this PR tested?
Release-branch CI runs on this branch once the conflicts are resolved and this PR is marked ready for review.
Was this PR authored or co-authored using generative AI tooling?
No.