]>
Commit | Line | Data |
---|---|---|
8b61dcaf | 1 | import { finalize } from 'rxjs/operators' |
0ca454e3 | 2 | import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' |
8b61dcaf | 3 | import { Notifier } from '@app/core' |
3da38d6e | 4 | import { FindInBulkService } from '@app/shared/shared-search' |
8ee25e17 | 5 | import { MiniatureDisplayOptions } from '../../shared-video-miniature' |
3da38d6e | 6 | import { VideoPlaylist } from '../../shared-video-playlist' |
0ca454e3 | 7 | import { CustomMarkupComponent } from './shared' |
2539932e C |
8 | |
9 | /* | |
10 | * Markup component that creates a playlist miniature only | |
11 | */ | |
12 | ||
13 | @Component({ | |
14 | selector: 'my-playlist-miniature-markup', | |
15 | templateUrl: 'playlist-miniature-markup.component.html', | |
16 | styleUrls: [ 'playlist-miniature-markup.component.scss' ] | |
17 | }) | |
0ca454e3 | 18 | export class PlaylistMiniatureMarkupComponent implements CustomMarkupComponent, OnInit { |
2539932e C |
19 | @Input() uuid: string |
20 | ||
0ca454e3 C |
21 | @Output() loaded = new EventEmitter<boolean>() |
22 | ||
2539932e C |
23 | playlist: VideoPlaylist |
24 | ||
25 | displayOptions: MiniatureDisplayOptions = { | |
26 | date: true, | |
27 | views: true, | |
28 | by: true, | |
29 | avatar: false, | |
30 | privacyLabel: false, | |
31 | privacyText: false, | |
32 | state: false, | |
33 | blacklistInfo: false | |
34 | } | |
35 | ||
36 | constructor ( | |
3da38d6e | 37 | private findInBulkService: FindInBulkService, |
8b61dcaf | 38 | private notifier: Notifier |
2539932e C |
39 | ) { } |
40 | ||
41 | ngOnInit () { | |
3da38d6e | 42 | this.findInBulkService.getPlaylist(this.uuid) |
8b61dcaf | 43 | .pipe(finalize(() => this.loaded.emit(true))) |
1378c0d3 C |
44 | .subscribe({ |
45 | next: playlist => this.playlist = playlist, | |
0ca454e3 | 46 | |
1378c0d3 C |
47 | error: err => this.notifier.error($localize`Error in playlist miniature component: ${err.message}`) |
48 | }) | |
2539932e C |
49 | } |
50 | } |