aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-10-08 15:15:11 +0200
committerChocobozzz <me@florianbigard.com>2018-10-08 15:55:32 +0200
commit791645e620fb98c6e7c32271d91d91ff7e41b892 (patch)
treeb9554ae53c93c1e699d8cc2e137128e599a4c045
parent80c7336a896d9eb1e71b7c89a72285f914259457 (diff)
downloadPeerTube-791645e620fb98c6e7c32271d91d91ff7e41b892.tar.gz
PeerTube-791645e620fb98c6e7c32271d91d91ff7e41b892.tar.zst
PeerTube-791645e620fb98c6e7c32271d91d91ff7e41b892.zip
Add bulk actions in users table
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.html31
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.scss11
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.ts93
-rw-r--r--client/src/app/header/header.component.html4
-rw-r--r--client/src/app/shared/buttons/action-dropdown.component.html8
-rw-r--r--client/src/app/shared/buttons/action-dropdown.component.scss14
-rw-r--r--client/src/app/shared/buttons/action-dropdown.component.ts4
-rw-r--r--client/src/app/shared/moderation/user-ban-modal.component.html2
-rw-r--r--client/src/app/shared/moderation/user-ban-modal.component.ts23
-rw-r--r--client/src/app/shared/moderation/user-moderation-dropdown.component.html2
-rw-r--r--client/src/app/shared/moderation/user-moderation-dropdown.component.ts9
-rw-r--r--client/src/app/shared/users/user.service.ts39
-rw-r--r--client/src/sass/primeng-custom.scss38
13 files changed, 233 insertions, 45 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 cca057ba1..9d1f2e34a 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
@@ -10,10 +10,31 @@
10<p-table 10<p-table
11 [value]="users" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" 11 [value]="users" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
12 [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" 12 [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
13 [(selection)]="selectedUsers"
13> 14>
15 <ng-template pTemplate="caption">
16 <div class="caption">
17 <div>
18 <my-action-dropdown
19 *ngIf="isInSelectionMode()" i18n-label label="Batch actions" theme="orange"
20 [actions]="bulkUserActions" [entry]="selectedUsers"
21 >
22 </my-action-dropdown>
23 </div>
24
25 <div>
26 <input
27 type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..."
28 >
29 </div>
30 </div>
31 </ng-template>
32
14 <ng-template pTemplate="header"> 33 <ng-template pTemplate="header">
15 <tr> 34 <tr>
16 <th style="width: 40px"></th> 35 <th style="width: 40px"></th>
36 <th style="width: 40px">
37 </th>
17 <th i18n pSortableColumn="username">Username <p-sortIcon field="username"></p-sortIcon></th> 38 <th i18n pSortableColumn="username">Username <p-sortIcon field="username"></p-sortIcon></th>
18 <th i18n>Email</th> 39 <th i18n>Email</th>
19 <th i18n>Video quota</th> 40 <th i18n>Video quota</th>
@@ -25,12 +46,17 @@
25 46
26 <ng-template pTemplate="body" let-expanded="expanded" let-user> 47 <ng-template pTemplate="body" let-expanded="expanded" let-user>
27 48
28 <tr [ngClass]="{ banned: user.blocked }"> 49 <tr [pSelectableRow]="user" [ngClass]="{ banned: user.blocked }">
50 <td>
51 <p-tableCheckbox [value]="user"></p-tableCheckbox>
52 </td>
53
29 <td> 54 <td>
30 <span *ngIf="user.blockedReason" class="expander" [pRowToggler]="user"> 55 <span *ngIf="user.blockedReason" class="expander" [pRowToggler]="user">
31 <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i> 56 <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i>
32 </span> 57 </span>
33 </td> 58 </td>
59
34 <td> 60 <td>
35 {{ user.username }} 61 {{ user.username }}
36 <span *ngIf="user.blocked" class="banned-info">(banned)</span> 62 <span *ngIf="user.blocked" class="banned-info">(banned)</span>
@@ -40,7 +66,7 @@
40 <td>{{ user.roleLabel }}</td> 66 <td>{{ user.roleLabel }}</td>
41 <td>{{ user.createdAt }}</td> 67 <td>{{ user.createdAt }}</td>
42 <td class="action-cell"> 68 <td class="action-cell">
43 <my-user-moderation-dropdown [user]="user" (userChanged)="onUserChanged()" (userDeleted)="onUserChanged()"> 69 <my-user-moderation-dropdown *ngIf="!isInSelectionMode()" [user]="user" (userChanged)="onUserChanged()" (userDeleted)="onUserChanged()">
44 </my-user-moderation-dropdown> 70 </my-user-moderation-dropdown>
45 </td> 71 </td>
46 </tr> 72 </tr>
@@ -56,3 +82,4 @@
56 </ng-template> 82 </ng-template>
57</p-table> 83</p-table>
58 84
85<my-user-ban-modal #userBanModal (userBanned)="onUsersBanned()"></my-user-ban-modal>
diff --git a/client/src/app/+admin/users/user-list/user-list.component.scss b/client/src/app/+admin/users/user-list/user-list.component.scss
index 47291918d..01f43dfe1 100644
--- a/client/src/app/+admin/users/user-list/user-list.component.scss
+++ b/client/src/app/+admin/users/user-list/user-list.component.scss
@@ -15,4 +15,15 @@ tr.banned {
15 15
16.ban-reason-label { 16.ban-reason-label {
17 font-weight: $font-semibold; 17 font-weight: $font-semibold;
18}
19
20.caption {
21 height: 40px;
22 display: flex;
23 justify-content: space-between;
24 align-items: center;
25
26 input {
27 @include peertube-input-text(250px);
28 }
18} \ No newline at end of file 29} \ No newline at end of file
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 dee3ed643..f3e7e0ead 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,12 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit, ViewChild } from '@angular/core'
2import { NotificationsService } from 'angular2-notifications' 2import { NotificationsService } from 'angular2-notifications'
3import { SortMeta } from 'primeng/components/common/sortmeta' 3import { SortMeta } from 'primeng/components/common/sortmeta'
4import { ConfirmService } from '../../../core' 4import { ConfirmService } from '../../../core'
5import { RestPagination, RestTable, UserService } from '../../../shared' 5import { RestPagination, RestTable, UserService } from '../../../shared'
6import { I18n } from '@ngx-translate/i18n-polyfill' 6import { I18n } from '@ngx-translate/i18n-polyfill'
7import { User } from '../../../../../../shared' 7import { User } from '../../../../../../shared'
8import { UserBanModalComponent } from '@app/shared/moderation'
9import { DropdownAction } from '@app/shared/buttons/action-dropdown.component'
8 10
9@Component({ 11@Component({
10 selector: 'my-user-list', 12 selector: 'my-user-list',
@@ -12,12 +14,17 @@ import { User } from '../../../../../../shared'
12 styleUrls: [ './user-list.component.scss' ] 14 styleUrls: [ './user-list.component.scss' ]
13}) 15})
14export class UserListComponent extends RestTable implements OnInit { 16export class UserListComponent extends RestTable implements OnInit {
17 @ViewChild('userBanModal') userBanModal: UserBanModalComponent
18
15 users: User[] = [] 19 users: User[] = []
16 totalRecords = 0 20 totalRecords = 0
17 rowsPerPage = 10 21 rowsPerPage = 10
18 sort: SortMeta = { field: 'createdAt', order: 1 } 22 sort: SortMeta = { field: 'createdAt', order: 1 }
19 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 23 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
20 24
25 selectedUsers: User[] = []
26 bulkUserActions: DropdownAction<User>[] = []
27
21 constructor ( 28 constructor (
22 private notificationsService: NotificationsService, 29 private notificationsService: NotificationsService,
23 private confirmService: ConfirmService, 30 private confirmService: ConfirmService,
@@ -29,13 +36,28 @@ export class UserListComponent extends RestTable implements OnInit {
29 36
30 ngOnInit () { 37 ngOnInit () {
31 this.loadSort() 38 this.loadSort()
32 }
33 39
34 onUserChanged () { 40 this.bulkUserActions = [
35 this.loadData() 41 {
42 label: this.i18n('Delete'),
43 handler: users => this.removeUsers(users)
44 },
45 {
46 label: this.i18n('Ban'),
47 handler: users => this.openBanUserModal(users),
48 isDisplayed: users => users.every(u => u.blocked === false)
49 },
50 {
51 label: this.i18n('Unban'),
52 handler: users => this.unbanUsers(users),
53 isDisplayed: users => users.every(u => u.blocked === true)
54 }
55 ]
36 } 56 }
37 57
38 protected loadData () { 58 protected loadData () {
59 this.selectedUsers = []
60
39 this.userService.getUsers(this.pagination, this.sort) 61 this.userService.getUsers(this.pagination, this.sort)
40 .subscribe( 62 .subscribe(
41 resultList => { 63 resultList => {
@@ -46,4 +68,67 @@ export class UserListComponent extends RestTable implements OnInit {
46 err => this.notificationsService.error(this.i18n('Error'), err.message) 68 err => this.notificationsService.error(this.i18n('Error'), err.message)
47 ) 69 )
48 } 70 }
71
72 openBanUserModal (users: User[]) {
73 for (const user of users) {
74 if (user.username === 'root') {
75 this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot ban root.'))
76 return
77 }
78 }
79
80 this.userBanModal.openModal(users)
81 }
82
83 onUsersBanned () {
84 this.loadData()
85 }
86
87 async unbanUsers (users: User[]) {
88 const message = this.i18n('Do you really want to unban {{num}} users?', { num: users.length })
89
90 const res = await this.confirmService.confirm(message, this.i18n('Unban'))
91 if (res === false) return
92
93 this.userService.unbanUsers(users)
94 .subscribe(
95 () => {
96 const message = this.i18n('{{num}} users unbanned.', { num: users.length })
97
98 this.notificationsService.success(this.i18n('Success'), message)
99 this.loadData()
100 },
101
102 err => this.notificationsService.error(this.i18n('Error'), err.message)
103 )
104 }
105
106 async removeUsers (users: User[]) {
107 for (const user of users) {
108 if (user.username === 'root') {
109 this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot delete root.'))
110 return
111 }
112 }
113
114 const message = this.i18n('If you remove these users, you will not be able to create others with the same username!')
115 const res = await this.confirmService.confirm(message, this.i18n('Delete'))
116 if (res === false) return
117
118 this.userService.removeUser(users).subscribe(
119 () => {
120 this.notificationsService.success(
121 this.i18n('Success'),
122 this.i18n('{{num}} users deleted.', { num: users.length })
123 )
124 this.loadData()
125 },
126
127 err => this.notificationsService.error(this.i18n('Error'), err.message)
128 )
129 }
130
131 isInSelectionMode () {
132 return this.selectedUsers.length !== 0
133 }
49} 134}
diff --git a/client/src/app/header/header.component.html b/client/src/app/header/header.component.html
index a04354db5..c23e0c55d 100644
--- a/client/src/app/header/header.component.html
+++ b/client/src/app/header/header.component.html
@@ -1,6 +1,6 @@
1<input 1<input
2 type="text" id="search-video" name="search-video" i18n-placeholder placeholder="Search..." 2 type="text" id="search-video" name="search-video" i18n-placeholder placeholder="Search..."
3 [(ngModel)]="searchValue" (keyup.enter)="doSearch()" 3 [(ngModel)]="searchValue" (keyup.enter)="doSearch()"
4> 4>
5<span (click)="doSearch()" class="icon icon-search"></span> 5<span (click)="doSearch()" class="icon icon-search"></span>
6 6
diff --git a/client/src/app/shared/buttons/action-dropdown.component.html b/client/src/app/shared/buttons/action-dropdown.component.html
index 8110e2515..111627424 100644
--- a/client/src/app/shared/buttons/action-dropdown.component.html
+++ b/client/src/app/shared/buttons/action-dropdown.component.html
@@ -1,6 +1,10 @@
1<div class="dropdown-root" ngbDropdown [placement]="placement"> 1<div class="dropdown-root" ngbDropdown [placement]="placement">
2 <div class="action-button" [ngClass]="{ small: buttonSize === 'small' }" ngbDropdownToggle role="button"> 2 <div
3 <span class="icon icon-action"></span> 3 class="action-button" [ngClass]="{ small: buttonSize === 'small', grey: theme === 'grey', orange: theme === 'orange' }"
4 ngbDropdownToggle role="button"
5 >
6 <span *ngIf="!label" class="icon icon-action"></span>
7 <span *ngIf="label" class="dropdown-toggle">{{ label }}</span>
4 </div> 8 </div>
5 9
6 <div ngbDropdownMenu class="dropdown-menu"> 10 <div ngbDropdownMenu class="dropdown-menu">
diff --git a/client/src/app/shared/buttons/action-dropdown.component.scss b/client/src/app/shared/buttons/action-dropdown.component.scss
index 00f120fb8..0a9aa7b04 100644
--- a/client/src/app/shared/buttons/action-dropdown.component.scss
+++ b/client/src/app/shared/buttons/action-dropdown.component.scss
@@ -3,7 +3,14 @@
3 3
4.action-button { 4.action-button {
5 @include peertube-button; 5 @include peertube-button;
6 @include grey-button; 6
7 &.grey {
8 @include grey-button;
9 }
10
11 &.orange {
12 @include orange-button;
13 }
7 14
8 display: inline-block; 15 display: inline-block;
9 padding: 0 10px; 16 padding: 0 10px;
@@ -30,6 +37,11 @@
30 } 37 }
31} 38}
32 39
40.dropdown-toggle::after {
41 position: relative;
42 top: 1px;
43}
44
33.dropdown-menu { 45.dropdown-menu {
34 .dropdown-item { 46 .dropdown-item {
35 cursor: pointer; 47 cursor: pointer;
diff --git a/client/src/app/shared/buttons/action-dropdown.component.ts b/client/src/app/shared/buttons/action-dropdown.component.ts
index 1838ff697..022ab5ee8 100644
--- a/client/src/app/shared/buttons/action-dropdown.component.ts
+++ b/client/src/app/shared/buttons/action-dropdown.component.ts
@@ -16,6 +16,8 @@ export type DropdownAction<T> = {
16export class ActionDropdownComponent<T> { 16export class ActionDropdownComponent<T> {
17 @Input() actions: DropdownAction<T>[] = [] 17 @Input() actions: DropdownAction<T>[] = []
18 @Input() entry: T 18 @Input() entry: T
19 @Input() placement = 'left' 19 @Input() placement = 'bottom-left'
20 @Input() buttonSize: 'normal' | 'small' = 'normal' 20 @Input() buttonSize: 'normal' | 'small' = 'normal'
21 @Input() label: string
22 @Input() theme: 'orange' | 'grey' = 'grey'
21} 23}
diff --git a/client/src/app/shared/moderation/user-ban-modal.component.html b/client/src/app/shared/moderation/user-ban-modal.component.html
index b2958caa4..fa5cb7404 100644
--- a/client/src/app/shared/moderation/user-ban-modal.component.html
+++ b/client/src/app/shared/moderation/user-ban-modal.component.html
@@ -1,6 +1,6 @@
1<ng-template #modal> 1<ng-template #modal>
2 <div class="modal-header"> 2 <div class="modal-header">
3 <h4 i18n class="modal-title">Ban {{ userToBan.username }}</h4> 3 <h4 i18n class="modal-title">Ban</h4>
4 <span class="close" aria-hidden="true" (click)="hideBanUserModal()"></span> 4 <span class="close" aria-hidden="true" (click)="hideBanUserModal()"></span>
5 </div> 5 </div>
6 6
diff --git a/client/src/app/shared/moderation/user-ban-modal.component.ts b/client/src/app/shared/moderation/user-ban-modal.component.ts
index 67ae38e48..60bd442dd 100644
--- a/client/src/app/shared/moderation/user-ban-modal.component.ts
+++ b/client/src/app/shared/moderation/user-ban-modal.component.ts
@@ -15,9 +15,9 @@ import { User } from '../../../../../shared'
15}) 15})
16export class UserBanModalComponent extends FormReactive implements OnInit { 16export class UserBanModalComponent extends FormReactive implements OnInit {
17 @ViewChild('modal') modal: NgbModal 17 @ViewChild('modal') modal: NgbModal
18 @Output() userBanned = new EventEmitter<User>() 18 @Output() userBanned = new EventEmitter<User | User[]>()
19 19
20 private userToBan: User 20 private usersToBan: User | User[]
21 private openedModal: NgbModalRef 21 private openedModal: NgbModalRef
22 22
23 constructor ( 23 constructor (
@@ -37,28 +37,29 @@ export class UserBanModalComponent extends FormReactive implements OnInit {
37 }) 37 })
38 } 38 }
39 39
40 openModal (user: User) { 40 openModal (user: User | User[]) {
41 this.userToBan = user 41 this.usersToBan = user
42 this.openedModal = this.modalService.open(this.modal) 42 this.openedModal = this.modalService.open(this.modal)
43 } 43 }
44 44
45 hideBanUserModal () { 45 hideBanUserModal () {
46 this.userToBan = undefined 46 this.usersToBan = undefined
47 this.openedModal.close() 47 this.openedModal.close()
48 } 48 }
49 49
50 async banUser () { 50 async banUser () {
51 const reason = this.form.value['reason'] || undefined 51 const reason = this.form.value['reason'] || undefined
52 52
53 this.userService.banUser(this.userToBan, reason) 53 this.userService.banUsers(this.usersToBan, reason)
54 .subscribe( 54 .subscribe(
55 () => { 55 () => {
56 this.notificationsService.success( 56 const message = Array.isArray(this.usersToBan)
57 this.i18n('Success'), 57 ? this.i18n('{{num}} users banned.', { num: this.usersToBan.length })
58 this.i18n('User {{username}} banned.', { username: this.userToBan.username }) 58 : this.i18n('User {{username}} banned.', { username: this.usersToBan.username })
59 )
60 59
61 this.userBanned.emit(this.userToBan) 60 this.notificationsService.success(this.i18n('Success'), message)
61
62 this.userBanned.emit(this.usersToBan)
62 this.hideBanUserModal() 63 this.hideBanUserModal()
63 }, 64 },
64 65
diff --git a/client/src/app/shared/moderation/user-moderation-dropdown.component.html b/client/src/app/shared/moderation/user-moderation-dropdown.component.html
index ed1a4c863..2c477ab23 100644
--- a/client/src/app/shared/moderation/user-moderation-dropdown.component.html
+++ b/client/src/app/shared/moderation/user-moderation-dropdown.component.html
@@ -1,5 +1,5 @@
1<ng-container *ngIf="user && userActions.length !== 0"> 1<ng-container *ngIf="user && userActions.length !== 0">
2 <my-user-ban-modal #userBanModal (userBanned)="onUserBanned()"></my-user-ban-modal> 2 <my-user-ban-modal #userBanModal (userBanned)="onUserBanned()"></my-user-ban-modal>
3 3
4 <my-action-dropdown i18n-label label="Actions" [actions]="userActions" [entry]="user" [buttonSize]="buttonSize"></my-action-dropdown> 4 <my-action-dropdown [actions]="userActions" [entry]="user" [buttonSize]="buttonSize"></my-action-dropdown>
5</ng-container> \ No newline at end of file 5</ng-container> \ No newline at end of file
diff --git a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts
index 4f88456de..174e9f024 100644
--- a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts
+++ b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts
@@ -2,7 +2,6 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angu
2import { NotificationsService } from 'angular2-notifications' 2import { NotificationsService } from 'angular2-notifications'
3import { I18n } from '@ngx-translate/i18n-polyfill' 3import { I18n } from '@ngx-translate/i18n-polyfill'
4import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' 4import { DropdownAction } from '@app/shared/buttons/action-dropdown.component'
5import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
6import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component' 5import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component'
7import { UserService } from '@app/shared/users' 6import { UserService } from '@app/shared/users'
8import { AuthService, ConfirmService } from '@app/core' 7import { AuthService, ConfirmService } from '@app/core'
@@ -24,8 +23,6 @@ export class UserModerationDropdownComponent implements OnInit {
24 23
25 userActions: DropdownAction<User>[] = [] 24 userActions: DropdownAction<User>[] = []
26 25
27 private openedModal: NgbModalRef
28
29 constructor ( 26 constructor (
30 private authService: AuthService, 27 private authService: AuthService,
31 private notificationsService: NotificationsService, 28 private notificationsService: NotificationsService,
@@ -38,10 +35,6 @@ export class UserModerationDropdownComponent implements OnInit {
38 this.buildActions() 35 this.buildActions()
39 } 36 }
40 37
41 hideBanUserModal () {
42 this.openedModal.close()
43 }
44
45 openBanUserModal (user: User) { 38 openBanUserModal (user: User) {
46 if (user.username === 'root') { 39 if (user.username === 'root') {
47 this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot ban root.')) 40 this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot ban root.'))
@@ -60,7 +53,7 @@ export class UserModerationDropdownComponent implements OnInit {
60 const res = await this.confirmService.confirm(message, this.i18n('Unban')) 53 const res = await this.confirmService.confirm(message, this.i18n('Unban'))
61 if (res === false) return 54 if (res === false) return
62 55
63 this.userService.unbanUser(user) 56 this.userService.unbanUsers(user)
64 .subscribe( 57 .subscribe(
65 () => { 58 () => {
66 this.notificationsService.success( 59 this.notificationsService.success(
diff --git a/client/src/app/shared/users/user.service.ts b/client/src/app/shared/users/user.service.ts
index d9b81c181..0eb3870b0 100644
--- a/client/src/app/shared/users/user.service.ts
+++ b/client/src/app/shared/users/user.service.ts
@@ -1,5 +1,5 @@
1import { Observable } from 'rxjs' 1import { from, Observable } from 'rxjs'
2import { catchError, map } from 'rxjs/operators' 2import { catchError, concatMap, map, toArray } from 'rxjs/operators'
3import { HttpClient, HttpParams } from '@angular/common/http' 3import { HttpClient, HttpParams } from '@angular/common/http'
4import { Injectable } from '@angular/core' 4import { Injectable } from '@angular/core'
5import { ResultList, User, UserCreate, UserRole, UserUpdate, UserUpdateMe, UserVideoQuota } from '../../../../../shared' 5import { ResultList, User, UserCreate, UserRole, UserUpdate, UserUpdateMe, UserVideoQuota } from '../../../../../shared'
@@ -170,21 +170,38 @@ export class UserService {
170 ) 170 )
171 } 171 }
172 172
173 removeUser (user: { id: number }) { 173 removeUser (usersArg: User | User[]) {
174 return this.authHttp.delete(UserService.BASE_USERS_URL + user.id) 174 const users = Array.isArray(usersArg) ? usersArg : [ usersArg ]
175 .pipe(catchError(err => this.restExtractor.handleError(err))) 175
176 return from(users)
177 .pipe(
178 concatMap(u => this.authHttp.delete(UserService.BASE_USERS_URL + u.id)),
179 toArray(),
180 catchError(err => this.restExtractor.handleError(err))
181 )
176 } 182 }
177 183
178 banUser (user: { id: number }, reason?: string) { 184 banUsers (usersArg: User | User[], reason?: string) {
179 const body = reason ? { reason } : {} 185 const body = reason ? { reason } : {}
186 const users = Array.isArray(usersArg) ? usersArg : [ usersArg ]
180 187
181 return this.authHttp.post(UserService.BASE_USERS_URL + user.id + '/block', body) 188 return from(users)
182 .pipe(catchError(err => this.restExtractor.handleError(err))) 189 .pipe(
190 concatMap(u => this.authHttp.post(UserService.BASE_USERS_URL + u.id + '/block', body)),
191 toArray(),
192 catchError(err => this.restExtractor.handleError(err))
193 )
183 } 194 }
184 195
185 unbanUser (user: { id: number }) { 196 unbanUsers (usersArg: User | User[]) {
186 return this.authHttp.post(UserService.BASE_USERS_URL + user.id + '/unblock', {}) 197 const users = Array.isArray(usersArg) ? usersArg : [ usersArg ]
187 .pipe(catchError(err => this.restExtractor.handleError(err))) 198
199 return from(users)
200 .pipe(
201 concatMap(u => this.authHttp.post(UserService.BASE_USERS_URL + u.id + '/unblock', {})),
202 toArray(),
203 catchError(err => this.restExtractor.handleError(err))
204 )
188 } 205 }
189 206
190 private formatUser (user: User) { 207 private formatUser (user: User) {
diff --git a/client/src/sass/primeng-custom.scss b/client/src/sass/primeng-custom.scss
index 5a03ac9c5..4a19e0275 100644
--- a/client/src/sass/primeng-custom.scss
+++ b/client/src/sass/primeng-custom.scss
@@ -14,8 +14,11 @@
14p-table { 14p-table {
15 font-size: 15px !important; 15 font-size: 15px !important;
16 16
17 .ui-table-caption {
18 border: none;
19 }
20
17 td { 21 td {
18 // border: 1px solid #E5E5E5 !important;
19 padding-left: 15px !important; 22 padding-left: 15px !important;
20 23
21 &:not(.action-cell) { 24 &:not(.action-cell) {
@@ -28,6 +31,11 @@ p-table {
28 tr { 31 tr {
29 background-color: var(--mainBackgroundColor) !important; 32 background-color: var(--mainBackgroundColor) !important;
30 height: 46px; 33 height: 46px;
34
35 &.ui-state-highlight {
36 background-color:var(--submenuColor) !important;
37 color:var(--mainForegroundColor) !important;
38 }
31 } 39 }
32 40
33 .ui-table-tbody { 41 .ui-table-tbody {
@@ -216,4 +224,32 @@ p-calendar .ui-datepicker {
216 @include glyphicon-light; 224 @include glyphicon-light;
217 } 225 }
218 } 226 }
227}
228
229.ui-chkbox-box {
230 &.ui-state-active {
231 border-color: var(--mainColor) !important;
232 background-color: var(--mainColor) !important;
233 }
234
235 .ui-chkbox-icon {
236 position: relative;
237
238 &:after {
239 content: '';
240 position: absolute;
241 left: 5px;
242 width: 5px;
243 height: 12px;
244 opacity: 0;
245 transform: rotate(45deg) scale(0);
246 border-right: 2px solid var(--mainBackgroundColor);
247 border-bottom: 2px solid var(--mainBackgroundColor);
248 }
249
250 &.pi-check:after {
251 opacity: 1;
252 transform: rotate(45deg) scale(1);
253 }
254 }
219} \ No newline at end of file 255} \ No newline at end of file