diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-12 15:28:54 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-13 12:02:21 +0100 |
commit | 17119e4a546522468878cf115558b17949ab50d0 (patch) | |
tree | 3f130cfd7fdccf5aeeac9beee941750590239047 /client/src/app/+my-library/my-video-imports/my-video-imports.component.ts | |
parent | b4bc269e5517849b5b89052f0c1a2c01b6f65089 (diff) | |
download | PeerTube-17119e4a546522468878cf115558b17949ab50d0.tar.gz PeerTube-17119e4a546522468878cf115558b17949ab50d0.tar.zst PeerTube-17119e4a546522468878cf115558b17949ab50d0.zip |
Reorganize left menu and account menu
Add my-settings and my-library in left menu
Move administration below my-library
Split account menu: my-setting and my library
Diffstat (limited to 'client/src/app/+my-library/my-video-imports/my-video-imports.component.ts')
-rw-r--r-- | client/src/app/+my-library/my-video-imports/my-video-imports.component.ts | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts new file mode 100644 index 000000000..d6d7d7a1b --- /dev/null +++ b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts | |||
@@ -0,0 +1,76 @@ | |||
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 | templateUrl: './my-video-imports.component.html', | ||
9 | styleUrls: [ './my-video-imports.component.scss' ] | ||
10 | }) | ||
11 | export class MyVideoImportsComponent extends RestTable implements OnInit { | ||
12 | videoImports: VideoImport[] = [] | ||
13 | totalRecords = 0 | ||
14 | sort: SortMeta = { field: 'createdAt', order: 1 } | ||
15 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | ||
16 | |||
17 | constructor ( | ||
18 | private notifier: Notifier, | ||
19 | private videoImportService: VideoImportService | ||
20 | ) { | ||
21 | super() | ||
22 | } | ||
23 | |||
24 | ngOnInit () { | ||
25 | this.initialize() | ||
26 | } | ||
27 | |||
28 | getIdentifier () { | ||
29 | return 'MyVideoImportsComponent' | ||
30 | } | ||
31 | |||
32 | getVideoImportStateClass (state: VideoImportState) { | ||
33 | switch (state) { | ||
34 | case VideoImportState.FAILED: | ||
35 | return 'badge-red' | ||
36 | case VideoImportState.REJECTED: | ||
37 | return 'badge-banned' | ||
38 | case VideoImportState.PENDING: | ||
39 | return 'badge-yellow' | ||
40 | default: | ||
41 | return 'badge-green' | ||
42 | } | ||
43 | } | ||
44 | |||
45 | isVideoImportSuccess (videoImport: VideoImport) { | ||
46 | return videoImport.state.id === VideoImportState.SUCCESS | ||
47 | } | ||
48 | |||
49 | isVideoImportPending (videoImport: VideoImport) { | ||
50 | return videoImport.state.id === VideoImportState.PENDING | ||
51 | } | ||
52 | |||
53 | isVideoImportFailed (videoImport: VideoImport) { | ||
54 | return videoImport.state.id === VideoImportState.FAILED | ||
55 | } | ||
56 | |||
57 | getVideoUrl (video: { uuid: string }) { | ||
58 | return '/videos/watch/' + video.uuid | ||
59 | } | ||
60 | |||
61 | getEditVideoUrl (video: { uuid: string }) { | ||
62 | return '/videos/update/' + video.uuid | ||
63 | } | ||
64 | |||
65 | protected loadData () { | ||
66 | this.videoImportService.getMyVideoImports(this.pagination, this.sort) | ||
67 | .subscribe( | ||
68 | resultList => { | ||
69 | this.videoImports = resultList.data | ||
70 | this.totalRecords = resultList.total | ||
71 | }, | ||
72 | |||
73 | err => this.notifier.error(err.message) | ||
74 | ) | ||
75 | } | ||
76 | } | ||