Copilot commented on code in PR #8005:
URL: https://github.com/apache/texera/pull/8005#discussion_r3866643511


##########
frontend/src/app/common/component/warehouse-create-modal/warehouse-create-modal.component.html:
##########
@@ -0,0 +1,59 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<nz-modal
+  [nzVisible]="visible"
+  nzTitle="Create Warehouse"
+  [nzContent]="createWarehouseModalContent"
+  [nzFooter]="createWarehouseModalFooter"
+  (nzOnCancel)="handleCreateWarehouseModalCancel()">
+  <ng-template #createWarehouseModalContent>
+    <div class="create-warehouse-container">
+      <div class="select-unit name-field">
+        <span>Warehouse Name</span>
+        <input
+          [required]="true"
+          nz-input
+          placeholder="Enter the name of your warehouse (required)"
+          maxlength="64"
+          class="warehouse-name-input"
+          [(ngModel)]="newWarehouseName"
+          (keyup.enter)="createWarehouse()" />
+        <p class="warehouse-name-hint">Letters, digits, '-' and '_' only; must 
start with a letter or digit.</p>

Review Comment:
   This visible text is not associated with the input, and the constraint hint 
is also omitted from its accessible description. Associate a real label and the 
hint with the control so screen-reader and voice-control users receive the same 
name and validation guidance.



##########
frontend/src/app/dashboard/component/user/user-warehouse/user-warehouse-list-item/user-warehouse-list-item.component.scss:
##########
@@ -0,0 +1,105 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+@use "../../../section-style" as *;
+@use "../../../dashboard.component.scss" as *;
+
+.warehouse-list-item-card {
+  padding: 3px;
+  width: 100%;
+  background-color: white;
+  position: relative;
+  min-height: 65px;
+  height: auto;
+
+  &:hover {
+    background-color: #f0f0f0;
+  }
+}
+
+// The computing-unit row is 64px of content: its two 32px metric bars drive
+// the height. A warehouse row has no metrics, so pin the same content height
+// here — card paddings and borders already match, so the rows line up exactly.
+.warehouse-item-row {
+  min-height: 64px;
+}
+
+.warehouse-list-item-card:hover .button-group {
+  display: flex;
+  background-color: transparent;
+}
+
+.type-icon {
+  font-size: 30px;
+}
+
+.warehouse-id {
+  padding: 6px;
+}
+
+.resource-name-group {
+  min-width: 0;
+}
+
+.resource-name {
+  font-size: 17px;
+  font-weight: 600;
+  cursor: pointer;
+  text-decoration: none;
+}
+
+.resource-name:hover {
+  text-decoration: underline;
+}
+
+.resource-info {
+  font-size: 13px;
+  color: grey;
+}
+
+.truncate-single-line {
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  overflow: hidden;
+}
+
+.button-group {
+  display: none;

Review Comment:
   `display: none` removes the delete button from the tab order, and this card 
has no focusable element that could trigger its hover-only reveal. Consequently 
keyboard users cannot reach the delete action. Keep the action in the 
accessibility tree and reveal it on `:focus-within` as well as hover, or leave 
it visibly available.



##########
frontend/src/app/dashboard/component/user/user-warehouse/user-warehouse-list-item/user-warehouse-list-item.component.html:
##########
@@ -0,0 +1,86 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<nz-card
+  [nzBodyStyle]="{padding: '3px'}"
+  class="warehouse-list-item-card">
+  <div
+    nz-row
+    nzAlign="middle"
+    class="warehouse-item-row">
+    <div
+      nz-col
+      nzFlex="20px"></div>
+
+    <div
+      nz-col
+      nzFlex="0"
+      class="type-icon">
+      <i
+        nz-icon
+        nzType="cloud-server"></i>
+    </div>
+
+    <div
+      nz-col
+      nzFlex="0"
+      class="warehouse-id">
+      <i>#{{ warehouse.whid }}</i>
+    </div>
+
+    <div
+      nz-col
+      nzFlex="1"
+      class="resource-name-group">
+      <div
+        class="resource-name truncate-single-line"
+        (click)="openWarehouseMetadataModal()">
+        {{ warehouse.name }}
+      </div>

Review Comment:
   The warehouse name is an interactive dialog trigger, but a clickable `div` 
is neither focusable nor activatable with Enter/Space. Use a semantic 
button/link so keyboard and assistive-technology users can open the metadata 
dialog.



##########
frontend/src/app/common/component/warehouse-create-modal/warehouse-create-modal.component.ts:
##########
@@ -0,0 +1,117 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } 
from "@angular/core";
+import { FormsModule } from "@angular/forms";
+import { UntilDestroy, untilDestroyed } from "@ngneat/until-destroy";
+import { Subject, takeUntil } from "rxjs";
+import { NzButtonComponent } from "ng-zorro-antd/button";
+import { ɵNzTransitionPatchDirective } from 
"ng-zorro-antd/core/transition-patch";
+import { NzWaveDirective } from "ng-zorro-antd/core/wave";
+import { NzInputDirective } from "ng-zorro-antd/input";
+import { NzModalComponent } from "ng-zorro-antd/modal";
+import { NotificationService } from 
"../../service/notification/notification.service";
+import { WarehouseActionsService } from 
"../../service/warehouse/warehouse-actions.service";
+import { DashboardWarehouse } from "../../type/warehouse";
+import { extractErrorMessage } from "../../util/error";
+
+/**
+ * Shared create-warehouse modal (#6933), embedded the same way
+ * ComputingUnitCreateModalComponent is — two-way `[(visible)]` controls the
+ * dialog and `(warehouseCreated)` returns the created warehouse — by the
+ * dashboard tab today and by the workspace picker once it lands (#7817).
+ */
+@UntilDestroy()
+@Component({
+  selector: "texera-warehouse-create-modal",
+  templateUrl: "./warehouse-create-modal.component.html",
+  styleUrls: ["./warehouse-create-modal.component.scss"],
+  imports: [
+    FormsModule,
+    NzModalComponent,
+    NzButtonComponent,
+    NzWaveDirective,
+    ɵNzTransitionPatchDirective,
+    NzInputDirective,
+  ],
+})
+export class WarehouseCreateModalComponent implements OnChanges {
+  // Must be bound two-way ([(visible)]): the modal closes itself.
+  @Input() visible = false;
+  @Output() visibleChange = new EventEmitter<boolean>();
+  @Output() warehouseCreated = new EventEmitter<DashboardWarehouse>();
+
+  newWarehouseName = "";
+  creating = false;
+
+  // Closing the dialog ends the attempt it was showing. Without this the 
request
+  // outlives the dialog (the component itself is never torn down), so Cancel
+  // would still create the warehouse and a late response would close — and
+  // discard — whatever the user had typed after reopening.
+  private readonly closed$ = new Subject<void>();
+
+  constructor(
+    private warehouseActionsService: WarehouseActionsService,
+    private notificationService: NotificationService
+  ) {}
+
+  ngOnChanges(changes: SimpleChanges): void {
+    if (changes["visible"]?.currentValue === true) {
+      this.newWarehouseName = "";
+      // Cancelling mid-flight leaves creating set; without this the Create 
button
+      // reopens stuck in its loading state.
+      this.creating = false;
+    }
+  }
+
+  createWarehouse(): void {
+    const name = this.newWarehouseName.trim();
+    if (!name || this.creating) {
+      return;
+    }
+    this.creating = true;
+    this.warehouseActionsService
+      .create(name)
+      .pipe(takeUntil(this.closed$), untilDestroyed(this))

Review Comment:
   Cancelling only unsubscribes the HTTP observable; it cannot roll back 
`WarehouseResource.create` after the server has received the request. In that 
race, the warehouse is still persisted, but suppressing `next` also prevents 
`warehouseCreated` and the list refresh, leaving an unexpected invisible 
warehouse. Either prevent closing while creation is in flight or add a 
server-supported cancellation/idempotency flow rather than treating `takeUntil` 
as operation cancellation.



-- 
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