update angular
This commit is contained in:
@@ -8,7 +8,8 @@ import {DbService} from '../../../services/db.service';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class FileDataService {
|
||||
public constructor(private db: DbService) {}
|
||||
public constructor(private db: DbService) {
|
||||
}
|
||||
|
||||
public async set(songId: string, file: FileServer): Promise<string> {
|
||||
const songRef = this.db.doc('songs/' + songId);
|
||||
|
||||
@@ -7,7 +7,8 @@ import {FileDataService} from './file-data.service';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class FileService {
|
||||
public constructor(private storage: AngularFireStorage, private fileDataService: FileDataService) {}
|
||||
public constructor(private storage: AngularFireStorage, private fileDataService: FileDataService) {
|
||||
}
|
||||
|
||||
public getDownloadUrl(path: string): Observable<string> {
|
||||
const ref = this.storage.ref(path);
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('SongDataService', () => {
|
||||
() =>
|
||||
void TestBed.configureTestingModule({
|
||||
providers: [{provide: AngularFirestore, useValue: mockAngularFirestore}],
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
it('should be created', () => {
|
||||
@@ -34,6 +34,6 @@ describe('SongDataService', () => {
|
||||
service.list$().subscribe(s => {
|
||||
void expect(s[0].title).toEqual('title1');
|
||||
});
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -8,14 +8,14 @@ import {map} from 'rxjs/operators';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SongDataService {
|
||||
public list$ = new BehaviorSubject<Song[]>([]);
|
||||
private collection = 'songs';
|
||||
|
||||
public constructor(private dbService: DbService) {
|
||||
this.dbService.col$<Song>(this.collection).subscribe(_ => this.list$.next(_));
|
||||
}
|
||||
|
||||
public list$ = new BehaviorSubject<Song[]>([]);
|
||||
// public list$ = (): Observable<Song[]> => this.dbService.col$(this.collection);
|
||||
|
||||
//public read$ = (songId: string): Observable<Song | null> => this.dbService.doc$(this.collection + '/' + songId);
|
||||
public read$ = (songId: string): Observable<Song | null> => this.list$.pipe(map(_ => _.find(s => s.id === songId) || null));
|
||||
public update$ = async (songId: string, data: Partial<Song>): Promise<void> => await this.dbService.doc(this.collection + '/' + songId).update(data);
|
||||
|
||||
@@ -9,7 +9,8 @@ import {filter} from 'rxjs/operators';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SongListResolver {
|
||||
public constructor(private songService: SongService) {}
|
||||
public constructor(private songService: SongService) {
|
||||
}
|
||||
|
||||
public resolve(): Observable<Song[]> {
|
||||
return this.songService.list$().pipe(filter(_ => _.length > 0));
|
||||
|
||||
@@ -15,7 +15,7 @@ describe('SongService', () => {
|
||||
() =>
|
||||
void TestBed.configureTestingModule({
|
||||
providers: [{provide: SongDataService, useValue: mockSongDataService}],
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
it('should be created', () => {
|
||||
@@ -30,6 +30,6 @@ describe('SongService', () => {
|
||||
service.list$().subscribe(s => {
|
||||
void expect(s[0].title).toEqual('title1');
|
||||
});
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ export class SongService {
|
||||
|
||||
public constructor(
|
||||
private songDataService: SongDataService,
|
||||
private userService: UserService
|
||||
private userService: UserService,
|
||||
) {
|
||||
// importCCLI = (songs: Song[]) => this.updateFromCLI(songs);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ import {Line} from './line';
|
||||
export class TextRenderingService {
|
||||
private regexSection = /(Strophe|Refrain|Bridge)/;
|
||||
|
||||
public constructor(private transposeService: TransposeService) {}
|
||||
public constructor(private transposeService: TransposeService) {
|
||||
}
|
||||
|
||||
public parse(text: string, transpose: TransposeMode | null): Section[] {
|
||||
if (!text) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div [formGroup]="filterFormGroup">
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Titel oder Text</mat-label>
|
||||
<input formControlName="q" matInput/>
|
||||
<input formControlName="q" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<div class="third">
|
||||
@@ -10,8 +10,9 @@
|
||||
<mat-select formControlName="type">
|
||||
<mat-option [value]="null">- kein Filter -</mat-option>
|
||||
<mat-option *ngFor="let type of types" [value]="type">{{
|
||||
type | songType
|
||||
}}</mat-option>
|
||||
type | songType
|
||||
}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -20,8 +21,9 @@
|
||||
<mat-select formControlName="key">
|
||||
<mat-option [value]="null">- kein Filter -</mat-option>
|
||||
<mat-option *ngFor="let key of keys" [value]="key">{{
|
||||
key | key
|
||||
}}</mat-option>
|
||||
key | key
|
||||
}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -30,8 +32,9 @@
|
||||
<mat-select formControlName="legalType">
|
||||
<mat-option [value]="null">- kein Filter -</mat-option>
|
||||
<mat-option *ngFor="let key of legalType" [value]="key">{{
|
||||
key | legalType
|
||||
}}</mat-option>
|
||||
key | legalType
|
||||
}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -40,8 +43,9 @@
|
||||
<mat-select formControlName="flag">
|
||||
<mat-option [value]="null">- kein Filter -</mat-option>
|
||||
<mat-option *ngFor="let flag of getFlags()" [value]="flag">{{
|
||||
flag
|
||||
}}</mat-option>
|
||||
flag
|
||||
}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('FilterComponent', () => {
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [FilterComponent],
|
||||
}).compileComponents();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -10,6 +10,7 @@ import {KEYS} from '../../services/key.helper';
|
||||
selector: 'app-filter',
|
||||
templateUrl: './filter.component.html',
|
||||
styleUrls: ['./filter.component.less'],
|
||||
standalone: false,
|
||||
})
|
||||
export class FilterComponent {
|
||||
public filterFormGroup: UntypedFormGroup;
|
||||
|
||||
@@ -9,11 +9,19 @@
|
||||
<div>{{ song.title }}</div>
|
||||
<div>
|
||||
<ng-container *appRole="['contributor']">
|
||||
<div *ngIf="song.status === 'draft'" class="warning"><fa-icon [icon]="faDraft"></fa-icon></div>
|
||||
<div *ngIf="song.status === 'set'" class="neutral"><fa-icon [icon]="faDraft"></fa-icon></div>
|
||||
<div *ngIf="song.status === 'final'" class="success"><fa-icon [icon]="faFinal"></fa-icon></div>
|
||||
<div *ngIf="song.status === 'draft'" class="warning">
|
||||
<fa-icon [icon]="faDraft"></fa-icon>
|
||||
</div>
|
||||
<div *ngIf="song.status === 'set'" class="neutral">
|
||||
<fa-icon [icon]="faDraft"></fa-icon>
|
||||
</div>
|
||||
<div *ngIf="song.status === 'final'" class="success">
|
||||
<fa-icon [icon]="faFinal"></fa-icon>
|
||||
</div>
|
||||
</ng-container>
|
||||
<div *ngIf="song.legalType === 'open'" class="warning" ><fa-icon [icon]="faLegal"></fa-icon></div>
|
||||
<div *ngIf="song.legalType === 'open'" class="warning">
|
||||
<fa-icon [icon]="faLegal"></fa-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div>{{ song.key }}</div>
|
||||
</div>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
}
|
||||
|
||||
.neutral, .warning, .success {
|
||||
width: 30px;
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.neutral {
|
||||
|
||||
@@ -22,7 +22,7 @@ describe('SongListComponent', () => {
|
||||
providers: [{provide: SongService, useValue: mockSongService}],
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -16,13 +16,15 @@ import {faBalanceScaleRight, faCheck, faPencilRuler} from '@fortawesome/free-sol
|
||||
styleUrls: ['./song-list.component.less'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
animations: [fade],
|
||||
standalone: false,
|
||||
})
|
||||
export class SongListComponent implements OnInit, OnDestroy {
|
||||
public anyFilterActive = false;
|
||||
public songs$: Observable<Song[]> | null = combineLatest([
|
||||
this.activatedRoute.queryParams.pipe(map(_ => _ as FilterValues)),
|
||||
this.activatedRoute.data.pipe(
|
||||
map(data => data.songList as Song[]),
|
||||
map(songs => songs.sort((a, b) => a.number - b.number))
|
||||
map(songs => songs.sort((a, b) => a.number - b.number)),
|
||||
),
|
||||
]).pipe(
|
||||
map(_ => {
|
||||
@@ -30,14 +32,14 @@ export class SongListComponent implements OnInit, OnDestroy {
|
||||
const filter = _[0];
|
||||
this.anyFilterActive = this.checkIfFilterActive(filter);
|
||||
return songs.filter(song => this.filter(song, filter)).sort((a, b) => a.title?.localeCompare(b.title));
|
||||
})
|
||||
}),
|
||||
);
|
||||
public anyFilterActive = false;
|
||||
public faLegal = faBalanceScaleRight;
|
||||
public faDraft = faPencilRuler;
|
||||
public faFinal = faCheck;
|
||||
|
||||
public constructor(private songService: SongService, private activatedRoute: ActivatedRoute, private scrollService: ScrollService) {}
|
||||
public constructor(private songService: SongService, private activatedRoute: ActivatedRoute, private scrollService: ScrollService) {
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
setTimeout(() => this.scrollService.restoreScrollPositionFor('songlist'), 100);
|
||||
@@ -48,6 +50,8 @@ export class SongListComponent implements OnInit, OnDestroy {
|
||||
this.scrollService.storeScrollPositionFor('songlist');
|
||||
}
|
||||
|
||||
public trackBy = (index: number, show: Song) => show.id;
|
||||
|
||||
private filter(song: Song, filter: FilterValues): boolean {
|
||||
let baseFilter = filterSong(song, filter.q);
|
||||
baseFilter = baseFilter && (!filter.type || filter.type === song.type);
|
||||
@@ -74,6 +78,4 @@ export class SongListComponent implements OnInit, OnDestroy {
|
||||
|
||||
return flagStrings.indexOf(flag) !== -1;
|
||||
}
|
||||
|
||||
public trackBy = (index: number, show: Song) => show.id;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ import {CommonModule} from '@angular/common';
|
||||
import {SongListComponent} from './song-list.component';
|
||||
import {CardModule} from '../../../widget-modules/components/card/card.module';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {LegalTypeTranslatorModule} from '../../../widget-modules/pipes/legal-type-translator/legal-type-translator.module';
|
||||
import {
|
||||
LegalTypeTranslatorModule,
|
||||
} from '../../../widget-modules/pipes/legal-type-translator/legal-type-translator.module';
|
||||
import {ListHeaderModule} from '../../../widget-modules/components/list-header/list-header.module';
|
||||
import {MatFormFieldModule} from '@angular/material/form-field';
|
||||
import {MatInputModule} from '@angular/material/input';
|
||||
@@ -37,4 +39,5 @@ import {KeyTranslatorModule} from '../../../widget-modules/pipes/key-translator/
|
||||
KeyTranslatorModule,
|
||||
],
|
||||
})
|
||||
export class SongListModule {}
|
||||
export class SongListModule {
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
<div class="upload">
|
||||
<label>
|
||||
<input (change)="detectFiles($event)" type="file"/>
|
||||
<input (change)="detectFiles($event)" type="file" />
|
||||
</label>
|
||||
|
||||
<button
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('EditFileComponent', () => {
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [EditFileComponent],
|
||||
}).compileComponents();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,6 +11,7 @@ import {File} from '../../../services/file';
|
||||
selector: 'app-edit-file',
|
||||
templateUrl: './edit-file.component.html',
|
||||
styleUrls: ['./edit-file.component.less'],
|
||||
standalone: false,
|
||||
})
|
||||
export class EditFileComponent {
|
||||
public selectedFiles: FileList | null = null;
|
||||
@@ -22,7 +23,7 @@ export class EditFileComponent {
|
||||
this.activatedRoute.params
|
||||
.pipe(
|
||||
map(param => param as {songId: string}),
|
||||
map(param => param.songId)
|
||||
map(param => param.songId),
|
||||
)
|
||||
.subscribe(songId => {
|
||||
this.songId = songId;
|
||||
@@ -31,7 +32,7 @@ export class EditFileComponent {
|
||||
this.files$ = this.activatedRoute.params.pipe(
|
||||
map(param => param as {songId: string}),
|
||||
map(param => param.songId),
|
||||
switchMap(songId => this.fileService.read$(songId))
|
||||
switchMap(songId => this.fileService.read$(songId)),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('FileComponent', () => {
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [FileComponent],
|
||||
}).compileComponents();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -8,6 +8,7 @@ import {FileService} from '../../../../services/file.service';
|
||||
selector: 'app-file',
|
||||
templateUrl: './file.component.html',
|
||||
styleUrls: ['./file.component.less'],
|
||||
standalone: false,
|
||||
})
|
||||
export class FileComponent {
|
||||
public url$: Observable<string> | null = null;
|
||||
@@ -17,7 +18,8 @@ export class FileComponent {
|
||||
private fileId: string | null = null;
|
||||
private path: string | null = null;
|
||||
|
||||
public constructor(private fileService: FileService) {}
|
||||
public constructor(private fileService: FileService) {
|
||||
}
|
||||
|
||||
@Input()
|
||||
public set file(file: File) {
|
||||
|
||||
@@ -11,7 +11,7 @@ export class EditSongGuard {
|
||||
component: EditComponent,
|
||||
currentRoute: ActivatedRouteSnapshot,
|
||||
currentState: RouterStateSnapshot,
|
||||
nextState: RouterStateSnapshot
|
||||
nextState: RouterStateSnapshot,
|
||||
): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
return component.editSongComponent ? component.editSongComponent.askForSave(nextState) : true;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<form [formGroup]="form" class="form">
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Titel</mat-label>
|
||||
<input formControlName="title" matInput/>
|
||||
<input formControlName="title" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<div class="fourth">
|
||||
@@ -10,28 +10,31 @@
|
||||
<mat-label>Typ</mat-label>
|
||||
<mat-select formControlName="type">
|
||||
<mat-option *ngFor="let type of types" [value]="type">{{
|
||||
type | songType
|
||||
}}</mat-option>
|
||||
type | songType
|
||||
}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Tonart</mat-label>
|
||||
<mat-select formControlName="key">
|
||||
<mat-option *ngFor="let key of keys" [value]="key">{{
|
||||
key | key
|
||||
}}</mat-option>
|
||||
key | key
|
||||
}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Tempo</mat-label>
|
||||
<input formControlName="tempo" matInput/>
|
||||
<input formControlName="tempo" matInput />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Status</mat-label>
|
||||
<mat-select formControlName="status">
|
||||
<mat-option *ngFor="let status of status" [value]="status">{{
|
||||
status | status
|
||||
}}</mat-option>
|
||||
status | status
|
||||
}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
@@ -119,8 +122,9 @@
|
||||
<mat-label>Rechtlicher Status</mat-label>
|
||||
<mat-select formControlName="legalType">
|
||||
<mat-option *ngFor="let key of legalType" [value]="key">{{
|
||||
key | legalType
|
||||
}}</mat-option>
|
||||
key | legalType
|
||||
}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -128,14 +132,15 @@
|
||||
<mat-label>Rechteinhaber</mat-label>
|
||||
<mat-select formControlName="legalOwner">
|
||||
<mat-option *ngFor="let key of legalOwner" [value]="key">{{
|
||||
key | legalOwner
|
||||
}}</mat-option>
|
||||
key | legalOwner
|
||||
}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Rechteinhaber ID (z.B. CCLI Liednummer)</mat-label>
|
||||
<input formControlName="legalOwnerId" matInput/>
|
||||
<input formControlName="legalOwnerId" matInput />
|
||||
<a
|
||||
*ngIf="form.value.legalOwner === 'CCLI'"
|
||||
class="link-ccli"
|
||||
@@ -153,22 +158,22 @@
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Künstler</mat-label>
|
||||
<input formControlName="artist" matInput/>
|
||||
<input formControlName="artist" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Verlag / Copyright</mat-label>
|
||||
<input formControlName="label" matInput/>
|
||||
<input formControlName="label" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Nutzungsbedingungen</mat-label>
|
||||
<input formControlName="termsOfUse" matInput/>
|
||||
<input formControlName="termsOfUse" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>abweichende Quelle</mat-label>
|
||||
<input formControlName="origin" matInput/>
|
||||
<input formControlName="origin" matInput />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('EditSongComponent', () => {
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [EditSongComponent],
|
||||
}).compileComponents();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -16,6 +16,7 @@ import {SaveDialogComponent} from './save-dialog/save-dialog.component';
|
||||
selector: 'app-edit-song',
|
||||
templateUrl: './edit-song.component.html',
|
||||
styleUrls: ['./edit-song.component.less'],
|
||||
standalone: false,
|
||||
})
|
||||
export class EditSongComponent implements OnInit {
|
||||
public song: Song | null = null;
|
||||
@@ -37,8 +38,9 @@ export class EditSongComponent implements OnInit {
|
||||
private songService: SongService,
|
||||
private editService: EditService,
|
||||
private router: Router,
|
||||
public dialog: MatDialog
|
||||
) {}
|
||||
public dialog: MatDialog,
|
||||
) {
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.activatedRoute.params
|
||||
@@ -46,7 +48,7 @@ export class EditSongComponent implements OnInit {
|
||||
map(param => param as {songId: string}),
|
||||
map(param => param.songId),
|
||||
switchMap(songId => this.songService.read$(songId)),
|
||||
first()
|
||||
first(),
|
||||
)
|
||||
.subscribe(song => {
|
||||
this.song = song;
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('SaveDialogComponent', () => {
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [SaveDialogComponent],
|
||||
}).compileComponents();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -4,5 +4,7 @@ import {Component} from '@angular/core';
|
||||
selector: 'app-save-dialog',
|
||||
templateUrl: './save-dialog.component.html',
|
||||
styleUrls: ['./save-dialog.component.less'],
|
||||
standalone: false,
|
||||
})
|
||||
export class SaveDialogComponent {}
|
||||
export class SaveDialogComponent {
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('EditComponent', () => {
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [EditComponent],
|
||||
}).compileComponents();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -5,6 +5,7 @@ import {EditSongComponent} from './edit-song/edit-song.component';
|
||||
selector: 'app-edit',
|
||||
templateUrl: './edit.component.html',
|
||||
styleUrls: ['./edit.component.less'],
|
||||
standalone: false,
|
||||
})
|
||||
export class EditComponent {
|
||||
@ViewChild(EditSongComponent) public editSongComponent: EditSongComponent | null = null;
|
||||
|
||||
@@ -2,7 +2,9 @@ import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {EditComponent} from './edit.component';
|
||||
import {CardModule} from '../../../../widget-modules/components/card/card.module';
|
||||
import {SongTypeTranslaterModule} from '../../../../widget-modules/pipes/song-type-translater/song-type-translater.module';
|
||||
import {
|
||||
SongTypeTranslaterModule,
|
||||
} from '../../../../widget-modules/pipes/song-type-translater/song-type-translater.module';
|
||||
import {ReactiveFormsModule} from '@angular/forms';
|
||||
import {MatInputModule} from '@angular/material/input';
|
||||
import {MatCheckboxModule} from '@angular/material/checkbox';
|
||||
@@ -14,8 +16,12 @@ import {EditSongComponent} from './edit-song/edit-song.component';
|
||||
import {EditFileComponent} from './edit-file/edit-file.component';
|
||||
import {MatIconModule} from '@angular/material/icon';
|
||||
import {FileComponent} from './edit-file/file/file.component';
|
||||
import {LegalOwnerTranslatorModule} from '../../../../widget-modules/pipes/legal-owner-translator/legal-owner-translator.module';
|
||||
import {LegalTypeTranslatorModule} from '../../../../widget-modules/pipes/legal-type-translator/legal-type-translator.module';
|
||||
import {
|
||||
LegalOwnerTranslatorModule,
|
||||
} from '../../../../widget-modules/pipes/legal-owner-translator/legal-owner-translator.module';
|
||||
import {
|
||||
LegalTypeTranslatorModule,
|
||||
} from '../../../../widget-modules/pipes/legal-type-translator/legal-type-translator.module';
|
||||
import {KeyTranslatorModule} from '../../../../widget-modules/pipes/key-translator/key-translator.module';
|
||||
import {MatChipsModule} from '@angular/material/chips';
|
||||
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
|
||||
@@ -57,4 +63,5 @@ import {SongTextModule} from '../../../../widget-modules/components/song-text/so
|
||||
SongTextModule,
|
||||
],
|
||||
})
|
||||
export class EditModule {}
|
||||
export class EditModule {
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('HistoryComponent', () => {
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [HistoryComponent],
|
||||
}).compileComponents();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -8,11 +8,13 @@ import {Song} from '../../../services/song';
|
||||
selector: 'app-history',
|
||||
templateUrl: './history.component.html',
|
||||
styleUrls: ['./history.component.less'],
|
||||
standalone: false,
|
||||
})
|
||||
export class HistoryComponent implements OnInit {
|
||||
public song: Song | null = null;
|
||||
|
||||
public constructor(private activatedRoute: ActivatedRoute, private songService: SongService) {}
|
||||
public constructor(private activatedRoute: ActivatedRoute, private songService: SongService) {
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.activatedRoute.params
|
||||
@@ -20,7 +22,7 @@ export class HistoryComponent implements OnInit {
|
||||
map(param => param as {songId: string}),
|
||||
map(param => param.songId),
|
||||
switchMap(songId => this.songService.read$(songId)),
|
||||
first()
|
||||
first(),
|
||||
)
|
||||
.subscribe(song => {
|
||||
this.song = song;
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('FileComponent', () => {
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [FileComponent],
|
||||
}).compileComponents();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -7,12 +7,14 @@ import {Observable} from 'rxjs';
|
||||
selector: 'app-file',
|
||||
templateUrl: './file.component.html',
|
||||
styleUrls: ['./file.component.less'],
|
||||
standalone: false,
|
||||
})
|
||||
export class FileComponent {
|
||||
public url$: Observable<string> | null = null;
|
||||
public name = '';
|
||||
|
||||
public constructor(private storage: AngularFireStorage) {}
|
||||
public constructor(private storage: AngularFireStorage) {
|
||||
}
|
||||
|
||||
@Input()
|
||||
public set file(file: File) {
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
<div [formGroup]="form" class="split">
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Nummer</mat-label>
|
||||
<input formControlName="number" matInput/>
|
||||
<input formControlName="number" matInput />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Titel</mat-label>
|
||||
<input autofocus formControlName="title" matInput/>
|
||||
<input autofocus formControlName="title" matInput />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('NewComponent', () => {
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [NewComponent],
|
||||
}).compileComponents();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -10,6 +10,7 @@ import {Subscription} from 'rxjs';
|
||||
selector: 'app-new',
|
||||
templateUrl: './new.component.html',
|
||||
styleUrls: ['./new.component.less'],
|
||||
standalone: false,
|
||||
})
|
||||
export class NewComponent implements OnInit, OnDestroy {
|
||||
public faSave = faSave;
|
||||
@@ -17,8 +18,10 @@ export class NewComponent implements OnInit, OnDestroy {
|
||||
number: new UntypedFormControl(null, Validators.required),
|
||||
title: new UntypedFormControl(null, Validators.required),
|
||||
});
|
||||
private subs: Subscription[] = [];
|
||||
|
||||
public constructor(private songService: SongService, private router: Router) {}
|
||||
public constructor(private songService: SongService, private router: Router) {
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.form.reset();
|
||||
@@ -27,11 +30,10 @@ export class NewComponent implements OnInit, OnDestroy {
|
||||
this.songService.list$().subscribe(songs => {
|
||||
const freeSongnumber = this.getFreeSongNumber(songs);
|
||||
this.form.controls.number.setValue(freeSongnumber);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
private subs: Subscription[] = [];
|
||||
public ngOnDestroy(): void {
|
||||
this.subs.forEach(_ => _.unsubscribe());
|
||||
}
|
||||
|
||||
@@ -13,4 +13,5 @@ import {AutofocusModule} from '../../../../widget-modules/directives/autofocus/a
|
||||
declarations: [NewComponent],
|
||||
imports: [CommonModule, CardModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, ButtonRowModule, ButtonModule, AutofocusModule],
|
||||
})
|
||||
export class NewModule {}
|
||||
export class NewModule {
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
aria-label="Attribute"
|
||||
>
|
||||
<mat-chip-option *ngFor="let flag of getFlags(song.flags)">{{
|
||||
flag
|
||||
flag
|
||||
}}
|
||||
</mat-chip-option>
|
||||
</mat-chip-listbox>
|
||||
|
||||
@@ -18,7 +18,7 @@ describe('SongComponent', () => {
|
||||
declarations: [SongComponent],
|
||||
providers: [{provide: ActivatedRoute, useValue: mockActivatedRoute}],
|
||||
}).compileComponents();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,6 +17,7 @@ import {ShowSongService} from '../../shows/services/show-song.service';
|
||||
selector: 'app-song',
|
||||
templateUrl: './song.component.html',
|
||||
styleUrls: ['./song.component.less'],
|
||||
standalone: false,
|
||||
})
|
||||
export class SongComponent implements OnInit {
|
||||
public song$: Observable<Song | null> | null = null;
|
||||
@@ -34,7 +35,7 @@ export class SongComponent implements OnInit {
|
||||
private userService: UserService,
|
||||
private router: Router,
|
||||
private showService: ShowService,
|
||||
private showSongService: ShowSongService
|
||||
private showSongService: ShowSongService,
|
||||
) {
|
||||
this.user$ = userService.user$;
|
||||
}
|
||||
@@ -43,13 +44,13 @@ export class SongComponent implements OnInit {
|
||||
this.song$ = this.activatedRoute.params.pipe(
|
||||
map(param => param as {songId: string}),
|
||||
map(param => param.songId),
|
||||
switchMap(songId => this.songService.read$(songId))
|
||||
switchMap(songId => this.songService.read$(songId)),
|
||||
);
|
||||
|
||||
this.files$ = this.activatedRoute.params.pipe(
|
||||
map(param => param as {songId: string}),
|
||||
map(param => param.songId),
|
||||
switchMap(songId => this.fileService.read$(songId))
|
||||
switchMap(songId => this.fileService.read$(songId)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -77,6 +78,6 @@ export class SongComponent implements OnInit {
|
||||
map(([user, song]) => {
|
||||
return user.songUsage[song.id];
|
||||
}),
|
||||
distinctUntilChanged()
|
||||
distinctUntilChanged(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import {SongTypeTranslaterModule} from '../../../widget-modules/pipes/song-type-
|
||||
import {MatButtonModule} from '@angular/material/button';
|
||||
import {ButtonRowModule} from '../../../widget-modules/components/button-row/button-row.module';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {LegalOwnerTranslatorModule} from '../../../widget-modules/pipes/legal-owner-translator/legal-owner-translator.module';
|
||||
import {
|
||||
LegalOwnerTranslatorModule,
|
||||
} from '../../../widget-modules/pipes/legal-owner-translator/legal-owner-translator.module';
|
||||
import {SongTextModule} from '../../../widget-modules/components/song-text/song-text.module';
|
||||
import {MatChipsModule} from '@angular/material/chips';
|
||||
import {RoleModule} from '../../../services/user/role.module';
|
||||
@@ -37,4 +39,5 @@ import {ShowTypeTranslaterModule} from '../../../widget-modules/pipes/show-type-
|
||||
ShowTypeTranslaterModule,
|
||||
],
|
||||
})
|
||||
export class SongModule {}
|
||||
export class SongModule {
|
||||
}
|
||||
|
||||
@@ -33,4 +33,5 @@ const routes: Routes = [
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class SongsRoutingModule {}
|
||||
export class SongsRoutingModule {
|
||||
}
|
||||
|
||||
@@ -11,4 +11,5 @@ import {NewModule} from './song/new/new.module';
|
||||
declarations: [],
|
||||
imports: [CommonModule, SongsRoutingModule, SongListModule, SongModule, EditModule, NewModule],
|
||||
})
|
||||
export class SongsModule {}
|
||||
export class SongsModule {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user