1 import { Component, Input, Output, EventEmitter } from '@angular/core';
3 import { NotificationsService } from 'angular2-notifications';
5 import { ConfirmService } from '../../core';
6 import { SortField, Video, VideoService } from '../shared';
7 import { User } from '../../shared';
10 selector: 'my-video-miniature',
11 styleUrls: [ './video-miniature.component.scss' ],
12 templateUrl: './video-miniature.component.html'
15 export class VideoMiniatureComponent {
16 @Output() removed = new EventEmitter<any>();
18 @Input() currentSort: SortField;
20 @Input() video: Video;
25 private notificationsService: NotificationsService,
26 private confirmService: ConfirmService,
27 private videoService: VideoService
31 return this.hovering && this.video.isRemovableBy(this.user);
35 this.hovering = false;
42 removeVideo(id: string) {
43 this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe(
45 if (res === false) return;
47 this.videoService.removeVideo(id).subscribe(
48 status => this.removed.emit(true),
50 error => this.notificationsService.error('Error', error.text)