feat(gui): warehouse dashboard tab and per-execution warehouse picker - #7536
feat(gui): warehouse dashboard tab and per-execution warehouse picker#7536mengw15 wants to merge 4 commits into
Conversation
Automated Reviewer SuggestionsBased on the
|
There was a problem hiding this comment.
Pull request overview
Adds feature-gated warehouse management and per-execution warehouse selection to the frontend.
Changes:
- Adds warehouse API types, service, dashboard page, and routing.
- Adds warehouse selection and execution payload integration.
- Adds feature gating and Vitest coverage.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
execute-workflow.service.ts |
Sends the selected warehouse ID. |
execute-workflow.service.spec.ts |
Tests execution payload handling. |
computing-unit-selection.component.ts |
Implements warehouse selection. |
computing-unit-selection.component.spec.ts |
Tests picker behavior. |
computing-unit-selection.component.scss |
Styles the picker. |
computing-unit-selection.component.html |
Renders the picker. |
workflow-executions-entry.ts |
Adds execution warehouse metadata. |
workflow-execution-history.component.spec.ts |
Updates execution fixtures. |
user-warehouse.component.ts |
Implements warehouse management. |
user-warehouse.component.spec.ts |
Tests management flows. |
user-warehouse.component.scss |
Styles the warehouse page. |
user-warehouse.component.html |
Renders warehouse management UI. |
dashboard.component.ts |
Loads warehouse feature status. |
dashboard.component.spec.ts |
Tests tab gating. |
dashboard.component.html |
Adds the Warehouses tab. |
warehouse.ts |
Defines warehouse API types. |
warehouse.service.ts |
Implements warehouse API and selection state. |
warehouse.service.spec.ts |
Tests API calls and selection state. |
app-routing.module.ts |
Registers the warehouse route. |
app-routing.constant.ts |
Defines the warehouse route constant. |
Suppressed comments (4)
frontend/src/app/workspace/component/power-button/computing-unit-selection.component.ts:323
- On a reused workspace component, this error path retains the previous workflow's
lastExecutionWhid. If workflow A used warehouse 2 and workflow B has no executions, B therefore selects warehouse 2 instead of the documented first-warehouse fallback. Clear the cached execution warehouse before applying the fallback.
// No execution history: still preselect a warehouse (the first one).
this.applyWarehousePreselect();
frontend/src/app/workspace/component/power-button/computing-unit-selection.component.ts:347
- Returning here leaves the root-scoped service's prior warehouse ID intact. After the feature is disabled or the current user has no warehouses, the picker is hidden but
ExecuteWorkflowServicestill sends that stale explicit ID; the backend then rejects the run instead of using shared storage. Clear the service selection in this branch.
private applyWarehousePreselect(): void {
if (!this.warehouseEnabled || this.warehouses.length === 0) {
return;
frontend/src/app/workspace/component/power-button/computing-unit-selection.component.ts:315
- Every workflow change leaves its
retrieveLatestWorkflowExecutionrequest active. If workflow A's response arrives after switching to B, this callback applies A's warehouse whilethis.workflowIdalready points to B, so B's next run can write to the wrong warehouse. Cancel older requests withswitchMap, or capture the requested workflow ID and ignore responses that no longer match.
this.lastExecutionWhid = latestWorkflowExecution.whId ?? undefined;
this.applyWarehousePreselect();
frontend/src/app/workspace/component/power-button/computing-unit-selection.component.ts:350
- This preselection can overwrite an explicit user choice. Once the status response renders the picker, a user can select a warehouse before the concurrent latest-execution request finishes; its later callback calls this method and silently changes the selection. Track whether the user has selected a value for the current workflow and do not preselect after that point.
const lastUsed = this.warehouses.find(warehouse => warehouse.whid === this.lastExecutionWhid);
this.warehouseService.selectWarehouse((lastUsed ?? this.warehouses[0]).whid);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| eId: number; | ||
| vId: number; | ||
| cuId: number; | ||
| whId: number; |
There was a problem hiding this comment.
Right — whId is Integer on the wire and is null for shared-storage runs and after ON DELETE SET NULL. Typed as number | null in 44e65a4; the cast in the picker spec is gone.
| error: (err: unknown) => { | ||
| console.error("Failed to fetch warehouse status", err); | ||
| }, |
There was a problem hiding this comment.
Good catch, this was a real leak: the pick lives in the root-scoped WarehouseService, so hiding the picker left a previous workflow's id in place and the next execution would have carried it. Fixed in 44e65a4 — the status-failure path and the nothing-selectable path both clear the selection now, pinned by two spec cases (verified red without the fix).
| <i | ||
| nz-icon | ||
| nzType="delete" | ||
| class="warehouse-delete-icon" | ||
| nz-tooltip | ||
| nzTooltipTitle="Delete warehouse and all data stored in it" | ||
| (click)="confirmDelete(warehouse)" | ||
| role="button" | ||
| aria-label="Delete warehouse"> | ||
| </i> |
There was a problem hiding this comment.
This follows the established pattern for row actions in this codebase — the computing-unit list's delete/rename/share icons are all <i nz-icon (click)> with role="button". Making just this one a real button would be inconsistent; fixing them together is a separate accessibility pass worth its own issue.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7536 +/- ##
============================================
+ Coverage 89.65% 89.68% +0.02%
- Complexity 4397 4401 +4
============================================
Files 1177 1180 +3
Lines 46996 47140 +144
Branches 5268 5277 +9
============================================
+ Hits 42136 42278 +142
- Misses 3094 3102 +8
+ Partials 1766 1760 -6
*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:
|
What changes were proposed in this PR?
Adds the user-facing UI for per-user warehouses (#6870), shown only when the backend reports the feature enabled (
GET /warehouse/status):/user/warehouse): list, create, and delete the caller's warehouses, via a newWarehouseService. Deleting warns that the warehouse's data is purged.WorkflowExecuteRequest.warehouseId. Mirroring the CU selector, it preselects the latest execution's warehouse (whId, now onWorkflowExecutionsEntry) and falls back to the user's first warehouse, so a run needs no explicit pick.Any related issues, documentation, discussions?
Closes #6933. Backend counterpart: #7473.
How was this PR tested?
New Vitest specs for
WarehouseService(HTTP + pick state) and the warehouse tab (disabled/empty/list, create, delete); new cases in the CU-selection, execute-workflow, and dashboard specs covering preselection, thewarehouseIdpayload, and tab gating. All touched spec files pass locally (117 tests).Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (claude-fable-5)