Skip to content

fix(amber, frontend, v1.2): serve created datasets to the admin quota modal - #7328

Closed
github-actions[bot] wants to merge 1 commit into
release/v1.2from
backport/7318-serve-created-datasets-to-the-admin-quot-v1.2
Closed

github-actions[bot] wants to merge 1 commit into
release/v1.2from
backport/7318-serve-created-datasets-to-the-admin-quot-v1.2

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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.

…#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]>
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

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:

  • amber/src/test/scala/org/apache/texera/web/resource/dashboard/admin/user/AdminUserResourceSpec.scala
  • frontend/src/app/dashboard/service/admin/user/admin-user.service.spec.ts

@github-actions
github-actions Bot requested a review from xuang7 August 5, 2026 06:46
@aglinxinyuan
aglinxinyuan marked this pull request as ready for review August 5, 2026 06:53
Copilot AI lite review requested due to automatic review settings August 5, 2026 06:53

Copilot AI 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.

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 sends user_id=<uid> as a query parameter.
  • Backend (Amber): add GET /admin/user/created_datasets?user_id=N (ADMIN-only) delegating to DatasetStatisticsUtils.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 Yicong-Huang 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.

Is this a feature??

@aglinxinyuan

aglinxinyuan commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Is this a feature??

No. It's fixing a missing endpoint.

@aglinxinyuan

aglinxinyuan commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

The endpoint was introduced in #2680 , and deleted by mistake in later refactors.

@Yicong-Huang

Copy link
Copy Markdown
Contributor

The endpoint was introduced in #7318 , 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

@aglinxinyuan

Copy link
Copy Markdown
Contributor

You can make the call. I don't have a strong opinion on this one.

@xuang7

xuang7 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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 /admin/user/created_datasets endpoint has never existed on any branch. The frontend has been calling it since #2680 in 2024 and has always received a 404 response. Since there is no previously working behavior to restore, backporting this change would introduce a new admin API route.

@xuang7 xuang7 closed this Aug 5, 2026
@xuang7
xuang7 deleted the backport/7318-serve-created-datasets-to-the-admin-quot-v1.2 branch September 24, 2026 19:17
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.

4 participants