diff options
Diffstat (limited to 'client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts')
-rw-r--r-- | client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts deleted file mode 100644 index 9dd5ef142..000000000 --- a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | import { SortMeta } from 'primeng/api' | ||
2 | import { Component, OnInit } from '@angular/core' | ||
3 | import { Notifier, RestPagination, RestTable } from '@app/core' | ||
4 | import { VideoImportService } from '@app/shared/shared-main' | ||
5 | import { VideoImport, VideoImportState } from '@shared/models' | ||
6 | |||
7 | @Component({ | ||
8 | selector: 'my-account-video-imports', | ||
9 | templateUrl: './my-account-video-imports.component.html', | ||
10 | styleUrls: [ './my-account-video-imports.component.scss' ] | ||
11 | }) | ||
12 | export class MyAccountVideoImportsComponent extends RestTable implements OnInit { | ||
13 | videoImports: VideoImport[] = [] | ||
14 | totalRecords = 0 | ||
15 | sort: SortMeta = { field: 'createdAt', order: 1 } | ||
16 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | ||
17 | |||
18 | constructor ( | ||
19 | private notifier: Notifier, | ||
20 | private videoImportService: VideoImportService | ||
21 | ) { | ||
22 | super() | ||
23 | } | ||
24 | |||
25 | ngOnInit () { | ||
26 | this.initialize() | ||
27 | } | ||
28 | |||
29 | getIdentifier () { | ||
30 | return 'MyAccountVideoImportsComponent' | ||
31 | } | ||
32 | |||
33 | getVideoImportStateClass (state: VideoImportState) { | ||
34 | switch (state) { | ||
35 | case VideoImportState.FAILED: | ||
36 | return 'badge-red' | ||
37 | case VideoImportState.REJECTED: | ||
38 | return 'badge-banned' | ||
39 | case VideoImportState.PENDING: | ||
40 | return 'badge-yellow' | ||
41 | default: | ||
42 | return 'badge-green' | ||
43 | } | ||
44 | } | ||
45 | |||
46 | isVideoImportSuccess (videoImport: VideoImport) { | ||
47 | return videoImport.state.id === VideoImportState.SUCCESS | ||
48 | } | ||
49 | |||
50 | isVideoImportPending (videoImport: VideoImport) { | ||
51 | return videoImport.state.id === VideoImportState.PENDING | ||
52 | } | ||
53 | |||
54 | isVideoImportFailed (videoImport: VideoImport) { | ||
55 | return videoImport.state.id === VideoImportState.FAILED | ||
56 | } | ||
57 | |||
58 | getVideoUrl (video: { uuid: string }) { | ||
59 | return '/videos/watch/' + video.uuid | ||
60 | } | ||
61 | |||
62 | getEditVideoUrl (video: { uuid: string }) { | ||
63 | return '/videos/update/' + video.uuid | ||
64 | } | ||
65 | |||
66 | protected loadData () { | ||
67 | this.videoImportService.getMyVideoImports(this.pagination, this.sort) | ||
68 | .subscribe( | ||
69 | resultList => { | ||
70 | this.videoImports = resultList.data | ||
71 | this.totalRecords = resultList.total | ||
72 | }, | ||
73 | |||
74 | err => this.notifier.error(err.message) | ||
75 | ) | ||
76 | } | ||
77 | } | ||