bugfixing
This commit is contained in:
@@ -35,14 +35,14 @@ export class AddSongComponent {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
});
|
||||
|
||||
const filterValue = this.filteredSongsControl.value;
|
||||
return filterValue ? songs.filter(_ => filterSong(_, filterValue)) : songs;
|
||||
}
|
||||
|
||||
public async onAddSongSelectionChanged(event: MatSelectChange) {
|
||||
let order = this.showSongs.reduce((oa, u) => Math.max(oa, u.order), 0) + 1;
|
||||
const order = this.showSongs.reduce((oa, u) => Math.max(oa, u.order), 0) + 1;
|
||||
await this.showSongService.new$(this.showId, event.value, order, this.addedLive);
|
||||
event.source.value = null;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,10 @@ export class FilterComponent {
|
||||
|
||||
constructor(private router: Router, activatedRoute: ActivatedRoute) {
|
||||
activatedRoute.queryParams.subscribe(_ => {
|
||||
if (_.q) this.value = _.q;
|
||||
})
|
||||
if (_.q) {
|
||||
this.value = _.q;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async valueChange(text: string): Promise<void> {
|
||||
|
||||
@@ -17,4 +17,4 @@ export const songSwitch = // the fade-in/fade-out animation.
|
||||
transition(':leave',
|
||||
animate(1200, style({opacity: 0}))
|
||||
)
|
||||
])
|
||||
]);
|
||||
|
||||
@@ -8,7 +8,7 @@ import {LineType} from '../../../modules/songs/services/line-type';
|
||||
import {Section} from '../../../modules/songs/services/section';
|
||||
import {Line} from '../../../modules/songs/services/line';
|
||||
|
||||
export type ChordMode = 'show' | 'hide' | 'onlyFirst'
|
||||
export type ChordMode = 'show' | 'hide' | 'onlyFirst';
|
||||
|
||||
@Component({
|
||||
selector: 'app-song-text',
|
||||
@@ -41,10 +41,12 @@ export class SongTextComponent implements OnInit {
|
||||
public set text(value: string) {
|
||||
this.sections = null;
|
||||
this.offset = 0;
|
||||
if (this.fullscreen)
|
||||
if (this.fullscreen) {
|
||||
setTimeout(() =>
|
||||
this.sections = this.textRenderingService.parse(value, this.transpose).sort((a, b) => a.type - b.type), 100);
|
||||
else this.sections = this.textRenderingService.parse(value, this.transpose).sort((a, b) => a.type - b.type)
|
||||
} else {
|
||||
this.sections = this.textRenderingService.parse(value, this.transpose).sort((a, b) => a.type - b.type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +63,9 @@ export class SongTextComponent implements OnInit {
|
||||
|
||||
public getLines(section: Section): Line[] {
|
||||
return section.lines.filter(_ => {
|
||||
if (_.type !== LineType.chord) return true;
|
||||
if (_.type !== LineType.chord) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (this._chordMode) {
|
||||
case 'show':
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {Directive, ElementRef, Input} from "@angular/core";
|
||||
import {Directive, ElementRef, Input} from '@angular/core';
|
||||
|
||||
@Directive({
|
||||
selector: "[autofocus]"
|
||||
selector: '[autofocus]'
|
||||
})
|
||||
export class AutofocusDirective {
|
||||
private focus = true;
|
||||
|
||||
@@ -15,21 +15,27 @@ export class RoleGuard implements CanActivate {
|
||||
next: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Observable<boolean | UrlTree> {
|
||||
const requiredRoles = next.data.requiredRoles;
|
||||
if (!requiredRoles) throw new Error('requiredRoles is not defined!');
|
||||
if (!requiredRoles) {
|
||||
throw new Error('requiredRoles is not defined!');
|
||||
}
|
||||
|
||||
return this.userService.user$.pipe(
|
||||
map(user => {
|
||||
const roles = user.role?.split(';') ?? [];
|
||||
if (roles.indexOf('admin') !== -1) return true;
|
||||
if (roles.indexOf('admin') !== -1) {
|
||||
return true;
|
||||
}
|
||||
const allowed = roles.some(s => requiredRoles.indexOf(s) !== -1);
|
||||
|
||||
return allowed || this.router.createUrlTree(this.defaultRoute(roles));
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private defaultRoute(roles: string[]): string[] {
|
||||
if (!roles || roles.length === 0) return ['brand', 'new-user'];
|
||||
if (!roles || roles.length === 0) {
|
||||
return ['brand', 'new-user'];
|
||||
}
|
||||
switch (roles[0]) {
|
||||
case 'user':
|
||||
return ['songs'];
|
||||
|
||||
Reference in New Issue
Block a user