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-account/my-account-ownership/my-account-ownership.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-account/my-account-ownership/my-account-ownership.component.ts')
-rw-r--r-- | client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts b/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts deleted file mode 100644 index 7473470aa..000000000 --- a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | import { SortMeta } from 'primeng/api' | ||
2 | import { Component, OnInit, ViewChild } from '@angular/core' | ||
3 | import { Notifier, RestPagination, RestTable } from '@app/core' | ||
4 | import { VideoOwnershipService, Actor, Video, Account } from '@app/shared/shared-main' | ||
5 | import { VideoChangeOwnership, VideoChangeOwnershipStatus } from '@shared/models' | ||
6 | import { MyAccountAcceptOwnershipComponent } from './my-account-accept-ownership/my-account-accept-ownership.component' | ||
7 | import { getAbsoluteAPIUrl } from '@app/helpers' | ||
8 | |||
9 | @Component({ | ||
10 | selector: 'my-account-ownership', | ||
11 | templateUrl: './my-account-ownership.component.html', | ||
12 | styleUrls: [ './my-account-ownership.component.scss' ] | ||
13 | }) | ||
14 | export class MyAccountOwnershipComponent extends RestTable implements OnInit { | ||
15 | videoChangeOwnerships: VideoChangeOwnership[] = [] | ||
16 | totalRecords = 0 | ||
17 | sort: SortMeta = { field: 'createdAt', order: -1 } | ||
18 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | ||
19 | |||
20 | @ViewChild('myAccountAcceptOwnershipComponent', { static: true }) myAccountAcceptOwnershipComponent: MyAccountAcceptOwnershipComponent | ||
21 | |||
22 | constructor ( | ||
23 | private notifier: Notifier, | ||
24 | private videoOwnershipService: VideoOwnershipService | ||
25 | ) { | ||
26 | super() | ||
27 | } | ||
28 | |||
29 | ngOnInit () { | ||
30 | this.initialize() | ||
31 | } | ||
32 | |||
33 | getIdentifier () { | ||
34 | return 'MyAccountOwnershipComponent' | ||
35 | } | ||
36 | |||
37 | getStatusClass (status: VideoChangeOwnershipStatus) { | ||
38 | switch (status) { | ||
39 | case VideoChangeOwnershipStatus.ACCEPTED: | ||
40 | return 'badge-green' | ||
41 | case VideoChangeOwnershipStatus.REFUSED: | ||
42 | return 'badge-red' | ||
43 | default: | ||
44 | return 'badge-yellow' | ||
45 | } | ||
46 | } | ||
47 | |||
48 | switchToDefaultAvatar ($event: Event) { | ||
49 | ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() | ||
50 | } | ||
51 | |||
52 | openAcceptModal (videoChangeOwnership: VideoChangeOwnership) { | ||
53 | this.myAccountAcceptOwnershipComponent.show(videoChangeOwnership) | ||
54 | } | ||
55 | |||
56 | accepted () { | ||
57 | this.loadData() | ||
58 | } | ||
59 | |||
60 | refuse (videoChangeOwnership: VideoChangeOwnership) { | ||
61 | this.videoOwnershipService.refuseOwnership(videoChangeOwnership.id) | ||
62 | .subscribe( | ||
63 | () => this.loadData(), | ||
64 | err => this.notifier.error(err.message) | ||
65 | ) | ||
66 | } | ||
67 | |||
68 | protected loadData () { | ||
69 | return this.videoOwnershipService.getOwnershipChanges(this.pagination, this.sort) | ||
70 | .subscribe( | ||
71 | resultList => { | ||
72 | this.videoChangeOwnerships = resultList.data.map(change => ({ | ||
73 | ...change, | ||
74 | initiatorAccount: new Account(change.initiatorAccount), | ||
75 | nextOwnerAccount: new Account(change.nextOwnerAccount) | ||
76 | })) | ||
77 | this.totalRecords = resultList.total | ||
78 | }, | ||
79 | |||
80 | err => this.notifier.error(err.message) | ||
81 | ) | ||
82 | } | ||
83 | } | ||