The GitHub Actions job "Required Checks" on 
texera.git/gh-readonly-queue/main/pr-9332-b4b06482e84f83e114891dc3086bdf3bcd1c9817
 has failed.
Run started by GitHub user aglinxinyuan (triggered by aglinxinyuan).

Head commit for run:
f626b5139a9897b4cbd2dab6a00203bcc1dcccc7 / Xinyuan Lin <[email protected]>
refactor(frontend): deduplicate admin user resource queries (#9332)

### What changes were proposed in this PR?
Deduplicate the repetitive resource query logic in `AdminUserService`
and its unit test suite:
1. In `AdminUserService` (`admin-user.service.ts`), extract a typed
private helper `getUserResource<T>(url: string, uid: number):
Observable<ReadonlyArray<T>>` to deduplicate repetitive `HttpParams`
setup and HTTP GET calls across `getCreatedDatasets`,
`getCreatedWorkflows`, `getAccessWorkflows`, and `getExecutionQuota`.
2. In `admin-user.service.spec.ts`, table-drive the repetitive GET query
test cases via the parameterized `userResourceQueryCases` array,
preserving all assertions while reducing spec boilerplate.

### Any related issues, documentation, discussions?
Closes #9331.

### How was this PR tested?
Frontend unit tests in `frontend`, covering the service, the unchanged
`UserQuotaService`, and both components that use them:
```bash
npx ng test --watch=false --include='**/admin-user.service.spec.ts' 
--include='**/user-quota.service.spec.ts' 
--include='**/admin-user.component.spec.ts' 
--include='**/user-quota.component.spec.ts'
```
Output:
```
 ✓  gui  src/app/dashboard/service/user/quota/user-quota.service.spec.ts (7 
tests)
 ✓  gui  src/app/dashboard/service/admin/user/admin-user.service.spec.ts (17 
tests)
 ✓  gui  
src/app/dashboard/component/user/user-quota/user-quota.component.spec.ts (25 
tests)
 ✓  gui  src/app/dashboard/component/admin/user/admin-user.component.spec.ts 
(55 tests)

 Test Files  4 passed (4)
      Tests  104 passed (104)
```

`npx tsc --noEmit -p src/tsconfig.app.json` and `-p
src/tsconfig.spec.json`: clean.

Prettier and ESLint: `yarn format:ci` passes.

### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Antigravity (Gemini 2.5 Pro), Claude Code (Claude Opus
5.5)

Report URL: https://github.com/apache/texera/actions/runs/42567895683

With regards,
GitHub Actions via GitBox

Reply via email to