feat: add notify for success upload
All checks were successful
Build and Deploy Angular App / build (push) Successful in 48s

This commit is contained in:
2025-02-06 16:42:04 +03:00
parent 74a7fe7eb6
commit ea5e731bd2

View File

@ -12,6 +12,7 @@ import {DataSpinnerComponent} from "@component/common/data-spinner/data-spinner.
import {MatFormFieldModule} from "@angular/material/form-field"; import {MatFormFieldModule} from "@angular/material/form-field";
import {FormsModule} from "@angular/forms"; import {FormsModule} from "@angular/forms";
import {MatInput} from "@angular/material/input"; import {MatInput} from "@angular/material/input";
import {ToastrService} from "ngx-toastr";
@Component({ @Component({
selector: 'app-schedule-file-upload', selector: 'app-schedule-file-upload',
@ -32,7 +33,7 @@ export class ScheduleFileUploadComponent {
fileLoading: boolean = false; fileLoading: boolean = false;
@ViewChild('fileInput') input!: ElementRef; @ViewChild('fileInput') input!: ElementRef;
constructor(private dialog: MatDialog, private api: ScheduleService) { constructor(private dialog: MatDialog, private api: ScheduleService, private notify: ToastrService) {
} }
protected saveFunction() { protected saveFunction() {
@ -55,13 +56,13 @@ export class ScheduleFileUploadComponent {
onFileSelected(event: any): void { onFileSelected(event: any): void {
this.fileLoading = false; this.fileLoading = false;
console.log(Array.from(event.target.files));
this.selectedFiles = Array.from(event.target.files) this.selectedFiles = Array.from(event.target.files)
.map(x => <{file: File, campus: string}>{file: x, campus: ''}); .map(x => <{file: File, campus: string}>{file: x, campus: ''});
} }
onUpload(data: Observable<any>): void { onUpload(data: Observable<any>): void {
data.subscribe(_ => { data.subscribe(_ => {
this.notify.info(`Файлы в размере ${this.selectedFiles.length} успешно загружены. Задача поставлена в очередь`);
this.selectedFiles = []; this.selectedFiles = [];
}); });
} }