aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-02 17:48:50 +0200
committerChocobozzz <me@florianbigard.com>2018-08-06 11:19:16 +0200
commited31c059851a30bd5ba9999f8ecb3822d576b9f4 (patch)
tree7923ef7891ae9fd26965c3004bd75e736f0fedd0 /client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts
parent299474e8279675adb6c5ce140e7e39c6f3439453 (diff)
downloadPeerTube-ed31c059851a30bd5ba9999f8ecb3822d576b9f4.tar.gz
PeerTube-ed31c059851a30bd5ba9999f8ecb3822d576b9f4.tar.zst
PeerTube-ed31c059851a30bd5ba9999f8ecb3822d576b9f4.zip
Add ability to list video imports
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.ts66
1 files changed, 66 insertions, 0 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
new file mode 100644
index 000000000..31ccb0bc8
--- /dev/null
+++ b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts
@@ -0,0 +1,66 @@
1import { Component, OnInit } from '@angular/core'
2import { RestPagination, RestTable } from '@app/shared'
3import { SortMeta } from 'primeng/components/common/sortmeta'
4import { NotificationsService } from 'angular2-notifications'
5import { ConfirmService } from '@app/core'
6import { I18n } from '@ngx-translate/i18n-polyfill'
7import { VideoImport, VideoImportState } from '../../../../../shared/models/videos'
8import { VideoImportService } from '@app/shared/video-import'
9
10@Component({
11 selector: 'my-account-video-imports',
12 templateUrl: './my-account-video-imports.component.html',
13 styleUrls: [ './my-account-video-imports.component.scss' ]
14})
15export class MyAccountVideoImportsComponent extends RestTable implements OnInit {
16 videoImports: VideoImport[] = []
17 totalRecords = 0
18 rowsPerPage = 10
19 sort: SortMeta = { field: 'createdAt', order: 1 }
20 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
21
22 constructor (
23 private notificationsService: NotificationsService,
24 private confirmService: ConfirmService,
25 private videoImportService: VideoImportService,
26 private i18n: I18n
27 ) {
28 super()
29 }
30
31 ngOnInit () {
32 this.loadSort()
33 }
34
35 isVideoImportSuccess (videoImport: VideoImport) {
36 return videoImport.state.id === VideoImportState.SUCCESS
37 }
38
39 isVideoImportPending (videoImport: VideoImport) {
40 return videoImport.state.id === VideoImportState.PENDING
41 }
42
43 isVideoImportFailed (videoImport: VideoImport) {
44 return videoImport.state.id === VideoImportState.FAILED
45 }
46
47 getVideoUrl (video: { uuid: string }) {
48 return '/videos/watch/' + video.uuid
49 }
50
51 getEditVideoUrl (video: { uuid: string }) {
52 return '/videos/update/' + video.uuid
53 }
54
55 protected loadData () {
56 this.videoImportService.getMyVideoImports(this.pagination, this.sort)
57 .subscribe(
58 resultList => {
59 this.videoImports = resultList.data
60 this.totalRecords = resultList.total
61 },
62
63 err => this.notificationsService.error(this.i18n('Error'), err.message)
64 )
65 }
66}