From 4f5d045960b042eb27e10bac1bdaf1c074c9fa2a Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Thu, 23 Jul 2020 21:30:04 +0200 Subject: harmonize search for libraries --- .../app/+admin/users/user-list/user-list.component.html | 6 ++++-- .../app/+admin/users/user-list/user-list.component.ts | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'client/src/app/+admin') 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 571c780d6..e8a084259 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 @@ -112,8 +112,10 @@ - - {{ user.email }} + + + {{ user.email }} + 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 b2978212e..699b2a6da 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 @@ -7,6 +7,13 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { ServerConfig, User, UserRole } from '@shared/models' import { Params, Router, ActivatedRoute } from '@angular/router' +type UserForList = User & { + rawVideoQuota: number + rawVideoQuotaUsed: number + rawVideoQuotaDaily: number + rawVideoQuotaUsedDaily: number +} + @Component({ selector: 'my-user-list', templateUrl: './user-list.component.html', @@ -24,8 +31,8 @@ export class UserListComponent extends RestTable implements OnInit { selectedUsers: User[] = [] bulkUserActions: DropdownAction[][] = [] columns: { key: string, label: string }[] - _selectedColumns: { key: string, label: string }[] + private _selectedColumns: { key: string, label: string }[] private serverConfig: ServerConfig constructor ( @@ -111,7 +118,7 @@ export class UserListComponent extends RestTable implements OnInit { { key: 'role', label: 'Role' }, { key: 'createdAt', label: 'Created' } ] - this.selectedColumns = [...this.columns] + this.selectedColumns = [ ...this.columns ] // make a full copy of the array this.columns.push({ key: 'quotaDaily', label: 'Daily quota' }) this.columns.push({ key: 'pluginAuth', label: 'Auth plugin' }) this.columns.push({ key: 'lastLoginDate', label: 'Last login' }) @@ -133,14 +140,14 @@ export class UserListComponent extends RestTable implements OnInit { } getColumn (key: string) { - return this.selectedColumns.find((col: any) => col.key === key) + return this.selectedColumns.find((col: { key: string }) => col.key === key) } - getUserVideoQuotaPercentage (user: User & { rawVideoQuota: number, rawVideoQuotaUsed: number}) { + getUserVideoQuotaPercentage (user: UserForList) { return user.rawVideoQuotaUsed * 100 / user.rawVideoQuota } - getUserVideoQuotaDailyPercentage (user: User & { rawVideoQuotaDaily: number, rawVideoQuotaUsedDaily: number}) { + getUserVideoQuotaDailyPercentage (user: UserForList) { return user.rawVideoQuotaUsedDaily * 100 / user.rawVideoQuotaDaily } -- cgit v1.2.3