aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/friends/friend-list
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-15 10:10:41 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commit51548b31815c6f96f314ae96588a9adca150519d (patch)
treeb3298447b7ac128823016fdec92d083e07d9432e /client/src/app/+admin/friends/friend-list
parent350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad (diff)
downloadPeerTube-51548b31815c6f96f314ae96588a9adca150519d.tar.gz
PeerTube-51548b31815c6f96f314ae96588a9adca150519d.tar.zst
PeerTube-51548b31815c6f96f314ae96588a9adca150519d.zip
Add follow tabs
Following Follow Followers
Diffstat (limited to 'client/src/app/+admin/friends/friend-list')
-rw-r--r--client/src/app/+admin/friends/friend-list/friend-list.component.html29
-rw-r--r--client/src/app/+admin/friends/friend-list/friend-list.component.scss3
-rw-r--r--client/src/app/+admin/friends/friend-list/friend-list.component.ts87
-rw-r--r--client/src/app/+admin/friends/friend-list/index.ts1
4 files changed, 0 insertions, 120 deletions
diff --git a/client/src/app/+admin/friends/friend-list/friend-list.component.html b/client/src/app/+admin/friends/friend-list/friend-list.component.html
deleted file mode 100644
index df5a570fd..000000000
--- a/client/src/app/+admin/friends/friend-list/friend-list.component.html
+++ /dev/null
@@ -1,29 +0,0 @@
1<div class="row">
2 <div class="content-padding">
3 <h3>Friends list</h3>
4
5 <p-dataTable
6 [value]="friends" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
7 sortField="createdAt" (onLazyLoad)="loadLazy($event)"
8 >
9 <p-column field="id" header="ID"></p-column>
10 <p-column field="host" header="Host"></p-column>
11 <p-column field="email" header="Email"></p-column>
12 <p-column field="score" header="Score"></p-column>
13 <p-column field="createdAt" header="Created date" [sortable]="true"></p-column>
14 <p-column header="Delete" styleClass="action-cell">
15 <ng-template pTemplate="body" let-pod="rowData">
16 <span (click)="removeFriend(pod)" class="glyphicon glyphicon-remove glyphicon-black" title="Remove this pod"></span>
17 </ng-template>
18 </p-column>
19 </p-dataTable>
20
21 <a *ngIf="hasFriends()" class="btn btn-danger pull-left" (click)="quitFriends()">
22 Quit friends
23 </a>
24
25 <a *ngIf="!hasFriends()" class="btn btn-success pull-right" [routerLink]="[ '/admin/friends/add' ]">
26 Make friends
27 </a>
28 </div>
29</div>
diff --git a/client/src/app/+admin/friends/friend-list/friend-list.component.scss b/client/src/app/+admin/friends/friend-list/friend-list.component.scss
deleted file mode 100644
index 0a0f621c6..000000000
--- a/client/src/app/+admin/friends/friend-list/friend-list.component.scss
+++ /dev/null
@@ -1,3 +0,0 @@
1.btn {
2 margin-top: 10px;
3}
diff --git a/client/src/app/+admin/friends/friend-list/friend-list.component.ts b/client/src/app/+admin/friends/friend-list/friend-list.component.ts
deleted file mode 100644
index 3fa8ef19f..000000000
--- a/client/src/app/+admin/friends/friend-list/friend-list.component.ts
+++ /dev/null
@@ -1,87 +0,0 @@
1import { Component, OnInit } from '@angular/core'
2
3import { NotificationsService } from 'angular2-notifications'
4import { SortMeta } from 'primeng/primeng'
5
6import { ConfirmService } from '../../../core'
7import { RestTable, RestPagination } from '../../../shared'
8import { Pod } from '../../../../../../shared'
9import { FriendService } from '../shared'
10
11@Component({
12 selector: 'my-friend-list',
13 templateUrl: './friend-list.component.html',
14 styleUrls: ['./friend-list.component.scss']
15})
16export class FriendListComponent extends RestTable implements OnInit {
17 friends: Pod[] = []
18 totalRecords = 0
19 rowsPerPage = 10
20 sort: SortMeta = { field: 'createdAt', order: 1 }
21 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
22
23 constructor (
24 private notificationsService: NotificationsService,
25 private confirmService: ConfirmService,
26 private friendService: FriendService
27 ) {
28 super()
29 }
30
31 ngOnInit () {
32 this.loadData()
33 }
34
35 hasFriends () {
36 return this.friends.length !== 0
37 }
38
39 quitFriends () {
40 const confirmMessage = 'Do you really want to quit your friends? All their videos will be deleted.'
41 this.confirmService.confirm(confirmMessage, 'Quit friends').subscribe(
42 res => {
43 if (res === false) return
44
45 this.friendService.quitFriends().subscribe(
46 status => {
47 this.notificationsService.success('Success', 'Friends left!')
48 this.loadData()
49 },
50
51 err => this.notificationsService.error('Error', err.message)
52 )
53 }
54 )
55 }
56
57 removeFriend (friend: Pod) {
58 const confirmMessage = 'Do you really want to remove this friend ? All its videos will be deleted.'
59
60 this.confirmService.confirm(confirmMessage, 'Remove').subscribe(
61 res => {
62 if (res === false) return
63
64 this.friendService.removeFriend(friend).subscribe(
65 status => {
66 this.notificationsService.success('Success', 'Friend removed')
67 this.loadData()
68 },
69
70 err => this.notificationsService.error('Error', err.message)
71 )
72 }
73 )
74 }
75
76 protected loadData () {
77 this.friendService.getFollowing(this.pagination, this.sort)
78 .subscribe(
79 resultList => {
80 this.friends = resultList.data
81 this.totalRecords = resultList.total
82 },
83
84 err => this.notificationsService.error('Error', err.message)
85 )
86 }
87}
diff --git a/client/src/app/+admin/friends/friend-list/index.ts b/client/src/app/+admin/friends/friend-list/index.ts
deleted file mode 100644
index c9cbd2800..000000000
--- a/client/src/app/+admin/friends/friend-list/index.ts
+++ /dev/null
@@ -1 +0,0 @@
1export * from './friend-list.component'