Repository navigation
feat(frontend): add admin computing units dashboard - #8888
Merged
Merged
Conversation
Add an ADMIN-only page listing every active computing unit across all users (name, owner, type, status, created, resource summary), with an expandable row revealing full specs (CPU, memory, GPU, JVM, shared memory). Read-only. Reuses the existing WorkflowComputingUnitManagingService (new listAllComputingUnits() hitting GET /computing-unit/admin/list) and DashboardWorkflowComputingUnit type, plus the shared status-badge and relative-time formatters. Follows the existing admin dashboard pattern (nz-table, admin route + guard + nav entry). Closes apache#6479.
The dashboard's template pipes creationTime through `date` for the
created-at tooltip, but the standalone component imported only NgFor and
NgIf from @angular/common. AOT compilation therefore failed with NG8004
("No pipe found with name 'date'"), and since a failed build emits no
index.html, `ng serve` answered every request with a 404 rather than
serving the app.
The existing specs did not catch this: none of them render the template,
so JIT never resolved the pipe. Add the one render test that mounts a row,
which fails with NG0302 without the import and passes with it, so a pipe
or directive missing from `imports` is caught by the unit tests instead of
only by the app build.
Surface fetch/poll errors via NzMessageService and clear the loading flag so a failed load stops the spinner instead of spinning forever; catch poll errors inside switchMap so one failure does not terminate the refresh interval. Drop the isOwner star on the owner avatar — isOwner is relative to the requesting admin, so it is meaningless in an all-users view.
The rxjs/no-implicit-any-catch rule (run in format:ci) requires an explicit `: unknown` on catchError and subscribe error callbacks, and crashes on an untyped parameter. Annotate both to match the codebase convention.
…he admin dashboard Main renamed the owner avatar field and the UserAvatarComponent input from googleAvatar to avatar, so the dashboard stopped compiling once rebased (TS2339 on unit.ownerGoogleAvatar, NG8002 on [googleAvatar]). Bind [avatar]="unit.ownerAvatar" instead. The backend now also reports Failed, Unknown and Terminating units, which the status filter did not offer, so an admin could not narrow the table to the broken units this page exists to find. Offer every status, and cover it with a test along with the failure reason reaching the status tooltip. The sidebar link-count test in dashboard.component.spec.ts hardcoded the 14 links that existed before this feature; the new Computing Units entry makes 15. Update the count and add a test that the entry is shown to admins only.
…ate a null resource The 5s poll used `interval` with `switchMap`, so a response slower than the interval was cancelled by the next tick and the table stopped refreshing on a slow cluster. The first load also raced the first poll. Both now run as one `exhaustMap` stream, so a slow response finishes and a failed poll shows a message without ending the stream. `parseDashboardUnit` only repaired a string `resource`, so a `NULL` one reached the template as `null` and broke the whole table. It now gets the same `NaN` placeholder as a malformed one. Also derives the status filter from `ComputingUnitState`, renders the spec detail from a field list, and adds tests for the poll, the expander and the sidebar entry. Comments are trimmed to the essentials.
Contributor
Automated Reviewer SuggestionsBased on the
|
Contributor
Author
|
/request-review @aicam |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8888 +/- ##
=========================================
Coverage 92.59% 92.60%
Complexity 5043 5043
=========================================
Files 1252 1256 +4
Lines 53583 53676 +93
Branches 6672 6682 +10
=========================================
+ Hits 49615 49706 +91
- Misses 2319 2321 +2
Partials 1649 1649
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…own owner and sort fallbacks Codecov flagged 7 lines of the page. The loading indicator never rendered because every test answers the first load synchronously, the `"Unknown"` owner label was never hit, and the sort comparators only tried a missing name or owner on the left side. Adds a test that the spinner shows while the first load is pending and goes away when it answers, one for an owner without a name, and the missing-on-the-right cases for `sortByName` and `sortByOwner`.
aicam
reviewed
Oct 10, 2026
aicam
approved these changes
Oct 10, 2026
aicam
left a comment
Contributor
There was a problem hiding this comment.
LGTM!, please address comment
…toast a failing poll once A failed poll raised an error toast on every tick, so a sustained outage flashed one every 5s, while the table kept the last good snapshot with nothing to say it was stale (or showed "No Data" when the first poll failed). Toast only when polling starts failing and re-arm on the next success, and show a warning above the table for as long as the refresh is failing, with the time of the last good load.
kunwp1
enabled auto-merge
October 10, 2026 22:02
renovate-bot
pushed a commit
to renovate-bot/apache-_-texera
that referenced
this pull request
Oct 12, 2026
### What changes were proposed in this PR? Problem. An admin can list every computing unit on Admin > Computing Units (apache#8888) but cannot act on one. Freeing a stuck or idle unit on a full Kubernetes cluster still means finding its pod and deleting it with `kubectl`. The backend already lets an ADMIN terminate any unit (`DELETE /computing-unit/{cuid}/terminate`, apache#7337), so only the UI is missing. Fix. Adds a delete-icon button to every row, in a new Actions column. It calls `ComputingUnitActionsService.confirmAndTerminate`, the confirmation the user's own Computing Units page already uses, so the dialog follows the unit type: a "results will be lost" warning for a Kubernetes unit and "Disconnect" for a local one. Cancelling the dialog or a failed request leaves the row alone. `confirmAndTerminate` gains an optional `onTerminated` callback that runs only after a successful termination, and the page uses it to drop the row at once instead of showing the unit as `Running` until the next 5 second poll. Two details follow from an admin seeing other users' units. A poll that started before the `DELETE` can answer after it with the unit still listed, so the page remembers the units it terminated and filters them out of every poll response. And ng-zorro renders the dialog and toast text through `[innerHTML]` while any user can rename their unit, so `confirmAndTerminate` now HTML-escapes the unit name for every caller. ``` Before: admin finds a stuck unit on the page -> finds its pod -> kubectl delete pod After: admin finds a stuck unit on the page -> clicks its delete icon -> confirms -> row disappears ``` Not included. Telling the owner their unit was terminated (apache#6483) and the cluster capacity panels (apache#6481, apache#6482) are separate issues. There is no backend change. ### Any related issues, documentation, discussions? Closes apache#6480. Part of apache#6476. Follows apache#8888, which added the page. ### How was this PR tested? Tests were added for the button, the hand-off to the dialog and the name escaping. They cover a button on every row (Kubernetes and local), the click confirming the clicked row's unit, the row leaving only after a successful termination and staying on cancel or failure, a stale in-flight poll not bringing the row back, the detail row's `colspan`, a unit name holding markup in the dialog and the toast, and `onTerminated` firing on success only. The tests were written first and watched fail, and breaking the code on purpose (name left unescaped, callback on every outcome, row dropped on click, poll responses left unfiltered) fails exactly the seven tests meant to catch it. ``` cd frontend && npx ng test --watch=false --include='**/admin-computing-unit.component.spec.ts' --include='**/computing-unit-actions.service.spec.ts' cd frontend && npx ng test --watch=false ``` The first command passes 53 tests and the second passes 6,622 (1 skipped). `ngc -p src/tsconfig.app.json --noEmit`, `prettier-eslint` and `eslint` ran clean on the changed files. https://github.com/user-attachments/assets/a33ffa6f-439a-4f71-ae8f-7efe5d94daac ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code, Claude Sonnet 5.5
renovate-bot
pushed a commit
to renovate-bot/apache-_-texera
that referenced
this pull request
Oct 25, 2026
### What changes were proposed in this PR? Problem. When a computing unit fails to start because the cluster is full, an admin cannot see from the app how much of the cluster is left (apache#6476), and the cluster capacity panel (apache#6482) has nothing to show. The backend only lists pods in the computing-unit pool namespace and never reads node capacity. Fix. Adds `GET /api/computing-unit/admin/cluster-capacity` (ADMIN only), which returns `total`, `allocated` and `available` for CPU (millicores), memory (bytes) and GPU (devices). `total` is the allocatable of every Ready, uncordoned node, and `allocated` is the requests of the pods running on them in every namespace, with init containers and runtime-class overhead counted the way kube-scheduler counts them. That is the figure `kubectl describe node` reports as "Allocated resources", so `available` bounds what a new unit can claim. Live usage from metrics-server is not used because it reads below what is committed and has no GPU metric. The pod list is narrowed on the API server to pods that have not finished, so a cluster that keeps many finished pods does not ship them all. On a deployment without Kubernetes computing units it answers 404, and a Kubernetes API failure comes back with the cluster's own message. Nodes are cluster-scoped, so the chart adds a ClusterRole that can only `list` `nodes` and `pods`, bound to the computing unit manager's service account. This is the one new permission: the manager can now list pods in every namespace, where it could previously see only its own pool. ``` Before: admin sees a unit stuck Pending -> kubectl describe nodes -> adds up the requests by hand After: admin sees a unit stuck Pending -> GET /computing-unit/admin/cluster-capacity -> available CPU, memory, GPU ``` Not included. The panel that shows it (apache#6482) and telling the owner on terminate (apache#6483). `available` is an upper bound, not a go or no-go: it sums across nodes, so capacity spread thinly over many nodes can still refuse a unit that needs one node's worth, and it ignores the pool's ResourceQuota, node placement (taints, node selectors, runtime-class scheduling), pod-level resources and native sidecars. The ClusterRole is unconditional, with no chart value to turn it off. ### Any related issues, documentation, discussions? Closes apache#6481. Part of apache#6476. Feeds the panel in apache#6482 and follows apache#8888, which added the page. ### How was this PR tested? Tests were added for the aggregation, the client wrapper, the guard and the endpoint. They cover node and pod filtering (cordoned, not Ready, no Ready condition, no status, unbound pods, finished pods), the effective-request rule (container sum, init containers, overhead, containers with no resources), decimal and fractional quantities, a custom GPU resource key, `available` floored at zero, the wrapper reading nodes and the unfinished pods of every namespace, the 404 on a non-Kubernetes deployment, a Kubernetes failure keeping its message, and the JSON field names the panel will read. The tests were written first and watched fail on a stub, apart from the JSON field-name test, which pins the response shape. Breaking the aggregation on purpose (finished pods counted, init containers summed instead of maxed, no floor at zero, a not-Ready node counted, a cordoned node counted, overhead dropped) turns at least one test red each time. ``` sbt "ComputingUnitManagingService/testOnly org.apache.texera.service.util.ClusterCapacitySpec org.apache.texera.service.util.KubernetesClientSpec org.apache.texera.service.util.ComputingUnitHelpersSpec org.apache.texera.service.resource.AdminComputingUnitResourceSpec" sbt "ComputingUnitManagingService/test" ``` The first command passes 107 tests and the second passes 289. `scalafmtCheckAll` and `scalafixAll --check` ran clean. The ClusterRole was checked by rendering its template alone with `helm template` against the chart's `values.yaml` (rendering the whole chart needs its subcharts downloaded) and asserting it grants exactly `list` on `nodes` and `pods` and is bound to the manager's service account, and `bin/k8s/tests/test_helm_values.sh` passes. Not exercised: a live Kubernetes cluster, since the local stack has none, so the Kubernetes calls are only checked against a stubbed client, and the endpoint over HTTP. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code, Claude Sonnet 5.5
renovate-bot
pushed a commit
to renovate-bot/apache-_-texera
that referenced
this pull request
Oct 26, 2026
### What changes were proposed in this PR? Problem. When a computing unit stays `Pending` on a full cluster, Admin > Computing Units (apache#8888) lists the unit but not how much of the cluster is left, so an admin still runs `kubectl describe nodes` to find which resource ran out. The backend has reported it since apache#8986 (`GET /computing-unit/admin/cluster-capacity`), but nothing in the UI reads it. Fix. Adds a Cluster capacity card above the units table. CPU, memory and GPU each get a row with a bar of the share allocated, then the allocated, available and total amounts: CPU in cores to the millicore, memory in binary units (`GiB`, as unit limits are written) and GPU as a count. The bars share one scale, so the resource that runs out first stands out. From 80% a row turns gold and is marked "Running low", and from 95% red and "Nearly full", with an icon and a screen-reader label so color is not the only signal. The share is rounded down, so 100% shows only when nothing is left, and it can pass 100% (the bar cannot) when pods request more than the nodes offer. A note under the rows says that allocated means requested, not used, and that available is summed across nodes. The card polls every 30 seconds rather than the table's 5, since capacity only moves when units start or stop and the backend lists every pod in the cluster to answer. A refresh button fetches at once and restarts the 30 seconds, so a click is not followed by a second cluster-wide listing seconds later. On a deployment without Kubernetes units the endpoint answers 404, so the card never shows and the poll ends. Any other failure shows the cluster's own message (a missing read grant reads "nodes is forbidden: ..."), and a failed refresh keeps the last numbers under a warning, as the table does. A resource the cluster has none of, usually GPU, reads "None in the cluster", and a missing, non-numeric or negative figure reads "Not reported" without taking the other rows down. When the card is narrower than the table needs, which the sidebar decides rather than the window, the rows stack into one labelled line per figure. ``` Before: admin sees a unit stuck Pending -> kubectl describe nodes -> adds up the requests by hand After: admin sees a unit stuck Pending -> Admin > Computing Units -> CPU 82% Running low, GPU 100% Nearly full ``` Not included. Telling the owner when an admin terminates their unit (apache#6483). The card shows what the endpoint reports, so the endpoint's limits carry over: `available` is an upper bound summed across nodes, so free capacity spread over several nodes can still refuse a unit that needs one node's worth, and a tainted node (say an RKE2 server reserved for control-plane pods) still counts although no unit can be scheduled there. Like the units table, the card keeps polling while the browser tab is hidden. ### Any related issues, documentation, discussions? Closes apache#6482. Part of apache#6476. Reads the endpoint added in apache#8986, on the page added in apache#8888. ### How was this PR tested? Before <img width="2880" height="1800" alt="before-1440" src="https://github.com/user-attachments/assets/4fadf670-2470-4ac7-a028-b4f5f37f27db" /> After <img width="2880" height="1800" alt="after-1440" src="https://github.com/user-attachments/assets/e8240430-e366-440d-8c3e-066ded7276b8" /> ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code, Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Problem. An admin cannot see computing units across users in the UI. On a full Kubernetes cluster they run
kubectland match each pod'scuidto itsworkflow_computing_unitrow by hand.Fix. Adds an ADMIN-only Computing Units page, reached from Admin in the dashboard sidebar. It lists every active unit from the existing
GET /computing-unit/admin/list, one row each with name, owner, type, status, creation time and a resource summary. A Kubernetes row expands to its CPU, memory, GPU, JVM memory and shared memory, while a local unit has no limits and does not expand. Type and status are filterable, status covers every state includingFailed,UnknownandTerminating, and a failing unit'sstatusReasonshows in the status tooltip.The table polls every 5 seconds with
exhaustMap, so a response slower than the interval finishes instead of being cancelled by the next tick, and a failed poll shows a message and keeps polling.parseDashboardUnitnow gives aNULLor malformedresourcetheNaNplaceholder, so one bad row cannot break the table.Not included. Terminating a unit from the page (#6480), the cluster capacity panel (#6481, #6482) and the owner notification (#6483) are separate issues.
Any related issues, documentation, discussions?
Closes #6479. Part of #6476.
Replaces #7356, which the stale bot closed after 37 days without review activity. This is the same change rebased onto current
main.How was this PR tested?
Tests were added for the page, for
listAllComputingUnitsand for the sidebar entry. They cover the poll (a failed poll, a slow response, teardown), the expander, the status filter, sorting, and aNULL,"null"or malformedresource.The first command passes 59 tests and the second passes 6,600 (1 skipped).
ngc -p src/tsconfig.app.json --noEmit,prettier-eslintandeslintran clean on the changed files.Checked in a browser against a local stack: sign in as an admin, open Admin > Computing Units, and the local unit lists with a green
Runningbadge. The first request fires at once and then every 5 seconds without overlap. No Kubernetes cluster was available, so the Kubernetes rows (expand, limits,Pending,Failed) are covered by unit tests only.Screen.Recording.2026-10-06.at.8.30.35.PM.mov
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code, Claude Sonnet 5.5