carloea2 commented on code in PR #4181:
URL: https://github.com/apache/texera/pull/4181#discussion_r2749201249
##########
frontend/src/app/dashboard/component/user/files-uploader/files-uploader.component.ts:
##########
@@ -32,98 +37,229 @@ import { UntilDestroy, untilDestroyed } from
"@ngneat/until-destroy";
styleUrls: ["./files-uploader.component.scss"],
})
export class FilesUploaderComponent {
- @Input()
- showUploadAlert: boolean = false;
+ @Input() showUploadAlert: boolean = false;
- @Output()
- uploadedFiles = new EventEmitter<FileUploadItem[]>();
+ @Output() uploadedFiles = new EventEmitter<FileUploadItem[]>();
newUploadFileTreeNodes: DatasetFileNode[] = [];
fileUploadingFinished: boolean = false;
- // four types: "success", "info", "warning" and "error"
fileUploadBannerType: "error" | "success" | "info" | "warning" = "success";
fileUploadBannerMessage: string = "";
singleFileUploadMaxSizeMiB: number = 20;
constructor(
private notificationService: NotificationService,
- private adminSettingsService: AdminSettingsService
+ private adminSettingsService: AdminSettingsService,
+ private datasetService: DatasetService,
+ @Optional() @Host() private parent: DatasetDetailComponent,
+ private modal: NzModalService
) {
this.adminSettingsService
.getSetting("single_file_upload_max_size_mib")
.pipe(untilDestroyed(this))
.subscribe(value => (this.singleFileUploadMaxSizeMiB = parseInt(value)));
}
- hideBanner() {
+ private formatBytes(n: number): string {
+ const mib = n / (1024 * 1024);
+ if (mib >= 1024) return `${(mib / 1024).toFixed(2)} GiB`;
+ if (mib >= 1) return `${mib.toFixed(2)} MiB`;
+ return `${Math.max(1, Math.round(n / 1024))} KiB`;
+ }
+
+ private markForceRestart(item: FileUploadItem): void {
+ // uploader should call backend init with type=forceRestart when this is
set
+ (item as any).restart = true;
+ }
+
+ private askResumeOrSkip(
+ item: FileUploadItem,
+ showForAll: boolean
+ ): Promise<"resume" | "resumeAll" | "restart" | "restartAll"> {
+ return new Promise(resolve => {
+ const fileName = item.name.split("/").pop() || item.name;
+ const sizeStr = this.formatBytes(item.file.size);
+
+ const ref = this.modal.create({
+ nzTitle: "Conflicting File",
+ nzMaskClosable: false,
+ nzClosable: false,
+ nzContent: `
+<div>
Review Comment:
I added a small component. Thanks.
--
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]