Fix progress dialog showing the wrong percentages

TG-78 #closed

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/6/head
trivernis 3 years ago
parent ba203d26a7
commit 2bec24c387
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -23,13 +23,18 @@ export class BusyDialogComponent {
public progress = 0; public progress = 0;
public mode: ProgressBarMode = "indeterminate"; public mode: ProgressBarMode = "indeterminate";
constructor(public dialogRef: MatDialogRef<BusyDialogComponent>, @Inject(MAT_DIALOG_DATA) data: BusyDialogData) { constructor(
public dialogRef: MatDialogRef<BusyDialogComponent>,
@Inject(MAT_DIALOG_DATA) data: BusyDialogData
) {
this.title = data.title; this.title = data.title;
if (data.message) { if (data.message) {
data.message.subscribe(m => this.message = m); data.message.subscribe(m => this.message = m);
} }
if (data.progress) { if (data.progress) {
data.progress.subscribe(p => this.progress = p); data.progress.subscribe(p => {
this.progress = Math.floor(p * 100);
});
this.mode = "determinate"; this.mode = "determinate";
} }
this.allowCancel = data.allowCancel ?? false; this.allowCancel = data.allowCancel ?? false;

@ -3,18 +3,10 @@ import {File} from "../../../../../api/models/File";
import {ContextMenuComponent} from "../../app-common/context-menu/context-menu.component"; import {ContextMenuComponent} from "../../app-common/context-menu/context-menu.component";
import {FileService} from "../../../../services/file/file.service"; import {FileService} from "../../../../services/file/file.service";
import {LoggingService} from "../../../../services/logging/logging.service"; import {LoggingService} from "../../../../services/logging/logging.service";
import {MatDialog, MatDialogRef} from "@angular/material/dialog"; import {MatDialog} from "@angular/material/dialog";
import {BusyDialogComponent} from "../../app-common/busy-dialog/busy-dialog.component";
import {BehaviorSubject} from "rxjs";
import {FileActionBaseComponent} from "../../app-base/file-action-base/file-action-base.component"; import {FileActionBaseComponent} from "../../app-base/file-action-base/file-action-base.component";
import {FileStatus} from "../../../../../api/api-types/files"; import {FileStatus} from "../../../../../api/api-types/files";
type ProgressDialogContext = {
dialog: MatDialogRef<BusyDialogComponent>,
progress: BehaviorSubject<number>,
message: BehaviorSubject<string>,
};
@Component({ @Component({
selector: "app-file-context-menu", selector: "app-file-context-menu",
templateUrl: "./file-context-menu.component.html", templateUrl: "./file-context-menu.component.html",

Loading…
Cancel
Save