mengw15 commented on code in PR #8551:
URL: https://github.com/apache/texera/pull/8551#discussion_r4030488272


##########
frontend/src/app/workspace/component/menu/menu.component.ts:
##########
@@ -408,6 +408,18 @@ export class MenuComponent implements OnInit, OnDestroy {
       };
     }
 
+    // Per-user warehouses enabled but none to write to (#7817): mirror the
+    // Connect state above — name the fixing action, and runWorkflow() routes
+    // the click into the create-warehouse modal.
+    if (this.computingUnitSelectionComponent?.warehouseRequiredButMissing) {

Review Comment:
   Done — the menu re-snapshots the Run button on every warehouse pick change; 
each relevant transition (load, preselect, create, disable, failure) ends in a 
`selectWarehouse` call, so the pick stream covers them all. Covered by a 
regression test.



##########
frontend/src/app/workspace/component/power-button/computing-unit-selection.component.html:
##########
@@ -58,6 +58,92 @@
     </div>
   </div>
 
+  <button
+    *ngIf="warehouseEnabled"
+    nz-button
+    nz-dropdown
+    nzTrigger="click"
+    [nzDropdownMenu]="warehouseMenu"
+    [nzPlacement]="'bottomRight'"
+    (nzVisibleChange)="onWarehouseDropdownVisibilityChange($event)"
+    class="warehouse-dropdown-button"
+    nz-tooltip
+    nzTooltipTitle="Warehouse this execution writes to">
+    <div class="button-content">
+      <texera-user-avatar
+        *ngIf="selectedWarehouse as selected"
+        [avatar]="selected.ownerAvatar || ''"
+        userColor="grey"
+        [userName]="selected.ownerName || ''"
+        [style.transform]="'scale(0.65)'"
+        [style.opacity]="0.7"
+        [style.padding-right.px]="2">
+      </texera-user-avatar>
+      <i
+        nz-icon
+        nzType="cloud-server"></i>
+      <span class="warehouse-name-text">{{ getWarehouseButtonText() }}</span>
+      <i
+        nz-icon
+        nzType="down"></i>
+    </div>
+  </button>
+
+  <nz-dropdown-menu #warehouseMenu="nzDropdownMenu">
+    <ul
+      nz-menu
+      class="warehouses-dropdown">
+      <li
+        nz-menu-item
+        *ngFor="let warehouse of warehouses; trackBy: trackByWhid"
+        id="warehouse-option"
+        class="warehouse-option"

Review Comment:
   Done — each row's id is now `warehouse-option-<whid>`. Line 125 is the 
delete icon, which carries only a class and an aria-label — classes may repeat.



##########
frontend/src/app/workspace/component/power-button/computing-unit-selection.component.ts:
##########
@@ -153,9 +158,23 @@ export class ComputingUnitSelectionComponent implements 
OnInit {
   selectedComputingUnit: DashboardWorkflowComputingUnit | null = null;
   allComputingUnits: DashboardWorkflowComputingUnit[] = [];
 
+  // Per-user warehouse picker (#7817): shown whenever the deployment reports
+  // the feature enabled — with zero warehouses it still offers the create
+  // entry, and the Run button leads there too.
+  warehouseEnabled: boolean = false;
+  warehouses: DashboardWarehouse[] = [];
+  selectedWarehouseId?: number;
+  // The latest execution's warehouse; the warehouse list and the latest
+  // execution are fetched concurrently, so preselection re-runs after
+  // whichever response lands last.
+  private lastExecutionWhid?: number;

Review Comment:
   Done — the field is cleared on workflow change, so a history-less workflow 
falls back to its own first warehouse. The pick itself is left until the new 
preselect lands: what the dropdown shows in that window is exactly what would 
ride a run. Covered by a regression test.



##########
frontend/src/app/workspace/component/power-button/computing-unit-selection.component.ts:
##########
@@ -409,6 +450,123 @@ export class ComputingUnitSelectionComponent implements 
OnInit {
     }
   }
 
+  /**
+   * Fetches the warehouse list, on init and on every dropdown open (mirroring
+   * onDropdownVisibilityChange). Preselection re-runs only when the current
+   * pick is gone (first load, or the picked warehouse was deleted), so a
+   * routine refresh cannot override a manual pick.
+   */
+  private refreshWarehouses(): void {
+    this.warehouseService
+      .getStatus()
+      .pipe(untilDestroyed(this))
+      .subscribe({

Review Comment:
   Done — refreshes flow through a single switchMap'd stream now, the same 
shape as `UserWarehouseComponent`. Covered by a regression test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to