aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-27 16:54:44 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-27 16:59:56 +0100
commit5769e1db8d3d5a1e3baa8dff23090cfe93d48a50 (patch)
treeacbb14fda82b7517734f22d4ca57fb5e1ff9ef04 /client/src/app/+admin
parent7ddd02c9b8c1e088f6679a2227f105e6439fc992 (diff)
downloadPeerTube-5769e1db8d3d5a1e3baa8dff23090cfe93d48a50.tar.gz
PeerTube-5769e1db8d3d5a1e3baa8dff23090cfe93d48a50.tar.zst
PeerTube-5769e1db8d3d5a1e3baa8dff23090cfe93d48a50.zip
Client: better confirm box for a beautiful world
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/friends/friend-add/friend-add.component.ts22
-rw-r--r--client/src/app/+admin/friends/friend-list/friend-list.component.ts21
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.ts26
3 files changed, 44 insertions, 25 deletions
diff --git a/client/src/app/+admin/friends/friend-add/friend-add.component.ts b/client/src/app/+admin/friends/friend-add/friend-add.component.ts
index a271970ae..12c46e5cd 100644
--- a/client/src/app/+admin/friends/friend-add/friend-add.component.ts
+++ b/client/src/app/+admin/friends/friend-add/friend-add.component.ts
@@ -4,6 +4,7 @@ import { Router } from '@angular/router';
4 4
5import { NotificationsService } from 'angular2-notifications'; 5import { NotificationsService } from 'angular2-notifications';
6 6
7import { ConfirmService } from '../../../core';
7import { validateHost } from '../../../shared'; 8import { validateHost } from '../../../shared';
8import { FriendService } from '../shared'; 9import { FriendService } from '../shared';
9 10
@@ -20,6 +21,7 @@ export class FriendAddComponent implements OnInit {
20 constructor( 21 constructor(
21 private router: Router, 22 private router: Router,
22 private notificationsService: NotificationsService, 23 private notificationsService: NotificationsService,
24 private confirmService: ConfirmService,
23 private friendService: FriendService 25 private friendService: FriendService
24 ) {} 26 ) {}
25 27
@@ -84,16 +86,20 @@ export class FriendAddComponent implements OnInit {
84 return; 86 return;
85 } 87 }
86 88
87 const confirmMessage = 'Are you sure to make friends with:\n - ' + notEmptyHosts.join('\n - '); 89 const confirmMessage = 'Are you sure to make friends with:<br /> - ' + notEmptyHosts.join('<br /> - ');
88 if (!confirm(confirmMessage)) return; 90 this.confirmService.confirm(confirmMessage, 'Make friends').subscribe(
91 res => {
92 if (res === false) return;
89 93
90 this.friendService.makeFriends(notEmptyHosts).subscribe( 94 this.friendService.makeFriends(notEmptyHosts).subscribe(
91 status => { 95 status => {
92 this.notificationsService.success('Sucess', 'Make friends request sent!'); 96 this.notificationsService.success('Sucess', 'Make friends request sent!');
93 this.router.navigate([ '/admin/friends/list' ]); 97 this.router.navigate([ '/admin/friends/list' ]);
94 }, 98 },
95 99
96 err => this.notificationsService.error('Error', err.text) 100 err => this.notificationsService.error('Error', err.text)
101 );
102 }
97 ); 103 );
98 } 104 }
99 105
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 700ea7a69..175ad9cba 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
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
2 2
3import { NotificationsService } from 'angular2-notifications'; 3import { NotificationsService } from 'angular2-notifications';
4 4
5import { ConfirmService } from '../../../core';
5import { Friend, FriendService } from '../shared'; 6import { Friend, FriendService } from '../shared';
6 7
7@Component({ 8@Component({
@@ -14,6 +15,7 @@ export class FriendListComponent implements OnInit {
14 15
15 constructor( 16 constructor(
16 private notificationsService: NotificationsService, 17 private notificationsService: NotificationsService,
18 private confirmService: ConfirmService,
17 private friendService: FriendService 19 private friendService: FriendService
18 ) { } 20 ) { }
19 21
@@ -22,16 +24,21 @@ export class FriendListComponent implements OnInit {
22 } 24 }
23 25
24 quitFriends() { 26 quitFriends() {
25 if (!confirm('Are you sure?')) return; 27 const confirmMessage = 'Do you really want to quit your friends? All their videos will be deleted.';
28 this.confirmService.confirm(confirmMessage, 'Quit friends').subscribe(
29 res => {
30 if (res === false) return;
26 31
27 this.friendService.quitFriends().subscribe( 32 this.friendService.quitFriends().subscribe(
28 status => { 33 status => {
29 this.notificationsService.success('Sucess', 'Friends left!'); 34 this.notificationsService.success('Sucess', 'Friends left!');
30 35
31 this.getFriends(); 36 this.getFriends();
32 }, 37 },
33 38
34 err => this.notificationsService.error('Error', err.text) 39 err => this.notificationsService.error('Error', err.text)
40 );
41 }
35 ); 42 );
36 } 43 }
37 44
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts
index ca08ed305..baefb7064 100644
--- a/client/src/app/+admin/users/user-list/user-list.component.ts
+++ b/client/src/app/+admin/users/user-list/user-list.component.ts
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
2 2
3import { NotificationsService } from 'angular2-notifications'; 3import { NotificationsService } from 'angular2-notifications';
4 4
5import { ConfirmService } from '../../../core';
5import { User } from '../../../shared'; 6import { User } from '../../../shared';
6import { UserService } from '../shared'; 7import { UserService } from '../shared';
7 8
@@ -16,6 +17,7 @@ export class UserListComponent implements OnInit {
16 17
17 constructor( 18 constructor(
18 private notificationsService: NotificationsService, 19 private notificationsService: NotificationsService,
20 private confirmService: ConfirmService,
19 private userService: UserService 21 private userService: UserService
20 ) {} 22 ) {}
21 23
@@ -36,15 +38,19 @@ export class UserListComponent implements OnInit {
36 38
37 39
38 removeUser(user: User) { 40 removeUser(user: User) {
39 if (confirm('Are you sure?')) { 41 this.confirmService.confirm('Do you really want to delete this user?', 'Delete').subscribe(
40 this.userService.removeUser(user).subscribe( 42 res => {
41 () => { 43 if (res === false) return;
42 this.notificationsService.success('Success', `User ${user.username} deleted.`); 44
43 this.getUsers(); 45 this.userService.removeUser(user).subscribe(
44 }, 46 () => {
45 47 this.notificationsService.success('Success', `User ${user.username} deleted.`);
46 err => this.notificationsService.error('Error', err.text) 48 this.getUsers();
47 ); 49 },
48 } 50
51 err => this.notificationsService.error('Error', err.text)
52 );
53 }
54 );
49 } 55 }
50} 56}