This is an automated email from the ASF dual-hosted git repository.

linxinyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/texera.git


The following commit(s) were added to refs/heads/master by this push:
     new d03f3bffaf feat: inline dataset version creation and remove modal flow 
(#3659)
d03f3bffaf is described below

commit d03f3bffafe87eb37f6f578bb83cb5648e741082
Author: Xuan Gu <[email protected]>
AuthorDate: Wed Aug 13 17:25:39 2025 -0700

    feat: inline dataset version creation and remove modal flow (#3659)
    
    ### **Purpose**
    This PR restructures the dataset version creation logic by removing the
    modal-based flow and supporting inline creation only. This change
    improves the user experience with a more flexible and direct workflow.
    
    ### **Changes**
    - dataset-detail.component.ts/html/scss: Removed modal-related
    logic(modal, isCreating, form controls) and unified creation flow into
    the inline form.
    
    ### **Demonstration**
    **Before – Clicking Submit opened a pop-up window for version creation**
    
    <img width="402" height="455" alt="prev"
    
src="https://github.com/user-attachments/assets/18562ea8-a5a2-4c22-b45d-e36903d6d3ed";
    />
    <img width="537" height="246" alt="window"
    
src="https://github.com/user-attachments/assets/b31ecba1-b86c-4631-9b40-fabdf593bca9";
    />
    
    **After - Version creation happens directly in the dataset detail view**
    <img width="400" height="421" alt="new"
    
src="https://github.com/user-attachments/assets/5a4ac3bb-6f26-4d3a-9fd5-eb64dbd25f84";
    />
    
    Signed-off-by: Xinyuan Lin <[email protected]>
    Co-authored-by: Xinyuan Lin <[email protected]>
---
 .../dataset-detail.component.html                  | 30 ++++++++++---
 .../dataset-detail.component.scss                  | 21 ++++++++-
 .../dataset-detail.component.ts                    | 50 +++++++++++-----------
 3 files changed, 68 insertions(+), 33 deletions(-)

diff --git 
a/core/gui/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.html
 
b/core/gui/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.html
index df8e1b88f8..a762930851 100644
--- 
a/core/gui/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.html
+++ 
b/core/gui/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.html
@@ -272,14 +272,30 @@
             [did]="did"
             [userMakeChangesEvent]="userMakeChanges"
             
(stagedObjectsChanged)="onStagedObjectsUpdated($event)"></texera-dataset-staged-objects-list>
-          <button
-            nz-button
-            nzType="primary"
+          <div
             *ngIf="userHasWriteAccess() && userHasPendingChanges"
-            class="create-dataset-version-button"
-            (click)="onClickOpenVersionCreator()">
-            Submit
-          </button>
+            class="version-creator">
+            <div class="version-input-container">
+              <label>Version:</label>
+              <input
+                nz-input
+                [(ngModel)]="versionName"
+                placeholder="Describe the new version (Optional)"
+                [disabled]="isCreatingVersion"
+                (keydown.enter)="onClickOpenVersionCreator()"
+                class="version-input" />
+            </div>
+            <div>
+              <button
+                nz-button
+                nzType="primary"
+                [nzLoading]="isCreatingVersion"
+                (click)="onClickOpenVersionCreator()"
+                class="create-dataset-version-button">
+                Submit
+              </button>
+            </div>
+          </div>
         </nz-collapse-panel>
       </nz-collapse>
     </div>
diff --git 
a/core/gui/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.scss
 
b/core/gui/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.scss
index 0fe8072d4a..a6a0cbcdfe 100644
--- 
a/core/gui/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.scss
+++ 
b/core/gui/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.scss
@@ -27,7 +27,7 @@
   border-radius: 25px;
   cursor: pointer;
   transition: background-color 0.3s;
-  margin: 50px auto 0 auto; /* Auto margins for horizontal centering */
+  margin: 18px auto 0 auto; /* Auto margins for horizontal centering */
   width: 200px; /* Adjust width as needed */
   font-size: 18px; /* Make text slightly bigger */
   font-weight: bold; /* Optional: Make text bold */
@@ -174,3 +174,22 @@ nz-select {
 .upload-progress-container {
   margin-left: 20px;
 }
+
+.version-creator {
+  margin-top: 20px;
+  padding: 40px;
+}
+
+.version-input-container label {
+  font-size: 15px;
+}
+
+.version-input-container {
+  display: flex;
+  align-items: center;
+  gap: 10px;
+}
+
+.version-input {
+  padding: 6px;
+}
diff --git 
a/core/gui/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.ts
 
b/core/gui/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.ts
index 5329037b08..c223f7385b 100644
--- 
a/core/gui/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.ts
+++ 
b/core/gui/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.ts
@@ -40,6 +40,7 @@ import { DatasetStagedObject } from 
"../../../../../common/type/dataset-staged-o
 import { NzModalService } from "ng-zorro-antd/modal";
 import { UserDatasetVersionCreatorComponent } from 
"./user-dataset-version-creator/user-dataset-version-creator.component";
 import { AdminSettingsService } from 
"../../../../service/admin/settings/admin-settings.service";
+import { HttpErrorResponse } from "@angular/common/http";
 import { Subscription } from "rxjs";
 
 export const THROTTLE_TIME_MS = 1000;
@@ -83,6 +84,9 @@ export class DatasetDetailComponent implements OnInit {
   maxConcurrentChunks: number = 10;
   private uploadSubscriptions = new Map<string, Subscription>();
 
+  versionName: string = "";
+  isCreatingVersion: boolean = false;
+
   //  List of upload tasks – each task tracked by its filePath
   public uploadTasks: Array<
     MultipartUploadProgress & {
@@ -169,32 +173,28 @@ export class DatasetDetailComponent implements OnInit {
 
     this.loadUploadSettings();
   }
+
   public onClickOpenVersionCreator() {
-    if (this.did) {
-      const modal = this.modalService.create({
-        nzTitle: "Create New Dataset Version",
-        nzContent: UserDatasetVersionCreatorComponent,
-        nzFooter: null,
-        nzData: {
-          isCreatingVersion: true,
-          did: this.did,
-        },
-        nzBodyStyle: {
-          resize: "both",
-          overflow: "auto",
-          minHeight: "200px",
-          minWidth: "550px",
-          maxWidth: "90vw",
-          maxHeight: "80vh",
-        },
-        nzWidth: "fit-content",
-      });
-      modal.afterClose.pipe(untilDestroyed(this)).subscribe(result => {
-        if (result != null) {
-          this.retrieveDatasetVersionList();
-          this.userMakeChanges.emit();
-        }
-      });
+    if (this.did && !this.isCreatingVersion) {
+      this.isCreatingVersion = true;
+
+      this.datasetService
+        .createDatasetVersion(this.did, this.versionName?.trim() || "")
+        .pipe(untilDestroyed(this))
+        .subscribe({
+          next: res => {
+            this.notificationService.success("Version Created");
+            this.isCreatingVersion = false;
+            this.versionName = "";
+            this.retrieveDatasetVersionList();
+            this.userMakeChanges.emit();
+          },
+          error: (res: unknown) => {
+            const err = res as HttpErrorResponse;
+            this.notificationService.error(`Version creation failed: 
${err.error.message}`);
+            this.isCreatingVersion = false;
+          },
+        });
     }
   }
 

Reply via email to