diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-22 15:29:32 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-22 15:29:32 +0100 |
commit | 1f30a1853e38c20a45722dbd6d38aaaec63839e8 (patch) | |
tree | cdce8cc9fcc62d9b3343c9478b1dbcefedcea972 /client/src/app/+admin/users | |
parent | 78967fca4cacbc247fa6fb62d64b2d6825a10804 (diff) | |
download | PeerTube-1f30a1853e38c20a45722dbd6d38aaaec63839e8.tar.gz PeerTube-1f30a1853e38c20a45722dbd6d38aaaec63839e8.tar.zst PeerTube-1f30a1853e38c20a45722dbd6d38aaaec63839e8.zip |
Add confirm when admin use custom js/css
Diffstat (limited to 'client/src/app/+admin/users')
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.ts | 25 |
1 files changed, 11 insertions, 14 deletions
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 1e8e1af49..512152808 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 | |||
@@ -1,10 +1,10 @@ | |||
1 | import { Component } from '@angular/core' | 1 | import { Component } from '@angular/core' |
2 | import { SortMeta } from 'primeng/components/common/sortmeta' | ||
3 | 2 | ||
4 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { SortMeta } from 'primeng/components/common/sortmeta' | ||
5 | 5 | ||
6 | import { ConfirmService } from '../../../core' | 6 | import { ConfirmService } from '../../../core' |
7 | import { RestTable, RestPagination, User } from '../../../shared' | 7 | import { RestPagination, RestTable, User } from '../../../shared' |
8 | import { UserService } from '../shared' | 8 | import { UserService } from '../shared' |
9 | 9 | ||
10 | @Component({ | 10 | @Component({ |
@@ -27,25 +27,22 @@ export class UserListComponent extends RestTable { | |||
27 | super() | 27 | super() |
28 | } | 28 | } |
29 | 29 | ||
30 | removeUser (user: User) { | 30 | async removeUser (user: User) { |
31 | if (user.username === 'root') { | 31 | if (user.username === 'root') { |
32 | this.notificationsService.error('Error', 'You cannot delete root.') | 32 | this.notificationsService.error('Error', 'You cannot delete root.') |
33 | return | 33 | return |
34 | } | 34 | } |
35 | 35 | ||
36 | this.confirmService.confirm('Do you really want to delete this user?', 'Delete').subscribe( | 36 | const res = await this.confirmService.confirm('Do you really want to delete this user?', 'Delete') |
37 | res => { | 37 | if (res === false) return |
38 | if (res === false) return | ||
39 | 38 | ||
40 | this.userService.removeUser(user).subscribe( | 39 | this.userService.removeUser(user).subscribe( |
41 | () => { | 40 | () => { |
42 | this.notificationsService.success('Success', `User ${user.username} deleted.`) | 41 | this.notificationsService.success('Success', `User ${user.username} deleted.`) |
43 | this.loadData() | 42 | this.loadData() |
44 | }, | 43 | }, |
45 | 44 | ||
46 | err => this.notificationsService.error('Error', err.message) | 45 | err => this.notificationsService.error('Error', err.message) |
47 | ) | ||
48 | } | ||
49 | ) | 46 | ) |
50 | } | 47 | } |
51 | 48 | ||