diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-05 21:29:39 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-05 21:29:39 +0200 |
commit | 8094a8980265a0a28e508dbd7cf7c7029e6d98b6 (patch) | |
tree | 26be2b9b43dfe485ea14eb53d3a1adb6247c35f8 /client/src/app/+admin/users/user-list | |
parent | 980246ea8f1c51a137eaf0c441ef7e3b6fb88810 (diff) | |
download | PeerTube-8094a8980265a0a28e508dbd7cf7c7029e6d98b6.tar.gz PeerTube-8094a8980265a0a28e508dbd7cf7c7029e6d98b6.tar.zst PeerTube-8094a8980265a0a28e508dbd7cf7c7029e6d98b6.zip |
Add user update for admins
Diffstat (limited to 'client/src/app/+admin/users/user-list')
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.html | 2 | ||||
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.ts | 17 |
2 files changed, 14 insertions, 5 deletions
diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index bb4c99a3f..eb5bc9d4a 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | <ng2-smart-table | 6 | <ng2-smart-table |
7 | [settings]="tableSettings" [source]="usersSource" | 7 | [settings]="tableSettings" [source]="usersSource" |
8 | (delete)="removeUser($event)" | 8 | (delete)="removeUser($event)" (edit)="editUser($event)" |
9 | ></ng2-smart-table> | 9 | ></ng2-smart-table> |
10 | 10 | ||
11 | <a class="add-user btn btn-success pull-right" [routerLink]="['/admin/users/add']"> | 11 | <a class="add-user btn btn-success pull-right" [routerLink]="['/admin/users/add']"> |
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 dbb85cedd..7187a2008 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 | |||
@@ -5,6 +5,7 @@ import { NotificationsService } from 'angular2-notifications' | |||
5 | import { ConfirmService } from '../../../core' | 5 | import { ConfirmService } from '../../../core' |
6 | import { RestDataSource, User, Utils } from '../../../shared' | 6 | import { RestDataSource, User, Utils } from '../../../shared' |
7 | import { UserService } from '../shared' | 7 | import { UserService } from '../shared' |
8 | import { Router } from '@angular/router' | ||
8 | 9 | ||
9 | @Component({ | 10 | @Component({ |
10 | selector: 'my-user-list', | 11 | selector: 'my-user-list', |
@@ -22,15 +23,18 @@ export class UserListComponent { | |||
22 | actions: { | 23 | actions: { |
23 | position: 'right', | 24 | position: 'right', |
24 | add: false, | 25 | add: false, |
25 | edit: false, | 26 | edit: true, |
26 | delete: true | 27 | delete: true |
27 | }, | 28 | }, |
28 | delete: { | 29 | delete: { |
29 | deleteButtonContent: Utils.getRowDeleteButton() | 30 | deleteButtonContent: Utils.getRowDeleteButton() |
30 | }, | 31 | }, |
32 | edit: { | ||
33 | editButtonContent: Utils.getRowEditButton() | ||
34 | }, | ||
31 | pager: { | 35 | pager: { |
32 | display: true, | 36 | display: true, |
33 | perPage: 1 | 37 | perPage: 10 |
34 | }, | 38 | }, |
35 | columns: { | 39 | columns: { |
36 | id: { | 40 | id: { |
@@ -58,6 +62,7 @@ export class UserListComponent { | |||
58 | } | 62 | } |
59 | 63 | ||
60 | constructor ( | 64 | constructor ( |
65 | private router: Router, | ||
61 | private notificationsService: NotificationsService, | 66 | private notificationsService: NotificationsService, |
62 | private confirmService: ConfirmService, | 67 | private confirmService: ConfirmService, |
63 | private userService: UserService | 68 | private userService: UserService |
@@ -65,8 +70,12 @@ export class UserListComponent { | |||
65 | this.usersSource = this.userService.getDataSource() | 70 | this.usersSource = this.userService.getDataSource() |
66 | } | 71 | } |
67 | 72 | ||
68 | removeUser ({ data }) { | 73 | editUser ({ data }: { data: User }) { |
69 | const user: User = data | 74 | this.router.navigate([ '/admin', 'users', data.id, 'update' ]) |
75 | } | ||
76 | |||
77 | removeUser ({ data }: { data: User }) { | ||
78 | const user = data | ||
70 | 79 | ||
71 | if (user.username === 'root') { | 80 | if (user.username === 'root') { |
72 | this.notificationsService.error('Error', 'You cannot delete root.') | 81 | this.notificationsService.error('Error', 'You cannot delete root.') |