aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/friends/friend-list/friend-list.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/friends/friend-list/friend-list.component.ts')
-rw-r--r--client/src/app/+admin/friends/friend-list/friend-list.component.ts30
1 files changed, 27 insertions, 3 deletions
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
index 9f0256d7f..822a112cc 100644
--- a/client/src/app/+admin/friends/friend-list/friend-list.component.ts
+++ b/client/src/app/+admin/friends/friend-list/friend-list.component.ts
@@ -6,6 +6,7 @@ import { ServerDataSource } from 'ng2-smart-table'
6import { ConfirmService } from '../../../core' 6import { ConfirmService } from '../../../core'
7import { Utils } from '../../../shared' 7import { Utils } from '../../../shared'
8import { FriendService } from '../shared' 8import { FriendService } from '../shared'
9import { Pod } from '../../../../../../shared'
9 10
10@Component({ 11@Component({
11 selector: 'my-friend-list', 12 selector: 'my-friend-list',
@@ -15,6 +16,7 @@ import { FriendService } from '../shared'
15export class FriendListComponent { 16export class FriendListComponent {
16 friendsSource = null 17 friendsSource = null
17 tableSettings = { 18 tableSettings = {
19 mode: 'external',
18 attr: { 20 attr: {
19 class: 'table-hover' 21 class: 'table-hover'
20 }, 22 },
@@ -23,7 +25,10 @@ export class FriendListComponent {
23 position: 'right', 25 position: 'right',
24 add: false, 26 add: false,
25 edit: false, 27 edit: false,
26 delete: false 28 delete: true
29 },
30 delete: {
31 deleteButtonContent: Utils.getRowDeleteButton()
27 }, 32 },
28 columns: { 33 columns: {
29 id: { 34 id: {
@@ -71,8 +76,7 @@ export class FriendListComponent {
71 76
72 this.friendService.quitFriends().subscribe( 77 this.friendService.quitFriends().subscribe(
73 status => { 78 status => {
74 this.notificationsService.success('Sucess', 'Friends left!') 79 this.notificationsService.success('Success', 'Friends left!')
75
76 this.friendsSource.refresh() 80 this.friendsSource.refresh()
77 }, 81 },
78 82
@@ -81,4 +85,24 @@ export class FriendListComponent {
81 } 85 }
82 ) 86 )
83 } 87 }
88
89 removeFriend ({ data }) {
90 const confirmMessage = 'Do you really want to remove this friend ? All its videos will be deleted.'
91 const friend: Pod = data
92
93 this.confirmService.confirm(confirmMessage, 'Remove').subscribe(
94 res => {
95 if (res === false) return
96
97 this.friendService.removeFriend(friend).subscribe(
98 status => {
99 this.notificationsService.success('Success', 'Friend removed')
100 this.friendsSource.refresh()
101 },
102
103 err => this.notificationsService.error('Error', err.text)
104 )
105 }
106 )
107 }
84} 108}