This is an automated email from the ASF dual-hosted git repository.
linxinyuan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/main by this push:
new bf8c942440 feat: enable canceling pending uploads before upload begins
(#3847)
bf8c942440 is described below
commit bf8c94244095d4a8d514a87b34f209fb0012c436
Author: Xuan Gu <[email protected]>
AuthorDate: Thu Oct 9 22:23:23 2025 -0700
feat: enable canceling pending uploads before upload begins (#3847)
### **Purpose**
This PR resolved #3844 that pending uploads cannot be removed before
they start. This PR enables removing/canceling items directly from the
Pending panel, improving queue control and flexibility in managing
uploads.
### **Changes**
- Add a Remove action to Pending items; behavior and styling match the
Uploading panel’s remove action.
- Refactor cancelExistingUpload(fileName: string):
- Uploading/Initializing → reuse the abort path to properly finalize
server-side and prevent leaks.
- Pending → front-end clean only (remove from queue, tasks) with no
backend abort call.
### **Demonstration**
https://github.com/user-attachments/assets/aa4aa40c-bf7a-45fd-9257-fcfac4a00da9
---
.../dataset-detail.component.html | 12 ++++++++++++
.../dataset-detail.component.scss | 1 -
.../user-dataset-explorer/dataset-detail.component.ts | 18 +++++++-----------
3 files changed, 19 insertions(+), 12 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 7d8909b15a..d4dddf94f6 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
@@ -288,6 +288,18 @@
*ngFor="let fileName of queuedFileNames"
class="upload-progress-container">
<span>{{ fileName }}</span>
+ <button
+ nz-button
+ nzType="text"
+ nzShape="circle"
+ nz-tooltip
+ [nzTooltipTitle]="'Remove from queue'"
+ (click)="cancelExistingUpload(fileName)">
+ <span
+ nz-icon
+ nzType="close"
+ nzTheme="outline"></span>
+ </button>
</div>
</div>
</nz-collapse-panel>
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 0790f28358..389ac07454 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
@@ -185,7 +185,6 @@ nz-select {
.upload-progress-wrapper-pending {
display: flex;
flex-direction: column;
- gap: 10px;
max-height: 15vh;
}
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 206efc22e9..3e1b4ade1c 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
@@ -493,17 +493,13 @@ export class DatasetDetailComponent implements OnInit {
}
}
- private cancelExistingUpload(fileName: string): void {
- const isUploading = this.uploadTasks.some(
- t => t.filePath === fileName && (t.status === "uploading" || t.status
=== "initializing")
- );
- this.uploadSubscriptions.get(fileName)?.unsubscribe();
- this.uploadSubscriptions.delete(fileName);
- this.uploadTasks = this.uploadTasks.filter(t => t.filePath !== fileName);
-
- // Process next in queue if this was active
- if (isUploading) {
- this.onUploadComplete();
+ cancelExistingUpload(fileName: string): void {
+ const task = this.uploadTasks.find(t => t.filePath === fileName);
+ if (task) {
+ if (task.status === "uploading" || task.status === "initializing") {
+ this.onClickAbortUploadProgress(task);
+ return;
+ }
}
// Remove from pending queue if present
this.pendingQueue = this.pendingQueue.filter(item => item.fileName !==
fileName);