bugfixing

This commit is contained in:
2020-06-14 15:46:24 +02:00
parent 1e1e127f13
commit 19b28453d3
36 changed files with 175 additions and 97 deletions

View File

@@ -25,7 +25,7 @@ export class FileComponent {
this.name = file.name;
this.fileId = file.id;
this.path = file.path + '/' + file.name;
};
}
public async onDelete(): Promise<void> {
await this.fileService.delete(this.path, this.songId, this.fileId);

View File

@@ -51,7 +51,7 @@ export class EditSongComponent implements OnInit {
).subscribe(song => {
this.song = song;
this.form = this.editService.createSongForm(song);
this.form.controls.flags.valueChanges.subscribe(_ => this.onFlagsChanged(_))
this.form.controls.flags.valueChanges.subscribe(_ => this.onFlagsChanged(_));
this.onFlagsChanged(this.form.controls.flags.value);
});
}
@@ -78,7 +78,9 @@ export class EditSongComponent implements OnInit {
this.form.controls.flags.setValue(flags.join(';'));
}
if (input) input.value = '';
if (input) {
input.value = '';
}
}
private onFlagsChanged(flagArray: string): void {
@@ -91,7 +93,9 @@ export class EditSongComponent implements OnInit {
}
public askForSave(nextState?: RouterStateSnapshot): boolean {
if (!this.form.dirty) return true;
if (!this.form.dirty) {
return true;
}
const dialogRef = this.dialog.open(SaveDialogComponent, {
width: '350px'

View File

@@ -21,7 +21,7 @@ export class FileComponent implements OnInit {
this.url$ = ref.getDownloadURL();
this.name = file.name;
};
}
ngOnInit(): void {
}

View File

@@ -23,12 +23,12 @@ export class NewComponent implements OnInit {
this.form = new FormGroup({
number: new FormControl(null, Validators.required),
title: new FormControl(null, Validators.required),
})
});
this.songService.list$().pipe(autoComplete(this)).subscribe(songs => {
const freeSongnumber = this.getFreeSongNumber(songs);
this.form.controls.number.setValue(freeSongnumber);
})
});
}
public async onSave(): Promise<void> {
@@ -41,7 +41,9 @@ export class NewComponent implements OnInit {
private getFreeSongNumber(songs: Song[]): Number {
const numbers = songs.map(_ => _.number);
for (let i = 1; i < Number.MAX_SAFE_INTEGER; i++) {
if (!numbers.some(_ => _ === i)) return i;
if (!numbers.some(_ => _ === i)) {
return i;
}
}
}
}

View File

@@ -46,9 +46,11 @@ export class SongComponent implements OnInit {
}
public getFlags = (flags: string): string[] => {
if (!flags) return [];
if (!flags) {
return [];
}
return flags.split(';').filter(_ => !!_);
};
}
public async onDelete(songId: string): Promise<void> {
await this.songService.delete(songId);