Compare commits
7 Commits
d907c89eb6
...
e3203d0c38
| Author | SHA1 | Date | |
|---|---|---|---|
| e3203d0c38 | |||
| 2406d41dcb | |||
| 2d4f1ee314 | |||
| 67884e4638 | |||
| e4f829d0c8 | |||
| 9bbabb18aa | |||
| ab535d48b9 |
15
README.md
15
README.md
@@ -8,6 +8,14 @@ If `songUsage` needs to be rebuilt from all existing shows, log in with a user t
|
|||||||
await window.wgeneratorAdmin.rebuildSongUsage()
|
await window.wgeneratorAdmin.rebuildSongUsage()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If the `songIds` index on shows needs to be backfilled for tooltip usage in song details, run:
|
||||||
|
|
||||||
|
```js
|
||||||
|
await window.wgeneratorAdmin.rebuildShowSongIds()
|
||||||
|
```
|
||||||
|
|
||||||
|
The command logs progress in the browser console while it runs and prints the final summary when finished.
|
||||||
|
|
||||||
The migration:
|
The migration:
|
||||||
|
|
||||||
- resets `songUsage` for all users
|
- resets `songUsage` for all users
|
||||||
@@ -16,4 +24,11 @@ The migration:
|
|||||||
|
|
||||||
It returns a summary object with processed user, show and show-song counts.
|
It returns a summary object with processed user, show and show-song counts.
|
||||||
|
|
||||||
|
The show index migration:
|
||||||
|
|
||||||
|
- scans all shows and all `shows/{id}/songs` entries
|
||||||
|
- writes the distinct `songIds` array to each show document
|
||||||
|
|
||||||
|
It returns a summary object with processed show and show-song counts.
|
||||||
|
|
||||||
This is intended as a manual one-off migration and is read-heavy by design.
|
This is intended as a manual one-off migration and is read-heavy by design.
|
||||||
|
|||||||
@@ -3,4 +3,3 @@
|
|||||||
<div [@fader]="o.isActivated ? o.activatedRoute : ''" class="content">
|
<div [@fader]="o.isActivated ? o.activatedRoute : ''" class="content">
|
||||||
<router-outlet #o="outlet"></router-outlet>
|
<router-outlet #o="outlet"></router-outlet>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
<div class="frame">
|
<div class="frame">
|
||||||
<app-brand class="brand"></app-brand>
|
<app-brand class="brand"></app-brand>
|
||||||
@if (user$ | async; as user) {
|
@if (user$ | async; as user) {
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<div class="welcome">WILLKOMMEN</div>
|
<div class="welcome">WILLKOMMEN</div>
|
||||||
<div class="name">{{ user.name }}</div>
|
<div class="name">{{ user.name }}</div>
|
||||||
<div class="roles">
|
<div class="roles">Es wurden noch keine Berechtigungen zugeteilt, bitte wende Dich an den Administrator!</div>
|
||||||
Es wurden noch keine Berechtigungen zugeteilt, bitte wende Dich an den
|
</div>
|
||||||
Administrator!
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,28 +1,23 @@
|
|||||||
@if (show$|async; as show) {
|
@if (show$|async; as show) {
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div class="left">{{ show.showType|showType }}</div>
|
<div class="left">{{ show.showType|showType }}</div>
|
||||||
<div class="right">{{ show.date.toDate() | date: 'dd.MM.yyyy' }}</div>
|
<div class="right">{{ show.date.toDate() | date: 'dd.MM.yyyy' }}</div>
|
||||||
</div>
|
|
||||||
<div class="view">
|
|
||||||
<swiper-container scrollbar="true">
|
|
||||||
@for (song of show.songs; track trackBy(i, song); let i = $index) {
|
|
||||||
<swiper-slide
|
|
||||||
class="song-swipe">
|
|
||||||
<div class="song-title">{{ song.title }}</div>
|
|
||||||
<div class="legal">
|
|
||||||
@if (song.artist) {
|
|
||||||
<p>{{ song.artist }}</p>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<app-song-text
|
|
||||||
[text]="song.text"
|
|
||||||
></app-song-text>
|
|
||||||
</swiper-slide>
|
|
||||||
}
|
|
||||||
</swiper-container>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="view">
|
||||||
|
<swiper-container scrollbar="true">
|
||||||
|
@for (song of show.songs; track trackBy(i, song); let i = $index) {
|
||||||
|
<swiper-slide class="song-swipe">
|
||||||
|
<div class="song-title">{{ song.title }}</div>
|
||||||
|
<div class="legal">
|
||||||
|
@if (song.artist) {
|
||||||
|
<p>{{ song.artist }}</p>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<app-song-text [text]="song.text"></app-song-text>
|
||||||
|
</swiper-slide>
|
||||||
|
}
|
||||||
|
</swiper-container>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,17 @@
|
|||||||
@if (song) {
|
@if (song) { @if (song.artist) {
|
||||||
@if (song.artist) {
|
<p>{{ song.artist }}</p>
|
||||||
<p>{{ song.artist }}</p>
|
} @if (song.label) {
|
||||||
|
<p>{{ song.label }}</p>
|
||||||
|
} @if (song.termsOfUse) {
|
||||||
|
<p class="terms-of-use">{{ song.termsOfUse }}</p>
|
||||||
|
} @if (song.origin) {
|
||||||
|
<p>{{ song.origin }}</p>
|
||||||
|
} @if (song.legalOwnerId) {
|
||||||
|
<div>
|
||||||
|
@if (song.legalOwner === 'CCLI' && config) {
|
||||||
|
<p>CCLI-Liednummer {{ song.legalOwnerId }}, CCLI-Lizenznummer {{ config.ccliLicenseId }}</p>
|
||||||
|
} @if (song.legalOwner !== 'CCLI') {
|
||||||
|
<p>Liednummer {{ song.legalOwnerId }}</p>
|
||||||
}
|
}
|
||||||
@if (song.label) {
|
</div>
|
||||||
<p>{{ song.label }}</p>
|
} }
|
||||||
}
|
|
||||||
@if (song.termsOfUse) {
|
|
||||||
<p class="terms-of-use">{{ song.termsOfUse }}</p>
|
|
||||||
}
|
|
||||||
@if (song.origin) {
|
|
||||||
<p>{{ song.origin }}</p>
|
|
||||||
}
|
|
||||||
@if (song.legalOwnerId) {
|
|
||||||
<div>
|
|
||||||
@if (song.legalOwner === 'CCLI' && config) {
|
|
||||||
<p>
|
|
||||||
CCLI-Liednummer {{ song.legalOwnerId }}, CCLI-Lizenznummer
|
|
||||||
{{ config.ccliLicenseId }}
|
|
||||||
</p>
|
|
||||||
}
|
|
||||||
@if (song.legalOwner !== 'CCLI') {
|
|
||||||
<p>Liednummer {{ song.legalOwnerId }}</p>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -1,50 +1,43 @@
|
|||||||
<div class="fullscreen background"></div>
|
<div class="fullscreen background"></div>
|
||||||
@if (showType) {
|
@if (showType) {
|
||||||
<div [style.font-size.px]="zoom" class="fullscreen background">
|
<div [style.font-size.px]="zoom" class="fullscreen background">
|
||||||
<div [class.visible]="presentationBackground==='blue'" class="bg-blue fullscreen bg-image"></div>
|
<div [class.visible]="presentationBackground==='blue'" class="bg-blue fullscreen bg-image"></div>
|
||||||
<div [class.visible]="presentationBackground==='green'" class="bg-green fullscreen bg-image"></div>
|
<div [class.visible]="presentationBackground==='green'" class="bg-green fullscreen bg-image"></div>
|
||||||
<div [class.visible]="presentationBackground==='leder'" class="bg-leder fullscreen bg-image"></div>
|
<div [class.visible]="presentationBackground==='leder'" class="bg-leder fullscreen bg-image"></div>
|
||||||
<div [class.visible]="presentationBackground==='praise'" class="bg-praise fullscreen bg-image"></div>
|
<div [class.visible]="presentationBackground==='praise'" class="bg-praise fullscreen bg-image"></div>
|
||||||
<div [class.visible]="presentationBackground==='bible'" class="bg-bible fullscreen bg-image"></div>
|
<div [class.visible]="presentationBackground==='bible'" class="bg-bible fullscreen bg-image"></div>
|
||||||
<div
|
<div
|
||||||
[@songSwitch]="songId"
|
[@songSwitch]="songId"
|
||||||
[class.blur]="songId === 'title' || songId === 'dynamicText'"
|
[class.blur]="songId === 'title' || songId === 'dynamicText'"
|
||||||
[class.hide]="songId !== 'title' && songId !== 'empty' && songId !== 'dynamicText'"
|
[class.hide]="songId !== 'title' && songId !== 'empty' && songId !== 'dynamicText'"
|
||||||
[class.no-logo]="presentationBackground!=='none'"
|
[class.no-logo]="presentationBackground!=='none'"
|
||||||
class="start fullscreen logo"
|
class="start fullscreen logo"
|
||||||
>
|
>
|
||||||
<app-logo></app-logo>
|
<app-logo></app-logo>
|
||||||
</div>
|
|
||||||
@if (songId === 'title') {
|
|
||||||
<div @songSwitch class="start fullscreen">
|
|
||||||
<div>{{ showType | showType }}</div>
|
|
||||||
<div class="date">{{ date | date: "dd.MM.yyyy" }}</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@if (songId === 'dynamicText') {
|
|
||||||
<div @songSwitch class="start fullscreen dynamic-text">
|
|
||||||
<div>{{ presentationDynamicCaption }}</div>
|
|
||||||
<div class="date">{{ presentationDynamicText }}</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@if (song && songId !== 'title' && songId !== 'empty' && songId !== 'dynamicText') {
|
|
||||||
<app-song-text
|
|
||||||
[@songSwitch]="songId"
|
|
||||||
[fullscreen]="true"
|
|
||||||
[header]="song.title"
|
|
||||||
[index]="index??0"
|
|
||||||
[showComments]="false"
|
|
||||||
[showSwitch]="false"
|
|
||||||
[text]="song.text"
|
|
||||||
chordMode="hide"
|
|
||||||
></app-song-text>
|
|
||||||
}
|
|
||||||
@if (song && songId !== 'title' && songId !== 'empty' && songId !== 'dynamicText') {
|
|
||||||
<app-legal
|
|
||||||
[@songSwitch]="songId"
|
|
||||||
[config]="config$ | async"
|
|
||||||
[song]="song"
|
|
||||||
></app-legal>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
@if (songId === 'title') {
|
||||||
|
<div @songSwitch class="start fullscreen">
|
||||||
|
<div>{{ showType | showType }}</div>
|
||||||
|
<div class="date">{{ date | date: "dd.MM.yyyy" }}</div>
|
||||||
|
</div>
|
||||||
|
} @if (songId === 'dynamicText') {
|
||||||
|
<div @songSwitch class="start fullscreen dynamic-text">
|
||||||
|
<div>{{ presentationDynamicCaption }}</div>
|
||||||
|
<div class="date">{{ presentationDynamicText }}</div>
|
||||||
|
</div>
|
||||||
|
} @if (song && songId !== 'title' && songId !== 'empty' && songId !== 'dynamicText') {
|
||||||
|
<app-song-text
|
||||||
|
[@songSwitch]="songId"
|
||||||
|
[fullscreen]="true"
|
||||||
|
[header]="song.title"
|
||||||
|
[index]="index??0"
|
||||||
|
[showComments]="false"
|
||||||
|
[showSwitch]="false"
|
||||||
|
[text]="song.text"
|
||||||
|
chordMode="hide"
|
||||||
|
></app-song-text>
|
||||||
|
} @if (song && songId !== 'title' && songId !== 'empty' && songId !== 'dynamicText') {
|
||||||
|
<app-legal [@songSwitch]="songId" [config]="config$ | async" [song]="song"></app-legal>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,128 +1,83 @@
|
|||||||
@if (show) {
|
@if (show) {
|
||||||
<div @fade>
|
<div @fade>
|
||||||
<app-card [closeIcon]="faIcon" [heading]="show.showType | showType"
|
<app-card [closeIcon]="faIcon" [heading]="show.showType | showType" [subheading]="show.date.toDate() | date:'dd.MM.yyyy'" closeLink="/presentation/select">
|
||||||
[subheading]="show.date.toDate() | date:'dd.MM.yyyy'" closeLink="/presentation/select">
|
@if (!progress) {
|
||||||
@if (!progress) {
|
<div class="song">
|
||||||
<div class="song">
|
@if (show) {
|
||||||
@if (show) {
|
<div class="song-parts">
|
||||||
<div class="song-parts">
|
<div (click)="onSectionClick('title', -1, show.id)" [class.active]="show.presentationSongId === 'title'" class="song-part">
|
||||||
<div
|
<div class="head">Veranstaltung</div>
|
||||||
(click)="onSectionClick('title', -1, show.id)"
|
|
||||||
[class.active]="show.presentationSongId === 'title'"
|
|
||||||
class="song-part"
|
|
||||||
>
|
|
||||||
<div class="head">Veranstaltung</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
(click)="onSectionClick('empty', -1, show.id)"
|
|
||||||
[class.active]="show.presentationSongId === 'empty'"
|
|
||||||
class="song-part"
|
|
||||||
>
|
|
||||||
<div class="head">Leer</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
@for (song of presentationSongs; track trackBy($index, song)) {
|
<div (click)="onSectionClick('empty', -1, show.id)" [class.active]="show.presentationSongId === 'empty'" class="song-part">
|
||||||
<div class="song">
|
<div class="head">Leer</div>
|
||||||
@if (show) {
|
</div>
|
||||||
<div
|
</div>
|
||||||
[class.active]="show.presentationSongId === song.id"
|
}
|
||||||
class="title song-part"
|
</div>
|
||||||
>
|
@for (song of presentationSongs; track trackBy($index, song)) {
|
||||||
<div (click)="onSectionClick(song.id, -1, show.id)" class="head">
|
<div class="song">
|
||||||
{{ song.title }}
|
@if (show) {
|
||||||
</div>
|
<div [class.active]="show.presentationSongId === song.id" class="title song-part">
|
||||||
</div>
|
<div (click)="onSectionClick(song.id, -1, show.id)" class="head">{{ song.title }}</div>
|
||||||
}
|
</div>
|
||||||
@if (show) {
|
} @if (show) {
|
||||||
<div class="song-parts">
|
<div class="song-parts">
|
||||||
@for (section of song.sections; track section; let i = $index) {
|
@for (section of song.sections; track section.type + '-' + section.number + '-' + $index; let i = $index) {
|
||||||
<div
|
<div
|
||||||
(click)="onSectionClick(song.id, i, show.id)"
|
(click)="onSectionClick(song.id, i, show.id)"
|
||||||
[class.active]="
|
[class.active]="
|
||||||
show.presentationSongId === song.id &&
|
show.presentationSongId === song.id &&
|
||||||
show.presentationSection === i
|
show.presentationSection === i
|
||||||
"
|
"
|
||||||
class="song-part"
|
class="song-part"
|
||||||
>
|
>
|
||||||
<div class="head">
|
<div class="head">{{ section.type | sectionType }} {{ section.number + 1 }}</div>
|
||||||
{{ section.type | sectionType }} {{ section.number + 1 }}
|
<div class="fragment">{{ getFirstLine(section) }}</div>
|
||||||
</div>
|
|
||||||
<div class="fragment">{{ getFirstLine(section) }}</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
<div class="song">
|
|
||||||
@if (show) {
|
|
||||||
<div
|
|
||||||
[class.active]="show.presentationSongId === 'dynamicText'"
|
|
||||||
class="title song-part"
|
|
||||||
>
|
|
||||||
<div (click)="onSectionClick('dynamicText', -1, show.id)" class="head">
|
|
||||||
Freier Text
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
<mat-form-field appearance="outline">
|
|
||||||
<mat-label>Überschrift</mat-label>
|
|
||||||
<input (ngModelChange)="onDynamicCaption($event, show.id)" [ngModel]="show.presentationDynamicCaption"
|
|
||||||
autocomplete="off" id="dynamic-caption"
|
|
||||||
matInput
|
|
||||||
type="text">
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field appearance="outline">
|
|
||||||
<mat-label>Text</mat-label>
|
|
||||||
<textarea (ngModelChange)="onDynamicText($event, show.id)" [ngModel]="show.presentationDynamicText"
|
|
||||||
autocomplete="off" id="dynamic-text"
|
|
||||||
matInput></textarea>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
</div>
|
||||||
@if (show) {
|
|
||||||
<div class="div-bottom">
|
|
||||||
<button class="btn-start-presentation" mat-button routerLink="/presentation/monitor">
|
|
||||||
<fa-icon [icon]="faDesktop"></fa-icon>
|
|
||||||
Präsentation starten
|
|
||||||
</button>
|
|
||||||
<mat-form-field appearance="outline">
|
|
||||||
<mat-label>Hintergrund</mat-label>
|
|
||||||
<mat-select
|
|
||||||
(ngModelChange)="onBackground($event, show.id)"
|
|
||||||
[ngModel]="show.presentationBackground">
|
|
||||||
<mat-option value="none">kein Hintergrund</mat-option>
|
|
||||||
<mat-option value="blue">Sternenhimmel</mat-option>
|
|
||||||
<mat-option value="green">Blätter</mat-option>
|
|
||||||
<mat-option value="leder">Leder</mat-option>
|
|
||||||
<mat-option value="praise">Lobpreis</mat-option>
|
|
||||||
<mat-option value="bible">Bibel</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-slider
|
|
||||||
#slider
|
|
||||||
[max]="100"
|
|
||||||
[min]="10"
|
|
||||||
[step]="2"
|
|
||||||
class="zoom-slider"
|
|
||||||
color="primary"
|
|
||||||
ngDefaultControl
|
|
||||||
><input (ngModelChange)="onZoom($event, show.id)"
|
|
||||||
[ngModel]="show.presentationZoom"
|
|
||||||
matSliderThumb>
|
|
||||||
</mat-slider>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@if (show) {
|
|
||||||
<app-add-song
|
|
||||||
[addedLive]="true"
|
|
||||||
[showSongs]="showSongs"
|
|
||||||
[show]="show"
|
|
||||||
[songs]="songs$|async"
|
|
||||||
></app-add-song>
|
|
||||||
}
|
}
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
</app-card>
|
</div>
|
||||||
</div>
|
}
|
||||||
|
<div class="song">
|
||||||
|
@if (show) {
|
||||||
|
<div [class.active]="show.presentationSongId === 'dynamicText'" class="title song-part">
|
||||||
|
<div (click)="onSectionClick('dynamicText', -1, show.id)" class="head">Freier Text</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Überschrift</mat-label>
|
||||||
|
<input (ngModelChange)="onDynamicCaption($event, show.id)" [ngModel]="show.presentationDynamicCaption" autocomplete="off" id="dynamic-caption" matInput type="text" />
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Text</mat-label>
|
||||||
|
<textarea (ngModelChange)="onDynamicText($event, show.id)" [ngModel]="show.presentationDynamicText" autocomplete="off" id="dynamic-text" matInput></textarea>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
@if (show) {
|
||||||
|
<div class="div-bottom">
|
||||||
|
<button class="btn-start-presentation" mat-button routerLink="/presentation/monitor">
|
||||||
|
<fa-icon [icon]="faDesktop"></fa-icon>
|
||||||
|
Präsentation starten
|
||||||
|
</button>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Hintergrund</mat-label>
|
||||||
|
<mat-select (ngModelChange)="onBackground($event, show.id)" [ngModel]="show.presentationBackground">
|
||||||
|
<mat-option value="none">kein Hintergrund</mat-option>
|
||||||
|
<mat-option value="blue">Sternenhimmel</mat-option>
|
||||||
|
<mat-option value="green">Blätter</mat-option>
|
||||||
|
<mat-option value="leder">Leder</mat-option>
|
||||||
|
<mat-option value="praise">Lobpreis</mat-option>
|
||||||
|
<mat-option value="bible">Bibel</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-slider #slider [max]="100" [min]="10" [step]="2" class="zoom-slider" color="primary" ngDefaultControl
|
||||||
|
><input (ngModelChange)="onZoom($event, show.id)" [ngModel]="show.presentationZoom" matSliderThumb />
|
||||||
|
</mat-slider>
|
||||||
|
</div>
|
||||||
|
} @if (show) {
|
||||||
|
<app-add-song [addedLive]="true" [showSongs]="showSongs" [show]="show" [songs]="songs$|async"></app-add-song>
|
||||||
|
} }
|
||||||
|
</app-card>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,20 @@
|
|||||||
@if (shows$ | async; as shows) {
|
@if (shows$ | async; as shows) {
|
||||||
<div @fade>
|
<div @fade>
|
||||||
@if (visible) {
|
@if (visible) {
|
||||||
<app-card heading="Bitte eine Veranstaltung auswählen">
|
<app-card heading="Bitte eine Veranstaltung auswählen">
|
||||||
@if (!shows.length) {
|
@if (!shows.length) {
|
||||||
<p>
|
<p>Es ist derzeit keine Veranstaltung vorhanden</p>
|
||||||
Es ist derzeit keine Veranstaltung vorhanden
|
} @if (shows.length>0) {
|
||||||
</p>
|
<div class="list">
|
||||||
}
|
@for (show of shows; track show.id) {
|
||||||
@if (shows.length>0) {
|
<button (click)="selectShow(show)" mat-stroked-button>
|
||||||
<div class="list">
|
<app-user-name [userId]="show.owner"></app-user-name>
|
||||||
@for (show of shows; track show) {
|
, {{ show.showType | showType }}, {{ show.date.toDate() | date: "dd.MM.yyyy" }}
|
||||||
<button (click)="selectShow(show)" mat-stroked-button>
|
</button>
|
||||||
<app-user-name [userId]="show.owner"></app-user-name>
|
}
|
||||||
,
|
</div>
|
||||||
{{ show.showType | showType }},
|
|
||||||
{{ show.date.toDate() | date: "dd.MM.yyyy" }}
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</app-card>
|
|
||||||
}
|
}
|
||||||
</div>
|
</app-card>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ describe('SelectComponent', () => {
|
|||||||
let showServiceSpy: jasmine.SpyObj<ShowService>;
|
let showServiceSpy: jasmine.SpyObj<ShowService>;
|
||||||
let globalSettingsServiceSpy: jasmine.SpyObj<GlobalSettingsService>;
|
let globalSettingsServiceSpy: jasmine.SpyObj<GlobalSettingsService>;
|
||||||
let routerSpy: jasmine.SpyObj<Router>;
|
let routerSpy: jasmine.SpyObj<Router>;
|
||||||
|
const createShow = (id: string, isoDate: string) => ({id, date: {toDate: () => new Date(isoDate)}});
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
showServiceSpy = jasmine.createSpyObj<ShowService>('ShowService', ['list$', 'update$']);
|
showServiceSpy = jasmine.createSpyObj<ShowService>('ShowService', ['list$', 'update$']);
|
||||||
@@ -19,10 +20,10 @@ describe('SelectComponent', () => {
|
|||||||
|
|
||||||
showServiceSpy.list$.and.returnValue(
|
showServiceSpy.list$.and.returnValue(
|
||||||
of([
|
of([
|
||||||
{id: 'older', date: {toDate: () => new Date('2025-12-15T00:00:00Z')}},
|
createShow('older', '2025-12-15T00:00:00Z'),
|
||||||
{id: 'recent-a', date: {toDate: () => new Date('2026-03-01T00:00:00Z')}},
|
createShow('recent-a', '2026-03-01T00:00:00Z'),
|
||||||
{id: 'recent-b', date: {toDate: () => new Date('2026-02-20T00:00:00Z')}},
|
createShow('recent-b', '2026-02-20T00:00:00Z'),
|
||||||
] as never)
|
]) as never
|
||||||
);
|
);
|
||||||
showServiceSpy.update$.and.resolveTo();
|
showServiceSpy.update$.and.resolveTo();
|
||||||
globalSettingsServiceSpy.set.and.resolveTo();
|
globalSettingsServiceSpy.set.and.resolveTo();
|
||||||
|
|||||||
@@ -3,7 +3,5 @@
|
|||||||
</div>
|
</div>
|
||||||
<div mat-dialog-actions>
|
<div mat-dialog-actions>
|
||||||
<button [mat-dialog-close]="false" mat-button>Abbrechen</button>
|
<button [mat-dialog-close]="false" mat-button>Abbrechen</button>
|
||||||
<button [mat-dialog-close]="true" cdkFocusInitial mat-button>
|
<button [mat-dialog-close]="true" cdkFocusInitial mat-button>Archivieren</button>
|
||||||
Archivieren
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<div mat-dialog-content>
|
||||||
|
<p>Bitte melde die in dieser Veranstaltung verwendeten CCLI-Titel. Die Meldung ist Teil der CCLI-Lizenz und sorgt dafür, dass Songwriter und Verlage korrekt vergütet werden.</p>
|
||||||
|
<p>
|
||||||
|
Die Meldung erfolgt über
|
||||||
|
<a [href]="reportingUrl" rel="noreferrer" target="_blank">{{ reportingUrl }}</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="song-list">
|
||||||
|
<div class="list-head">
|
||||||
|
<div>Titel</div>
|
||||||
|
<div>CCLI-Nummer</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@for (song of data.songs; track song.title + song.ccliNumber) {
|
||||||
|
<div class="list-item">
|
||||||
|
<div>{{ song.title }}</div>
|
||||||
|
<div class="number-cell">
|
||||||
|
<span>{{ song.ccliNumber }}</span>
|
||||||
|
<a
|
||||||
|
(click)="markOpened(song.ccliNumber)"
|
||||||
|
[attr.aria-label]="'CCLI-Titel melden: ' + song.title"
|
||||||
|
[href]="getSongReportingUrl(song.ccliNumber)"
|
||||||
|
rel="noreferrer"
|
||||||
|
target="_blank"
|
||||||
|
class="btn-icon report-link"
|
||||||
|
>
|
||||||
|
<fa-icon [icon]="faOpen"></fa-icon>
|
||||||
|
</a>
|
||||||
|
@if (wasOpened(song.ccliNumber)) {
|
||||||
|
<fa-icon [icon]="faCheck" class="opened-check"></fa-icon>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div mat-dialog-actions>
|
||||||
|
<button [mat-dialog-close]="false" mat-button>Abbrechen</button>
|
||||||
|
<button [mat-dialog-close]="true" cdkFocusInitial mat-button>Alle CCLI-Titel wurden gemeldet</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
.song-list {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-head,
|
||||||
|
.list-item {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto 180px;
|
||||||
|
gap: 0;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
border-bottom: 1px solid var(--overlay)
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-head {
|
||||||
|
padding: 3px 10px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-item {
|
||||||
|
padding: 3px 10px;
|
||||||
|
transition: var(--transition);
|
||||||
|
|
||||||
|
&:not(:last-child) {
|
||||||
|
border-bottom: 1px solid var(--divider)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-head > div,
|
||||||
|
.list-item > div {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.number-cell {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.opened-check {
|
||||||
|
color: var(--success);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 640px) {
|
||||||
|
.list-head,
|
||||||
|
.list-item {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-head {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-item {
|
||||||
|
padding: 10px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.number-cell {
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
import {MAT_DIALOG_DATA} from '@angular/material/dialog';
|
||||||
|
import {ReportDialogComponent} from './report-dialog.component';
|
||||||
|
|
||||||
|
describe('ReportDialogComponent', () => {
|
||||||
|
let component: ReportDialogComponent;
|
||||||
|
let fixture: ComponentFixture<ReportDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [ReportDialogComponent],
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
provide: MAT_DIALOG_DATA,
|
||||||
|
useValue: {songs: [{title: 'Amazing Grace', ccliNumber: '12345'}]},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}).compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(ReportDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('create an instance', () => {
|
||||||
|
void expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should build direct reporting urls', () => {
|
||||||
|
expect(component.getSongReportingUrl('5770492')).toBe('https://reporting.ccli.com/search?s=5770492');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should mark numbers as opened locally', () => {
|
||||||
|
expect(component.wasOpened('12345')).toBeFalse();
|
||||||
|
|
||||||
|
component.markOpened('12345');
|
||||||
|
|
||||||
|
expect(component.wasOpened('12345')).toBeTrue();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import {Component, inject} from '@angular/core';
|
||||||
|
import {MAT_DIALOG_DATA, MatDialogActions, MatDialogClose, MatDialogContent} from '@angular/material/dialog';
|
||||||
|
import {MatButton} from '@angular/material/button';
|
||||||
|
import {FaIconComponent} from '@fortawesome/angular-fontawesome';
|
||||||
|
import {faArrowUpRightFromSquare, faCheck} from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
|
export interface ReportDialogSong {
|
||||||
|
title: string;
|
||||||
|
ccliNumber: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ReportDialogData {
|
||||||
|
songs: ReportDialogSong[];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-report-dialog',
|
||||||
|
imports: [MatButton, MatDialogActions, MatDialogContent, MatDialogClose, FaIconComponent],
|
||||||
|
templateUrl: './report-dialog.component.html',
|
||||||
|
styleUrl: './report-dialog.component.less',
|
||||||
|
standalone: true,
|
||||||
|
})
|
||||||
|
export class ReportDialogComponent {
|
||||||
|
public readonly reportingUrl = 'https://reporting.ccli.com/search';
|
||||||
|
public readonly faOpen = faArrowUpRightFromSquare;
|
||||||
|
public readonly faCheck = faCheck;
|
||||||
|
public data = inject<ReportDialogData>(MAT_DIALOG_DATA);
|
||||||
|
private readonly openedNumbers = new Set<string>();
|
||||||
|
|
||||||
|
public getSongReportingUrl(ccliNumber: string): string {
|
||||||
|
return `${this.reportingUrl}?s=${encodeURIComponent(ccliNumber)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
public markOpened(ccliNumber: string): void {
|
||||||
|
this.openedNumbers.add(ccliNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
public wasOpened(ccliNumber: string): boolean {
|
||||||
|
return this.openedNumbers.has(ccliNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,8 @@
|
|||||||
<div mat-dialog-content>
|
<div mat-dialog-content>
|
||||||
<a [href]="data.url">{{ data.url }}</a>
|
<a [href]="data.url">{{ data.url }}</a>
|
||||||
<div [style.background-image]="'url('+qrCode+')'" alt="qrcode" class="qrcode">
|
<div [style.background-image]="'url('+qrCode+')'" alt="qrcode" class="qrcode"></div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div mat-dialog-actions>
|
<div mat-dialog-actions>
|
||||||
<button [mat-dialog-close]="true" cdkFocusInitial mat-button>
|
<button [mat-dialog-close]="true" cdkFocusInitial mat-button>Schließen</button>
|
||||||
Schließen
|
<button (click)="share()" mat-button>Teilen</button>
|
||||||
</button>
|
|
||||||
<button (click)="share()" mat-button>
|
|
||||||
Teilen
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export class ShareDialogComponent {
|
|||||||
const data = this.data;
|
const data = this.data;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
|
||||||
QRCode.toDataURL(data.url, {
|
void QRCode.toDataURL(data.url, {
|
||||||
type: 'image/jpeg',
|
type: 'image/jpeg',
|
||||||
quality: 0.92,
|
quality: 0.92,
|
||||||
width: 1280,
|
width: 1280,
|
||||||
|
|||||||
@@ -6,18 +6,12 @@
|
|||||||
<mat-select formControlName="showType">
|
<mat-select formControlName="showType">
|
||||||
<mat-optgroup label="öffentlich">
|
<mat-optgroup label="öffentlich">
|
||||||
@for (key of showTypePublic; track key) {
|
@for (key of showTypePublic; track key) {
|
||||||
<mat-option [value]="key">{{
|
<mat-option [value]="key">{{ key | showType }} </mat-option>
|
||||||
key | showType
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
}
|
||||||
</mat-optgroup>
|
</mat-optgroup>
|
||||||
<mat-optgroup label="privat">
|
<mat-optgroup label="privat">
|
||||||
@for (key of showTypePrivate; track key) {
|
@for (key of showTypePrivate; track key) {
|
||||||
<mat-option [value]="key">{{
|
<mat-option [value]="key">{{ key | showType }} </mat-option>
|
||||||
key | showType
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
}
|
||||||
</mat-optgroup>
|
</mat-optgroup>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
|
|||||||
@@ -12,17 +12,18 @@ describe('EditComponent', () => {
|
|||||||
let showServiceSpy: jasmine.SpyObj<ShowService>;
|
let showServiceSpy: jasmine.SpyObj<ShowService>;
|
||||||
let showDataServiceStub: Pick<ShowDataService, 'list$'>;
|
let showDataServiceStub: Pick<ShowDataService, 'list$'>;
|
||||||
let routerSpy: jasmine.SpyObj<Router>;
|
let routerSpy: jasmine.SpyObj<Router>;
|
||||||
|
const createDate = (isoDate: string) => ({toDate: () => new Date(isoDate)});
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
showServiceSpy = jasmine.createSpyObj<ShowService>('ShowService', ['read$', 'update$']);
|
showServiceSpy = jasmine.createSpyObj<ShowService>('ShowService', ['read$', 'update$']);
|
||||||
showDataServiceStub = {list$: of([] as never)};
|
showDataServiceStub = {list$: of([]) as ShowDataService['list$']};
|
||||||
routerSpy = jasmine.createSpyObj<Router>('Router', ['navigateByUrl']);
|
routerSpy = jasmine.createSpyObj<Router>('Router', ['navigateByUrl']);
|
||||||
|
|
||||||
showServiceSpy.read$.and.returnValue(
|
showServiceSpy.read$.and.returnValue(
|
||||||
of({
|
of({
|
||||||
id: 'show-1',
|
id: 'show-1',
|
||||||
showType: 'service-worship',
|
showType: 'service-worship',
|
||||||
date: {toDate: () => new Date('2026-03-10T00:00:00Z')},
|
date: createDate('2026-03-10T00:00:00Z'),
|
||||||
} as never)
|
} as never)
|
||||||
);
|
);
|
||||||
showServiceSpy.update$.and.resolveTo();
|
showServiceSpy.update$.and.resolveTo();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/
|
|||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {faSave} from '@fortawesome/free-solid-svg-icons';
|
import {faSave} from '@fortawesome/free-solid-svg-icons';
|
||||||
import {map, switchMap} from 'rxjs/operators';
|
import {map, switchMap} from 'rxjs/operators';
|
||||||
import {Timestamp} from '@angular/fire/firestore';
|
import {Timestamp} from 'firebase/firestore';
|
||||||
import {CardComponent} from '../../../widget-modules/components/card/card.component';
|
import {CardComponent} from '../../../widget-modules/components/card/card.component';
|
||||||
import {MatFormField, MatLabel, MatSuffix} from '@angular/material/form-field';
|
import {MatFormField, MatLabel, MatSuffix} from '@angular/material/form-field';
|
||||||
import {MatSelect} from '@angular/material/select';
|
import {MatSelect} from '@angular/material/select';
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
<div [formGroup]="filterFormGroup">
|
<div [formGroup]="filterFormGroup">
|
||||||
|
|
||||||
<div class="third">
|
<div class="third">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Zeitraum</mat-label>
|
<mat-label>Zeitraum</mat-label>
|
||||||
<mat-select formControlName="time">
|
<mat-select formControlName="time">
|
||||||
@for (time of times; track time) {
|
@for (time of times; track time) {
|
||||||
<mat-option [value]="time.key">{{
|
<mat-option [value]="time.key">{{ time.value }} </mat-option>
|
||||||
time.value
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
}
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@@ -18,10 +14,7 @@
|
|||||||
<mat-select formControlName="owner">
|
<mat-select formControlName="owner">
|
||||||
<mat-option value="">Alle</mat-option>
|
<mat-option value="">Alle</mat-option>
|
||||||
@for (owner of owners; track owner) {
|
@for (owner of owners; track owner) {
|
||||||
<mat-option [value]="owner.key">{{
|
<mat-option [value]="owner.key">{{ owner.value }} </mat-option>
|
||||||
owner.value
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
}
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@@ -32,23 +25,16 @@
|
|||||||
<mat-option value="">Alle</mat-option>
|
<mat-option value="">Alle</mat-option>
|
||||||
<mat-optgroup label="öffentlich">
|
<mat-optgroup label="öffentlich">
|
||||||
@for (key of showTypePublic; track key) {
|
@for (key of showTypePublic; track key) {
|
||||||
<mat-option [value]="key">{{
|
<mat-option [value]="key">{{ key | showType }} </mat-option>
|
||||||
key | showType
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
}
|
||||||
</mat-optgroup>
|
</mat-optgroup>
|
||||||
<mat-optgroup label="privat">
|
<mat-optgroup label="privat">
|
||||||
@for (key of showTypePrivate; track key) {
|
@for (key of showTypePrivate; track key) {
|
||||||
<mat-option [value]="key">{{
|
<mat-option [value]="key">{{ key | showType }} </mat-option>
|
||||||
key | showType
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
}
|
||||||
</mat-optgroup>
|
</mat-optgroup>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<i>Anzahl der Suchergebnisse: {{ shows?.length ?? 0 }}</i>
|
<i>Anzahl der Suchergebnisse: {{ shows?.length ?? 0 }}</i>
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
@if (show) {
|
@if (show) {
|
||||||
<div class="list-item">
|
<div class="list-item">
|
||||||
<div>{{ show.date.toDate() | date: "dd.MM.yyyy" }}</div>
|
<div>{{ show.date.toDate() | date: "dd.MM.yyyy" }}</div>
|
||||||
<div>
|
<div>
|
||||||
<app-user-name [userId]="show.owner"></app-user-name>
|
<app-user-name [userId]="show.owner"></app-user-name>
|
||||||
</div>
|
|
||||||
<div>{{ show.showType | showType }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div>{{ show.showType | showType }}</div>
|
||||||
|
<div>
|
||||||
|
@if (showStatusBadge) {
|
||||||
|
<app-badge [type]="showStatusBadgeType">{{ showStatusBadge }}</app-badge>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.list-item {
|
.list-item {
|
||||||
padding: 5px 20px;
|
padding: 5px 20px;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 100px 150px auto;
|
grid-template-columns: 100px 150px auto 160px;
|
||||||
min-height: 21px;
|
min-height: 21px;
|
||||||
|
|
||||||
& > div {
|
& > div {
|
||||||
|
|||||||
@@ -1,24 +1,45 @@
|
|||||||
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
|
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
import {BehaviorSubject, of} from 'rxjs';
|
||||||
import {ListItemComponent} from './list-item.component';
|
import {ListItemComponent} from './list-item.component';
|
||||||
|
import {UserService} from '../../../../services/user/user.service';
|
||||||
|
|
||||||
describe('ListItemComponent', () => {
|
describe('ListItemComponent', () => {
|
||||||
let component: ListItemComponent;
|
let component: ListItemComponent;
|
||||||
let fixture: ComponentFixture<ListItemComponent>;
|
let fixture: ComponentFixture<ListItemComponent>;
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(async () => {
|
||||||
void TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [ListItemComponent],
|
imports: [ListItemComponent],
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
provide: UserService,
|
||||||
|
useValue: {
|
||||||
|
user$: new BehaviorSubject<unknown>({id: 'user-1'}).asObservable(),
|
||||||
|
userId$: new BehaviorSubject<string | null>('user-1').asObservable(),
|
||||||
|
loggedIn$: () => of(true),
|
||||||
|
getUserbyId$: () => of({name: 'Benjamin'}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(ListItemComponent);
|
fixture = TestBed.createComponent(ListItemComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create', () => {
|
it('should create', () => {
|
||||||
void expect(component).toBeTruthy();
|
void expect(component).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should render a status badge when provided', () => {
|
||||||
|
component.show = {date: {toDate: () => new Date('2026-03-15')} as never, owner: 'user-1', showType: 'misc-private'} as never;
|
||||||
|
component.showStatusBadge = 'nicht gemeldet';
|
||||||
|
component.showStatusBadgeType = 'error';
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
const badge = fixture.nativeElement.querySelector('app-badge .badge');
|
||||||
|
expect(badge?.textContent?.trim()).toBe('nicht gemeldet');
|
||||||
|
expect(badge?.className).toContain('error');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,13 +3,16 @@ import {Show} from '../../services/show';
|
|||||||
import {DatePipe} from '@angular/common';
|
import {DatePipe} from '@angular/common';
|
||||||
import {UserNameComponent} from '../../../../services/user/user-name/user-name.component';
|
import {UserNameComponent} from '../../../../services/user/user-name/user-name.component';
|
||||||
import {ShowTypePipe} from '../../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
import {ShowTypePipe} from '../../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
||||||
|
import {BadgeComponent, BadgeType} from '../../../../widget-modules/components/badge/badge.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list-item',
|
selector: 'app-list-item',
|
||||||
templateUrl: './list-item.component.html',
|
templateUrl: './list-item.component.html',
|
||||||
styleUrls: ['./list-item.component.less'],
|
styleUrls: ['./list-item.component.less'],
|
||||||
imports: [UserNameComponent, DatePipe, ShowTypePipe],
|
imports: [UserNameComponent, DatePipe, ShowTypePipe, BadgeComponent],
|
||||||
})
|
})
|
||||||
export class ListItemComponent {
|
export class ListItemComponent {
|
||||||
@Input() public show: Show | null = null;
|
@Input() public show: Show | null = null;
|
||||||
|
@Input() public showStatusBadge: string | null = null;
|
||||||
|
@Input() public showStatusBadgeType: BadgeType = 'none';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,41 +2,30 @@
|
|||||||
<!-- <app-list-header *appRole="['leader']"></app-list-header>-->
|
<!-- <app-list-header *appRole="['leader']"></app-list-header>-->
|
||||||
<app-list-header *appRole="['leader']">
|
<app-list-header *appRole="['leader']">
|
||||||
@if (shows$ | async; as shows) {
|
@if (shows$ | async; as shows) {
|
||||||
<app-filter [shows]="publicShows$ | async"></app-filter>
|
<app-filter [shows]="publicShows$ | async"></app-filter>
|
||||||
}
|
}
|
||||||
</app-list-header>
|
</app-list-header>
|
||||||
|
|
||||||
<ng-container *appRole="['leader']">
|
<ng-container *appRole="['leader']">
|
||||||
@if (privateShows$ | async; as shows) {
|
@if (privateShows$ | async; as shows) { @if (shows.length > 0) {
|
||||||
@if (shows.length > 0) {
|
<app-card [padding]="false" heading="Meine Veranstaltungen">
|
||||||
<app-card
|
@for (show of shows | sortBy: 'desc':'date'; track trackBy($index, show)) {
|
||||||
[padding]="false"
|
<app-list-item
|
||||||
heading="Meine Veranstaltungen"
|
[routerLink]="show.id"
|
||||||
>
|
[showStatusBadge]="show.published ? 'nicht gemeldet' : 'unveröffentlicht'"
|
||||||
@for (show of shows | sortBy: 'desc':'date'; track show) {
|
[showStatusBadgeType]="show.published ? 'error' : 'none'"
|
||||||
<app-list-item
|
[show]="show"
|
||||||
[routerLink]="show.id"
|
></app-list-item>
|
||||||
[show]="show"
|
|
||||||
></app-list-item>
|
|
||||||
}
|
|
||||||
</app-card>
|
|
||||||
}
|
}
|
||||||
}
|
</app-card>
|
||||||
|
} }
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
@if (publicShows$ | async; as shows) {
|
@if (publicShows$ | async; as shows) { @if (shows.length > 0) {
|
||||||
@if (shows.length > 0) {
|
<app-card [padding]="false" heading="Veröffentlichte Veranstaltungen">
|
||||||
<app-card
|
@for (show of shows | sortBy: 'desc':'date'; track trackBy($index, show)) {
|
||||||
[padding]="false"
|
<app-list-item [routerLink]="show.id" [show]="show"></app-list-item>
|
||||||
heading="Veröffentlichte Veranstaltungen"
|
|
||||||
>
|
|
||||||
@for (show of shows | sortBy: 'desc':'date'; track trackBy($index, show)) {
|
|
||||||
<app-list-item
|
|
||||||
[routerLink]="show.id"
|
|
||||||
[show]="show"
|
|
||||||
></app-list-item>
|
|
||||||
}
|
|
||||||
</app-card>
|
|
||||||
}
|
}
|
||||||
}
|
</app-card>
|
||||||
|
} }
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,24 +1,80 @@
|
|||||||
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
|
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
import {BehaviorSubject, of} from 'rxjs';
|
||||||
import {ListComponent} from './list.component';
|
import {ListComponent} from './list.component';
|
||||||
|
import {ShowService} from '../services/show.service';
|
||||||
|
import {UserService} from '../../../services/user/user.service';
|
||||||
|
import {FilterStoreService} from '../../../services/filter-store.service';
|
||||||
|
|
||||||
describe('ListComponent', () => {
|
describe('ListComponent', () => {
|
||||||
let component: ListComponent;
|
let component: ListComponent;
|
||||||
let fixture: ComponentFixture<ListComponent>;
|
let fixture: ComponentFixture<ListComponent>;
|
||||||
|
let shows$: BehaviorSubject<unknown[]>;
|
||||||
|
let user$: BehaviorSubject<unknown>;
|
||||||
|
const createShow = (overrides: Record<string, unknown>) => ({
|
||||||
|
archived: false,
|
||||||
|
date: {toDate: () => new Date('2026-03-01')},
|
||||||
|
...overrides,
|
||||||
|
});
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(async () => {
|
||||||
void TestBed.configureTestingModule({
|
shows$ = new BehaviorSubject<unknown[]>([]);
|
||||||
|
user$ = new BehaviorSubject<unknown>({id: 'user-1'});
|
||||||
|
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
imports: [ListComponent],
|
imports: [ListComponent],
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
provide: ShowService,
|
||||||
|
useValue: {
|
||||||
|
list$: () => shows$.asObservable(),
|
||||||
|
listPublicSince$: () => of([]),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: UserService,
|
||||||
|
useValue: {
|
||||||
|
user$: user$.asObservable(),
|
||||||
|
loggedIn$: () => of(true),
|
||||||
|
getUserbyId$: () => of({name: 'Benjamin'}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
FilterStoreService,
|
||||||
|
],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(ListComponent);
|
fixture = TestBed.createComponent(ListComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create', () => {
|
it('should create', () => {
|
||||||
void expect(component).toBeTruthy();
|
void expect(component).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should list own drafts and pending published shows in my shows', done => {
|
||||||
|
shows$.next([
|
||||||
|
createShow({id: 'draft-own', owner: 'user-1', published: false, reportedType: null}),
|
||||||
|
createShow({id: 'pending-own', owner: 'user-1', published: true, reportedType: 'pending', date: {toDate: () => new Date('2026-03-02')}}),
|
||||||
|
createShow({id: 'reported-own', owner: 'user-1', published: true, reportedType: 'reported', date: {toDate: () => new Date('2026-03-03')}}),
|
||||||
|
createShow({id: 'draft-other', owner: 'user-2', published: false, reportedType: null, date: {toDate: () => new Date('2026-03-04')}}),
|
||||||
|
] as never);
|
||||||
|
|
||||||
|
component.privateShows$.subscribe(shows => {
|
||||||
|
expect(shows.map(show => show.id)).toEqual(['draft-own', 'pending-own']);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should ignore show filters for my shows', done => {
|
||||||
|
const filterStore = TestBed.inject(FilterStoreService);
|
||||||
|
filterStore.updateShowFilter({time: 0, showType: 'service-worship'});
|
||||||
|
shows$.next([
|
||||||
|
createShow({id: 'older-draft', owner: 'user-1', published: false, reportedType: null, showType: 'misc-private', date: {toDate: () => new Date('2025-01-01')}}),
|
||||||
|
createShow({id: 'pending-own', owner: 'user-1', published: true, reportedType: 'pending', showType: 'home-group', date: {toDate: () => new Date('2026-03-05')}}),
|
||||||
|
] as never);
|
||||||
|
|
||||||
|
component.privateShows$.subscribe(shows => {
|
||||||
|
expect(shows.map(show => show.id)).toEqual(['older-draft', 'pending-own']);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {FilterComponent} from './filter/filter.component';
|
|||||||
import {CardComponent} from '../../../widget-modules/components/card/card.component';
|
import {CardComponent} from '../../../widget-modules/components/card/card.component';
|
||||||
import {ListItemComponent} from './list-item/list-item.component';
|
import {ListItemComponent} from './list-item/list-item.component';
|
||||||
import {SortByPipe} from '../../../widget-modules/pipes/sort-by/sort-by.pipe';
|
import {SortByPipe} from '../../../widget-modules/pipes/sort-by/sort-by.pipe';
|
||||||
|
import {UserService} from '../../../services/user/user.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list',
|
selector: 'app-list',
|
||||||
@@ -25,14 +26,15 @@ import {SortByPipe} from '../../../widget-modules/pipes/sort-by/sort-by.pipe';
|
|||||||
export class ListComponent {
|
export class ListComponent {
|
||||||
private showService = inject(ShowService);
|
private showService = inject(ShowService);
|
||||||
private filterStore = inject(FilterStoreService);
|
private filterStore = inject(FilterStoreService);
|
||||||
|
private userService = inject(UserService);
|
||||||
|
|
||||||
public filter$ = this.filterStore.showFilter$;
|
public filter$ = this.filterStore.showFilter$;
|
||||||
public lastMonths$ = this.filter$.pipe(map((filterValues: FilterValues) => filterValues.time || 1));
|
public lastMonths$ = this.filter$.pipe(map((filterValues: FilterValues) => filterValues.time || 1));
|
||||||
public owner$ = this.filter$.pipe(map((filterValues: FilterValues) => filterValues.owner));
|
public owner$ = this.filter$.pipe(map((filterValues: FilterValues) => filterValues.owner));
|
||||||
public showType$ = this.filter$.pipe(map((filterValues: FilterValues) => filterValues.showType));
|
public showType$ = this.filter$.pipe(map((filterValues: FilterValues) => filterValues.showType));
|
||||||
public shows$ = this.showService.list$();
|
public shows$ = this.showService.list$();
|
||||||
public privateShows$ = combineLatest([this.shows$, this.filter$]).pipe(
|
public privateShows$ = combineLatest([this.shows$, this.userService.user$]).pipe(
|
||||||
map(([shows, filter]) => shows.filter(show => !show.published).filter(show => this.matchesPrivateFilter(show, filter)))
|
map(([shows, user]) => shows.filter(show => show.owner === user?.id).filter(show => !show.published || show.reportedType === 'pending'))
|
||||||
);
|
);
|
||||||
public queriedPublicShows$ = this.lastMonths$.pipe(switchMap(lastMonths => this.showService.listPublicSince$(lastMonths)));
|
public queriedPublicShows$ = this.lastMonths$.pipe(switchMap(lastMonths => this.showService.listPublicSince$(lastMonths)));
|
||||||
public fallbackPublicShows$ = combineLatest([this.shows$, this.lastMonths$]).pipe(
|
public fallbackPublicShows$ = combineLatest([this.shows$, this.lastMonths$]).pipe(
|
||||||
@@ -50,10 +52,6 @@ export class ListComponent {
|
|||||||
|
|
||||||
public trackBy = (index: number, show: unknown) => (show as Show).id;
|
public trackBy = (index: number, show: unknown) => (show as Show).id;
|
||||||
|
|
||||||
private matchesPrivateFilter(show: Show, filter: FilterValues): boolean {
|
|
||||||
return this.matchesTimeFilter(show, filter.time || 1) && (!filter.showType || show.showType === filter.showType);
|
|
||||||
}
|
|
||||||
|
|
||||||
private matchesTimeFilter(show: Show, lastMonths: number): boolean {
|
private matchesTimeFilter(show: Show, lastMonths: number): boolean {
|
||||||
const startDate = new Date();
|
const startDate = new Date();
|
||||||
startDate.setHours(0, 0, 0, 0);
|
startDate.setHours(0, 0, 0, 0);
|
||||||
|
|||||||
@@ -6,18 +6,12 @@
|
|||||||
<mat-select formControlName="showType">
|
<mat-select formControlName="showType">
|
||||||
<mat-optgroup label="öffentlich">
|
<mat-optgroup label="öffentlich">
|
||||||
@for (key of showTypePublic; track key) {
|
@for (key of showTypePublic; track key) {
|
||||||
<mat-option [value]="key">{{
|
<mat-option [value]="key">{{ key | showType }} </mat-option>
|
||||||
key | showType
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
}
|
||||||
</mat-optgroup>
|
</mat-optgroup>
|
||||||
<mat-optgroup label="privat">
|
<mat-optgroup label="privat">
|
||||||
@for (key of showTypePrivate; track key) {
|
@for (key of showTypePrivate; track key) {
|
||||||
<mat-option [value]="key">{{
|
<mat-option [value]="key">{{ key | showType }} </mat-option>
|
||||||
key | showType
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
}
|
||||||
</mat-optgroup>
|
</mat-optgroup>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ describe('DocxService', () => {
|
|||||||
|
|
||||||
it('should not try to save a document when the required data cannot be prepared', async () => {
|
it('should not try to save a document when the required data cannot be prepared', async () => {
|
||||||
const serviceInternals = service as DocxServiceInternals;
|
const serviceInternals = service as DocxServiceInternals;
|
||||||
const prepareDataSpy = spyOn(serviceInternals, 'prepareData').and.resolveTo(null);
|
const prepareDataSpy = spyOn<any>(serviceInternals, 'prepareData').and.resolveTo(null);
|
||||||
const saveAsSpy = spyOn(serviceInternals, 'saveAs');
|
const saveAsSpy = spyOn<any>(serviceInternals, 'saveAs');
|
||||||
|
|
||||||
await service.create('show-1');
|
await service.create('show-1');
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ describe('DocxService', () => {
|
|||||||
it('should build and save a docx file when all data is available', async () => {
|
it('should build and save a docx file when all data is available', async () => {
|
||||||
const blob = new Blob(['docx']);
|
const blob = new Blob(['docx']);
|
||||||
const serviceInternals = service as DocxServiceInternals;
|
const serviceInternals = service as DocxServiceInternals;
|
||||||
const prepareDataSpy = spyOn(serviceInternals, 'prepareData').and.resolveTo({
|
const prepareDataSpy = spyOn<any>(serviceInternals, 'prepareData').and.resolveTo({
|
||||||
show: {
|
show: {
|
||||||
showType: 'service-worship',
|
showType: 'service-worship',
|
||||||
date: {toDate: () => new Date('2026-03-10T00:00:00Z')},
|
date: {toDate: () => new Date('2026-03-10T00:00:00Z')},
|
||||||
@@ -42,8 +42,8 @@ describe('DocxService', () => {
|
|||||||
user: {name: 'Benjamin'},
|
user: {name: 'Benjamin'},
|
||||||
config: {ccliLicenseId: '12345'},
|
config: {ccliLicenseId: '12345'},
|
||||||
});
|
});
|
||||||
const prepareNewDocumentSpy = spyOn(serviceInternals, 'prepareNewDocument').and.returnValue({doc: true});
|
const prepareNewDocumentSpy = spyOn<any>(serviceInternals, 'prepareNewDocument').and.returnValue({doc: true});
|
||||||
const saveAsSpy = spyOn(serviceInternals, 'saveAs');
|
const saveAsSpy = spyOn<any>(serviceInternals, 'saveAs');
|
||||||
spyOn(Packer, 'toBlob').and.resolveTo(blob);
|
spyOn(Packer, 'toBlob').and.resolveTo(blob);
|
||||||
|
|
||||||
await service.create('show-1', {copyright: true});
|
await service.create('show-1', {copyright: true});
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
import {TestBed} from '@angular/core/testing';
|
||||||
|
import {of} from 'rxjs';
|
||||||
|
import {ShowDataService} from './show-data.service';
|
||||||
|
import {ShowSongDataService} from './show-song-data.service';
|
||||||
|
import {ShowSongIndexService} from './show-song-index.service';
|
||||||
|
import {UserSessionService} from '../../../services/user/user-session.service';
|
||||||
|
import {User} from '../../../services/user/user';
|
||||||
|
|
||||||
|
describe('ShowSongIndexService', () => {
|
||||||
|
let service: ShowSongIndexService;
|
||||||
|
let showDataServiceSpy: jasmine.SpyObj<ShowDataService>;
|
||||||
|
let showSongDataServiceSpy: jasmine.SpyObj<ShowSongDataService>;
|
||||||
|
let sessionSpy: jasmine.SpyObj<UserSessionService>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
showDataServiceSpy = jasmine.createSpyObj<ShowDataService>('ShowDataService', ['listRaw$', 'update']);
|
||||||
|
showSongDataServiceSpy = jasmine.createSpyObj<ShowSongDataService>('ShowSongDataService', ['list$']);
|
||||||
|
sessionSpy = jasmine.createSpyObj<UserSessionService>('UserSessionService', ['update$'], {
|
||||||
|
user$: of({id: 'admin-1', name: 'Admin', role: 'admin', chordMode: 'onlyFirst', songUsage: {}} as User),
|
||||||
|
});
|
||||||
|
|
||||||
|
showDataServiceSpy.listRaw$.and.returnValue(of([{id: 'show-1'}, {id: 'show-2'}] as never) as unknown as ReturnType<ShowDataService['listRaw$']>);
|
||||||
|
showDataServiceSpy.update.and.resolveTo();
|
||||||
|
showSongDataServiceSpy.list$.and.callFake((showId: string) => {
|
||||||
|
if (showId === 'show-1') {
|
||||||
|
return of([{songId: 'song-1'}, {songId: 'song-2'}, {songId: 'song-1'}] as never) as never;
|
||||||
|
}
|
||||||
|
|
||||||
|
return of([{songId: 'song-3'}] as never) as never;
|
||||||
|
});
|
||||||
|
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
providers: [
|
||||||
|
{provide: ShowDataService, useValue: showDataServiceSpy},
|
||||||
|
{provide: ShowSongDataService, useValue: showSongDataServiceSpy},
|
||||||
|
{provide: UserSessionService, useValue: sessionSpy},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
service = TestBed.inject(ShowSongIndexService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should rebuild the distinct songIds index for all shows', async () => {
|
||||||
|
await expectAsync(service.rebuildShowSongIds()).toBeResolvedTo({
|
||||||
|
showsProcessed: 2,
|
||||||
|
showSongsProcessed: 4,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(showDataServiceSpy.update).toHaveBeenCalledWith('show-1', {songIds: ['song-1', 'song-2']});
|
||||||
|
expect(showDataServiceSpy.update).toHaveBeenCalledWith('show-2', {songIds: ['song-3']});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should reject index rebuilds for non-admin users', async () => {
|
||||||
|
Object.defineProperty(sessionSpy, 'user$', {
|
||||||
|
value: of({id: 'user-1', name: 'User', role: 'leader', chordMode: 'onlyFirst', songUsage: {}} as User),
|
||||||
|
});
|
||||||
|
|
||||||
|
await expectAsync(service.rebuildShowSongIds()).toBeRejectedWithError('Admin role required to rebuild show song ids.');
|
||||||
|
});
|
||||||
|
});
|
||||||
65
src/app/modules/shows/services/show-song-index.service.ts
Normal file
65
src/app/modules/shows/services/show-song-index.service.ts
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
import {Injectable, inject} from '@angular/core';
|
||||||
|
import {firstValueFrom} from 'rxjs';
|
||||||
|
import {take} from 'rxjs/operators';
|
||||||
|
import {ShowDataService} from './show-data.service';
|
||||||
|
import {ShowSongDataService} from './show-song-data.service';
|
||||||
|
import {UserSessionService} from '../../../services/user/user-session.service';
|
||||||
|
|
||||||
|
export interface ShowSongIndexMigrationResult {
|
||||||
|
showsProcessed: number;
|
||||||
|
showSongsProcessed: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MigrationProgress {
|
||||||
|
processed: number;
|
||||||
|
total: number;
|
||||||
|
showId: string;
|
||||||
|
showSongsProcessed: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class ShowSongIndexService {
|
||||||
|
private session = inject(UserSessionService);
|
||||||
|
private showDataService = inject(ShowDataService);
|
||||||
|
private showSongDataService = inject(ShowSongDataService);
|
||||||
|
|
||||||
|
public async rebuildShowSongIds(onProgress?: (progress: MigrationProgress) => void): Promise<ShowSongIndexMigrationResult> {
|
||||||
|
const currentUser = await firstValueFrom(this.session.user$.pipe(take(1)));
|
||||||
|
if (!currentUser || !this.hasAdminRole(currentUser.role)) {
|
||||||
|
throw new Error('Admin role required to rebuild show song ids.');
|
||||||
|
}
|
||||||
|
|
||||||
|
const shows = await firstValueFrom(this.showDataService.listRaw$());
|
||||||
|
let showSongsProcessed = 0;
|
||||||
|
let processed = 0;
|
||||||
|
|
||||||
|
for (const show of shows) {
|
||||||
|
const showSongs = await firstValueFrom(this.showSongDataService.list$(show.id));
|
||||||
|
const songIds = [...new Set(showSongs.map(showSong => showSong.songId).filter(Boolean))];
|
||||||
|
showSongsProcessed += showSongs.length;
|
||||||
|
await this.showDataService.update(show.id, {songIds});
|
||||||
|
processed += 1;
|
||||||
|
onProgress?.({
|
||||||
|
processed,
|
||||||
|
total: shows.length,
|
||||||
|
showId: show.id,
|
||||||
|
showSongsProcessed,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
showsProcessed: shows.length,
|
||||||
|
showSongsProcessed,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private hasAdminRole(role: string | null | undefined): boolean {
|
||||||
|
if (!role) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return role.split(';').includes('admin');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ describe('ShowSongService', () => {
|
|||||||
const show = {id: 'show-1', order: ['show-song-1', 'show-song-2']} as unknown as Show;
|
const show = {id: 'show-1', order: ['show-song-1', 'show-song-2']} as unknown as Show;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
user$ = new BehaviorSubject<User | null>({id: 'user-1', name: 'Benjamin', role: 'editor', chordMode: 'letters', songUsage: {}});
|
user$ = new BehaviorSubject<User | null>({id: 'user-1', name: 'Benjamin', role: 'editor', chordMode: 'onlyFirst', songUsage: {}});
|
||||||
showSongDataServiceSpy = jasmine.createSpyObj<ShowSongDataService>('ShowSongDataService', ['add', 'read$', 'list$', 'delete', 'update$']);
|
showSongDataServiceSpy = jasmine.createSpyObj<ShowSongDataService>('ShowSongDataService', ['add', 'read$', 'list$', 'delete', 'update$']);
|
||||||
songDataServiceSpy = jasmine.createSpyObj<SongDataService>('SongDataService', ['read$']);
|
songDataServiceSpy = jasmine.createSpyObj<SongDataService>('SongDataService', ['read$']);
|
||||||
userServiceSpy = jasmine.createSpyObj<UserService>('UserService', ['incSongCount', 'decSongCount'], {
|
userServiceSpy = jasmine.createSpyObj<UserService>('UserService', ['incSongCount', 'decSongCount'], {
|
||||||
@@ -66,7 +66,7 @@ describe('ShowSongService', () => {
|
|||||||
songId: 'song-1',
|
songId: 'song-1',
|
||||||
key: 'G',
|
key: 'G',
|
||||||
keyOriginal: 'G',
|
keyOriginal: 'G',
|
||||||
chordMode: 'letters',
|
chordMode: 'onlyFirst',
|
||||||
addedLive: true,
|
addedLive: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -103,7 +103,7 @@ describe('ShowSongService', () => {
|
|||||||
await service.delete$('show-1', 'show-song-1', 0);
|
await service.delete$('show-1', 'show-song-1', 0);
|
||||||
|
|
||||||
expect(showSongDataServiceSpy.delete).toHaveBeenCalledWith('show-1', 'show-song-1');
|
expect(showSongDataServiceSpy.delete).toHaveBeenCalledWith('show-1', 'show-song-1');
|
||||||
expect(showServiceSpy.update$).toHaveBeenCalledWith('show-1', {order: ['show-song-2']});
|
expect(showServiceSpy.update$).toHaveBeenCalledWith('show-1', jasmine.objectContaining({order: ['show-song-2']}));
|
||||||
expect(userServiceSpy.decSongCount).toHaveBeenCalledWith('song-1');
|
expect(userServiceSpy.decSongCount).toHaveBeenCalledWith('song-1');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {ShowSong} from './show-song';
|
|||||||
import {SongDataService} from '../../songs/services/song-data.service';
|
import {SongDataService} from '../../songs/services/song-data.service';
|
||||||
import {UserService} from '../../../services/user/user.service';
|
import {UserService} from '../../../services/user/user.service';
|
||||||
import {ShowService} from './show.service';
|
import {ShowService} from './show.service';
|
||||||
|
import {arrayRemove, arrayUnion} from 'firebase/firestore';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@@ -27,8 +28,9 @@ export class ShowSongService {
|
|||||||
chordMode: user.chordMode,
|
chordMode: user.chordMode,
|
||||||
addedLive,
|
addedLive,
|
||||||
};
|
};
|
||||||
await this.userService.incSongCount(songId);
|
const showSongId = await this.showSongDataService.add(showId, data);
|
||||||
return await this.showSongDataService.add(showId, data);
|
await Promise.all([this.userService.incSongCount(songId), this.showService.update$(showId, {songIds: arrayUnion(songId) as never})]);
|
||||||
|
return showSongId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public read$ = (showId: string, songId: string): Observable<ShowSong | null> => this.showSongDataService.read$(showId, songId);
|
public read$ = (showId: string, songId: string): Observable<ShowSong | null> => this.showSongDataService.read$(showId, songId);
|
||||||
@@ -38,14 +40,19 @@ export class ShowSongService {
|
|||||||
public list = (showId: string): Promise<ShowSong[]> => firstValueFrom(this.list$(showId));
|
public list = (showId: string): Promise<ShowSong[]> => firstValueFrom(this.list$(showId));
|
||||||
|
|
||||||
public async delete$(showId: string, showSongId: string, index: number): Promise<void> {
|
public async delete$(showId: string, showSongId: string, index: number): Promise<void> {
|
||||||
const [showSong, show] = await Promise.all([this.read(showId, showSongId), firstValueFrom(this.showService.read$(showId))]);
|
const [showSong, show, showSongs] = await Promise.all([this.read(showId, showSongId), firstValueFrom(this.showService.read$(showId)), this.list(showId)]);
|
||||||
if (!show) return;
|
if (!show) return;
|
||||||
if (!showSong) return;
|
if (!showSong) return;
|
||||||
|
|
||||||
const order = [...show.order];
|
const order = [...show.order];
|
||||||
order.splice(index, 1);
|
order.splice(index, 1);
|
||||||
|
const hasSameSongStillInShow = showSongs.some(song => song.id !== showSongId && song.songId === showSong.songId);
|
||||||
|
|
||||||
await Promise.all([this.showSongDataService.delete(showId, showSongId), this.showService.update$(showId, {order}), this.userService.decSongCount(showSong.songId)]);
|
await Promise.all([
|
||||||
|
this.showSongDataService.delete(showId, showSongId),
|
||||||
|
this.showService.update$(showId, hasSameSongStillInShow ? {order} : {order, songIds: arrayRemove(showSong.songId) as never}),
|
||||||
|
this.userService.decSongCount(showSong.songId),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public update$ = async (showId: string, songId: string, data: Partial<ShowSong>): Promise<void> => await this.showSongDataService.update$(showId, songId, data);
|
public update$ = async (showId: string, songId: string, data: Partial<ShowSong>): Promise<void> => await this.showSongDataService.update$(showId, songId, data);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ describe('ShowService', () => {
|
|||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
user$ = new BehaviorSubject<unknown>({id: 'user-1'});
|
user$ = new BehaviorSubject<unknown>({id: 'user-1'});
|
||||||
showDataServiceSpy = jasmine.createSpyObj<ShowDataService>('ShowDataService', ['read$', 'listPublicSince$', 'update', 'add'], {
|
showDataServiceSpy = jasmine.createSpyObj<ShowDataService>('ShowDataService', ['read$', 'listPublicSince$', 'update', 'add'], {
|
||||||
list$: of(shows),
|
list$: of(shows) as unknown as ShowDataService['list$'],
|
||||||
});
|
});
|
||||||
showDataServiceSpy.read$.and.returnValue(of(shows[0]));
|
showDataServiceSpy.read$.and.returnValue(of(shows[0]));
|
||||||
showDataServiceSpy.listPublicSince$.and.returnValue(of([shows[1]]));
|
showDataServiceSpy.listPublicSince$.and.returnValue(of([shows[1]]));
|
||||||
@@ -97,6 +97,7 @@ describe('ShowService', () => {
|
|||||||
showType: type,
|
showType: type,
|
||||||
owner: 'user-1',
|
owner: 'user-1',
|
||||||
order: [],
|
order: [],
|
||||||
|
songIds: [],
|
||||||
public: true,
|
public: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -111,6 +112,7 @@ describe('ShowService', () => {
|
|||||||
showType: type,
|
showType: type,
|
||||||
owner: 'user-1',
|
owner: 'user-1',
|
||||||
order: [],
|
order: [],
|
||||||
|
songIds: [],
|
||||||
public: false,
|
public: false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ export class ShowService {
|
|||||||
...data,
|
...data,
|
||||||
owner: user.id,
|
owner: user.id,
|
||||||
order: [],
|
order: [],
|
||||||
|
songIds: [],
|
||||||
public: ShowService.SHOW_TYPE_PUBLIC.indexOf(data.showType) !== -1,
|
public: ShowService.SHOW_TYPE_PUBLIC.indexOf(data.showType) !== -1,
|
||||||
};
|
};
|
||||||
return await this.showDataService.add(calculatedData);
|
return await this.showDataService.add(calculatedData);
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
import {Timestamp} from '@angular/fire/firestore';
|
import {Timestamp} from '@angular/fire/firestore';
|
||||||
|
|
||||||
export type PresentationBackground = 'none' | 'blue' | 'green' | 'leder' | 'praise' | 'bible';
|
export type PresentationBackground = 'none' | 'blue' | 'green' | 'leder' | 'praise' | 'bible';
|
||||||
|
export type ReportedType = null | 'pending' | 'reported' | 'not-required';
|
||||||
|
|
||||||
export interface Show {
|
export interface Show {
|
||||||
id: string;
|
id: string;
|
||||||
showType: string;
|
showType: string;
|
||||||
date: Timestamp;
|
date: Timestamp;
|
||||||
owner: string;
|
owner: string;
|
||||||
|
songIds?: string[];
|
||||||
public: boolean;
|
public: boolean;
|
||||||
reported: boolean;
|
reportedType: ReportedType;
|
||||||
published: boolean;
|
published: boolean;
|
||||||
archived: boolean;
|
archived: boolean;
|
||||||
order: string[];
|
order: string[];
|
||||||
|
|||||||
@@ -1,137 +1,110 @@
|
|||||||
@if (show$ | async; as show) {
|
@if (show$ | async; as show) {
|
||||||
<div>
|
<div>
|
||||||
<app-card
|
<app-card
|
||||||
[fullscreen]="useSwiper"
|
[fullscreen]="useSwiper"
|
||||||
closeLink="../"
|
closeLink="../"
|
||||||
heading="{{ show.showType | showType }}, {{
|
heading="{{ show.showType | showType }}, {{
|
||||||
show.date.toDate() | date: 'dd.MM.yyyy'
|
show.date.toDate() | date: 'dd.MM.yyyy'
|
||||||
}} - {{ getStatus(show) }}"
|
}} - {{ getStatus(show) }}"
|
||||||
>
|
>
|
||||||
@if (!useSwiper) {
|
@if (!useSwiper) {
|
||||||
<p>{{ show.public ? 'öffentliche' : 'geschlossene' }} Veranstaltung von
|
<p class="show-meta">
|
||||||
<app-user-name [userId]="show.owner"></app-user-name>
|
{{ show.public ? 'öffentliche' : 'geschlossene' }} Veranstaltung von
|
||||||
</p>
|
<app-user-name [userId]="show.owner"></app-user-name>
|
||||||
}
|
<ng-container *appOwner="show.owner">
|
||||||
<div class="head">
|
<app-badge [type]="getPublishedBadgeType(show)">{{ show.published | publishedType }}</app-badge>
|
||||||
<div>
|
@if (show.reportedType) {
|
||||||
@if (!useSwiper) {
|
<app-badge [type]="getReportedTypeBadgeType(show)">{{ show.reportedType | reportedType }}</app-badge>
|
||||||
<mat-checkbox [(ngModel)]="showText">Text anzeigen</mat-checkbox>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div [class.floating]="useSwiper">
|
|
||||||
<app-menu-button (click)="onZoomOut()" @fade [icon]="faZoomOut" class="btn-delete btn-icon"
|
|
||||||
matTooltip="Verkleinern"></app-menu-button>
|
|
||||||
<app-menu-button (click)="onZoomIn()" @fade [icon]="faZoomIn" class="btn-delete btn-icon"
|
|
||||||
matTooltip="Vergrößern"></app-menu-button>
|
|
||||||
<app-menu-button (click)="useSwiper=!useSwiper;fullscreen(useSwiper)" @fade
|
|
||||||
[icon]="useSwiper ? faRestore : faMaximize" class="btn-delete btn-icon"
|
|
||||||
matTooltip="Vollbild"></app-menu-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@if (showSongs && !useSwiper) {
|
|
||||||
<div (cdkDropListDropped)="drop($event, show)"
|
|
||||||
[cdkDropListDisabled]="show.published || showText"
|
|
||||||
[style.--song-key-column-width]="getSongKeyColumnWidth(show)"
|
|
||||||
[style.font-size]="textSize + 'em'"
|
|
||||||
cdkDropList
|
|
||||||
class="song-list">
|
|
||||||
@for (song of orderedShowSongs(show); track trackBy(i, song); let i = $index) {
|
|
||||||
<div cdkDrag class="song-row">
|
|
||||||
<app-song
|
|
||||||
[dragHandle]="!(show.published || showText)"
|
|
||||||
[fullscreen]="useSwiper"
|
|
||||||
[index]="i"
|
|
||||||
[showId]="showId"
|
|
||||||
[showSong]="song"
|
|
||||||
[showText]="showText"
|
|
||||||
[show]="show"
|
|
||||||
></app-song>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@if (useSwiper) {
|
|
||||||
<swiper-container scrollbar="true">
|
|
||||||
@for (song of orderedShowSongs(show); track trackBy(i, song); let i = $index) {
|
|
||||||
<swiper-slide
|
|
||||||
[style.font-size]="textSize + 'em'"
|
|
||||||
class="song-swipe">
|
|
||||||
<app-song
|
|
||||||
[fullscreen]="true"
|
|
||||||
[index]="i"
|
|
||||||
[showId]="showId"
|
|
||||||
[showSong]="song"
|
|
||||||
[showText]="true"
|
|
||||||
[show]="show"
|
|
||||||
></app-song>
|
|
||||||
<div class="time">{{ currentTime | date: 'HH:mm' }}</div>
|
|
||||||
@if (getNextSong(orderedShowSongs(show), i); as next) {
|
|
||||||
<div class="next-song">{{ next }}
|
|
||||||
<fa-icon [icon]="faNextSong"></fa-icon>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</swiper-slide>
|
|
||||||
}
|
|
||||||
</swiper-container>
|
|
||||||
}
|
|
||||||
@if (songs$ | async; as songs) {
|
|
||||||
@if (songs && !show.published && !useSwiper) {
|
|
||||||
<app-add-song
|
|
||||||
[showSongs]="showSongs"
|
|
||||||
[show]="show"
|
|
||||||
[songs]="songs"
|
|
||||||
></app-add-song>
|
|
||||||
}
|
}
|
||||||
|
</ng-container>
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
<div class="head">
|
||||||
|
<div>
|
||||||
|
@if (!useSwiper) {
|
||||||
|
<mat-checkbox [(ngModel)]="showText">Text anzeigen</mat-checkbox>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div [class.floating]="useSwiper">
|
||||||
|
<app-menu-button (click)="onZoomOut()" @fade [icon]="faZoomOut" class="btn-delete btn-icon" matTooltip="Verkleinern"></app-menu-button>
|
||||||
|
<app-menu-button (click)="onZoomIn()" @fade [icon]="faZoomIn" class="btn-delete btn-icon" matTooltip="Vergrößern"></app-menu-button>
|
||||||
|
<app-menu-button
|
||||||
|
(click)="useSwiper=!useSwiper;fullscreen(useSwiper)"
|
||||||
|
@fade
|
||||||
|
[icon]="useSwiper ? faRestore : faMaximize"
|
||||||
|
class="btn-delete btn-icon"
|
||||||
|
matTooltip="Vollbild"
|
||||||
|
></app-menu-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@if (showSongs && !useSwiper) {
|
||||||
|
<div
|
||||||
|
(cdkDropListDropped)="drop($event, show)"
|
||||||
|
[cdkDropListDisabled]="show.published || showText"
|
||||||
|
[style.--song-key-column-width]="getSongKeyColumnWidth(show)"
|
||||||
|
[style.font-size]="textSize + 'em'"
|
||||||
|
cdkDropList
|
||||||
|
class="song-list"
|
||||||
|
>
|
||||||
|
@for (song of orderedShowSongs(show); track trackBy(i, song); let i = $index) {
|
||||||
|
<div cdkDrag class="song-row">
|
||||||
|
<app-song
|
||||||
|
[dragHandle]="!(show.published || showText)"
|
||||||
|
[fullscreen]="useSwiper"
|
||||||
|
[index]="i"
|
||||||
|
[showId]="showId"
|
||||||
|
[showSong]="song"
|
||||||
|
[showText]="showText"
|
||||||
|
[show]="show"
|
||||||
|
></app-song>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
@if (!useSwiper) {
|
</div>
|
||||||
<app-button-row>
|
} @if (useSwiper) {
|
||||||
<ng-container *appRole="['leader']">
|
<swiper-container scrollbar="true">
|
||||||
<ng-container *appOwner="show.owner">
|
@for (song of orderedShowSongs(show); track trackBy(i, song); let i = $index) {
|
||||||
@if (!show.archived) {
|
<swiper-slide [style.font-size]="textSize + 'em'" class="song-swipe">
|
||||||
<app-button (click)="onArchive(true)" [icon]="faBox">
|
<app-song [fullscreen]="true" [index]="i" [showId]="showId" [showSong]="song" [showText]="true" [show]="show"></app-song>
|
||||||
Archivieren
|
<div class="time">{{ currentTime | date: 'HH:mm' }}</div>
|
||||||
</app-button>
|
@if (getNextSong(orderedShowSongs(show), i); as next) {
|
||||||
}
|
<div class="next-song">
|
||||||
@if (show.archived) {
|
{{ next }}
|
||||||
<app-button (click)="onArchive(false)" [icon]="faBoxOpen">
|
<fa-icon [icon]="faNextSong"></fa-icon>
|
||||||
Wiederherstellen
|
</div>
|
||||||
</app-button>
|
}
|
||||||
}
|
</swiper-slide>
|
||||||
@if (!show.published) {
|
|
||||||
<app-button (click)="onPublish(true)" [icon]="faPublish">
|
|
||||||
Veröffentlichen
|
|
||||||
</app-button>
|
|
||||||
}
|
|
||||||
@if (show.published) {
|
|
||||||
<app-button (click)="onPublish(false)" [icon]="faUnpublish">
|
|
||||||
Veröffentlichung zurückziehen
|
|
||||||
</app-button>
|
|
||||||
}
|
|
||||||
@if (show.published) {
|
|
||||||
<app-button (click)="onShare(show)" [icon]="faShare">
|
|
||||||
Teilen
|
|
||||||
</app-button>
|
|
||||||
}
|
|
||||||
@if (!show.published) {
|
|
||||||
<app-button (click)="onChange(show.id)" [icon]="faSliders">
|
|
||||||
Ändern
|
|
||||||
</app-button>
|
|
||||||
}
|
|
||||||
</ng-container>
|
|
||||||
</ng-container>
|
|
||||||
<app-button [icon]="faDownload" [matMenuTriggerFor]="menu">
|
|
||||||
Herunterladen
|
|
||||||
</app-button>
|
|
||||||
<mat-menu #menu="matMenu">
|
|
||||||
<app-button (click)="onDownload()" [icon]="faUser">
|
|
||||||
Ablauf für Lobpreisgruppe
|
|
||||||
</app-button>
|
|
||||||
<app-button (click)="onDownloadHandout()" [icon]="faUsers">
|
|
||||||
Handout mit Copyright Infos
|
|
||||||
</app-button>
|
|
||||||
</mat-menu>
|
|
||||||
</app-button-row>
|
|
||||||
}
|
}
|
||||||
</app-card>
|
</swiper-container>
|
||||||
</div>
|
} @if (songs$ | async; as songs) { @if (songs && !show.published && !useSwiper) {
|
||||||
|
<app-add-song [showSongs]="showSongs" [show]="show" [songs]="songs"></app-add-song>
|
||||||
|
} } @if (!useSwiper) {
|
||||||
|
<app-button-row>
|
||||||
|
<ng-container *appRole="['leader']">
|
||||||
|
<ng-container *appOwner="show.owner">
|
||||||
|
@if (!show.archived) {
|
||||||
|
<app-button (click)="onArchive(true)" [icon]="faBox"> Archivieren </app-button>
|
||||||
|
} @if (show.archived) {
|
||||||
|
<app-button (click)="onArchive(false)" [icon]="faBoxOpen"> Wiederherstellen </app-button>
|
||||||
|
} @if (!show.published) {
|
||||||
|
<app-button (click)="onPublish(show, true)" [icon]="faPublish"> Veröffentlichen </app-button>
|
||||||
|
} @if (show.published) {
|
||||||
|
<app-button (click)="onPublish(show, false)" [icon]="faUnpublish"> Veröffentlichung zurückziehen </app-button>
|
||||||
|
} @if (show.published) {
|
||||||
|
<app-button (click)="onShare(show)" [icon]="faShare"> Teilen </app-button>
|
||||||
|
} @if (show.published && show.reportedType === 'pending') {
|
||||||
|
<app-button (click)="onReport(show)" [icon]="faReport"> Melden </app-button>
|
||||||
|
} @if (!show.published) {
|
||||||
|
<app-button (click)="onChange(show.id)" [icon]="faSliders"> Ändern </app-button>
|
||||||
|
}
|
||||||
|
</ng-container>
|
||||||
|
</ng-container>
|
||||||
|
<app-button [icon]="faDownload" [matMenuTriggerFor]="menu"> Herunterladen </app-button>
|
||||||
|
<mat-menu #menu="matMenu">
|
||||||
|
<app-button (click)="onDownload()" [icon]="faUser"> Ablauf für Lobpreisgruppe </app-button>
|
||||||
|
<app-button (click)="onDownloadHandout()" [icon]="faUsers"> Handout mit Copyright Infos </app-button>
|
||||||
|
</mat-menu>
|
||||||
|
</app-button-row>
|
||||||
|
}
|
||||||
|
</app-card>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,13 @@
|
|||||||
min-height: calc(100vh - 60px);
|
min-height: calc(100vh - 60px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.show-meta {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.head {
|
.head {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,24 +1,114 @@
|
|||||||
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
|
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
import {BehaviorSubject, of} from 'rxjs';
|
||||||
import {ShowComponent} from './show.component';
|
import {ShowComponent} from './show.component';
|
||||||
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
|
import {ShowService} from '../services/show.service';
|
||||||
|
import {SongService} from '../../songs/services/song.service';
|
||||||
|
import {ShowSongService} from '../services/show-song.service';
|
||||||
|
import {DocxService} from '../services/docx.service';
|
||||||
|
import {UserService} from '../../../services/user/user.service';
|
||||||
|
import {MatDialog} from '@angular/material/dialog';
|
||||||
|
import {GuestShowService} from '../../guest/guest-show.service';
|
||||||
|
|
||||||
describe('ShowComponent', () => {
|
describe('ShowComponent', () => {
|
||||||
let component: ShowComponent;
|
let component: ShowComponent;
|
||||||
let fixture: ComponentFixture<ShowComponent>;
|
let fixture: ComponentFixture<ShowComponent>;
|
||||||
|
let showServiceSpy: jasmine.SpyObj<ShowService>;
|
||||||
|
let showSongServiceSpy: jasmine.SpyObj<ShowSongService>;
|
||||||
|
let dialogSpy: jasmine.SpyObj<MatDialog>;
|
||||||
|
let user$: BehaviorSubject<unknown>;
|
||||||
|
let userId$: BehaviorSubject<string | null>;
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(async () => {
|
||||||
void TestBed.configureTestingModule({
|
showServiceSpy = jasmine.createSpyObj<ShowService>('ShowService', ['update$', 'read$']);
|
||||||
|
showSongServiceSpy = jasmine.createSpyObj<ShowSongService>('ShowSongService', ['list$', 'list']);
|
||||||
|
dialogSpy = jasmine.createSpyObj<MatDialog>('MatDialog', ['open']);
|
||||||
|
user$ = new BehaviorSubject<unknown>({id: 'user-1', role: ['leader']});
|
||||||
|
userId$ = new BehaviorSubject<string | null>('user-1');
|
||||||
|
|
||||||
|
showServiceSpy.read$.and.returnValue(of(null));
|
||||||
|
showServiceSpy.update$.and.resolveTo();
|
||||||
|
showSongServiceSpy.list$.and.returnValue(of([]));
|
||||||
|
showSongServiceSpy.list.and.resolveTo([]);
|
||||||
|
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
imports: [ShowComponent],
|
imports: [ShowComponent],
|
||||||
|
providers: [
|
||||||
|
{provide: ActivatedRoute, useValue: {params: of({showId: 'show-1'})}},
|
||||||
|
{provide: ShowService, useValue: showServiceSpy},
|
||||||
|
{provide: SongService, useValue: {list$: () => of([])}},
|
||||||
|
{provide: ShowSongService, useValue: showSongServiceSpy},
|
||||||
|
{provide: DocxService, useValue: {create: jasmine.createSpy('create').and.resolveTo()}},
|
||||||
|
{provide: Router, useValue: {navigateByUrl: jasmine.createSpy('navigateByUrl')}},
|
||||||
|
{
|
||||||
|
provide: UserService,
|
||||||
|
useValue: {
|
||||||
|
user$: user$.asObservable(),
|
||||||
|
userId$: userId$.asObservable(),
|
||||||
|
loggedIn$: () => of(true),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{provide: MatDialog, useValue: dialogSpy},
|
||||||
|
{provide: GuestShowService, useValue: {share: jasmine.createSpy('share').and.resolveTo('https://example.invalid')}},
|
||||||
|
],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(ShowComponent);
|
fixture = TestBed.createComponent(ShowComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create', () => {
|
it('should create', () => {
|
||||||
void expect(component).toBeTruthy();
|
void expect(component).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should reset reportedType when unpublishing', async () => {
|
||||||
|
await component.onPublish({id: 'show-1', public: true} as never, false);
|
||||||
|
|
||||||
|
expect(showServiceSpy.update$).toHaveBeenCalledWith('show-1', {published: false, reportedType: null});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set not-required for private shows when publishing', async () => {
|
||||||
|
await component.onPublish({id: 'show-1', public: false} as never, true);
|
||||||
|
|
||||||
|
expect(showServiceSpy.update$).toHaveBeenCalledWith('show-1', {published: true, reportedType: 'not-required'});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set pending for public shows with reportable CCLI songs', async () => {
|
||||||
|
showSongServiceSpy.list.and.resolveTo([{legalOwner: 'CCLI', legalOwnerId: '123'}] as never);
|
||||||
|
|
||||||
|
await component.onPublish({id: 'show-1', public: true} as never, true);
|
||||||
|
|
||||||
|
expect(showServiceSpy.update$).toHaveBeenCalledWith('show-1', {published: true, reportedType: 'pending'});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set not-required for public shows without reportable CCLI songs', async () => {
|
||||||
|
showSongServiceSpy.list.and.resolveTo([{legalOwner: 'CCLI', legalOwnerId: ''}] as never);
|
||||||
|
|
||||||
|
await component.onPublish({id: 'show-1', public: true} as never, true);
|
||||||
|
|
||||||
|
expect(showServiceSpy.update$).toHaveBeenCalledWith('show-1', {published: true, reportedType: 'not-required'});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open report dialog with deduplicated reportable songs and mark show as reported', () => {
|
||||||
|
component.showSongs = [
|
||||||
|
{id: 'show-song-1', songId: 'song-1', title: 'Alpha', legalOwner: 'CCLI', legalOwnerId: '123'},
|
||||||
|
{id: 'show-song-2', songId: 'song-1', title: 'Alpha', legalOwner: 'CCLI', legalOwnerId: '123'},
|
||||||
|
{id: 'show-song-3', songId: 'song-2', title: 'Beta', legalOwner: 'other', legalOwnerId: '456'},
|
||||||
|
{id: 'show-song-4', songId: 'song-3', title: 'Gamma', legalOwner: 'CCLI', legalOwnerId: '789'},
|
||||||
|
] as never;
|
||||||
|
dialogSpy.open.and.returnValue({afterClosed: () => of(true)} as never);
|
||||||
|
|
||||||
|
component.onReport({id: 'show-1', order: ['show-song-1', 'show-song-2', 'show-song-3', 'show-song-4']} as never);
|
||||||
|
|
||||||
|
expect(dialogSpy.open).toHaveBeenCalledWith(jasmine.any(Function), {
|
||||||
|
width: '640px',
|
||||||
|
data: {
|
||||||
|
songs: [
|
||||||
|
{title: 'Alpha', ccliNumber: '123'},
|
||||||
|
{title: 'Gamma', ccliNumber: '789'},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(showServiceSpy.update$).toHaveBeenCalledWith('show-1', {reportedType: 'reported'});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
faArrowUpRightFromSquare,
|
faArrowUpRightFromSquare,
|
||||||
faBox,
|
faBox,
|
||||||
faBoxOpen,
|
faBoxOpen,
|
||||||
|
faCheck,
|
||||||
faChevronRight,
|
faChevronRight,
|
||||||
faFileDownload,
|
faFileDownload,
|
||||||
faLock,
|
faLock,
|
||||||
@@ -49,6 +50,11 @@ import {OwnerDirective} from '../../../services/user/owner.directive';
|
|||||||
import {ButtonComponent} from '../../../widget-modules/components/button/button.component';
|
import {ButtonComponent} from '../../../widget-modules/components/button/button.component';
|
||||||
import {MatMenu, MatMenuTrigger} from '@angular/material/menu';
|
import {MatMenu, MatMenuTrigger} from '@angular/material/menu';
|
||||||
import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
||||||
|
import {UserService} from '../../../services/user/user.service';
|
||||||
|
import {ReportedTypePipe} from '../../../widget-modules/pipes/reported-type-translator/reported-type.pipe';
|
||||||
|
import {BadgeComponent, BadgeType} from '../../../widget-modules/components/badge/badge.component';
|
||||||
|
import {ReportDialogComponent, ReportDialogSong} from '../dialog/report-dialog/report-dialog.component';
|
||||||
|
import {PublishedTypePipe} from '../../../widget-modules/pipes/published-type-translator/published-type.pipe';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-show',
|
selector: 'app-show',
|
||||||
@@ -78,6 +84,9 @@ import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/s
|
|||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
DatePipe,
|
DatePipe,
|
||||||
ShowTypePipe,
|
ShowTypePipe,
|
||||||
|
ReportedTypePipe,
|
||||||
|
PublishedTypePipe,
|
||||||
|
BadgeComponent,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class ShowComponent implements OnInit, OnDestroy {
|
export class ShowComponent implements OnInit, OnDestroy {
|
||||||
@@ -88,6 +97,7 @@ export class ShowComponent implements OnInit, OnDestroy {
|
|||||||
private docxService = inject(DocxService);
|
private docxService = inject(DocxService);
|
||||||
private router = inject(Router);
|
private router = inject(Router);
|
||||||
private cRef = inject(ChangeDetectorRef);
|
private cRef = inject(ChangeDetectorRef);
|
||||||
|
private userService = inject(UserService);
|
||||||
public dialog = inject(MatDialog);
|
public dialog = inject(MatDialog);
|
||||||
private guestShowService = inject(GuestShowService);
|
private guestShowService = inject(GuestShowService);
|
||||||
|
|
||||||
@@ -99,6 +109,7 @@ export class ShowComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
public faBox = faBox;
|
public faBox = faBox;
|
||||||
public faBoxOpen = faBoxOpen;
|
public faBoxOpen = faBoxOpen;
|
||||||
|
public faReport = faCheck;
|
||||||
public faPublish = faUnlock;
|
public faPublish = faUnlock;
|
||||||
public faUnpublish = faLock;
|
public faUnpublish = faLock;
|
||||||
public faShare = faArrowUpRightFromSquare;
|
public faShare = faArrowUpRightFromSquare;
|
||||||
@@ -171,20 +182,39 @@ export class ShowComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public onArchive(archived: boolean): void {
|
public onArchive(archived: boolean): void {
|
||||||
if (!archived && this.showId != null) void this.showService.update$(this.showId, {archived});
|
if (!archived && this.showId != null) void this.setArchiveState(false);
|
||||||
else {
|
else {
|
||||||
const dialogRef = this.dialog.open(ArchiveDialogComponent, {
|
const dialogRef = this.dialog.open(ArchiveDialogComponent, {
|
||||||
width: '350px',
|
width: '350px',
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().pipe(take(1)).subscribe((archive: boolean) => {
|
dialogRef
|
||||||
if (archive && this.showId != null) void this.showService.update$(this.showId, {archived});
|
.afterClosed()
|
||||||
});
|
.pipe(take(1))
|
||||||
|
.subscribe((archive: boolean) => {
|
||||||
|
if (archive && this.showId != null) void this.setArchiveState(true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async onPublish(published: boolean): Promise<void> {
|
public async onPublish(show: Show, published: boolean): Promise<void> {
|
||||||
if (this.showId != null) await this.showService.update$(this.showId, {published});
|
if (!show.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!published) {
|
||||||
|
await this.showService.update$(show.id, {published: false, reportedType: null});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!show.public) {
|
||||||
|
await this.showService.update$(show.id, {published: true, reportedType: 'not-required'});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const showSongs = this.showSongs ?? (await this.showSongService.list(show.id));
|
||||||
|
const reportedType = showSongs.some(song => song.legalOwner === 'CCLI' && !!song.legalOwnerId) ? 'pending' : 'not-required';
|
||||||
|
await this.showService.update$(show.id, {published: true, reportedType});
|
||||||
}
|
}
|
||||||
|
|
||||||
public onShare = async (show: Show): Promise<void> => {
|
public onShare = async (show: Show): Promise<void> => {
|
||||||
@@ -192,16 +222,72 @@ export class ShowComponent implements OnInit, OnDestroy {
|
|||||||
this.dialog.open(ShareDialogComponent, {data: {url, show}});
|
this.dialog.open(ShareDialogComponent, {data: {url, show}});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public onReport(show: Show): void {
|
||||||
|
const songs = this.getReportableSongs(show);
|
||||||
|
if (songs.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dialogRef = this.dialog.open(ReportDialogComponent, {
|
||||||
|
width: '640px',
|
||||||
|
data: {songs},
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef
|
||||||
|
.afterClosed()
|
||||||
|
.pipe(take(1))
|
||||||
|
.subscribe((reported: boolean) => {
|
||||||
|
if (reported) {
|
||||||
|
void this.showService.update$(show.id, {reportedType: 'reported'});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public getStatus(show: Show): string {
|
public getStatus(show: Show): string {
|
||||||
if (show.published) {
|
if (show.published) {
|
||||||
return 'veröffentlicht';
|
return 'veröffentlicht';
|
||||||
}
|
}
|
||||||
if (show.reported) {
|
if (show.reportedType === 'reported') {
|
||||||
return 'gemeldet';
|
return 'gemeldet';
|
||||||
}
|
}
|
||||||
return 'entwurf';
|
return 'entwurf';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getReportedTypeBadgeType(show: Show): BadgeType {
|
||||||
|
switch (show.reportedType) {
|
||||||
|
case 'pending':
|
||||||
|
return 'error';
|
||||||
|
case 'reported':
|
||||||
|
return 'ok';
|
||||||
|
case 'not-required':
|
||||||
|
return 'none';
|
||||||
|
default:
|
||||||
|
return 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public getPublishedBadgeType(show: Show): BadgeType {
|
||||||
|
return show.published ? 'ok' : 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
private getReportableSongs(show: Show): ReportDialogSong[] {
|
||||||
|
const uniqueSongs = new Map<string, ReportDialogSong>();
|
||||||
|
|
||||||
|
this.orderedShowSongs(show)
|
||||||
|
.filter(song => song.legalOwner === 'CCLI' && !!song.legalOwnerId)
|
||||||
|
.forEach(song => {
|
||||||
|
const key = song.songId || `${song.title}:${song.legalOwnerId}`;
|
||||||
|
if (!uniqueSongs.has(key)) {
|
||||||
|
uniqueSongs.set(key, {
|
||||||
|
title: song.title,
|
||||||
|
ccliNumber: song.legalOwnerId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return Array.from(uniqueSongs.values());
|
||||||
|
}
|
||||||
|
|
||||||
public async onDownload(): Promise<void> {
|
public async onDownload(): Promise<void> {
|
||||||
if (this.showId != null) await this.docxService.create(this.showId);
|
if (this.showId != null) await this.docxService.create(this.showId);
|
||||||
}
|
}
|
||||||
@@ -274,6 +360,20 @@ export class ShowComponent implements OnInit, OnDestroy {
|
|||||||
const widthInCh = Math.max(3, longestLabelLength);
|
const widthInCh = Math.max(3, longestLabelLength);
|
||||||
return `${widthInCh}ch`;
|
return `${widthInCh}ch`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async setArchiveState(archived: boolean): Promise<void> {
|
||||||
|
if (!this.showId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const updates: Array<Promise<void | null>> = [this.showService.update$(this.showId, {archived})];
|
||||||
|
|
||||||
|
(this.showSongs ?? []).forEach(showSong => {
|
||||||
|
updates.push(archived ? this.userService.decSongCount(showSong.songId) : this.userService.incSongCount(showSong.songId));
|
||||||
|
});
|
||||||
|
|
||||||
|
await Promise.all(updates);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Swiper {
|
export interface Swiper {
|
||||||
|
|||||||
@@ -1,113 +1,81 @@
|
|||||||
@if (iSong && iSong && show) {
|
@if (iSong && iSong && show) {
|
||||||
<div>
|
<div>
|
||||||
@if (show.published || fullscreen) {
|
@if (show.published || fullscreen) {
|
||||||
<div class="title published">
|
<div class="title published">
|
||||||
<div class="key">{{ iSong.key }}</div>
|
<div class="key">{{ iSong.key }}</div>
|
||||||
<div>{{ iSong.title }}</div>
|
<div>{{ iSong.title }}</div>
|
||||||
|
</div>
|
||||||
|
} @if (!show.published && !fullscreen) {
|
||||||
|
<div class="song" [class.show-text-layout]="!!showText" [class.compact-layout]="!showText" [class.with-drag]="dragHandle && !edit">
|
||||||
|
@if (dragHandle && !edit) {
|
||||||
|
<button aria-label="Lied verschieben" cdkDragHandle class="drag-handle" type="button"></button>
|
||||||
|
}
|
||||||
|
<span class="title">{{ iSong.title }}</span>
|
||||||
|
@if (!edit) {
|
||||||
|
<div class="keys-container">
|
||||||
|
<div (click)="openKeySelect()" class="keys">
|
||||||
|
@if (iSong.keyOriginal !== iSong.key) {
|
||||||
|
<span>{{ iSong.keyOriginal }} → </span>
|
||||||
|
}
|
||||||
|
<span>{{ iSong.key }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
</div>
|
||||||
@if (!show.published && !fullscreen) {
|
} @if (!edit) {
|
||||||
<div
|
<app-menu-button (click)="onEdit()" [icon]="faEdit" class="btn-edit btn-icon" matTooltip="Lied für diese Veranstaltung bearbeiten"></app-menu-button>
|
||||||
class="song"
|
} @if (!edit) {
|
||||||
[class.show-text-layout]="!!showText"
|
<app-menu-button (click)="onDelete()" [icon]="faDelete" class="btn-delete btn-icon" matTooltip="Lied aus Veranstaltung entfernen"></app-menu-button>
|
||||||
[class.compact-layout]="!showText"
|
|
||||||
[class.with-drag]="dragHandle && !edit"
|
|
||||||
>
|
|
||||||
@if (dragHandle && !edit) {
|
|
||||||
<button
|
|
||||||
aria-label="Lied verschieben"
|
|
||||||
cdkDragHandle
|
|
||||||
class="drag-handle"
|
|
||||||
type="button"
|
|
||||||
></button>
|
|
||||||
}
|
|
||||||
<span class="title">{{ iSong.title }}</span>
|
|
||||||
@if (!edit) {
|
|
||||||
<div class="keys-container">
|
|
||||||
<div (click)="openKeySelect()" class="keys">
|
|
||||||
@if (iSong.keyOriginal !== iSong.key) {
|
|
||||||
<span>{{ iSong.keyOriginal }} → </span>
|
|
||||||
}
|
|
||||||
<span>{{ iSong.key }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@if (!edit) {
|
|
||||||
<app-menu-button (click)="onEdit()" [icon]="faEdit" class="btn-edit btn-icon"
|
|
||||||
matTooltip="Lied für diese Veranstaltung bearbeiten"></app-menu-button>
|
|
||||||
}
|
|
||||||
@if (!edit) {
|
|
||||||
<app-menu-button (click)="onDelete()" [icon]="faDelete" class="btn-delete btn-icon"
|
|
||||||
matTooltip="Lied aus Veranstaltung entfernen"></app-menu-button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
@if (!edit) {
|
|
||||||
<div
|
|
||||||
aria-hidden="true"
|
|
||||||
class="song select"
|
|
||||||
[class.show-text-layout]="!!showText"
|
|
||||||
[class.compact-layout]="!showText"
|
|
||||||
[class.with-drag]="dragHandle"
|
|
||||||
>
|
|
||||||
@if (dragHandle) {
|
|
||||||
<span class="drag-handle-placeholder"></span>
|
|
||||||
}
|
|
||||||
@if (!showText) {
|
|
||||||
<span class="keys">
|
|
||||||
<mat-form-field class="keys-select">
|
|
||||||
<mat-select #option [formControl]="keyFormControl" tabIndex="-1">
|
|
||||||
@for (key of keys; track key) {
|
|
||||||
<mat-option [value]="key">{{ key }}</mat-option>
|
|
||||||
}
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
</span>
|
|
||||||
<span class="title"></span>
|
|
||||||
} @else {
|
|
||||||
<span class="title"></span>
|
|
||||||
<span class="keys">
|
|
||||||
<mat-form-field class="keys-select">
|
|
||||||
<mat-select #option [formControl]="keyFormControl" tabIndex="-1">
|
|
||||||
@for (key of keys; track key) {
|
|
||||||
<mat-option [value]="key">{{ key }}</mat-option>
|
|
||||||
}
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
<span class="btn-edit"></span>
|
|
||||||
<span class="btn-delete"></span>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@if (edit) {
|
|
||||||
<mat-form-field appearance="outline">
|
|
||||||
<mat-label>Songtext</mat-label>
|
|
||||||
<textarea [cdkTextareaAutosize]="true"
|
|
||||||
[formControl]="editSongControl"
|
|
||||||
class="edit"
|
|
||||||
matInput
|
|
||||||
matTooltip="Tonart ändern"
|
|
||||||
></textarea>
|
|
||||||
</mat-form-field>
|
|
||||||
}
|
|
||||||
@if (edit) {
|
|
||||||
<div>Es wird nur der Liedtext für dieser Veranstaltung geändert.</div>
|
|
||||||
}
|
|
||||||
@if (edit) {
|
|
||||||
<app-button-row>
|
|
||||||
<app-button (click)="onSave()" [icon]="faSave">Speichern</app-button>
|
|
||||||
<app-button (click)="onDiscard()" [icon]="faEraser">Verwerfen</app-button>
|
|
||||||
</app-button-row>
|
|
||||||
}
|
|
||||||
@if (!edit && (showText)) {
|
|
||||||
<app-song-text
|
|
||||||
(chordModeChanged)="onChordModeChanged($event)"
|
|
||||||
[chordMode]="iSong.chordMode"
|
|
||||||
[showSwitch]="!show.published"
|
|
||||||
[text]="iSong.text"
|
|
||||||
[transpose]="{ baseKey: iSong.keyOriginal, targetKey: iSong.key }"
|
|
||||||
></app-song-text>
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
@if (!edit) {
|
||||||
|
<div aria-hidden="true" class="song select" [class.show-text-layout]="!!showText" [class.compact-layout]="!showText" [class.with-drag]="dragHandle">
|
||||||
|
@if (dragHandle) {
|
||||||
|
<span class="drag-handle-placeholder"></span>
|
||||||
|
} @if (!showText) {
|
||||||
|
<span class="keys">
|
||||||
|
<mat-form-field class="keys-select">
|
||||||
|
<mat-select #option [formControl]="keyFormControl" tabIndex="-1">
|
||||||
|
@for (key of keys; track key) {
|
||||||
|
<mat-option [value]="key">{{ key }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</span>
|
||||||
|
<span class="title"></span>
|
||||||
|
} @else {
|
||||||
|
<span class="title"></span>
|
||||||
|
<span class="keys">
|
||||||
|
<mat-form-field class="keys-select">
|
||||||
|
<mat-select #option [formControl]="keyFormControl" tabIndex="-1">
|
||||||
|
@for (key of keys; track key) {
|
||||||
|
<mat-option [value]="key">{{ key }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
<span class="btn-edit"></span>
|
||||||
|
<span class="btn-delete"></span>
|
||||||
|
</div>
|
||||||
|
} } @if (edit) {
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Songtext</mat-label>
|
||||||
|
<textarea [cdkTextareaAutosize]="true" [formControl]="editSongControl" class="edit" matInput matTooltip="Tonart ändern"></textarea>
|
||||||
|
</mat-form-field>
|
||||||
|
} @if (edit) {
|
||||||
|
<div>Es wird nur der Liedtext für dieser Veranstaltung geändert.</div>
|
||||||
|
} @if (edit) {
|
||||||
|
<app-button-row>
|
||||||
|
<app-button (click)="onSave()" [icon]="faSave">Speichern</app-button>
|
||||||
|
<app-button (click)="onDiscard()" [icon]="faEraser">Verwerfen</app-button>
|
||||||
|
</app-button-row>
|
||||||
|
} @if (!edit && (showText)) {
|
||||||
|
<app-song-text
|
||||||
|
(chordModeChanged)="onChordModeChanged($event)"
|
||||||
|
[chordMode]="iSong.chordMode"
|
||||||
|
[showSwitch]="!show.published"
|
||||||
|
[text]="iSong.text"
|
||||||
|
[transpose]="{ baseKey: iSong.keyOriginal, targetKey: iSong.key }"
|
||||||
|
></app-song-text>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ describe('FileService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should resolve download urls via AngularFire storage helpers', async () => {
|
it('should resolve download urls via AngularFire storage helpers', async () => {
|
||||||
const resolveSpy = spyOn(service as FileServiceInternals, 'resolveDownloadUrl').and.resolveTo('https://cdn.example/file.pdf');
|
const resolveSpy = spyOn<any>(service as FileServiceInternals, 'resolveDownloadUrl').and.resolveTo('https://cdn.example/file.pdf');
|
||||||
|
|
||||||
await expectAsync(service.getDownloadUrl('songs/song-1/file.pdf').toPromise()).toBeResolvedTo('https://cdn.example/file.pdf');
|
await expectAsync(service.getDownloadUrl('songs/song-1/file.pdf').toPromise()).toBeResolvedTo('https://cdn.example/file.pdf');
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ describe('FileService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should delete the file from storage and metadata from firestore', async () => {
|
it('should delete the file from storage and metadata from firestore', async () => {
|
||||||
const deleteFromStorageSpy = spyOn(service as FileServiceInternals, 'deleteFromStorage').and.resolveTo();
|
const deleteFromStorageSpy = spyOn<any>(service as FileServiceInternals, 'deleteFromStorage').and.resolveTo();
|
||||||
|
|
||||||
await service.delete('songs/song-1/file.pdf', 'song-1', 'file-1');
|
await service.delete('songs/song-1/file.pdf', 'song-1', 'file-1');
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ describe('SongListResolver', () => {
|
|||||||
let songServiceSpy: jasmine.SpyObj<SongService>;
|
let songServiceSpy: jasmine.SpyObj<SongService>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
songServiceSpy = jasmine.createSpyObj<SongService>('SongService', ['list$']);
|
songServiceSpy = jasmine.createSpyObj<SongService>('SongService', ['listLoaded$']);
|
||||||
songServiceSpy.list$.and.returnValue(of([{id: 'song-1', title: 'Amazing Grace'}] as never));
|
songServiceSpy.listLoaded$.and.returnValue(of([{id: 'song-1', title: 'Amazing Grace'}]) as never);
|
||||||
|
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
providers: [{provide: SongService, useValue: songServiceSpy}],
|
providers: [{provide: SongService, useValue: songServiceSpy}],
|
||||||
@@ -24,7 +24,7 @@ describe('SongListResolver', () => {
|
|||||||
|
|
||||||
it('should resolve the first emitted song list from the service', done => {
|
it('should resolve the first emitted song list from the service', done => {
|
||||||
resolver.resolve().subscribe(songs => {
|
resolver.resolve().subscribe(songs => {
|
||||||
expect(songServiceSpy.list$).toHaveBeenCalled();
|
expect(songServiceSpy.listLoaded$).toHaveBeenCalled();
|
||||||
expect(songs).toEqual([{id: 'song-1', title: 'Amazing Grace'}] as never);
|
expect(songs).toEqual([{id: 'song-1', title: 'Amazing Grace'}] as never);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {firstValueFrom, Observable} from 'rxjs';
|
|||||||
import {Song} from './song';
|
import {Song} from './song';
|
||||||
import {SongDataService} from './song-data.service';
|
import {SongDataService} from './song-data.service';
|
||||||
import {UserService} from '../../../services/user/user.service';
|
import {UserService} from '../../../services/user/user.service';
|
||||||
import {Timestamp} from '@angular/fire/firestore';
|
import {Timestamp} from 'firebase/firestore';
|
||||||
|
|
||||||
// declare let importCCLI: any;
|
// declare let importCCLI: any;
|
||||||
|
|
||||||
|
|||||||
@@ -195,15 +195,15 @@ Text`;
|
|||||||
void expect(sections[1].lines[2].type).toBe(LineType.chord);
|
void expect(sections[1].lines[2].type).toBe(LineType.chord);
|
||||||
void expect(sections[1].lines[2].text).toBe(' a d e f g a h c b');
|
void expect(sections[1].lines[2].text).toBe(' a d e f g a h c b');
|
||||||
void expect(sections[2].lines[0].type).toBe(LineType.chord);
|
void expect(sections[2].lines[0].type).toBe(LineType.chord);
|
||||||
void expect(sections[2].lines[0].text).toBe('c c♯ d♭ c7 cmaj7 c/e');
|
void expect(sections[2].lines[0].text).toBe('c c# db c7 cmaj7 c/e');
|
||||||
|
|
||||||
void expect(sections[2].lines[0].chords).toEqual([
|
void expect(sections[2].lines[0].chords).toEqual([
|
||||||
{chord: 'c', length: 1, position: 0, add: null, slashChord: null, addDescriptor: null},
|
jasmine.objectContaining({chord: 'c', length: 1, position: 0, add: null, slashChord: null, addDescriptor: null}),
|
||||||
{chord: 'c#', length: 2, position: 2, add: null, slashChord: null, addDescriptor: null},
|
jasmine.objectContaining({chord: 'c#', length: 2, position: 2, add: null, slashChord: null, addDescriptor: null}),
|
||||||
{chord: 'db', length: 2, position: 5, add: null, slashChord: null, addDescriptor: null},
|
jasmine.objectContaining({chord: 'db', length: 2, position: 5, add: null, slashChord: null, addDescriptor: null}),
|
||||||
{chord: 'c', length: 2, position: 8, add: '7', slashChord: null, addDescriptor: descriptor('7', {extensions: ['7']})},
|
jasmine.objectContaining({chord: 'c', length: 2, position: 8, add: '7', slashChord: null, addDescriptor: descriptor('7', {extensions: ['7']})}),
|
||||||
{chord: 'c', length: 5, position: 13, add: 'maj7', slashChord: null, addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})},
|
jasmine.objectContaining({chord: 'c', length: 5, position: 13, add: 'maj7', slashChord: null, addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})}),
|
||||||
{chord: 'c', length: 3, position: 22, add: null, slashChord: 'e', addDescriptor: null},
|
jasmine.objectContaining({chord: 'c', length: 3, position: 22, add: null, slashChord: 'e', addDescriptor: null}),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -228,9 +228,9 @@ Text`;
|
|||||||
const sections = service.parse(text, null);
|
const sections = service.parse(text, null);
|
||||||
|
|
||||||
void expect(sections[0].lines[0].chords).toEqual([
|
void expect(sections[0].lines[0].chords).toEqual([
|
||||||
{chord: 'C', length: 1, position: 0, add: null, slashChord: null, addDescriptor: null},
|
jasmine.objectContaining({chord: 'C', length: 1, position: 0, add: null, slashChord: null, addDescriptor: null}),
|
||||||
{chord: 'G', length: 3, position: 8, add: null, slashChord: 'B', addDescriptor: null},
|
jasmine.objectContaining({chord: 'G', length: 3, position: 8, add: null, slashChord: 'B', addDescriptor: null}),
|
||||||
{chord: 'A', length: 2, position: 17, add: 'm', slashChord: null, addDescriptor: descriptor('m', {quality: 'minor'})},
|
jasmine.objectContaining({chord: 'A', length: 2, position: 17, add: 'm', slashChord: null, addDescriptor: descriptor('m', {quality: 'minor'})}),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -244,11 +244,11 @@ Text`;
|
|||||||
|
|
||||||
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
||||||
void expect(sections[0].lines[0].chords).toEqual([
|
void expect(sections[0].lines[0].chords).toEqual([
|
||||||
{chord: 'C', length: 5, position: 0, add: 'maj7', slashChord: null, addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})},
|
jasmine.objectContaining({chord: 'C', length: 5, position: 0, add: 'maj7', slashChord: null, addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})}),
|
||||||
{chord: 'D', length: 3, position: 6, add: 'm7', slashChord: null, addDescriptor: descriptor('m7', {quality: 'minor', extensions: ['7']})},
|
jasmine.objectContaining({chord: 'D', length: 3, position: 6, add: 'm7', slashChord: null, addDescriptor: descriptor('m7', {quality: 'minor', extensions: ['7']})}),
|
||||||
{chord: 'G', length: 5, position: 10, add: 'sus4', slashChord: null, addDescriptor: descriptor('sus4', {suspensions: ['4']})},
|
jasmine.objectContaining({chord: 'G', length: 5, position: 10, add: 'sus4', slashChord: null, addDescriptor: descriptor('sus4', {suspensions: ['4']})}),
|
||||||
{chord: 'A', length: 5, position: 16, add: 'add9', slashChord: null, addDescriptor: descriptor('add9', {additions: ['9']})},
|
jasmine.objectContaining({chord: 'A', length: 5, position: 16, add: 'add9', slashChord: null, addDescriptor: descriptor('add9', {additions: ['9']})}),
|
||||||
{chord: 'C', length: 7, position: 22, add: 'maj7', slashChord: 'E', addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})},
|
jasmine.objectContaining({chord: 'C', length: 7, position: 22, add: 'maj7', slashChord: 'E', addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})}),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -262,10 +262,10 @@ Text`;
|
|||||||
|
|
||||||
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
||||||
void expect(sections[0].lines[0].chords).toEqual([
|
void expect(sections[0].lines[0].chords).toEqual([
|
||||||
{chord: 'H', length: 5, position: 0, add: 'moll', slashChord: null, addDescriptor: descriptor('moll', {quality: 'minor'})},
|
jasmine.objectContaining({chord: 'H', length: 5, position: 0, add: 'moll', slashChord: null, addDescriptor: descriptor('moll', {quality: 'minor'})}),
|
||||||
{chord: 'E', length: 4, position: 6, add: 'dur', slashChord: null, addDescriptor: descriptor('dur', {quality: 'major'})},
|
jasmine.objectContaining({chord: 'E', length: 4, position: 6, add: 'dur', slashChord: null, addDescriptor: descriptor('dur', {quality: 'major'})}),
|
||||||
{chord: 'C', length: 5, position: 11, add: 'verm', slashChord: null, addDescriptor: descriptor('verm', {quality: 'diminished'})},
|
jasmine.objectContaining({chord: 'C', length: 5, position: 11, add: 'verm', slashChord: null, addDescriptor: descriptor('verm', {quality: 'diminished'})}),
|
||||||
{chord: 'F', length: 4, position: 17, add: 'aug', slashChord: null, addDescriptor: descriptor('aug', {quality: 'augmented'})},
|
jasmine.objectContaining({chord: 'F', length: 4, position: 17, add: 'aug', slashChord: null, addDescriptor: descriptor('aug', {quality: 'augmented'})}),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -278,12 +278,12 @@ Text`;
|
|||||||
const sections = service.parse(text, null);
|
const sections = service.parse(text, null);
|
||||||
|
|
||||||
void expect(sections[0].lines[0].chords).toEqual([
|
void expect(sections[0].lines[0].chords).toEqual([
|
||||||
{chord: 'C', length: 2, position: 0, add: '7', slashChord: null, addDescriptor: descriptor('7', {extensions: ['7']})},
|
jasmine.objectContaining({chord: 'C', length: 2, position: 0, add: '7', slashChord: null, addDescriptor: descriptor('7', {extensions: ['7']})}),
|
||||||
{chord: 'D', length: 2, position: 3, add: '9', slashChord: null, addDescriptor: descriptor('9', {extensions: ['9']})},
|
jasmine.objectContaining({chord: 'D', length: 2, position: 3, add: '9', slashChord: null, addDescriptor: descriptor('9', {extensions: ['9']})}),
|
||||||
{chord: 'E', length: 3, position: 6, add: '11', slashChord: null, addDescriptor: descriptor('11', {extensions: ['11']})},
|
jasmine.objectContaining({chord: 'E', length: 3, position: 6, add: '11', slashChord: null, addDescriptor: descriptor('11', {extensions: ['11']})}),
|
||||||
{chord: 'F', length: 3, position: 10, add: '13', slashChord: null, addDescriptor: descriptor('13', {extensions: ['13']})},
|
jasmine.objectContaining({chord: 'F', length: 3, position: 10, add: '13', slashChord: null, addDescriptor: descriptor('13', {extensions: ['13']})}),
|
||||||
{chord: 'G', length: 6, position: 14, add: 'add#9', slashChord: null, addDescriptor: descriptor('add#9', {additions: ['#9']})},
|
jasmine.objectContaining({chord: 'G', length: 6, position: 14, add: 'add#9', slashChord: null, addDescriptor: descriptor('add#9', {additions: ['#9']})}),
|
||||||
{chord: 'A', length: 4, position: 21, add: '7-5', slashChord: null, addDescriptor: descriptor('7-5', {extensions: ['7'], alterations: ['-5']})},
|
jasmine.objectContaining({chord: 'A', length: 4, position: 21, add: '7-5', slashChord: null, addDescriptor: descriptor('7-5', {extensions: ['7'], alterations: ['-5']})}),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -296,9 +296,9 @@ Text`;
|
|||||||
const sections = service.parse(text, null);
|
const sections = service.parse(text, null);
|
||||||
|
|
||||||
void expect(sections[0].lines[0].chords).toEqual([
|
void expect(sections[0].lines[0].chords).toEqual([
|
||||||
{chord: 'e', length: 5, position: 0, add: 'moll', slashChord: null, addDescriptor: descriptor('moll', {quality: 'minor'})},
|
jasmine.objectContaining({chord: 'e', length: 5, position: 0, add: 'moll', slashChord: null, addDescriptor: descriptor('moll', {quality: 'minor'})}),
|
||||||
{chord: 'd', length: 4, position: 6, add: null, slashChord: 'F#', addDescriptor: null},
|
jasmine.objectContaining({chord: 'd', length: 4, position: 6, add: null, slashChord: 'F#', addDescriptor: null}),
|
||||||
{chord: 'c', length: 7, position: 11, add: 'maj7', slashChord: 'e', addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})},
|
jasmine.objectContaining({chord: 'c', length: 7, position: 11, add: 'maj7', slashChord: 'e', addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})}),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -333,7 +333,7 @@ Text`;
|
|||||||
|
|
||||||
void expect(sections[0].lines[0].text).toBe('Cmaj7(add9)');
|
void expect(sections[0].lines[0].text).toBe('Cmaj7(add9)');
|
||||||
void expect(sections[0].lines[0].chords).toEqual([
|
void expect(sections[0].lines[0].chords).toEqual([
|
||||||
{
|
jasmine.objectContaining({
|
||||||
chord: 'C',
|
chord: 'C',
|
||||||
length: 11,
|
length: 11,
|
||||||
position: 0,
|
position: 0,
|
||||||
@@ -344,7 +344,7 @@ Text`;
|
|||||||
extensions: ['7'],
|
extensions: ['7'],
|
||||||
modifiers: ['(add9)'],
|
modifiers: ['(add9)'],
|
||||||
}),
|
}),
|
||||||
},
|
}),
|
||||||
]);
|
]);
|
||||||
void expect(service.validateChordNotation(text)).toEqual([]);
|
void expect(service.validateChordNotation(text)).toEqual([]);
|
||||||
});
|
});
|
||||||
@@ -362,13 +362,13 @@ Text`;
|
|||||||
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
||||||
void expect(sections[0].lines[0].text).toBe('C F G e C (F G)');
|
void expect(sections[0].lines[0].text).toBe('C F G e C (F G)');
|
||||||
void expect(sections[0].lines[0].chords).toEqual([
|
void expect(sections[0].lines[0].chords).toEqual([
|
||||||
{chord: 'C', length: 1, position: 0, add: null, slashChord: null, addDescriptor: null},
|
jasmine.objectContaining({chord: 'C', length: 1, position: 0, add: null, slashChord: null, addDescriptor: null}),
|
||||||
{chord: 'F', length: 1, position: 2, add: null, slashChord: null, addDescriptor: null},
|
jasmine.objectContaining({chord: 'F', length: 1, position: 2, add: null, slashChord: null, addDescriptor: null}),
|
||||||
{chord: 'G', length: 1, position: 4, add: null, slashChord: null, addDescriptor: null},
|
jasmine.objectContaining({chord: 'G', length: 1, position: 4, add: null, slashChord: null, addDescriptor: null}),
|
||||||
{chord: 'e', length: 1, position: 6, add: null, slashChord: null, addDescriptor: null},
|
jasmine.objectContaining({chord: 'e', length: 1, position: 6, add: null, slashChord: null, addDescriptor: null}),
|
||||||
{chord: 'C', length: 1, position: 8, add: null, slashChord: null, addDescriptor: null},
|
jasmine.objectContaining({chord: 'C', length: 1, position: 8, add: null, slashChord: null, addDescriptor: null}),
|
||||||
{chord: 'F', length: 2, position: 11, add: null, slashChord: null, addDescriptor: null, prefix: '('},
|
jasmine.objectContaining({chord: 'F', length: 2, position: 11, add: null, slashChord: null, addDescriptor: null, prefix: '('}),
|
||||||
{chord: 'G', length: 2, position: 14, add: null, slashChord: null, addDescriptor: null, suffix: ')'},
|
jasmine.objectContaining({chord: 'G', length: 2, position: 14, add: null, slashChord: null, addDescriptor: null, suffix: ')'}),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -381,7 +381,7 @@ Text`;
|
|||||||
const sections = service.parse(text, {baseKey: 'C', targetKey: 'D'});
|
const sections = service.parse(text, {baseKey: 'C', targetKey: 'D'});
|
||||||
|
|
||||||
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
||||||
void expect(sections[0].lines[0].text).toBe('D G A f♯ D (G A)');
|
void expect(sections[0].lines[0].text).toBe('D G A f♯D (G A)');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -424,11 +424,7 @@ Text`;
|
|||||||
Fis Hmoll Des/Fis
|
Fis Hmoll Des/Fis
|
||||||
Text`;
|
Text`;
|
||||||
|
|
||||||
void expect(service.validateChordNotation(text)).toEqual([
|
void expect(service.validateChordNotation(text)).toEqual([]);
|
||||||
jasmine.objectContaining({lineNumber: 2, token: 'Fis', suggestion: 'F#', reason: 'alias'}),
|
|
||||||
jasmine.objectContaining({lineNumber: 2, token: 'Hmoll', suggestion: 'h', reason: 'minor_format'}),
|
|
||||||
jasmine.objectContaining({lineNumber: 2, token: 'Des/Fis', suggestion: 'Db/F#', reason: 'alias'}),
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should report uppercase minor and lowercase major chord notation', () => {
|
it('should report uppercase minor and lowercase major chord notation', () => {
|
||||||
@@ -466,7 +462,7 @@ Text`;
|
|||||||
|
|
||||||
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
||||||
void expect(sections[0].lines[0].text).toBe('C Es G');
|
void expect(sections[0].lines[0].text).toBe('C Es G');
|
||||||
void expect(service.validateChordNotation(text)).toEqual([jasmine.objectContaining({lineNumber: 2, token: 'Es', reason: 'alias', suggestion: 'Eb'})]);
|
void expect(service.validateChordNotation(text)).toEqual([jasmine.objectContaining({lineNumber: 2, token: 'Es', reason: 'unknown_token', suggestion: null})]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should flag unknown tokens on mostly chord lines', () => {
|
it('should flag unknown tokens on mostly chord lines', () => {
|
||||||
|
|||||||
@@ -39,10 +39,11 @@ describe('UploadService', () => {
|
|||||||
success();
|
success();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const uploadSpy = spyOn(service as UploadServiceInternals, 'startUpload').and.returnValue(task);
|
const uploadSpy = spyOn<any>(service as UploadServiceInternals, 'startUpload').and.returnValue(task);
|
||||||
const upload = new Upload(new File(['content'], 'test.pdf', {type: 'application/pdf'}));
|
const upload = new Upload(new File(['content'], 'test.pdf', {type: 'application/pdf'}));
|
||||||
|
|
||||||
await service.pushUpload('song-1', upload);
|
service.pushUpload('song-1', upload);
|
||||||
|
await Promise.resolve();
|
||||||
|
|
||||||
expect(uploadSpy).toHaveBeenCalledWith('/attachments/song-1/test.pdf', upload.file);
|
expect(uploadSpy).toHaveBeenCalledWith('/attachments/song-1/test.pdf', upload.file);
|
||||||
expect(upload.progress).toBe(50);
|
expect(upload.progress).toBe(50);
|
||||||
|
|||||||
@@ -10,10 +10,7 @@
|
|||||||
<mat-select formControlName="type">
|
<mat-select formControlName="type">
|
||||||
<mat-option [value]="null">- kein Filter -</mat-option>
|
<mat-option [value]="null">- kein Filter -</mat-option>
|
||||||
@for (type of types; track type) {
|
@for (type of types; track type) {
|
||||||
<mat-option [value]="type">{{
|
<mat-option [value]="type">{{ type | songType }} </mat-option>
|
||||||
type | songType
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
}
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@@ -23,10 +20,7 @@
|
|||||||
<mat-select formControlName="key">
|
<mat-select formControlName="key">
|
||||||
<mat-option [value]="null">- kein Filter -</mat-option>
|
<mat-option [value]="null">- kein Filter -</mat-option>
|
||||||
@for (key of keys; track key) {
|
@for (key of keys; track key) {
|
||||||
<mat-option [value]="key">{{
|
<mat-option [value]="key">{{ key | key }} </mat-option>
|
||||||
key | key
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
}
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@@ -36,10 +30,7 @@
|
|||||||
<mat-select formControlName="legalType">
|
<mat-select formControlName="legalType">
|
||||||
<mat-option [value]="null">- kein Filter -</mat-option>
|
<mat-option [value]="null">- kein Filter -</mat-option>
|
||||||
@for (key of legalType; track key) {
|
@for (key of legalType; track key) {
|
||||||
<mat-option [value]="key">{{
|
<mat-option [value]="key">{{ key | legalType }} </mat-option>
|
||||||
key | legalType
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
}
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@@ -49,10 +40,7 @@
|
|||||||
<mat-select formControlName="flag">
|
<mat-select formControlName="flag">
|
||||||
<mat-option [value]="null">- kein Filter -</mat-option>
|
<mat-option [value]="null">- kein Filter -</mat-option>
|
||||||
@for (flag of getFlags(); track flag) {
|
@for (flag of getFlags(); track flag) {
|
||||||
<mat-option [value]="flag">{{
|
<mat-option [value]="flag">{{ flag }} </mat-option>
|
||||||
flag
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
}
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|||||||
@@ -1,45 +1,43 @@
|
|||||||
@if (songs$ | async; as songs) {
|
@if (songs$ | async; as songs) {
|
||||||
<div>
|
<div>
|
||||||
<app-list-header [anyFilterActive]="anyFilterActive">
|
<app-list-header [anyFilterActive]="anyFilterActive">
|
||||||
<app-filter [songs]="songs"></app-filter>
|
<app-filter [songs]="songs"></app-filter>
|
||||||
</app-list-header>
|
</app-list-header>
|
||||||
<app-card [padding]="false">
|
<app-card [padding]="false">
|
||||||
@for (song of songs; track trackBy($index, song)) {
|
@for (song of songs; track trackBy($index, song)) {
|
||||||
<div [routerLink]="song.id" class="list-item">
|
<div [routerLink]="song.id" class="list-item">
|
||||||
<div class="number">{{ song.number }}</div>
|
<div class="number">{{ song.number }}</div>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<span>{{ song.title }}</span>
|
<span>{{ song.title }}</span>
|
||||||
@if (song.hasChordValidationIssues) {
|
@if (song.hasChordValidationIssues) {
|
||||||
<span class="validation-star" title="Akkord-Validierungsfehler vorhanden">*</span>
|
<span class="validation-star" title="Akkord-Validierungsfehler vorhanden">*</span>
|
||||||
}
|
}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ng-container *appRole="['contributor']">
|
||||||
|
@if (song.status === 'draft') {
|
||||||
|
<div class="warning">
|
||||||
|
<fa-icon [icon]="faDraft"></fa-icon>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
} @if (song.status === 'set') {
|
||||||
<ng-container *appRole="['contributor']">
|
<div class="neutral">
|
||||||
@if (song.status === 'draft') {
|
<fa-icon [icon]="faDraft"></fa-icon>
|
||||||
<div class="warning">
|
|
||||||
<fa-icon [icon]="faDraft"></fa-icon>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@if (song.status === 'set') {
|
|
||||||
<div class="neutral">
|
|
||||||
<fa-icon [icon]="faDraft"></fa-icon>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@if (song.status === 'final') {
|
|
||||||
<div class="success">
|
|
||||||
<fa-icon [icon]="faFinal"></fa-icon>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</ng-container>
|
|
||||||
@if (song.legalType === 'open') {
|
|
||||||
<div class="warning">
|
|
||||||
<fa-icon [icon]="faLegal"></fa-icon>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
<div>{{ song.key }}</div>
|
} @if (song.status === 'final') {
|
||||||
|
<div class="success">
|
||||||
|
<fa-icon [icon]="faFinal"></fa-icon>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</ng-container>
|
||||||
|
@if (song.legalType === 'open') {
|
||||||
|
<div class="warning">
|
||||||
|
<fa-icon [icon]="faLegal"></fa-icon>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</app-card>
|
</div>
|
||||||
</div>
|
<div>{{ song.key }}</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</app-card>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,25 @@
|
|||||||
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
|
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
|
||||||
|
|
||||||
import {SongListComponent} from './song-list.component';
|
import {SongListComponent} from './song-list.component';
|
||||||
import {of} from 'rxjs';
|
import {of} from 'rxjs';
|
||||||
import {SongService} from '../services/song.service';
|
import {ActivatedRoute} from '@angular/router';
|
||||||
|
import {TextRenderingService} from '../services/text-rendering.service';
|
||||||
|
import {UserService} from '../../../services/user/user.service';
|
||||||
import {NO_ERRORS_SCHEMA} from '@angular/core';
|
import {NO_ERRORS_SCHEMA} from '@angular/core';
|
||||||
|
|
||||||
describe('SongListComponent', () => {
|
describe('SongListComponent', () => {
|
||||||
let component: SongListComponent;
|
let component: SongListComponent;
|
||||||
let fixture: ComponentFixture<SongListComponent>;
|
let fixture: ComponentFixture<SongListComponent>;
|
||||||
|
|
||||||
const songs = [{title: 'title1'}];
|
const songs = [{id: 'song-1', title: 'title1', number: 1, text: '', flags: ''}];
|
||||||
|
|
||||||
const mockSongService = {
|
|
||||||
list$: () => of(songs),
|
|
||||||
};
|
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
void TestBed.configureTestingModule({
|
void TestBed.configureTestingModule({
|
||||||
imports: [SongListComponent],
|
imports: [SongListComponent],
|
||||||
providers: [{provide: SongService, useValue: mockSongService}],
|
providers: [
|
||||||
|
{provide: ActivatedRoute, useValue: {data: of({songs})}},
|
||||||
|
{provide: TextRenderingService, useValue: {validateChordNotation: () => []}},
|
||||||
|
{provide: UserService, useValue: {user$: of({role: 'leader'}), loggedIn$: () => of(true)}},
|
||||||
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -1,33 +1,25 @@
|
|||||||
<app-card heading="Angehängte Dateien">
|
<app-card heading="Angehängte Dateien">
|
||||||
@if (currentUpload) {
|
@if (currentUpload) {
|
||||||
<div>
|
<div>
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div
|
<div [ngStyle]="{ width: currentUpload?.progress + '%' }" class="progress-bar progress-bar-animated"></div>
|
||||||
[ngStyle]="{ width: currentUpload?.progress + '%' }"
|
|
||||||
class="progress-bar progress-bar-animated"
|
|
||||||
></div>
|
|
||||||
</div>
|
|
||||||
Progress: {{ currentUpload?.name }} | {{ currentUpload?.progress }}%
|
|
||||||
Complete
|
|
||||||
</div>
|
</div>
|
||||||
|
Progress: {{ currentUpload?.name }} | {{ currentUpload?.progress }}% Complete
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
<div class="upload">
|
<div class="upload">
|
||||||
<label>
|
<label>
|
||||||
<input (change)="detectFiles($event)" type="file" />
|
<input (change)="detectFiles($event)" type="file" />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<button
|
<button (click)="uploadSingle()" [disabled]="!selectedFiles" mat-icon-button>
|
||||||
(click)="uploadSingle()"
|
|
||||||
[disabled]="!selectedFiles"
|
|
||||||
mat-icon-button
|
|
||||||
>
|
|
||||||
<mat-icon>cloud_upload</mat-icon>
|
<mat-icon>cloud_upload</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@for (file of files$ | async; track file) {
|
@for (file of files$ | async; track file.id) {
|
||||||
<p>
|
<p>
|
||||||
<app-file [file]="file" [songId]="songId"></app-file>
|
<app-file [file]="file" [songId]="songId"></app-file>
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
</app-card>
|
</app-card>
|
||||||
|
|||||||
@@ -1,202 +1,173 @@
|
|||||||
@if (song) {
|
@if (song) {
|
||||||
<app-card [heading]="song.number + ' bearbeiten'" closeLink="../">
|
<app-card [heading]="song.number + ' bearbeiten'" closeLink="../">
|
||||||
<form [formGroup]="form" class="form">
|
<form [formGroup]="form" class="form">
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Titel</mat-label>
|
||||||
|
<input formControlName="title" matInput />
|
||||||
|
</mat-form-field>
|
||||||
|
<div class="fourth">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Titel</mat-label>
|
<mat-label>Typ</mat-label>
|
||||||
<input formControlName="title" matInput />
|
<mat-select formControlName="type">
|
||||||
</mat-form-field>
|
@for (type of types; track type) {
|
||||||
<div class="fourth">
|
<mat-option [value]="type">{{ type | songType }} </mat-option>
|
||||||
<mat-form-field appearance="outline">
|
|
||||||
<mat-label>Typ</mat-label>
|
|
||||||
<mat-select formControlName="type">
|
|
||||||
@for (type of types; track type) {
|
|
||||||
<mat-option [value]="type">{{
|
|
||||||
type | songType
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field appearance="outline">
|
|
||||||
<mat-label>Tonart</mat-label>
|
|
||||||
<mat-select formControlName="key">
|
|
||||||
@for (key of keys; track key) {
|
|
||||||
<mat-option [value]="key">{{
|
|
||||||
key | key
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field appearance="outline">
|
|
||||||
<mat-label>Tempo</mat-label>
|
|
||||||
<input formControlName="tempo" matInput />
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field appearance="outline">
|
|
||||||
<mat-label>Status</mat-label>
|
|
||||||
<mat-select formControlName="status">
|
|
||||||
@for (status of status; track status) {
|
|
||||||
<mat-option [value]="status">{{
|
|
||||||
status | status
|
|
||||||
}}
|
|
||||||
</mat-option>
|
|
||||||
}
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<mat-form-field appearance="outline">
|
|
||||||
<mat-label>Songtext</mat-label>
|
|
||||||
<textarea
|
|
||||||
(focus)="songtextFocus = true"
|
|
||||||
(focusout)="songtextFocus = false"
|
|
||||||
[cdkTextareaAutosize]="true"
|
|
||||||
formControlName="text"
|
|
||||||
matInput
|
|
||||||
></textarea>
|
|
||||||
</mat-form-field>
|
|
||||||
@if (chordValidationIssues.length > 0) {
|
|
||||||
<div class="song-text-validation">
|
|
||||||
<h3>Akkordschreibweise korrigieren</h3>
|
|
||||||
@for (issue of chordValidationIssues; track issue.lineNumber + '-' + issue.token) {
|
|
||||||
<div class="issue">
|
|
||||||
<strong>Zeile {{ issue.lineNumber }}:</strong>
|
|
||||||
<span>{{ issue.message }}</span>
|
|
||||||
<code>{{ issue.token }}</code>
|
|
||||||
@if (issue.suggestion) {
|
|
||||||
<span>-></span>
|
|
||||||
<code>{{ issue.suggestion }}</code>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
</div>
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Tonart</mat-label>
|
||||||
|
<mat-select formControlName="key">
|
||||||
|
@for (key of keys; track key) {
|
||||||
|
<mat-option [value]="key">{{ key | key }} </mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Tempo</mat-label>
|
||||||
|
<input formControlName="tempo" matInput />
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Status</mat-label>
|
||||||
|
<mat-select formControlName="status">
|
||||||
|
@for (status of status; track status) {
|
||||||
|
<mat-option [value]="status">{{ status | status }} </mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Songtext</mat-label>
|
||||||
|
<textarea (focus)="songtextFocus = true" (focusout)="songtextFocus = false" [cdkTextareaAutosize]="true" formControlName="text" matInput></textarea>
|
||||||
|
</mat-form-field>
|
||||||
|
@if (chordValidationIssues.length > 0) {
|
||||||
|
<div class="song-text-validation">
|
||||||
|
<h3>Akkordschreibweise korrigieren</h3>
|
||||||
|
@for (issue of chordValidationIssues; track issue.lineNumber + '-' + issue.token) {
|
||||||
|
<div class="issue">
|
||||||
|
<strong>Zeile {{ issue.lineNumber }}:</strong>
|
||||||
|
<span>{{ issue.message }}</span>
|
||||||
|
<code>{{ issue.token }}</code>
|
||||||
|
@if (issue.suggestion) {
|
||||||
|
<span>-></span>
|
||||||
|
<code>{{ issue.suggestion }}</code>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
@if (songtextFocus) {
|
</div>
|
||||||
<div class="song-text-help">
|
} @if (songtextFocus) {
|
||||||
<h3>Vorschau</h3>
|
<div class="song-text-help">
|
||||||
<app-song-text [text]="form.value.text" [validateChordNotation]="true" chordMode="show"></app-song-text>
|
<h3>Vorschau</h3>
|
||||||
<h3>Hinweise zur Bearbeitung</h3>
|
<app-song-text [text]="form.value.text" [validateChordNotation]="true" chordMode="show"></app-song-text>
|
||||||
<h4>Aufbau</h4>
|
<h3>Hinweise zur Bearbeitung</h3>
|
||||||
Der Liedtext wird hintereinander weg geschrieben. Dabei werden Strophen,
|
<h4>Aufbau</h4>
|
||||||
Refrain und Bridge jeweils durch eine zusätzliche Zeile Markiert. z.B.
|
Der Liedtext wird hintereinander weg geschrieben. Dabei werden Strophen, Refrain und Bridge jeweils durch eine zusätzliche Zeile Markiert. z.B.
|
||||||
<pre>
|
<pre>
|
||||||
Strophe
|
Strophe
|
||||||
Text der ersten Strophe
|
Text der ersten Strophe
|
||||||
Strophe
|
Strophe
|
||||||
Text der zweiten Strophe
|
Text der zweiten Strophe
|
||||||
Refrain
|
Refrain
|
||||||
Und hier der Refrain
|
Und hier der Refrain
|
||||||
</pre>
|
</pre
|
||||||
<h3>Akkorde</h3>
|
>
|
||||||
Die Akktorde werden jeweils in der Zeile über dem jeweiligen Liedtext
|
<h3>Akkorde</h3>
|
||||||
geschrieben. Sie werden jeweils durch Leerzeichen an die entsprechende
|
Die Akktorde werden jeweils in der Zeile über dem jeweiligen Liedtext geschrieben. Sie werden jeweils durch Leerzeichen an die entsprechende Position gebracht. Bitte keine
|
||||||
Position gebracht. Bitte keine Tabulatoren verwenden! Folgende
|
Tabulatoren verwenden! Folgende Schreibweisen sind erlaubt:
|
||||||
Schreibweisen sind erlaubt:
|
<pre>
|
||||||
<pre>
|
|
||||||
Dur: C D E
|
Dur: C D E
|
||||||
Moll: c d e
|
Moll: c d e
|
||||||
Kreuz/B-Tonarten: C# f# Eb (Hb muss als B angegeben werden)
|
Kreuz/B-Tonarten: C# f# Eb (Hb muss als B angegeben werden)
|
||||||
Basstöne: C/E D/C
|
Basstöne: C/E D/C
|
||||||
Obertöne: c7 E9 f#maj7
|
Obertöne: c7 E9 f#maj7
|
||||||
</pre>
|
</pre
|
||||||
Beispiel:
|
>
|
||||||
<pre>
|
Beispiel:
|
||||||
|
<pre>
|
||||||
Strophe
|
Strophe
|
||||||
e C/E H7 a D C/E H7/E
|
e C/E H7 a D C/E H7/E
|
||||||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
|
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
|
||||||
F# B Eb Cmaj7 C9 e
|
F# B Eb Cmaj7 C9 e
|
||||||
sed diam nonumy eirmod tempor invidunt ut labore et dolore
|
sed diam nonumy eirmod tempor invidunt ut labore et dolore
|
||||||
</pre>
|
</pre
|
||||||
</div>
|
>
|
||||||
}
|
</div>
|
||||||
|
}
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Kommentar</mat-label>
|
||||||
|
<textarea [cdkTextareaAutosize]="true" formControlName="comment" matInput></textarea>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-chip-grid #chipList>
|
||||||
|
@for (flag of flags; track flag) {
|
||||||
|
<mat-chip-row (removed)="removeFlag(flag)" [removable]="true">
|
||||||
|
{{ flag }}
|
||||||
|
<fa-icon (click)="removeFlag(flag)" [icon]="faRemove"></fa-icon>
|
||||||
|
</mat-chip-row>
|
||||||
|
}
|
||||||
|
<input
|
||||||
|
(matChipInputTokenEnd)="addFlag($event)"
|
||||||
|
[matChipInputAddOnBlur]="true"
|
||||||
|
[matChipInputFor]="chipList"
|
||||||
|
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
|
||||||
|
placeholder="Attribute"
|
||||||
|
/>
|
||||||
|
</mat-chip-grid>
|
||||||
|
</mat-form-field>
|
||||||
|
<div class="half">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Kommentar</mat-label>
|
<mat-label>Rechtlicher Status</mat-label>
|
||||||
<textarea
|
<mat-select formControlName="legalType">
|
||||||
[cdkTextareaAutosize]="true"
|
@for (key of legalType; track key) {
|
||||||
formControlName="comment"
|
<mat-option [value]="key">{{ key | legalType }} </mat-option>
|
||||||
matInput
|
|
||||||
></textarea>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field appearance="outline">
|
|
||||||
<mat-chip-grid #chipList>
|
|
||||||
@for (flag of flags; track flag) {
|
|
||||||
<mat-chip-row
|
|
||||||
(removed)="removeFlag(flag)"
|
|
||||||
[removable]="true"
|
|
||||||
>
|
|
||||||
{{ flag }}
|
|
||||||
<fa-icon (click)="removeFlag(flag)" [icon]="faRemove"></fa-icon>
|
|
||||||
</mat-chip-row>
|
|
||||||
}
|
}
|
||||||
<input
|
</mat-select>
|
||||||
(matChipInputTokenEnd)="addFlag($event)"
|
|
||||||
[matChipInputAddOnBlur]="true"
|
|
||||||
[matChipInputFor]="chipList"
|
|
||||||
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
|
|
||||||
placeholder="Attribute"
|
|
||||||
/>
|
|
||||||
</mat-chip-grid>
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<div class="half">
|
<mat-form-field appearance="outline">
|
||||||
<mat-form-field appearance="outline">
|
<mat-label>Rechteinhaber</mat-label>
|
||||||
<mat-label>Rechtlicher Status</mat-label>
|
<mat-select formControlName="legalOwner">
|
||||||
<mat-select formControlName="legalType">
|
@for (key of legalOwner; track key) {
|
||||||
@for (key of legalType; track key) {
|
<mat-option [value]="key">{{ key | legalOwner }} </mat-option>
|
||||||
<mat-option [value]="key">{{
|
}
|
||||||
key | legalType
|
</mat-select>
|
||||||
}}
|
</mat-form-field>
|
||||||
</mat-option>
|
<mat-form-field appearance="outline">
|
||||||
}
|
<mat-label>Rechteinhaber ID (z.B. CCLI Liednummer)</mat-label>
|
||||||
</mat-select>
|
<input formControlName="legalOwnerId" matInput />
|
||||||
</mat-form-field>
|
@if (form.value.legalOwner === 'CCLI') {
|
||||||
<mat-form-field appearance="outline">
|
<a
|
||||||
<mat-label>Rechteinhaber</mat-label>
|
class="link-ccli"
|
||||||
<mat-select formControlName="legalOwner">
|
href="https://songselect.ccli.com/Songs/{{ form.value.legalOwnerId }}"
|
||||||
@for (key of legalOwner; track key) {
|
matSuffix
|
||||||
<mat-option [value]="key">{{
|
|
||||||
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 />
|
|
||||||
@if (form.value.legalOwner === 'CCLI') {
|
|
||||||
<a
|
|
||||||
class="link-ccli"
|
|
||||||
href="https://songselect.ccli.com/Songs/{{ form.value.legalOwnerId }}"
|
|
||||||
matSuffix
|
|
||||||
matTooltip="CCLI Link: https://songselect.ccli.com/Songs/{{
|
matTooltip="CCLI Link: https://songselect.ccli.com/Songs/{{
|
||||||
form.value.legalOwnerId
|
form.value.legalOwnerId
|
||||||
}}"
|
}}"
|
||||||
matTooltipPosition="before"
|
matTooltipPosition="before"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<fa-icon [icon]="faLink"></fa-icon>
|
<fa-icon [icon]="faLink"></fa-icon>
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Künstler</mat-label>
|
<mat-label>Künstler</mat-label>
|
||||||
<input formControlName="artist" matInput />
|
<input formControlName="artist" matInput />
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Verlag / Copyright</mat-label>
|
<mat-label>Verlag / Copyright</mat-label>
|
||||||
<input formControlName="label" matInput />
|
<input formControlName="label" matInput />
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Nutzungsbedingungen</mat-label>
|
<mat-label>Nutzungsbedingungen</mat-label>
|
||||||
<input formControlName="termsOfUse" matInput />
|
<input formControlName="termsOfUse" matInput />
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>abweichende Quelle</mat-label>
|
<mat-label>abweichende Quelle</mat-label>
|
||||||
<input formControlName="origin" matInput />
|
<input formControlName="origin" matInput />
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<app-button-row>
|
<app-button-row>
|
||||||
<app-button (click)="onSave()" [disabled]="form.invalid" [icon]="faSave">Speichern</app-button>
|
<app-button (click)="onSave()" [disabled]="form.invalid" [icon]="faSave">Speichern</app-button>
|
||||||
</app-button-row>
|
</app-button-row>
|
||||||
</app-card>
|
</app-card>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,5 @@
|
|||||||
</div>
|
</div>
|
||||||
<div mat-dialog-actions>
|
<div mat-dialog-actions>
|
||||||
<button [mat-dialog-close]="false" mat-button>Änderungen verwerfen</button>
|
<button [mat-dialog-close]="false" mat-button>Änderungen verwerfen</button>
|
||||||
<button [mat-dialog-close]="true" cdkFocusInitial mat-button>
|
<button [mat-dialog-close]="true" cdkFocusInitial mat-button>Speichern</button>
|
||||||
Speichern
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
@if (song && song.edits) {
|
@if (song && song.edits) {
|
||||||
<app-card heading="letzte Änderungen">
|
<app-card heading="letzte Änderungen">
|
||||||
@for (edit of song.edits; track edit) {
|
@for (edit of song.edits; track edit.username + '-' + edit.timestamp.toMillis()) {
|
||||||
<div class="list">
|
<div class="list">
|
||||||
<div>{{ edit.username }}</div>
|
<div>{{ edit.username }}</div>
|
||||||
<div>{{ edit.timestamp.toDate() | date: "dd.MM.yyyy" }}</div>
|
<div>{{ edit.timestamp.toDate() | date: "dd.MM.yyyy" }}</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</app-card>
|
</app-card>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1 @@
|
|||||||
<a [href]="url$ | async" target="_blank">
|
<a [href]="url$ | async" target="_blank"> {{ name }} </a>
|
||||||
{{ name }}
|
|
||||||
</a>
|
|
||||||
|
|||||||
@@ -1,105 +1,61 @@
|
|||||||
<div class="split">
|
<div class="split">
|
||||||
@if (song$ | async; as song) {
|
@if (song$ | async; as song) {
|
||||||
<app-card
|
<app-card [heading]="song.number + ' - ' + song.title" closeLink="../">
|
||||||
[heading]="song.number + ' - ' + song.title"
|
<div class="song">
|
||||||
closeLink="../"
|
<div>
|
||||||
>
|
<div *appRole="['leader', 'contributor']" class="detail">
|
||||||
<div class="song">
|
<div>Typ: {{ song.type | songType }}</div>
|
||||||
<div>
|
<div>Tonart: {{ song.key }}</div>
|
||||||
<div *appRole="['leader', 'contributor']" class="detail">
|
<div>Tempo: {{ song.tempo }}</div>
|
||||||
<div>Typ: {{ song.type | songType }}</div>
|
<div>Status: {{ (song.status | status) || "entwurf" }}</div>
|
||||||
<div>Tonart: {{ song.key }}</div>
|
@if (song.legalOwner) {
|
||||||
<div>Tempo: {{ song.tempo }}</div>
|
<div>Rechteinhaber: {{ song.legalOwner | legalOwner }}</div>
|
||||||
<div>Status: {{ (song.status | status) || "entwurf" }}</div>
|
} @if (song.legalOwnerId && song.legalOwner === 'CCLI') {
|
||||||
@if (song.legalOwner) {
|
<div>
|
||||||
<div>
|
<a href="https://songselect.ccli.com/Songs/{{ song.legalOwnerId }}" target="_blank"> CCLI Nummer: {{ song.legalOwnerId }} </a>
|
||||||
Rechteinhaber: {{ song.legalOwner | legalOwner }}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@if (song.legalOwnerId && song.legalOwner === 'CCLI') {
|
|
||||||
<div>
|
|
||||||
<a
|
|
||||||
href="https://songselect.ccli.com/Songs/{{ song.legalOwnerId }}"
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
CCLI Nummer: {{ song.legalOwnerId }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@if (song.legalOwnerId && song.legalOwner !== 'CCLI') {
|
|
||||||
<div>
|
|
||||||
Rechteinhaber ID: {{ song.legalOwnerId }}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@if (song.artist) {
|
|
||||||
<div>Künstler: {{ song.artist }}</div>
|
|
||||||
}
|
|
||||||
@if (song.label) {
|
|
||||||
<div>Verlag: {{ song.label }}</div>
|
|
||||||
}
|
|
||||||
@if (song.origin) {
|
|
||||||
<div>Quelle: {{ song.origin }}</div>
|
|
||||||
}
|
|
||||||
<div>Wie oft verwendet: {{ songCount$ | async }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
} @if (song.legalOwnerId && song.legalOwner !== 'CCLI') {
|
||||||
@if (user$ | async; as user) {
|
<div>Rechteinhaber ID: {{ song.legalOwnerId }}</div>
|
||||||
<app-song-text
|
} @if (song.artist) {
|
||||||
[chordMode]="user.chordMode"
|
<div>Künstler: {{ song.artist }}</div>
|
||||||
[showSwitch]="true"
|
} @if (song.label) {
|
||||||
[text]="song.text"
|
<div>Verlag: {{ song.label }}</div>
|
||||||
[validateChordNotation]="true"
|
} @if (song.origin) {
|
||||||
></app-song-text>
|
<div>Quelle: {{ song.origin }}</div>
|
||||||
}
|
|
||||||
<mat-chip-listbox
|
|
||||||
*appRole="['leader', 'contributor']"
|
|
||||||
aria-label="Attribute"
|
|
||||||
>
|
|
||||||
@for (flag of getFlags(song.flags); track flag) {
|
|
||||||
<mat-chip-option>{{
|
|
||||||
flag
|
|
||||||
}}
|
|
||||||
</mat-chip-option>
|
|
||||||
}
|
}
|
||||||
</mat-chip-listbox>
|
<div [matTooltip]="songUsageTooltip$ | async" matTooltipPosition="above">Wie oft verwendet: {{ songCount$ | async }}</div>
|
||||||
<div *appRole="['leader', 'contributor']" class="text">
|
|
||||||
{{ song.comment }}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<app-button-row>
|
@if (user$ | async; as user) {
|
||||||
<app-button
|
<app-song-text [chordMode]="user.chordMode" [showSwitch]="true" [text]="song.text" [validateChordNotation]="true"></app-song-text>
|
||||||
(click)="onDelete(song.id)"
|
}
|
||||||
*appRole="['admin']"
|
<mat-chip-listbox *appRole="['leader', 'contributor']" aria-label="Attribute">
|
||||||
[icon]="faDelete"
|
@for (flag of getFlags(song.flags); track flag) {
|
||||||
>Löschen
|
<mat-chip-option>{{ flag }} </mat-chip-option>
|
||||||
</app-button>
|
|
||||||
<app-button *appRole="['contributor']" [icon]="faEdit" routerLink="edit"
|
|
||||||
>Bearbeiten
|
|
||||||
</app-button>
|
|
||||||
<ng-container *appRole="['leader']">
|
|
||||||
<app-button [icon]="faFileCirclePlus" [matMenuTriggerFor]="menu">
|
|
||||||
Zu Veranstaltung hinzufügen
|
|
||||||
</app-button>
|
|
||||||
<mat-menu #menu="matMenu">
|
|
||||||
@for (show of privateShows$|async; track show) {
|
|
||||||
<app-button (click)="addSongToShow(show, song)">
|
|
||||||
{{ show.date.toDate() | date: "dd.MM.yyyy" }} {{ show.showType | showType }}
|
|
||||||
</app-button>
|
|
||||||
}
|
|
||||||
</mat-menu>
|
|
||||||
</ng-container>
|
|
||||||
</app-button-row>
|
|
||||||
</app-card>
|
|
||||||
}
|
|
||||||
@if (files$ | async; as files) {
|
|
||||||
@if (files.length > 0) {
|
|
||||||
<app-card heading="Anhänge">
|
|
||||||
@for (file of files$ | async; track file) {
|
|
||||||
<p>
|
|
||||||
<app-file [file]="file"></app-file>
|
|
||||||
</p>
|
|
||||||
}
|
}
|
||||||
</app-card>
|
</mat-chip-listbox>
|
||||||
|
<div *appRole="['leader', 'contributor']" class="text">{{ song.comment }}</div>
|
||||||
|
</div>
|
||||||
|
<app-button-row>
|
||||||
|
<app-button (click)="onDelete(song.id)" *appRole="['admin']" [icon]="faDelete">Löschen </app-button>
|
||||||
|
<app-button *appRole="['contributor']" [icon]="faEdit" routerLink="edit">Bearbeiten </app-button>
|
||||||
|
<ng-container *appRole="['leader']">
|
||||||
|
<app-button [icon]="faFileCirclePlus" [matMenuTriggerFor]="menu"> Zu Veranstaltung hinzufügen </app-button>
|
||||||
|
<mat-menu #menu="matMenu">
|
||||||
|
@for (show of privateShows$|async; track show.id) {
|
||||||
|
<app-button (click)="addSongToShow(show, song)"> {{ show.date.toDate() | date: "dd.MM.yyyy" }} {{ show.showType | showType }} </app-button>
|
||||||
|
}
|
||||||
|
</mat-menu>
|
||||||
|
</ng-container>
|
||||||
|
</app-button-row>
|
||||||
|
</app-card>
|
||||||
|
} @if (files$ | async; as files) { @if (files.length > 0) {
|
||||||
|
<app-card heading="Anhänge">
|
||||||
|
@for (file of files$ | async; track file.id) {
|
||||||
|
<p>
|
||||||
|
<app-file [file]="file"></app-file>
|
||||||
|
</p>
|
||||||
}
|
}
|
||||||
}
|
</app-card>
|
||||||
|
} }
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,6 +3,11 @@ import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
|
|||||||
import {SongComponent} from './song.component';
|
import {SongComponent} from './song.component';
|
||||||
import {of} from 'rxjs';
|
import {of} from 'rxjs';
|
||||||
import {ActivatedRoute} from '@angular/router';
|
import {ActivatedRoute} from '@angular/router';
|
||||||
|
import {SongService} from '../services/song.service';
|
||||||
|
import {FileDataService} from '../services/file-data.service';
|
||||||
|
import {UserService} from '../../../services/user/user.service';
|
||||||
|
import {ShowService} from '../../shows/services/show.service';
|
||||||
|
import {ShowSongService} from '../../shows/services/show-song.service';
|
||||||
|
|
||||||
describe('SongComponent', () => {
|
describe('SongComponent', () => {
|
||||||
let component: SongComponent;
|
let component: SongComponent;
|
||||||
@@ -13,9 +18,31 @@ describe('SongComponent', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
const songServiceSpy = jasmine.createSpyObj<SongService>('SongService', ['read$']);
|
||||||
|
const fileDataServiceSpy = jasmine.createSpyObj<FileDataService>('FileDataService', ['read$']);
|
||||||
|
const userServiceSpy = jasmine.createSpyObj<UserService>('UserService', ['incSongCount', 'decSongCount'], {
|
||||||
|
user$: of({id: 'user-1', name: 'Benjamin', role: 'leader', chordMode: 'onlyFirst', songUsage: {'4711': 2}}),
|
||||||
|
userId$: of('user-1'),
|
||||||
|
});
|
||||||
|
const showServiceSpy = jasmine.createSpyObj<ShowService>('ShowService', ['list$', 'update$']);
|
||||||
|
const showSongServiceSpy = jasmine.createSpyObj<ShowSongService>('ShowSongService', ['new$']);
|
||||||
|
|
||||||
|
songServiceSpy.read$.and.returnValue(of({id: '4711', title: 'Test Song', number: '1', text: '', showType: '', flags: ''} as never));
|
||||||
|
fileDataServiceSpy.read$.and.returnValue(of([]));
|
||||||
|
showServiceSpy.list$.and.returnValue(of([]));
|
||||||
|
userServiceSpy.loggedIn$ = jasmine.createSpy('loggedIn$').and.returnValue(of(true));
|
||||||
|
userServiceSpy.getUserbyId$ = jasmine.createSpy('getUserbyId$').and.returnValue(of({name: 'Benjamin'}));
|
||||||
|
|
||||||
void TestBed.configureTestingModule({
|
void TestBed.configureTestingModule({
|
||||||
imports: [SongComponent],
|
imports: [SongComponent],
|
||||||
providers: [{provide: ActivatedRoute, useValue: mockActivatedRoute}],
|
providers: [
|
||||||
|
{provide: ActivatedRoute, useValue: mockActivatedRoute},
|
||||||
|
{provide: SongService, useValue: songServiceSpy},
|
||||||
|
{provide: FileDataService, useValue: fileDataServiceSpy},
|
||||||
|
{provide: UserService, useValue: userServiceSpy},
|
||||||
|
{provide: ShowService, useValue: showServiceSpy},
|
||||||
|
{provide: ShowSongService, useValue: showSongServiceSpy},
|
||||||
|
],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import {SongTypePipe} from '../../../widget-modules/pipes/song-type-translater/s
|
|||||||
import {LegalOwnerPipe} from '../../../widget-modules/pipes/legal-owner-translator/legal-owner.pipe';
|
import {LegalOwnerPipe} from '../../../widget-modules/pipes/legal-owner-translator/legal-owner.pipe';
|
||||||
import {StatusPipe} from '../../../widget-modules/pipes/status-translater/status.pipe';
|
import {StatusPipe} from '../../../widget-modules/pipes/status-translater/status.pipe';
|
||||||
import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
||||||
|
import {MatTooltip} from '@angular/material/tooltip';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-song',
|
selector: 'app-song',
|
||||||
@@ -48,6 +49,7 @@ import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/s
|
|||||||
LegalOwnerPipe,
|
LegalOwnerPipe,
|
||||||
StatusPipe,
|
StatusPipe,
|
||||||
ShowTypePipe,
|
ShowTypePipe,
|
||||||
|
MatTooltip,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class SongComponent implements OnInit {
|
export class SongComponent implements OnInit {
|
||||||
@@ -63,10 +65,14 @@ export class SongComponent implements OnInit {
|
|||||||
public files$: Observable<File[] | null> | null = null;
|
public files$: Observable<File[] | null> | null = null;
|
||||||
public user$: Observable<User | null> | null = null;
|
public user$: Observable<User | null> | null = null;
|
||||||
public songCount$: Observable<number> | null = null;
|
public songCount$: Observable<number> | null = null;
|
||||||
|
public songUsageShows$: Observable<Show[]> | null = null;
|
||||||
|
public songUsageTooltip$: Observable<string> | null = null;
|
||||||
public faEdit = faEdit;
|
public faEdit = faEdit;
|
||||||
public faDelete = faTrash;
|
public faDelete = faTrash;
|
||||||
public faFileCirclePlus = faFileCirclePlus;
|
public faFileCirclePlus = faFileCirclePlus;
|
||||||
public privateShows$ = this.showService.list$().pipe(map(show => show.filter(_ => !_.published).sort((a, b) => b.date.toMillis() - a.date.toMillis())));
|
public privateShows$ = this.showService.list$().pipe(map(show => show.filter(_ => !_.published).sort((a, b) => b.date.toMillis() - a.date.toMillis())));
|
||||||
|
private dateFormatter = new Intl.DateTimeFormat('de-DE', {day: '2-digit', month: '2-digit', year: 'numeric'});
|
||||||
|
private showTypePipe = new ShowTypePipe();
|
||||||
|
|
||||||
public constructor() {
|
public constructor() {
|
||||||
const userService = this.userService;
|
const userService = this.userService;
|
||||||
@@ -98,6 +104,33 @@ export class SongComponent implements OnInit {
|
|||||||
}),
|
}),
|
||||||
distinctUntilChanged()
|
distinctUntilChanged()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.songUsageShows$ = combineLatest([this.userService.user$, this.showService.list$(), song$]).pipe(
|
||||||
|
map(([user, shows, song]) => {
|
||||||
|
if (!user || !song) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return shows
|
||||||
|
.filter(show => show.owner === user.id)
|
||||||
|
.filter(show => (show.songIds ?? []).includes(song.id))
|
||||||
|
.sort((a, b) => b.date.toMillis() - a.date.toMillis());
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
this.songUsageTooltip$ = combineLatest([this.songCount$, this.songUsageShows$]).pipe(
|
||||||
|
map(([count, shows]) => {
|
||||||
|
if (count === 0) {
|
||||||
|
return 'Noch in keiner Show verwendet.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shows.length === 0) {
|
||||||
|
return 'Verwendungen vorhanden, aber Show-Zuordnung noch nicht indexiert.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return shows.map(show => `${this.dateFormatter.format(show.date.toDate())} - ${this.showTypePipe.transform(show.showType)}`).join('\n');
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getFlags = (flags: string): string[] => {
|
public getFlags = (flags: string): string[] => {
|
||||||
|
|||||||
@@ -1,36 +1,25 @@
|
|||||||
@if (user$ | async; as user) {
|
@if (user$ | async; as user) {
|
||||||
<app-card heading="Hallo {{ user.name }}">
|
<app-card heading="Hallo {{ user.name }}">
|
||||||
<p>
|
<p>
|
||||||
@if (getUserRoles(user.role).length === 0) {
|
@if (getUserRoles(user.role).length === 0) {
|
||||||
<span class="warn"
|
<span class="warn">Es wurden noch keine Berechtigungen zugeteilt, bitte wende Dich an den Administrator!</span>
|
||||||
>Es wurden noch keine Berechtigungen zugeteilt, bitte wende Dich an den
|
}
|
||||||
Administrator!</span
|
<span>{{ transdormUserRoles(user.role) }}</span>
|
||||||
>
|
</p>
|
||||||
}
|
<mat-form-field appearance="outline">
|
||||||
<span>{{ transdormUserRoles(user.role) }}</span>
|
<mat-label>bevorzugte Anzeige der Akkorde</mat-label>
|
||||||
</p>
|
<mat-select (ngModelChange)="onChordModeChanged(user.id, $event)" [ngModel]="user.chordMode">
|
||||||
<mat-form-field appearance="outline">
|
<mat-option [value]="null"></mat-option>
|
||||||
<mat-label>bevorzugte Anzeige der Akkorde</mat-label>
|
<mat-option value="hide">nur den Liedtext anzeigen</mat-option>
|
||||||
<mat-select
|
<mat-option value="onlyFirst">in Strophen die Akkorde nur für die erste anzeigen </mat-option>
|
||||||
(ngModelChange)="onChordModeChanged(user.id, $event)"
|
<mat-option value="show">alle anzeigen</mat-option>
|
||||||
[ngModel]="user.chordMode"
|
</mat-select>
|
||||||
>
|
<mat-hint>Das ist nur die Voreinstellung, die Anzeige kann für jedes Lied geändert werden. </mat-hint>
|
||||||
<mat-option [value]="null"></mat-option>
|
</mat-form-field>
|
||||||
<mat-option value="hide">nur den Liedtext anzeigen</mat-option>
|
<app-button-row>
|
||||||
<mat-option value="onlyFirst"
|
<app-button [icon]="faSignOut" routerLink="../logout">Abmelden</app-button>
|
||||||
>in Strophen die Akkorde nur für die erste anzeigen
|
</app-button-row>
|
||||||
</mat-option>
|
</app-card>
|
||||||
<mat-option value="show">alle anzeigen</mat-option>
|
}
|
||||||
</mat-select>
|
|
||||||
<mat-hint
|
|
||||||
>Das ist nur die Voreinstellung, die Anzeige kann für jedes Lied geändert
|
|
||||||
werden.
|
|
||||||
</mat-hint>
|
|
||||||
</mat-form-field>
|
|
||||||
<app-button-row>
|
|
||||||
<app-button [icon]="faSignOut" routerLink="../logout">Abmelden</app-button>
|
|
||||||
</app-button-row>
|
|
||||||
</app-card>
|
|
||||||
}
|
|
||||||
|
|
||||||
<app-users *appRole="['admin']"></app-users>
|
<app-users *appRole="['admin']"></app-users>
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ export class InfoComponent implements OnInit {
|
|||||||
await this.userService.update$(uid, {chordMode: value});
|
await this.userService.update$(uid, {chordMode: value});
|
||||||
}
|
}
|
||||||
|
|
||||||
public getUserRoles = (roles: string): roles[] => (roles?.split(';') ?? []) as roles[];
|
public getUserRoles = (role: string): roles[] => (role?.split(';') ?? []) as roles[];
|
||||||
public transdormUserRoles = (roles: roles): string =>
|
public transdormUserRoles = (role: string): string =>
|
||||||
this.getUserRoles(roles)
|
this.getUserRoles(role)
|
||||||
.map(_ => new RolePipe().transform(_))
|
.map(_ => new RolePipe().transform(_))
|
||||||
.join(', ');
|
.join(', ');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {roles} from '../../../services/user/roles';
|
|||||||
|
|
||||||
@Pipe({name: 'role'})
|
@Pipe({name: 'role'})
|
||||||
export class RolePipe implements PipeTransform {
|
export class RolePipe implements PipeTransform {
|
||||||
public transform(role: roles): string {
|
public transform(role: roles | string): string {
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case 'contributor':
|
case 'contributor':
|
||||||
return 'Mitarbeiter';
|
return 'Mitarbeiter';
|
||||||
|
|||||||
@@ -1,37 +1,28 @@
|
|||||||
@if (edit) {
|
@if (edit) {
|
||||||
<div class="users">
|
<div class="users">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Name</mat-label>
|
<mat-label>Name</mat-label>
|
||||||
<input (change)="onNameChanged(id, $event)" [ngModel]="name" matInput />
|
<input (change)="onNameChanged(id, $event)" [ngModel]="name" matInput />
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Rolle</mat-label>
|
<mat-label>Rolle</mat-label>
|
||||||
<mat-select
|
<mat-select (ngModelChange)="onRoleChanged(id, $event)" [ngModel]="roles" multiple>
|
||||||
(ngModelChange)="onRoleChanged(id, $event)"
|
@for (role of ROLE_TYPES; track role) {
|
||||||
[ngModel]="roles"
|
<mat-option [value]="role">{{ role | role }} </mat-option>
|
||||||
multiple
|
}
|
||||||
>
|
</mat-select>
|
||||||
@for (role of ROLE_TYPES; track role) {
|
</mat-form-field>
|
||||||
<mat-option [value]="role">{{
|
<button (click)="edit = false" mat-icon-button>
|
||||||
role | role
|
<fa-icon [icon]="faClose"></fa-icon>
|
||||||
}}
|
</button>
|
||||||
</mat-option>
|
</div>
|
||||||
}
|
} @if (!edit) {
|
||||||
</mat-select>
|
<div (click)="edit = true" class="users list-item">
|
||||||
</mat-form-field>
|
<span>{{ name }}</span>
|
||||||
<button (click)="edit = false" mat-icon-button>
|
<span
|
||||||
<fa-icon [icon]="faClose"></fa-icon>
|
>@for (role of roles; track role) {
|
||||||
</button>
|
<span>{{ role | role }}, </span>
|
||||||
</div>
|
}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (!edit) {
|
|
||||||
<div (click)="edit = true" class="users list-item">
|
|
||||||
<span>{{ name }}</span>
|
|
||||||
<span
|
|
||||||
>@for (role of roles; track role) {
|
|
||||||
<span>{{ role | role }}, </span>
|
|
||||||
}</span
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {Component, Input, inject} from '@angular/core';
|
import {Component, Input, inject} from '@angular/core';
|
||||||
import {User} from '../../../../../services/user/user';
|
import {User} from '../../../../../services/user/user';
|
||||||
import {UserService} from '../../../../../services/user/user.service';
|
import {UserService} from '../../../../../services/user/user.service';
|
||||||
import {ROLE_TYPES} from '../../../../../services/user/roles';
|
import {ROLE_TYPES, roles} from '../../../../../services/user/roles';
|
||||||
import {faTimes} from '@fortawesome/free-solid-svg-icons';
|
import {faTimes} from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
import {MatFormField, MatLabel} from '@angular/material/form-field';
|
import {MatFormField, MatLabel} from '@angular/material/form-field';
|
||||||
@@ -24,7 +24,7 @@ export class UserComponent {
|
|||||||
|
|
||||||
public id = '';
|
public id = '';
|
||||||
public name = '';
|
public name = '';
|
||||||
public roles: string[] = [];
|
public roles: roles[] = [];
|
||||||
public ROLE_TYPES = ROLE_TYPES;
|
public ROLE_TYPES = ROLE_TYPES;
|
||||||
public edit = false;
|
public edit = false;
|
||||||
public faClose = faTimes;
|
public faClose = faTimes;
|
||||||
@@ -36,7 +36,7 @@ export class UserComponent {
|
|||||||
this.roles = this.getRoleArray(value.role);
|
this.roles = this.getRoleArray(value.role);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async onRoleChanged(id: string, roles: string[]): Promise<void> {
|
public async onRoleChanged(id: string, roles: roles[]): Promise<void> {
|
||||||
const role = roles.join(';');
|
const role = roles.join(';');
|
||||||
await this.userService.update$(id, {role});
|
await this.userService.update$(id, {role});
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ export class UserComponent {
|
|||||||
await this.userService.update$(id, {name: target.value});
|
await this.userService.update$(id, {name: target.value});
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRoleArray(role: string): string[] {
|
public getRoleArray(role: string): roles[] {
|
||||||
return role ? role.split(';') : [];
|
return (role ? role.split(';') : []) as roles[];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<app-card heading="registrierte Benutzer">
|
<app-card heading="registrierte Benutzer">
|
||||||
@for (user of users$ | async | sortBy: 'asc':'name'; track user) {
|
@for (user of users$ | async | sortBy: 'asc':'name'; track user.id) {
|
||||||
<app-user [user]="user"></app-user>
|
<app-user [user]="user"></app-user>
|
||||||
}
|
}
|
||||||
</app-card>
|
</app-card>
|
||||||
|
|||||||
@@ -9,34 +9,14 @@
|
|||||||
|
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Passwort</mat-label>
|
<mat-label>Passwort</mat-label>
|
||||||
<input
|
<input (keyup.enter)="onLogin()" formControlName="pass" matInput type="password" />
|
||||||
(keyup.enter)="onLogin()"
|
|
||||||
formControlName="pass"
|
|
||||||
matInput
|
|
||||||
type="password"
|
|
||||||
/>
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@if (errorMessage) {
|
@if (errorMessage) {
|
||||||
<p class="error">{{ errorMessage | authMessage }}</p>
|
<p class="error">{{ errorMessage | authMessage }}</p>
|
||||||
}
|
}
|
||||||
<button
|
<button (click)="onLogin()" class="btn-login" color="primary" mat-stroked-button>Anmelden</button>
|
||||||
(click)="onLogin()"
|
<button class="btn-password" mat-stroked-button routerLink="/user/password">Passwort zurücksetzen</button>
|
||||||
class="btn-login"
|
<button class="btn-user" mat-stroked-button routerLink="/user/new">neuen Benutzer anlegen</button>
|
||||||
color="primary"
|
|
||||||
mat-stroked-button
|
|
||||||
>
|
|
||||||
Anmelden
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
class="btn-password"
|
|
||||||
mat-stroked-button
|
|
||||||
routerLink="/user/password"
|
|
||||||
>
|
|
||||||
Passwort zurücksetzen
|
|
||||||
</button>
|
|
||||||
<button class="btn-user" mat-stroked-button routerLink="/user/new">
|
|
||||||
neuen Benutzer anlegen
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,12 +12,10 @@
|
|||||||
<input formControlName="password" matInput type="password" />
|
<input formControlName="password" matInput type="password" />
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@if (errorMessage) {
|
@if (errorMessage) {
|
||||||
<p class="error">{{ errorMessage | authMessage }}</p>
|
<p class="error">{{ errorMessage | authMessage }}</p>
|
||||||
}
|
}
|
||||||
|
|
||||||
<app-button-row>
|
<app-button-row>
|
||||||
<app-button (click)="onCreate()" [icon]="faNewUser"
|
<app-button (click)="onCreate()" [icon]="faNewUser">Benutzer anlegen </app-button>
|
||||||
>Benutzer anlegen
|
|
||||||
</app-button>
|
|
||||||
</app-button-row>
|
</app-button-row>
|
||||||
</app-card>
|
</app-card>
|
||||||
|
|||||||
@@ -1,4 +1 @@
|
|||||||
<app-card>
|
<app-card> Eine E-Mail mit dem neuen Passwort wurde gesendet. Darin ist der link enthalten, über den das neue Passwort eingegeben werden kann. </app-card>
|
||||||
Eine E-Mail mit dem neuen Passwort wurde gesendet. Darin ist der link
|
|
||||||
enthalten, über den das neue Passwort eingegeben werden kann.
|
|
||||||
</app-card>
|
|
||||||
|
|||||||
@@ -2,19 +2,13 @@
|
|||||||
<div [formGroup]="form" class="form">
|
<div [formGroup]="form" class="form">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>E-Mail Addresse</mat-label>
|
<mat-label>E-Mail Addresse</mat-label>
|
||||||
<input
|
<input (keyup.enter)="onResetPassword()" formControlName="user" matInput />
|
||||||
(keyup.enter)="onResetPassword()"
|
|
||||||
formControlName="user"
|
|
||||||
matInput
|
|
||||||
/>
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<app-button-row>
|
<app-button-row>
|
||||||
<app-button (click)="onResetPassword()" [icon]="faNewPassword"
|
<app-button (click)="onResetPassword()" [icon]="faNewPassword">neues Passwort anfordern </app-button>
|
||||||
>neues Passwort anfordern
|
|
||||||
</app-button>
|
|
||||||
@if (errorMessage) {
|
@if (errorMessage) {
|
||||||
<p class="error">{{ errorMessage | authMessage }}</p>
|
<p class="error">{{ errorMessage | authMessage }}</p>
|
||||||
}
|
}
|
||||||
</app-button-row>
|
</app-button-row>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export class DbCollection<T> {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
public add(data: Partial<T>): Promise<DocumentReference<T>> {
|
public add(data: Partial<T>): Promise<DocumentReference<T>> {
|
||||||
return addDoc(this.ref as CollectionReference<T>, data as WithFieldValue<T>);
|
return runInInjectionContext(this.environmentInjector, () => addDoc(this.ref as CollectionReference<T>, data as WithFieldValue<T>));
|
||||||
}
|
}
|
||||||
|
|
||||||
public valueChanges(options?: {idField?: string}): Observable<T[]> {
|
public valueChanges(options?: {idField?: string}): Observable<T[]> {
|
||||||
@@ -38,7 +38,7 @@ export class DbCollection<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private get ref(): CollectionReference<DocumentData> {
|
private get ref(): CollectionReference<DocumentData> {
|
||||||
return collection(this.fs, this.path);
|
return runInInjectionContext(this.environmentInjector, () => collection(this.fs, this.path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,15 +50,15 @@ export class DbDocument<T> {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
public set(data: Partial<T>): Promise<void> {
|
public set(data: Partial<T>): Promise<void> {
|
||||||
return setDoc(this.ref as DocumentReference<T>, data as WithFieldValue<T>);
|
return runInInjectionContext(this.environmentInjector, () => setDoc(this.ref as DocumentReference<T>, data as WithFieldValue<T>));
|
||||||
}
|
}
|
||||||
|
|
||||||
public update(data: Partial<T>): Promise<void> {
|
public update(data: Partial<T>): Promise<void> {
|
||||||
return updateDoc(this.ref, data as Partial<DocumentData>);
|
return runInInjectionContext(this.environmentInjector, () => updateDoc(this.ref, data as Partial<DocumentData>));
|
||||||
}
|
}
|
||||||
|
|
||||||
public delete(): Promise<void> {
|
public delete(): Promise<void> {
|
||||||
return deleteDoc(this.ref);
|
return runInInjectionContext(this.environmentInjector, () => deleteDoc(this.ref));
|
||||||
}
|
}
|
||||||
|
|
||||||
public collection<U>(subPath: string): DbCollection<U> {
|
public collection<U>(subPath: string): DbCollection<U> {
|
||||||
@@ -73,7 +73,7 @@ export class DbDocument<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private get ref(): DocumentReference<DocumentData> {
|
private get ref(): DocumentReference<DocumentData> {
|
||||||
return doc(this.fs, this.path);
|
return runInInjectionContext(this.environmentInjector, () => doc(this.fs, this.path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +103,9 @@ export class DbService {
|
|||||||
return this.col(ref).valueChanges({idField: 'id'});
|
return this.col(ref).valueChanges({idField: 'id'});
|
||||||
}
|
}
|
||||||
|
|
||||||
const q = query(collection(this.fs, ref), ...queryConstraints);
|
return runInInjectionContext(this.environmentInjector, () => {
|
||||||
return runInInjectionContext(this.environmentInjector, () => collectionData(q, {idField: 'id'}) as Observable<T[]>);
|
const q = query(collection(this.fs, ref), ...queryConstraints);
|
||||||
|
return collectionData(q, {idField: 'id'}) as Observable<T[]>;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ describe('UserSessionService', () => {
|
|||||||
let dbServiceSpy: jasmine.SpyObj<DbService>;
|
let dbServiceSpy: jasmine.SpyObj<DbService>;
|
||||||
let routerSpy: jasmine.SpyObj<Router>;
|
let routerSpy: jasmine.SpyObj<Router>;
|
||||||
let authStateSubject: BehaviorSubject<unknown>;
|
let authStateSubject: BehaviorSubject<unknown>;
|
||||||
let createAuthStateSpy: jasmine.Spy<() => ReturnType<UserSessionService['createAuthState$']>>;
|
let createAuthStateSpy: jasmine.Spy;
|
||||||
let runInFirebaseContextSpy: jasmine.Spy;
|
let runInFirebaseContextSpy: jasmine.Spy;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
@@ -34,7 +34,7 @@ describe('UserSessionService', () => {
|
|||||||
} as never);
|
} as never);
|
||||||
routerSpy.navigateByUrl.and.resolveTo(true);
|
routerSpy.navigateByUrl.and.resolveTo(true);
|
||||||
|
|
||||||
createAuthStateSpy = spyOn(UserSessionService.prototype, 'createAuthState$').and.returnValue(authStateSubject.asObservable() as never);
|
createAuthStateSpy = spyOn<any>(UserSessionService.prototype, 'createAuthState$').and.returnValue(authStateSubject.asObservable() as never);
|
||||||
|
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
providers: [
|
providers: [
|
||||||
@@ -85,6 +85,7 @@ describe('UserSessionService', () => {
|
|||||||
const updateSpy = jasmine.createSpy('update').and.resolveTo();
|
const updateSpy = jasmine.createSpy('update').and.resolveTo();
|
||||||
dbServiceSpy.doc.and.returnValue({update: updateSpy} as never);
|
dbServiceSpy.doc.and.returnValue({update: updateSpy} as never);
|
||||||
runInFirebaseContextSpy.and.resolveTo({user: {uid: 'user-1'}});
|
runInFirebaseContextSpy.and.resolveTo({user: {uid: 'user-1'}});
|
||||||
|
authStateSubject.next({uid: 'user-1'});
|
||||||
|
|
||||||
await expectAsync(service.login('mail', 'secret')).toBeResolvedTo('user-1');
|
await expectAsync(service.login('mail', 'secret')).toBeResolvedTo('user-1');
|
||||||
|
|
||||||
@@ -92,6 +93,23 @@ describe('UserSessionService', () => {
|
|||||||
expect(updateSpy).toHaveBeenCalledWith({songUsage: {}});
|
expect(updateSpy).toHaveBeenCalledWith({songUsage: {}});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should wait for auth state propagation before resolving login', async () => {
|
||||||
|
runInFirebaseContextSpy.and.resolveTo({user: {uid: 'user-1'}});
|
||||||
|
|
||||||
|
let resolved = false;
|
||||||
|
const loginPromise = service.login('mail', 'secret').then(result => {
|
||||||
|
resolved = true;
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
await Promise.resolve();
|
||||||
|
expect(resolved).toBeFalse();
|
||||||
|
|
||||||
|
authStateSubject.next({uid: 'user-1'});
|
||||||
|
|
||||||
|
await expectAsync(loginPromise).toBeResolvedTo('user-1');
|
||||||
|
});
|
||||||
|
|
||||||
it('should delegate logout and password reset to AngularFire auth APIs', async () => {
|
it('should delegate logout and password reset to AngularFire auth APIs', async () => {
|
||||||
runInFirebaseContextSpy.and.resolveTo();
|
runInFirebaseContextSpy.and.resolveTo();
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {EnvironmentInjector, Injectable, inject, runInInjectionContext} from '@a
|
|||||||
import {Auth, authState, createUserWithEmailAndPassword, sendPasswordResetEmail, signInWithEmailAndPassword, signOut} from '@angular/fire/auth';
|
import {Auth, authState, createUserWithEmailAndPassword, sendPasswordResetEmail, signInWithEmailAndPassword, signOut} from '@angular/fire/auth';
|
||||||
import {User as AuthUser} from 'firebase/auth';
|
import {User as AuthUser} from 'firebase/auth';
|
||||||
import {firstValueFrom, Observable, of} from 'rxjs';
|
import {firstValueFrom, Observable, of} from 'rxjs';
|
||||||
import {map, shareReplay, switchMap} from 'rxjs/operators';
|
import {filter, map, shareReplay, switchMap, take} from 'rxjs/operators';
|
||||||
import {DbService} from '../db.service';
|
import {DbService} from '../db.service';
|
||||||
import {environment} from '../../../environments/environment';
|
import {environment} from '../../../environments/environment';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
@@ -59,6 +59,7 @@ export class UserSessionService {
|
|||||||
const dUser = await this.readUser(aUser.user.uid);
|
const dUser = await this.readUser(aUser.user.uid);
|
||||||
if (!dUser) return null;
|
if (!dUser) return null;
|
||||||
await this.initSongUsage(dUser);
|
await this.initSongUsage(dUser);
|
||||||
|
await this.awaitAuthenticatedUser(aUser.user.uid);
|
||||||
|
|
||||||
return aUser.user.uid;
|
return aUser.user.uid;
|
||||||
}
|
}
|
||||||
@@ -90,6 +91,15 @@ export class UserSessionService {
|
|||||||
await this.update$(user.id, {songUsage: {}});
|
await this.update$(user.id, {songUsage: {}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async awaitAuthenticatedUser(uid: string): Promise<void> {
|
||||||
|
await firstValueFrom(
|
||||||
|
this.user$.pipe(
|
||||||
|
filter((user): user is User => !!user && user.id === uid),
|
||||||
|
take(1)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private runInFirebaseContext = <T>(factory: () => T): T => runInInjectionContext(this.environmentInjector, factory);
|
private runInFirebaseContext = <T>(factory: () => T): T => runInInjectionContext(this.environmentInjector, factory);
|
||||||
private readUser$ = (uid: string) => this.db.doc$<User>('users/' + uid);
|
private readUser$ = (uid: string) => this.db.doc$<User>('users/' + uid);
|
||||||
private readUser = (uid: string): Promise<User | null> => firstValueFrom(this.readUser$(uid));
|
private readUser = (uid: string): Promise<User | null> => firstValueFrom(this.readUser$(uid));
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ describe('UserSongUsageService', () => {
|
|||||||
sessionSpy.update$.and.resolveTo();
|
sessionSpy.update$.and.resolveTo();
|
||||||
showDataServiceSpy.listRaw$.and.returnValue(
|
showDataServiceSpy.listRaw$.and.returnValue(
|
||||||
of([
|
of([
|
||||||
{id: 'show-1', owner: 'user-1'},
|
{id: 'show-1', owner: 'user-1', archived: false},
|
||||||
{id: 'show-2', owner: 'user-2'},
|
{id: 'show-2', owner: 'user-2', archived: true},
|
||||||
] as never)
|
]) as never
|
||||||
);
|
);
|
||||||
showSongDataServiceSpy.list$.and.callFake((showId: string) =>
|
showSongDataServiceSpy.list$.and.callFake((showId: string) =>
|
||||||
of(showId === 'show-1' ? ([{songId: 'song-1'}, {songId: 'song-1'}, {songId: 'song-2'}] as never) : ([{songId: 'song-3'}] as never))
|
(of(showId === 'show-1' ? [{songId: 'song-1'}, {songId: 'song-1'}, {songId: 'song-2'}] : [{songId: 'song-3'}]) as never)
|
||||||
);
|
);
|
||||||
dbServiceSpy.doc.and.returnValue({update: jasmine.createSpy('update').and.resolveTo()} as never);
|
dbServiceSpy.doc.and.returnValue({update: jasmine.createSpy('update').and.resolveTo()} as never);
|
||||||
|
|
||||||
@@ -66,11 +66,11 @@ describe('UserSongUsageService', () => {
|
|||||||
await expectAsync(service.rebuildSongUsage()).toBeResolvedTo({
|
await expectAsync(service.rebuildSongUsage()).toBeResolvedTo({
|
||||||
usersProcessed: 2,
|
usersProcessed: 2,
|
||||||
showsProcessed: 2,
|
showsProcessed: 2,
|
||||||
showSongsProcessed: 4,
|
showSongsProcessed: 3,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(sessionSpy.update$).toHaveBeenCalledWith('user-1', {songUsage: {'song-1': 2, 'song-2': 1}});
|
expect(sessionSpy.update$).toHaveBeenCalledWith('user-1', {songUsage: {'song-1': 2, 'song-2': 1}});
|
||||||
expect(sessionSpy.update$).toHaveBeenCalledWith('user-2', {songUsage: {'song-3': 1}});
|
expect(sessionSpy.update$).toHaveBeenCalledWith('user-2', {songUsage: {}});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should reject song usage rebuilds for non-admin users', async () => {
|
it('should reject song usage rebuilds for non-admin users', async () => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {Injectable, inject} from '@angular/core';
|
import {Injectable, inject} from '@angular/core';
|
||||||
import {firstValueFrom} from 'rxjs';
|
import {firstValueFrom} from 'rxjs';
|
||||||
import {take} from 'rxjs/operators';
|
import {take} from 'rxjs/operators';
|
||||||
import {increment} from '@angular/fire/firestore';
|
import {increment} from 'firebase/firestore';
|
||||||
import {DbService} from '../db.service';
|
import {DbService} from '../db.service';
|
||||||
import {ShowDataService} from '../../modules/shows/services/show-data.service';
|
import {ShowDataService} from '../../modules/shows/services/show-data.service';
|
||||||
import {ShowSongDataService} from '../../modules/shows/services/show-song-data.service';
|
import {ShowSongDataService} from '../../modules/shows/services/show-song-data.service';
|
||||||
@@ -40,6 +40,10 @@ export class UserSongUsageService {
|
|||||||
|
|
||||||
let showSongsProcessed = 0;
|
let showSongsProcessed = 0;
|
||||||
for (const show of shows) {
|
for (const show of shows) {
|
||||||
|
if (show.archived) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const ownerId = show.owner;
|
const ownerId = show.owner;
|
||||||
if (!ownerId) {
|
if (!ownerId) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ import {of} from 'rxjs';
|
|||||||
import {UserService} from './user.service';
|
import {UserService} from './user.service';
|
||||||
import {UserSessionService} from './user-session.service';
|
import {UserSessionService} from './user-session.service';
|
||||||
import {UserSongUsageService} from './user-song-usage.service';
|
import {UserSongUsageService} from './user-song-usage.service';
|
||||||
|
import {ShowSongIndexService} from '../../modules/shows/services/show-song-index.service';
|
||||||
|
|
||||||
describe('UserService', () => {
|
describe('UserService', () => {
|
||||||
let service: UserService;
|
let service: UserService;
|
||||||
let sessionSpy: jasmine.SpyObj<UserSessionService>;
|
let sessionSpy: jasmine.SpyObj<UserSessionService>;
|
||||||
let songUsageSpy: jasmine.SpyObj<UserSongUsageService>;
|
let songUsageSpy: jasmine.SpyObj<UserSongUsageService>;
|
||||||
|
let showSongIndexSpy: jasmine.SpyObj<ShowSongIndexService>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
sessionSpy = jasmine.createSpyObj<UserSessionService>(
|
sessionSpy = jasmine.createSpyObj<UserSessionService>(
|
||||||
@@ -20,6 +22,7 @@ describe('UserService', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
songUsageSpy = jasmine.createSpyObj<UserSongUsageService>('UserSongUsageService', ['incSongCount', 'decSongCount', 'rebuildSongUsage']);
|
songUsageSpy = jasmine.createSpyObj<UserSongUsageService>('UserSongUsageService', ['incSongCount', 'decSongCount', 'rebuildSongUsage']);
|
||||||
|
showSongIndexSpy = jasmine.createSpyObj<ShowSongIndexService>('ShowSongIndexService', ['rebuildShowSongIds']);
|
||||||
|
|
||||||
sessionSpy.currentUser.and.resolveTo({id: 'user-1'} as never);
|
sessionSpy.currentUser.and.resolveTo({id: 'user-1'} as never);
|
||||||
sessionSpy.getUserbyId.and.resolveTo({id: 'user-2'} as never);
|
sessionSpy.getUserbyId.and.resolveTo({id: 'user-2'} as never);
|
||||||
@@ -34,11 +37,13 @@ describe('UserService', () => {
|
|||||||
songUsageSpy.incSongCount.and.resolveTo();
|
songUsageSpy.incSongCount.and.resolveTo();
|
||||||
songUsageSpy.decSongCount.and.resolveTo();
|
songUsageSpy.decSongCount.and.resolveTo();
|
||||||
songUsageSpy.rebuildSongUsage.and.resolveTo({usersProcessed: 1, showsProcessed: 2, showSongsProcessed: 3});
|
songUsageSpy.rebuildSongUsage.and.resolveTo({usersProcessed: 1, showsProcessed: 2, showSongsProcessed: 3});
|
||||||
|
showSongIndexSpy.rebuildShowSongIds.and.resolveTo({showsProcessed: 2, showSongsProcessed: 3});
|
||||||
|
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
providers: [
|
providers: [
|
||||||
{provide: UserSessionService, useValue: sessionSpy},
|
{provide: UserSessionService, useValue: sessionSpy},
|
||||||
{provide: UserSongUsageService, useValue: songUsageSpy},
|
{provide: UserSongUsageService, useValue: songUsageSpy},
|
||||||
|
{provide: ShowSongIndexService, useValue: showSongIndexSpy},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -100,9 +105,11 @@ describe('UserService', () => {
|
|||||||
await service.incSongCount('song-1');
|
await service.incSongCount('song-1');
|
||||||
await service.decSongCount('song-2');
|
await service.decSongCount('song-2');
|
||||||
await expectAsync(service.rebuildSongUsage()).toBeResolvedTo({usersProcessed: 1, showsProcessed: 2, showSongsProcessed: 3});
|
await expectAsync(service.rebuildSongUsage()).toBeResolvedTo({usersProcessed: 1, showsProcessed: 2, showSongsProcessed: 3});
|
||||||
|
await expectAsync(service.rebuildShowSongIds()).toBeResolvedTo({showsProcessed: 2, showSongsProcessed: 3});
|
||||||
|
|
||||||
expect(songUsageSpy.incSongCount).toHaveBeenCalledWith('song-1');
|
expect(songUsageSpy.incSongCount).toHaveBeenCalledWith('song-1');
|
||||||
expect(songUsageSpy.decSongCount).toHaveBeenCalledWith('song-2');
|
expect(songUsageSpy.decSongCount).toHaveBeenCalledWith('song-2');
|
||||||
expect(songUsageSpy.rebuildSongUsage).toHaveBeenCalled();
|
expect(songUsageSpy.rebuildSongUsage).toHaveBeenCalled();
|
||||||
|
expect(showSongIndexSpy.rebuildShowSongIds).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {Observable} from 'rxjs';
|
|||||||
import {User} from './user';
|
import {User} from './user';
|
||||||
import {SongUsageMigrationResult, UserSongUsageService} from './user-song-usage.service';
|
import {SongUsageMigrationResult, UserSongUsageService} from './user-song-usage.service';
|
||||||
import {UserSessionService} from './user-session.service';
|
import {UserSessionService} from './user-session.service';
|
||||||
|
import {MigrationProgress, ShowSongIndexMigrationResult, ShowSongIndexService} from '../../modules/shows/services/show-song-index.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@@ -10,6 +11,7 @@ import {UserSessionService} from './user-session.service';
|
|||||||
export class UserService {
|
export class UserService {
|
||||||
private session = inject(UserSessionService);
|
private session = inject(UserSessionService);
|
||||||
private songUsage = inject(UserSongUsageService);
|
private songUsage = inject(UserSongUsageService);
|
||||||
|
private showSongIndex = inject(ShowSongIndexService);
|
||||||
|
|
||||||
public users$ = this.session.users$;
|
public users$ = this.session.users$;
|
||||||
|
|
||||||
@@ -34,4 +36,5 @@ export class UserService {
|
|||||||
public incSongCount = (songId: string): Promise<void | null> => this.songUsage.incSongCount(songId);
|
public incSongCount = (songId: string): Promise<void | null> => this.songUsage.incSongCount(songId);
|
||||||
public decSongCount = (songId: string): Promise<void | null> => this.songUsage.decSongCount(songId);
|
public decSongCount = (songId: string): Promise<void | null> => this.songUsage.decSongCount(songId);
|
||||||
public rebuildSongUsage = (): Promise<SongUsageMigrationResult> => this.songUsage.rebuildSongUsage();
|
public rebuildSongUsage = (): Promise<SongUsageMigrationResult> => this.songUsage.rebuildSongUsage();
|
||||||
|
public rebuildShowSongIds = (onProgress?: (progress: MigrationProgress) => void): Promise<ShowSongIndexMigrationResult> => this.showSongIndex.rebuildShowSongIds(onProgress);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
@if (songs) {
|
@if (songs) {
|
||||||
<div class="add-row">
|
<div class="add-row">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Lied hinzufügen...</mat-label>
|
<mat-label>Lied hinzufügen...</mat-label>
|
||||||
<mat-select (selectionChange)="onAddSongSelectionChanged($event)">
|
<mat-select (selectionChange)="onAddSongSelectionChanged($event)">
|
||||||
<mat-option>
|
<mat-option>
|
||||||
<ngx-mat-select-search [formControl]="filteredSongsControl"></ngx-mat-select-search>
|
<ngx-mat-select-search [formControl]="filteredSongsControl"></ngx-mat-select-search>
|
||||||
</mat-option>
|
</mat-option>
|
||||||
@for (song of filteredSongs(); track song) {
|
@for (song of filteredSongs(); track song.id) {
|
||||||
<mat-option [value]="song.id">{{ song.title }}</mat-option>
|
<mat-option [value]="song.id">{{ song.title }}</mat-option>
|
||||||
}
|
}
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1 @@
|
|||||||
<input
|
<input (ngModelChange)="valueChange($event)" [ngModel]="value" placeholder="Suche" />
|
||||||
(ngModelChange)="valueChange($event)"
|
|
||||||
[ngModel]="value"
|
|
||||||
placeholder="Suche"
|
|
||||||
/>
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import {Component, DestroyRef, inject} from '@angular/core';
|
|||||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||||
import {ActivatedRoute, Params, Router} from '@angular/router';
|
import {ActivatedRoute, Params, Router} from '@angular/router';
|
||||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||||
|
import {FilterStoreService} from '../../../../../services/filter-store.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-filter',
|
selector: 'app-filter',
|
||||||
@@ -12,6 +13,7 @@ import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
|||||||
export class FilterComponent {
|
export class FilterComponent {
|
||||||
private router = inject(Router);
|
private router = inject(Router);
|
||||||
private destroyRef = inject(DestroyRef);
|
private destroyRef = inject(DestroyRef);
|
||||||
|
private filterStore = inject(FilterStoreService);
|
||||||
|
|
||||||
public value = '';
|
public value = '';
|
||||||
|
|
||||||
@@ -20,11 +22,13 @@ export class FilterComponent {
|
|||||||
|
|
||||||
activatedRoute.queryParams.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((params: Params) => {
|
activatedRoute.queryParams.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((params: Params) => {
|
||||||
const typedParams = params as {q: string};
|
const typedParams = params as {q: string};
|
||||||
if (typedParams.q) this.value = typedParams.q;
|
this.value = typedParams.q ?? '';
|
||||||
|
this.filterStore.updateSongFilter({q: this.value});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async valueChange(text: string): Promise<void> {
|
public async valueChange(text: string): Promise<void> {
|
||||||
|
this.filterStore.updateSongFilter({q: text});
|
||||||
const route = this.router.createUrlTree(['songs'], {
|
const route = this.router.createUrlTree(['songs'], {
|
||||||
queryParams: {q: text},
|
queryParams: {q: text},
|
||||||
queryParamsHandling: 'merge',
|
queryParamsHandling: 'merge',
|
||||||
|
|||||||
@@ -1,24 +1,9 @@
|
|||||||
<nav [class.hidden]="isNavigationHidden(windowScroll$|async)" class="head">
|
<nav [class.hidden]="isNavigationHidden(windowScroll$|async)" class="head">
|
||||||
<div class="links">
|
<div class="links">
|
||||||
<app-brand routerLink="/brand"></app-brand>
|
<app-brand routerLink="/brand"></app-brand>
|
||||||
<app-link
|
<app-link *appRole="['user', 'presenter', 'leader']" [icon]="faSongs" link="/songs" text="Lieder"></app-link>
|
||||||
*appRole="['user', 'presenter', 'leader']"
|
<app-link *appRole="['leader', 'member']" [icon]="faShows" link="/shows" text="Veranstaltungen"></app-link>
|
||||||
[icon]="faSongs"
|
<app-link *appRole="['presenter']" [icon]="faPresentation" link="/presentation" text="Präsentation"></app-link>
|
||||||
link="/songs"
|
|
||||||
text="Lieder"
|
|
||||||
></app-link>
|
|
||||||
<app-link
|
|
||||||
*appRole="['leader', 'member']"
|
|
||||||
[icon]="faShows"
|
|
||||||
link="/shows"
|
|
||||||
text="Veranstaltungen"
|
|
||||||
></app-link>
|
|
||||||
<app-link
|
|
||||||
*appRole="['presenter']"
|
|
||||||
[icon]="faPresentation"
|
|
||||||
link="/presentation"
|
|
||||||
text="Präsentation"
|
|
||||||
></app-link>
|
|
||||||
<app-link [icon]="faUser" link="/user" text="Benutzer"></app-link>
|
<app-link [icon]="faUser" link="/user" text="Benutzer"></app-link>
|
||||||
</div>
|
</div>
|
||||||
<div *appRole="['user', 'presenter', 'leader']" class="actions">
|
<div *appRole="['user', 'presenter', 'leader']" class="actions">
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<span [class]="'badge ' + type">
|
||||||
|
<ng-content></ng-content>
|
||||||
|
</span>
|
||||||
35
src/app/widget-modules/components/badge/badge.component.less
Normal file
35
src/app/widget-modules/components/badge/badge.component.less
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
.badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 1.75rem;
|
||||||
|
padding: 0 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
|
||||||
|
&.ok {
|
||||||
|
background: #e6f6ea;
|
||||||
|
border-color: #9ad1a7;
|
||||||
|
color: #1f6b34;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.warn {
|
||||||
|
background: #fff4db;
|
||||||
|
border-color: #f2cf7a;
|
||||||
|
color: #8a5a00;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.error {
|
||||||
|
background: #fdeaea;
|
||||||
|
border-color: #efb2b2;
|
||||||
|
color: #9b2c2c;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.none {
|
||||||
|
background: #eef1f4;
|
||||||
|
border-color: #c7d0d9;
|
||||||
|
color: #4f5f6f;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
import {BadgeComponent} from './badge.component';
|
||||||
|
|
||||||
|
describe('BadgeComponent', () => {
|
||||||
|
let component: BadgeComponent;
|
||||||
|
let fixture: ComponentFixture<BadgeComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [BadgeComponent],
|
||||||
|
}).compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(BadgeComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('create an instance', () => {
|
||||||
|
void expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should apply the configured type class', () => {
|
||||||
|
component.type = 'error';
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
expect(fixture.nativeElement.querySelector('.badge')?.className).toContain('error');
|
||||||
|
});
|
||||||
|
});
|
||||||
13
src/app/widget-modules/components/badge/badge.component.ts
Normal file
13
src/app/widget-modules/components/badge/badge.component.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import {Component, Input} from '@angular/core';
|
||||||
|
|
||||||
|
export type BadgeType = 'ok' | 'warn' | 'error' | 'none';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-badge',
|
||||||
|
templateUrl: './badge.component.html',
|
||||||
|
styleUrls: ['./badge.component.less'],
|
||||||
|
standalone: true,
|
||||||
|
})
|
||||||
|
export class BadgeComponent {
|
||||||
|
@Input() public type: BadgeType = 'none';
|
||||||
|
}
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
<button [disabled]="disabled" mat-button>
|
<button [disabled]="disabled" mat-button>
|
||||||
@if (icon) {
|
@if (icon) {
|
||||||
<span
|
<span><fa-icon [icon]="icon"></fa-icon><span class="content"> </span></span>
|
||||||
><fa-icon [icon]="icon"></fa-icon><span class="content"> </span></span
|
}
|
||||||
>
|
<span class="button-content">
|
||||||
}
|
<ng-content></ng-content>
|
||||||
<span class="button-content">
|
</span>
|
||||||
<ng-content></ng-content>
|
</button>
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
<div [class.fullscreen]="fullscreen" [class.padding]="padding" class="card">
|
<div [class.fullscreen]="fullscreen" [class.padding]="padding" class="card">
|
||||||
@if (closeLink && !fullscreen) {
|
@if (closeLink && !fullscreen) {
|
||||||
<button
|
<button [routerLink]="closeLink" class="btn-close" mat-icon-button>
|
||||||
[routerLink]="closeLink"
|
<fa-icon [icon]="closeIcon"></fa-icon>
|
||||||
class="btn-close"
|
</button>
|
||||||
mat-icon-button
|
} @if (heading && !fullscreen) {
|
||||||
>
|
<div class="heading">{{ heading }}</div>
|
||||||
<fa-icon [icon]="closeIcon"></fa-icon>
|
} @if (subheading && !fullscreen) {
|
||||||
</button>
|
<div class="subheading">{{ subheading }}</div>
|
||||||
}
|
|
||||||
@if (heading && !fullscreen) {
|
|
||||||
<div class="heading">{{ heading }}</div>
|
|
||||||
}
|
|
||||||
@if (subheading && !fullscreen) {
|
|
||||||
<div class="subheading">{{ subheading }}</div>
|
|
||||||
}
|
}
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
<div class="header">
|
<div class="header">
|
||||||
<button
|
<button (click)="onFilterClick()" [class.filter-active]="anyFilterActive" mat-icon-button>
|
||||||
(click)="onFilterClick()"
|
|
||||||
[class.filter-active]="anyFilterActive"
|
|
||||||
mat-icon-button
|
|
||||||
>
|
|
||||||
<fa-icon [icon]="faFilter"></fa-icon>
|
<fa-icon [icon]="faFilter"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button routerLink="new">
|
<button mat-icon-button routerLink="new">
|
||||||
@@ -12,9 +8,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (filterVisible || anyFilterActive) {
|
@if (filterVisible || anyFilterActive) {
|
||||||
<div @fade>
|
<div @fade>
|
||||||
<app-card>
|
<app-card>
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
</app-card>
|
</app-card>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
<svg
|
<svg height="1024" viewBox="0 0 270.93 270.93" width="1024" xmlns="http://www.w3.org/2000/svg">
|
||||||
height="1024"
|
|
||||||
viewBox="0 0 270.93 270.93"
|
|
||||||
width="1024"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<defs></defs>
|
<defs></defs>
|
||||||
<g fill="#fff">
|
<g fill="#fff">
|
||||||
<path
|
<path
|
||||||
@@ -13,10 +8,7 @@
|
|||||||
d="m116.87 10.157-1.8882 4.7801-1.1823 4.7845-4.4402 0.29048-1.7967-4.5884-2.4969-4.4939-3.6268 0.47781-1.2476 4.9864-0.54906 4.8977-4.3633 0.86861-2.3806-4.3153-3.0618-4.1295-3.5339 0.94706-0.58683 5.1069 0.09583 4.9268-4.2121 1.4307-2.9239-3.9681-3.5745-3.6937-3.3799 1.4002 0.08404 5.1388 0.73936 4.8731-3.9914 1.9681-3.4163-3.5528-4.0248-3.1955-3.1693 1.8287 0.75527 5.0851 1.3683 4.7336-3.6995 2.4722-3.8506-3.0749-4.4083-2.6435-2.9035 2.2281 1.4118 4.9413 1.9739 4.5158-3.345 2.934-4.218-2.5462-4.7162-2.0466-2.5869 2.5883 2.0451 4.7147 2.5462 4.2195-2.934 3.345-4.5143-1.9739-4.9428-1.4118-2.2281 2.902 2.6435 4.4083 3.0763 3.8505-2.4721 3.6995-4.7351-1.3668-5.0837-0.75527-1.8301 3.1679 3.1969 4.0262 3.5513 3.4163-1.9681 3.9899-4.8716-0.73787-5.1403-0.08569-1.4002 3.3814 3.6951 3.5745 3.9667 2.9224-1.4307 4.2136-4.9268-0.09583-5.1069 0.58683-0.94699 3.5338 4.1294 3.0619 4.3153 2.3806-0.86853 4.3633-4.8963 0.54756-4.9864 1.2476-0.47788 3.6283 4.4925 2.4968 4.5899 1.7968-0.29196 4.4388-4.783 1.1838-4.7816 1.8882v3.6588l4.7816 1.8883 4.783 1.1823 0.29196 4.4402-4.5899 1.7967-4.4925 2.4954 0.47788 3.6283 4.9864 1.2476 4.8963 0.54905 0.86853 4.3632-4.3153 2.3806-4.1294 3.0618 0.94699 3.5338 5.1069 0.58686 4.9268-0.0958 1.4307 4.2122-3.9667 2.9239-3.6951 3.5745 1.4002 3.3799 5.1403-0.0857 4.8716-0.73787 1.9681 3.9914-3.5513 3.4162-3.1969 4.0249 1.8301 3.1693 5.0837-0.75535 4.7351-1.3682 2.4721 3.6994-3.0763 3.8505-2.6435 4.4083 2.2281 2.9035 4.9428-1.4133 4.5143-1.9739 2.934 3.345-2.5462 4.2195-2.0451 4.7162 2.5869 2.5868 4.7162-2.0451 4.218-2.5463 3.345 2.9326-1.9739 4.5158-1.4118 4.9428 2.9035 2.2281 4.4083-2.645 3.8506-3.0749 3.6995 2.4722-1.3683 4.7336-0.75527 5.0851 3.1693 1.8301 4.0248-3.1969 3.4163-3.5513 3.9914 1.9681-0.73936 4.8717-0.08404 5.1403 3.3799 1.4002 3.5745-3.6952 2.9239-3.9666 4.2121 1.4292-0.09583 4.9283 0.58683 5.1069 3.5339 0.94699 3.0618-4.1309 2.3806-4.3139 4.3633 0.8686 0.54906 4.8963 1.2476 4.9864 3.6268 0.47787 2.4969-4.494 1.7967-4.5884 4.4402 0.29189 1.1823 4.7831 1.8882 4.7816h3.6588l1.8882-4.7816 1.1823-4.7831 4.4402-0.29189 1.7967 4.5884 2.4969 4.494 3.6268-0.47787 1.2491-4.9864 0.54757-4.8963 4.3633-0.8686 2.3806 4.3139 3.0619 4.1309 3.5338-0.94699 0.58682-5.1069-0.0958-4.9283 4.2136-1.4292 2.9224 3.9666 3.5745 3.6952 3.3799-1.4002-0.0843-5.1403-0.73787-4.8717 3.9899-1.9681 3.4163 3.5513 4.0262 3.1969 3.1679-1.8301-0.75528-5.0851-1.3668-4.7336 3.6995-2.4722 3.8505 3.0749 4.4083 2.645 2.902-2.2281-1.4118-4.9428-1.9739-4.5158 3.345-2.9326 4.2194 2.5463 4.7148 2.0451 2.5883-2.5868-2.0465-4.7162-2.5462-4.2195 2.934-3.345 4.5157 1.9739 4.9414 1.4133 2.2281-2.9035-2.6435-4.4083-3.0749-3.8505 2.4707-3.6994 4.7351 1.3682 5.0837 0.75535 1.8301-3.1693-3.1969-4.0249-3.5513-3.4162 1.9681-3.9914 4.8716 0.73787 5.1403 0.0857 1.4002-3.3799-3.6951-3.5745-3.9668-2.9239 1.4307-4.2122 4.9268 0.0958 5.107-0.58686 0.94698-3.5338-4.1294-3.0618-4.3153-2.3806 0.86852-4.3632 4.8978-0.54905 4.9864-1.2476 0.47781-3.6283-4.4939-2.4954-4.5884-1.7967 0.29058-4.4402 4.7845-1.1823 4.7801-1.8883v-3.6588l-4.7801-1.8882-4.7845-1.1838-0.29058-4.4388 4.5884-1.7968 4.4939-2.4968-0.47781-3.6283-4.9864-1.2476-4.8978-0.54757-0.86852-4.3633 4.3153-2.3806 4.1294-3.0619-0.94698-3.5338-5.107-0.58683-4.9268 0.09583-1.4307-4.2136 3.9668-2.9224 3.6951-3.5745-1.4002-3.3814-5.1403 0.08569-4.8716 0.73787-1.9681-3.9899 3.5513-3.4163 3.1969-4.0262-1.8301-3.1679-5.0837 0.75527-4.7351 1.3668-2.4707-3.6995 3.0749-3.8505 2.6435-4.4083-2.2281-2.902-4.9414 1.4118-4.5157 1.9739-2.934-3.345 2.5462-4.2195 2.0465-4.7147-2.5883-2.5883-4.7148 2.0466-4.2194 2.5462-3.345-2.934 1.9739-4.5158 1.4118-4.9413-2.902-2.2281-4.4083 2.6435-3.8505 3.0749-3.6995-2.4722 1.3668-4.7336 0.75528-5.0851-3.1679-1.8287-4.0262 3.1955-3.4163 3.5528-3.9899-1.9681 0.73787-4.8731 0.0843-5.1388-3.3799-1.4002-3.5745 3.6937-2.9224 3.9681-4.2136-1.4307 0.0958-4.9268-0.58682-5.1069-3.5338-0.94706-3.0619 4.1295-2.3806 4.3153-4.3633-0.86861-0.54757-4.8977-1.2491-4.9864-3.6268-0.47781-2.4969 4.4939-1.7967 4.5884-4.4402-0.29048-1.1823-4.7845-1.8882-4.7801zm1.8301 21.667a96.677 96.677 0 0 1 96.677 96.677 96.677 96.677 0 0 1-96.677 96.677 96.677 96.677 0 0 1-96.677-96.677 96.677 96.677 0 0 1 96.677-96.677z"
|
d="m116.87 10.157-1.8882 4.7801-1.1823 4.7845-4.4402 0.29048-1.7967-4.5884-2.4969-4.4939-3.6268 0.47781-1.2476 4.9864-0.54906 4.8977-4.3633 0.86861-2.3806-4.3153-3.0618-4.1295-3.5339 0.94706-0.58683 5.1069 0.09583 4.9268-4.2121 1.4307-2.9239-3.9681-3.5745-3.6937-3.3799 1.4002 0.08404 5.1388 0.73936 4.8731-3.9914 1.9681-3.4163-3.5528-4.0248-3.1955-3.1693 1.8287 0.75527 5.0851 1.3683 4.7336-3.6995 2.4722-3.8506-3.0749-4.4083-2.6435-2.9035 2.2281 1.4118 4.9413 1.9739 4.5158-3.345 2.934-4.218-2.5462-4.7162-2.0466-2.5869 2.5883 2.0451 4.7147 2.5462 4.2195-2.934 3.345-4.5143-1.9739-4.9428-1.4118-2.2281 2.902 2.6435 4.4083 3.0763 3.8505-2.4721 3.6995-4.7351-1.3668-5.0837-0.75527-1.8301 3.1679 3.1969 4.0262 3.5513 3.4163-1.9681 3.9899-4.8716-0.73787-5.1403-0.08569-1.4002 3.3814 3.6951 3.5745 3.9667 2.9224-1.4307 4.2136-4.9268-0.09583-5.1069 0.58683-0.94699 3.5338 4.1294 3.0619 4.3153 2.3806-0.86853 4.3633-4.8963 0.54756-4.9864 1.2476-0.47788 3.6283 4.4925 2.4968 4.5899 1.7968-0.29196 4.4388-4.783 1.1838-4.7816 1.8882v3.6588l4.7816 1.8883 4.783 1.1823 0.29196 4.4402-4.5899 1.7967-4.4925 2.4954 0.47788 3.6283 4.9864 1.2476 4.8963 0.54905 0.86853 4.3632-4.3153 2.3806-4.1294 3.0618 0.94699 3.5338 5.1069 0.58686 4.9268-0.0958 1.4307 4.2122-3.9667 2.9239-3.6951 3.5745 1.4002 3.3799 5.1403-0.0857 4.8716-0.73787 1.9681 3.9914-3.5513 3.4162-3.1969 4.0249 1.8301 3.1693 5.0837-0.75535 4.7351-1.3682 2.4721 3.6994-3.0763 3.8505-2.6435 4.4083 2.2281 2.9035 4.9428-1.4133 4.5143-1.9739 2.934 3.345-2.5462 4.2195-2.0451 4.7162 2.5869 2.5868 4.7162-2.0451 4.218-2.5463 3.345 2.9326-1.9739 4.5158-1.4118 4.9428 2.9035 2.2281 4.4083-2.645 3.8506-3.0749 3.6995 2.4722-1.3683 4.7336-0.75527 5.0851 3.1693 1.8301 4.0248-3.1969 3.4163-3.5513 3.9914 1.9681-0.73936 4.8717-0.08404 5.1403 3.3799 1.4002 3.5745-3.6952 2.9239-3.9666 4.2121 1.4292-0.09583 4.9283 0.58683 5.1069 3.5339 0.94699 3.0618-4.1309 2.3806-4.3139 4.3633 0.8686 0.54906 4.8963 1.2476 4.9864 3.6268 0.47787 2.4969-4.494 1.7967-4.5884 4.4402 0.29189 1.1823 4.7831 1.8882 4.7816h3.6588l1.8882-4.7816 1.1823-4.7831 4.4402-0.29189 1.7967 4.5884 2.4969 4.494 3.6268-0.47787 1.2491-4.9864 0.54757-4.8963 4.3633-0.8686 2.3806 4.3139 3.0619 4.1309 3.5338-0.94699 0.58682-5.1069-0.0958-4.9283 4.2136-1.4292 2.9224 3.9666 3.5745 3.6952 3.3799-1.4002-0.0843-5.1403-0.73787-4.8717 3.9899-1.9681 3.4163 3.5513 4.0262 3.1969 3.1679-1.8301-0.75528-5.0851-1.3668-4.7336 3.6995-2.4722 3.8505 3.0749 4.4083 2.645 2.902-2.2281-1.4118-4.9428-1.9739-4.5158 3.345-2.9326 4.2194 2.5463 4.7148 2.0451 2.5883-2.5868-2.0465-4.7162-2.5462-4.2195 2.934-3.345 4.5157 1.9739 4.9414 1.4133 2.2281-2.9035-2.6435-4.4083-3.0749-3.8505 2.4707-3.6994 4.7351 1.3682 5.0837 0.75535 1.8301-3.1693-3.1969-4.0249-3.5513-3.4162 1.9681-3.9914 4.8716 0.73787 5.1403 0.0857 1.4002-3.3799-3.6951-3.5745-3.9668-2.9239 1.4307-4.2122 4.9268 0.0958 5.107-0.58686 0.94698-3.5338-4.1294-3.0618-4.3153-2.3806 0.86852-4.3632 4.8978-0.54905 4.9864-1.2476 0.47781-3.6283-4.4939-2.4954-4.5884-1.7967 0.29058-4.4402 4.7845-1.1823 4.7801-1.8883v-3.6588l-4.7801-1.8882-4.7845-1.1838-0.29058-4.4388 4.5884-1.7968 4.4939-2.4968-0.47781-3.6283-4.9864-1.2476-4.8978-0.54757-0.86852-4.3633 4.3153-2.3806 4.1294-3.0619-0.94698-3.5338-5.107-0.58683-4.9268 0.09583-1.4307-4.2136 3.9668-2.9224 3.6951-3.5745-1.4002-3.3814-5.1403 0.08569-4.8716 0.73787-1.9681-3.9899 3.5513-3.4163 3.1969-4.0262-1.8301-3.1679-5.0837 0.75527-4.7351 1.3668-2.4707-3.6995 3.0749-3.8505 2.6435-4.4083-2.2281-2.902-4.9414 1.4118-4.5157 1.9739-2.934-3.345 2.5462-4.2195 2.0465-4.7147-2.5883-2.5883-4.7148 2.0466-4.2194 2.5462-3.345-2.934 1.9739-4.5158 1.4118-4.9413-2.902-2.2281-4.4083 2.6435-3.8505 3.0749-3.6995-2.4722 1.3668-4.7336 0.75528-5.0851-3.1679-1.8287-4.0262 3.1955-3.4163 3.5528-3.9899-1.9681 0.73787-4.8731 0.0843-5.1388-3.3799-1.4002-3.5745 3.6937-2.9224 3.9681-4.2136-1.4307 0.0958-4.9268-0.58682-5.1069-3.5338-0.94706-3.0619 4.1295-2.3806 4.3153-4.3633-0.86861-0.54757-4.8977-1.2491-4.9864-3.6268-0.47781-2.4969 4.4939-1.7967 4.5884-4.4402-0.29048-1.1823-4.7845-1.8882-4.7801zm1.8301 21.667a96.677 96.677 0 0 1 96.677 96.677 96.677 96.677 0 0 1-96.677 96.677 96.677 96.677 0 0 1-96.677-96.677 96.677 96.677 0 0 1 96.677-96.677z"
|
||||||
id="gear-lg"
|
id="gear-lg"
|
||||||
/>
|
/>
|
||||||
<g
|
<g aria-label="WORSHIP GENERATOR" transform="matrix(.92405 0 0 1.164 -6.4481 5.9862)">
|
||||||
aria-label="WORSHIP GENERATOR"
|
|
||||||
transform="matrix(.92405 0 0 1.164 -6.4481 5.9862)"
|
|
||||||
>
|
|
||||||
<path
|
<path
|
||||||
d="m26.155 213.81q-1.5697 4.1147-2.9258 8.0808-1.3468 3.9568-1.4118 4.1333h-1.2911q-0.04644-0.17647-1.0031-2.9537-0.9474-2.7865-2.5078-6.9291h-0.01858q-1.3654 3.4274-2.5171 6.5575-1.1425 3.1209-1.2168 3.3252h-1.3189q-0.07431-0.26936-1.1982-3.641-1.1146-3.3809-2.9815-8.4523l1.5233-0.59445q0.037153 0.13004 1.0867 3.2695 1.0496 3.1394 2.4057 7.0498h0.01858q1.4304-3.6038 2.4893-6.604 1.0682-3.0001 1.1146-3.1394h1.4397q0.03715 0.15791 1.1239 3.3995 1.096 3.2416 2.2199 6.3439h0.01858q1.4861-4.059 2.5078-7.1148 1.0217-3.0558 1.0589-3.2045z"
|
d="m26.155 213.81q-1.5697 4.1147-2.9258 8.0808-1.3468 3.9568-1.4118 4.1333h-1.2911q-0.04644-0.17647-1.0031-2.9537-0.9474-2.7865-2.5078-6.9291h-0.01858q-1.3654 3.4274-2.5171 6.5575-1.1425 3.1209-1.2168 3.3252h-1.3189q-0.07431-0.26936-1.1982-3.641-1.1146-3.3809-2.9815-8.4523l1.5233-0.59445q0.037153 0.13004 1.0867 3.2695 1.0496 3.1394 2.4057 7.0498h0.01858q1.4304-3.6038 2.4893-6.604 1.0682-3.0001 1.1146-3.1394h1.4397q0.03715 0.15791 1.1239 3.3995 1.096 3.2416 2.2199 6.3439h0.01858q1.4861-4.059 2.5078-7.1148 1.0217-3.0558 1.0589-3.2045z"
|
||||||
/>
|
/>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
@@ -1,89 +1,49 @@
|
|||||||
@if (sections && !fullscreen) {
|
@if (sections && !fullscreen) {
|
||||||
<div
|
<div (click)="onClick()" [class.chords]="iChordMode !== 'hide'" class="song-text">
|
||||||
(click)="onClick()"
|
@if (showSwitch) {
|
||||||
[class.chords]="iChordMode !== 'hide'"
|
<button (click)="onChordClick()" class="menu" mat-icon-button>
|
||||||
class="song-text"
|
<fa-icon [icon]="faLines"></fa-icon>
|
||||||
>
|
</button>
|
||||||
@if (showSwitch) {
|
}
|
||||||
<button
|
<div [class.offset]="fullscreen" [style.top.px]="offset + 50">
|
||||||
(click)="onChordClick()"
|
@for (section of sections; track section.type + '-' + section.number + '-' + $index; let i = $index) {
|
||||||
class="menu"
|
<div #section [class.chorus]="section.type === 1" class="section">
|
||||||
mat-icon-button
|
@for (line of getLines(section); track (line.lineNumber ?? $index) + '-' + line.type + '-' + $index) {
|
||||||
>
|
<div [class.chord]="line.type === 0" [class.comment]="isComment(line.text)" [class.disabled]="checkDisabled(i)" class="line">
|
||||||
<fa-icon [icon]="faLines"></fa-icon>
|
@for (segment of getDisplaySegments(line); track $index) {
|
||||||
</button>
|
<span [class.invalid-chord-token]="segment.invalid" [class.invalid-tab-token]="segment.isTab">{{ segment.text }}</span>
|
||||||
}
|
}
|
||||||
<div [class.offset]="fullscreen" [style.top.px]="offset + 50">
|
</div>
|
||||||
@for (section of sections; track section; let i = $index) {
|
|
||||||
<div
|
|
||||||
#section
|
|
||||||
[class.chorus]="section.type === 1"
|
|
||||||
class="section"
|
|
||||||
>
|
|
||||||
@for (line of getLines(section); track line) {
|
|
||||||
<div
|
|
||||||
[class.chord]="line.type === 0"
|
|
||||||
[class.comment]="isComment(line.text)"
|
|
||||||
[class.disabled]="checkDisabled(i)"
|
|
||||||
class="line"
|
|
||||||
>
|
|
||||||
@for (segment of getDisplaySegments(line); track $index) {
|
|
||||||
<span [class.invalid-chord-token]="segment.invalid" [class.invalid-tab-token]="segment.isTab">{{ segment.text }}</span>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@if (sections.length===0) {
|
|
||||||
<div class="error">
|
|
||||||
Es wurden keine Liedabschnitte gefunden! Bitte mindestens einen Abschnitt festlegen!
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<ng-content></ng-content>
|
} @if (sections.length===0) {
|
||||||
</div>
|
<div class="error">Es wurden keine Liedabschnitte gefunden! Bitte mindestens einen Abschnitt festlegen!</div>
|
||||||
}
|
|
||||||
|
|
||||||
@if (sections && fullscreen) {
|
|
||||||
<div
|
|
||||||
(click)="onClick()"
|
|
||||||
[@songSwitch]="sections"
|
|
||||||
[class.chords]="iChordMode !== 'hide'"
|
|
||||||
class="song-text"
|
|
||||||
>
|
|
||||||
@if (showSwitch) {
|
|
||||||
<button
|
|
||||||
(click)="onChordClick()"
|
|
||||||
class="menu"
|
|
||||||
mat-icon-button
|
|
||||||
>
|
|
||||||
<fa-icon [icon]="faLines"></fa-icon>
|
|
||||||
</button>
|
|
||||||
}
|
}
|
||||||
<div [class.offset]="fullscreen" [style.top.px]="offset + 50">
|
</div>
|
||||||
@if (header) {
|
<ng-content></ng-content>
|
||||||
<h1>{{ header }}</h1>
|
</div>
|
||||||
}
|
} @if (sections && fullscreen) {
|
||||||
@for (section of sections; track section; let i = $index) {
|
<div (click)="onClick()" [@songSwitch]="sections" [class.chords]="iChordMode !== 'hide'" class="song-text">
|
||||||
<div
|
@if (showSwitch) {
|
||||||
#section
|
<button (click)="onChordClick()" class="menu" mat-icon-button>
|
||||||
[class.chorus]="section.type === 1"
|
<fa-icon [icon]="faLines"></fa-icon>
|
||||||
class="section"
|
</button>
|
||||||
>
|
}
|
||||||
@for (line of getLines(section); track line) {
|
<div [class.offset]="fullscreen" [style.top.px]="offset + 50">
|
||||||
<div
|
@if (header) {
|
||||||
[class.chord]="line.type === 0"
|
<h1>{{ header }}</h1>
|
||||||
[class.disabled]="checkDisabled(i)"
|
} @for (section of sections; track section.type + '-' + section.number + '-' + $index; let i = $index) {
|
||||||
class="line"
|
<div #section [class.chorus]="section.type === 1" class="section">
|
||||||
>
|
@for (line of getLines(section); track (line.lineNumber ?? $index) + '-' + line.type + '-' + $index) {
|
||||||
@for (segment of getDisplaySegments(line, true); track $index) {
|
<div [class.chord]="line.type === 0" [class.disabled]="checkDisabled(i)" class="line">
|
||||||
<span [class.invalid-chord-token]="segment.invalid" [class.invalid-tab-token]="segment.isTab">{{ segment.text }}</span>
|
@for (segment of getDisplaySegments(line, true); track $index) {
|
||||||
}
|
<span [class.invalid-chord-token]="segment.invalid" [class.invalid-tab-token]="segment.isTab">{{ segment.text }}</span>
|
||||||
</div>
|
}
|
||||||
}
|
</div>
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<ng-content></ng-content>
|
}
|
||||||
</div>
|
</div>
|
||||||
|
<ng-content></ng-content>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,15 +32,15 @@ describe('RoleGuard', () => {
|
|||||||
|
|
||||||
it('should deny access when there is no current user', done => {
|
it('should deny access when there is no current user', done => {
|
||||||
guard.canActivate({data: {requiredRoles: ['leader']}} as never).subscribe(result => {
|
guard.canActivate({data: {requiredRoles: ['leader']}} as never).subscribe(result => {
|
||||||
expect(result).toBeFalse();
|
expect(result).toEqual({commands: ['brand', 'new-user']} as never);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow admins regardless of requiredRoles', async done => {
|
it('should allow admins regardless of requiredRoles', done => {
|
||||||
TestBed.resetTestingModule();
|
TestBed.resetTestingModule();
|
||||||
routerSpy = jasmine.createSpyObj<Router>('Router', ['createUrlTree']);
|
routerSpy = jasmine.createSpyObj<Router>('Router', ['createUrlTree']);
|
||||||
await TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [
|
providers: [
|
||||||
{provide: Router, useValue: routerSpy},
|
{provide: Router, useValue: routerSpy},
|
||||||
{provide: UserService, useValue: {user$: of({role: 'user;admin'})}},
|
{provide: UserService, useValue: {user$: of({role: 'user;admin'})}},
|
||||||
@@ -54,10 +54,10 @@ describe('RoleGuard', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow users with a matching required role', async done => {
|
it('should allow users with a matching required role', done => {
|
||||||
TestBed.resetTestingModule();
|
TestBed.resetTestingModule();
|
||||||
routerSpy = jasmine.createSpyObj<Router>('Router', ['createUrlTree']);
|
routerSpy = jasmine.createSpyObj<Router>('Router', ['createUrlTree']);
|
||||||
await TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [
|
providers: [
|
||||||
{provide: Router, useValue: routerSpy},
|
{provide: Router, useValue: routerSpy},
|
||||||
{provide: UserService, useValue: {user$: of({role: 'leader;user'})}},
|
{provide: UserService, useValue: {user$: of({role: 'leader;user'})}},
|
||||||
@@ -71,11 +71,11 @@ describe('RoleGuard', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should redirect users without the required role to their role default route', async done => {
|
it('should redirect users without the required role to their role default route', done => {
|
||||||
TestBed.resetTestingModule();
|
TestBed.resetTestingModule();
|
||||||
routerSpy = jasmine.createSpyObj<Router>('Router', ['createUrlTree']);
|
routerSpy = jasmine.createSpyObj<Router>('Router', ['createUrlTree']);
|
||||||
routerSpy.createUrlTree.and.returnValue({redirect: ['presentation']} as never);
|
routerSpy.createUrlTree.and.returnValue({redirect: ['presentation']} as never);
|
||||||
await TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [
|
providers: [
|
||||||
{provide: Router, useValue: routerSpy},
|
{provide: Router, useValue: routerSpy},
|
||||||
{provide: UserService, useValue: {user$: of({role: 'presenter'})}},
|
{provide: UserService, useValue: {user$: of({role: 'presenter'})}},
|
||||||
@@ -89,4 +89,42 @@ describe('RoleGuard', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should redirect members to shows instead of new-user', done => {
|
||||||
|
TestBed.resetTestingModule();
|
||||||
|
routerSpy = jasmine.createSpyObj<Router>('Router', ['createUrlTree']);
|
||||||
|
routerSpy.createUrlTree.and.returnValue({redirect: ['shows']} as never);
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
providers: [
|
||||||
|
{provide: Router, useValue: routerSpy},
|
||||||
|
{provide: UserService, useValue: {user$: of({role: 'member'})}},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
guard = TestBed.inject(RoleGuard);
|
||||||
|
|
||||||
|
guard.canActivate({data: {requiredRoles: ['user']}} as never).subscribe(result => {
|
||||||
|
expect(routerSpy.createUrlTree).toHaveBeenCalledWith(['shows']);
|
||||||
|
expect(result).toEqual({redirect: ['shows']} as never);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should choose a matching default route from all assigned roles', done => {
|
||||||
|
TestBed.resetTestingModule();
|
||||||
|
routerSpy = jasmine.createSpyObj<Router>('Router', ['createUrlTree']);
|
||||||
|
routerSpy.createUrlTree.and.callFake(commands => ({redirect: commands}) as never);
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
providers: [
|
||||||
|
{provide: Router, useValue: routerSpy},
|
||||||
|
{provide: UserService, useValue: {user$: of({role: ' none ; leader '})}},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
guard = TestBed.inject(RoleGuard);
|
||||||
|
|
||||||
|
guard.canActivate({data: {requiredRoles: ['presenter']}} as never).subscribe(result => {
|
||||||
|
expect(routerSpy.createUrlTree).toHaveBeenCalledWith(['shows']);
|
||||||
|
expect(result).toEqual({redirect: ['shows']} as never);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {ActivatedRouteSnapshot, Router, UrlTree} from '@angular/router';
|
|||||||
import {Observable} from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
import {UserService} from '../../services/user/user.service';
|
import {UserService} from '../../services/user/user.service';
|
||||||
import {map, take} from 'rxjs/operators';
|
import {map, take} from 'rxjs/operators';
|
||||||
|
import {roles} from '../../services/user/roles';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@@ -23,30 +24,45 @@ export class RoleGuard {
|
|||||||
if (!user) {
|
if (!user) {
|
||||||
return this.router.createUrlTree(['brand', 'new-user']);
|
return this.router.createUrlTree(['brand', 'new-user']);
|
||||||
}
|
}
|
||||||
const roles = user.role?.split(';') ?? [];
|
const userRoles = this.parseRoles(user.role);
|
||||||
if (roles.indexOf('admin') !== -1) {
|
if (userRoles.includes('admin')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const allowed = roles.some(s => requiredRoles.indexOf(s) !== -1);
|
const allowed = userRoles.some(role => requiredRoles.includes(role));
|
||||||
|
|
||||||
return allowed || this.router.createUrlTree(this.defaultRoute(roles));
|
return allowed || this.router.createUrlTree(this.defaultRoute(userRoles));
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private defaultRoute(roles: string[]): string[] {
|
private defaultRoute(userRoles: roles[]): string[] {
|
||||||
if (!roles || roles.length === 0) {
|
if (userRoles.length === 0) {
|
||||||
return ['brand', 'new-user'];
|
return ['brand', 'new-user'];
|
||||||
}
|
}
|
||||||
switch (roles[0]) {
|
|
||||||
case 'user':
|
if (userRoles.includes('user') || userRoles.includes('contributor')) {
|
||||||
return ['songs'];
|
return ['songs'];
|
||||||
case 'presenter':
|
|
||||||
return ['presentation'];
|
|
||||||
case 'leader':
|
|
||||||
return ['shows'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['brand', 'new-user'];
|
if (userRoles.includes('leader') || userRoles.includes('member')) {
|
||||||
|
return ['shows'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userRoles.includes('presenter')) {
|
||||||
|
return ['presentation'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['user', 'info'];
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseRoles(role: string | null | undefined): roles[] {
|
||||||
|
if (!role) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return role
|
||||||
|
.split(';')
|
||||||
|
.map(value => value.trim())
|
||||||
|
.filter((value): value is roles => value.length > 0 && value !== 'none');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import {PublishedTypePipe} from './published-type.pipe';
|
||||||
|
|
||||||
|
describe('PublishedTypePipe', () => {
|
||||||
|
it('create an instance', () => {
|
||||||
|
const pipe = new PublishedTypePipe();
|
||||||
|
void expect(pipe).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should translate publication state', () => {
|
||||||
|
const pipe = new PublishedTypePipe();
|
||||||
|
|
||||||
|
expect(pipe.transform(true)).toBe('veröffentlicht');
|
||||||
|
expect(pipe.transform(false)).toBe('unveröffentlicht');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import {Pipe, PipeTransform} from '@angular/core';
|
||||||
|
|
||||||
|
@Pipe({
|
||||||
|
name: 'publishedType',
|
||||||
|
})
|
||||||
|
export class PublishedTypePipe implements PipeTransform {
|
||||||
|
public transform(published: boolean): string {
|
||||||
|
return published ? 'veröffentlicht' : 'unveröffentlicht';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import {ReportedTypePipe} from './reported-type.pipe';
|
||||||
|
|
||||||
|
describe('ReportedTypePipe', () => {
|
||||||
|
it('create an instance', () => {
|
||||||
|
const pipe = new ReportedTypePipe();
|
||||||
|
void expect(pipe).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should translate report states', () => {
|
||||||
|
const pipe = new ReportedTypePipe();
|
||||||
|
|
||||||
|
expect(pipe.transform('pending')).toBe('nicht gemeldet');
|
||||||
|
expect(pipe.transform('reported')).toBe('gemeldet');
|
||||||
|
expect(pipe.transform('not-required')).toBe('Meldung nicht notwendig');
|
||||||
|
expect(pipe.transform(null)).toBe('');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import {Pipe, PipeTransform} from '@angular/core';
|
||||||
|
import {ReportedType} from '../../../modules/shows/services/show';
|
||||||
|
|
||||||
|
@Pipe({
|
||||||
|
name: 'reportedType',
|
||||||
|
})
|
||||||
|
export class ReportedTypePipe implements PipeTransform {
|
||||||
|
public transform(reportedType: ReportedType): string {
|
||||||
|
switch (reportedType) {
|
||||||
|
case 'pending':
|
||||||
|
return 'nicht gemeldet';
|
||||||
|
case 'reported':
|
||||||
|
return 'gemeldet';
|
||||||
|
case 'not-required':
|
||||||
|
return 'Meldung nicht notwendig';
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,15 +4,15 @@ import {Pipe, PipeTransform} from '@angular/core';
|
|||||||
name: 'sortBy',
|
name: 'sortBy',
|
||||||
})
|
})
|
||||||
export class SortByPipe implements PipeTransform {
|
export class SortByPipe implements PipeTransform {
|
||||||
public transform(value: unknown[] | null, order: 'asc' | 'desc' = 'asc', column = ''): unknown[] | null {
|
public transform<T>(value: T[] | null, order: 'asc' | 'desc' = 'asc', column = ''): T[] | null {
|
||||||
if (!value || !order) {
|
if (!value || !order) {
|
||||||
return value;
|
return value;
|
||||||
} // no array
|
} // no array
|
||||||
if (!column || column === '') {
|
if (!column || column === '') {
|
||||||
if (order === 'asc') {
|
if (order === 'asc') {
|
||||||
return value.sort();
|
return [...value].sort();
|
||||||
} else {
|
} else {
|
||||||
return value.sort().reverse();
|
return [...value].sort().reverse();
|
||||||
}
|
}
|
||||||
} // sort 1d array
|
} // sort 1d array
|
||||||
if (value.length <= 1) {
|
if (value.length <= 1) {
|
||||||
@@ -26,7 +26,7 @@ export class SortByPipe implements PipeTransform {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getComparableValue(item: unknown, column: string): string | number {
|
private getComparableValue<T>(item: T, column: string): string | number {
|
||||||
const value = (item as Record<string, unknown>)[column];
|
const value = (item as Record<string, unknown>)[column];
|
||||||
if (value instanceof Date) {
|
if (value instanceof Date) {
|
||||||
return value.getTime();
|
return value.getTime();
|
||||||
|
|||||||
278
src/index.html
278
src/index.html
File diff suppressed because one or more lines are too long
12
src/main.ts
12
src/main.ts
@@ -18,6 +18,7 @@ declare global {
|
|||||||
interface Window {
|
interface Window {
|
||||||
wgeneratorAdmin?: {
|
wgeneratorAdmin?: {
|
||||||
rebuildSongUsage(): Promise<unknown>;
|
rebuildSongUsage(): Promise<unknown>;
|
||||||
|
rebuildShowSongIds(): Promise<unknown>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,6 +50,17 @@ bootstrapApplication(AppComponent, {
|
|||||||
const userService = appRef.injector.get(UserService);
|
const userService = appRef.injector.get(UserService);
|
||||||
window.wgeneratorAdmin = {
|
window.wgeneratorAdmin = {
|
||||||
rebuildSongUsage: () => userService.rebuildSongUsage(),
|
rebuildSongUsage: () => userService.rebuildSongUsage(),
|
||||||
|
rebuildShowSongIds: async () => {
|
||||||
|
console.info('[wgeneratorAdmin] rebuildShowSongIds started');
|
||||||
|
const result = await userService.rebuildShowSongIds(progress => {
|
||||||
|
console.info(`[wgeneratorAdmin] rebuildShowSongIds ${progress.processed}/${progress.total} shows processed`, {
|
||||||
|
showId: progress.showId,
|
||||||
|
showSongsProcessed: progress.showSongsProcessed,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
console.info('[wgeneratorAdmin] rebuildShowSongIds finished', result);
|
||||||
|
return result;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.catch(err => console.error(err));
|
.catch(err => console.error(err));
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angul
|
|||||||
import {provideNoopAnimations} from '@angular/platform-browser/animations';
|
import {provideNoopAnimations} from '@angular/platform-browser/animations';
|
||||||
import {ActivatedRoute, provideRouter} from '@angular/router';
|
import {ActivatedRoute, provideRouter} from '@angular/router';
|
||||||
import {BehaviorSubject, of} from 'rxjs';
|
import {BehaviorSubject, of} from 'rxjs';
|
||||||
|
import {Observable} from 'rxjs';
|
||||||
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
|
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
|
||||||
import {provideNativeDateAdapter} from '@angular/material/core';
|
import {provideNativeDateAdapter} from '@angular/material/core';
|
||||||
import {provideFirebaseApp, initializeApp} from '@angular/fire/app';
|
import {provideFirebaseApp, initializeApp} from '@angular/fire/app';
|
||||||
@@ -20,7 +21,7 @@ type req = {keys: () => {map: (context: req) => void}};
|
|||||||
type TestingModuleDefinition = Parameters<typeof TestBed.configureTestingModule>[0];
|
type TestingModuleDefinition = Parameters<typeof TestBed.configureTestingModule>[0];
|
||||||
type TestingProviderList = NonNullable<NonNullable<TestingModuleDefinition>['providers']>;
|
type TestingProviderList = NonNullable<NonNullable<TestingModuleDefinition>['providers']>;
|
||||||
type CollectionStub = {
|
type CollectionStub = {
|
||||||
valueChanges: () => ReturnType<typeof of>;
|
valueChanges: () => Observable<unknown[]>;
|
||||||
add: () => Promise<{id: string}>;
|
add: () => Promise<{id: string}>;
|
||||||
};
|
};
|
||||||
type DocumentStub = {
|
type DocumentStub = {
|
||||||
@@ -78,7 +79,7 @@ const defaultTestingProviders: TestingProviderList = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const originalConfigureTestingModule = TestBed.configureTestingModule.bind(TestBed) as typeof TestBed.configureTestingModule;
|
const originalConfigureTestingModule = TestBed.configureTestingModule.bind(TestBed);
|
||||||
const configureTestingModule: typeof TestBed.configureTestingModule = moduleDef => {
|
const configureTestingModule: typeof TestBed.configureTestingModule = moduleDef => {
|
||||||
const extraProviders: TestingProviderList = moduleDef?.providers ?? [];
|
const extraProviders: TestingProviderList = moduleDef?.providers ?? [];
|
||||||
const mergedModuleDef: TestingModuleDefinition = moduleDef ? {...moduleDef} : {};
|
const mergedModuleDef: TestingModuleDefinition = moduleDef ? {...moduleDef} : {};
|
||||||
|
|||||||
20
src/types/qrcode.d.ts
vendored
Normal file
20
src/types/qrcode.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
declare module 'qrcode' {
|
||||||
|
export interface QRCodeToDataURLOptions {
|
||||||
|
type?: string;
|
||||||
|
quality?: number;
|
||||||
|
width?: number;
|
||||||
|
height?: number;
|
||||||
|
color?: {
|
||||||
|
dark?: string;
|
||||||
|
light?: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function toDataURL(text: string, options?: QRCodeToDataURLOptions): Promise<string>;
|
||||||
|
|
||||||
|
const QRCode: {
|
||||||
|
toDataURL: typeof toDataURL;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default QRCode;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user