diff options
Diffstat (limited to 'client/src/app/+admin/users/user-list/user-list.component.ts')
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.ts | 19 |
1 files changed, 11 insertions, 8 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 2cc4d4349..b644fcf71 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,11 +1,10 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | |||
3 | import { NotificationsService } from 'angular2-notifications' | 2 | import { NotificationsService } from 'angular2-notifications' |
4 | import { SortMeta } from 'primeng/components/common/sortmeta' | 3 | import { SortMeta } from 'primeng/components/common/sortmeta' |
5 | |||
6 | import { ConfirmService } from '../../../core' | 4 | import { ConfirmService } from '../../../core' |
7 | import { RestPagination, RestTable, User } from '../../../shared' | 5 | import { RestPagination, RestTable, User } from '../../../shared' |
8 | import { UserService } from '../shared' | 6 | import { UserService } from '../shared' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | 8 | ||
10 | @Component({ | 9 | @Component({ |
11 | selector: 'my-user-list', | 10 | selector: 'my-user-list', |
@@ -22,7 +21,8 @@ export class UserListComponent extends RestTable implements OnInit { | |||
22 | constructor ( | 21 | constructor ( |
23 | private notificationsService: NotificationsService, | 22 | private notificationsService: NotificationsService, |
24 | private confirmService: ConfirmService, | 23 | private confirmService: ConfirmService, |
25 | private userService: UserService | 24 | private userService: UserService, |
25 | private i18n: I18n | ||
26 | ) { | 26 | ) { |
27 | super() | 27 | super() |
28 | } | 28 | } |
@@ -33,20 +33,23 @@ export class UserListComponent extends RestTable implements OnInit { | |||
33 | 33 | ||
34 | async removeUser (user: User) { | 34 | async removeUser (user: User) { |
35 | if (user.username === 'root') { | 35 | if (user.username === 'root') { |
36 | this.notificationsService.error('Error', 'You cannot delete root.') | 36 | this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot delete root.')) |
37 | return | 37 | return |
38 | } | 38 | } |
39 | 39 | ||
40 | const res = await this.confirmService.confirm('Do you really want to delete this user?', 'Delete') | 40 | const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this user?'), this.i18n('Delete')) |
41 | if (res === false) return | 41 | if (res === false) return |
42 | 42 | ||
43 | this.userService.removeUser(user).subscribe( | 43 | this.userService.removeUser(user).subscribe( |
44 | () => { | 44 | () => { |
45 | this.notificationsService.success('Success', `User ${user.username} deleted.`) | 45 | this.notificationsService.success( |
46 | this.i18n('Success'), | ||
47 | this.i18n('User {{ username }} deleted.', { username: user.username }) | ||
48 | ) | ||
46 | this.loadData() | 49 | this.loadData() |
47 | }, | 50 | }, |
48 | 51 | ||
49 | err => this.notificationsService.error('Error', err.message) | 52 | err => this.notificationsService.error(this.i18n('Error'), err.message) |
50 | ) | 53 | ) |
51 | } | 54 | } |
52 | 55 | ||
@@ -62,7 +65,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
62 | this.totalRecords = resultList.total | 65 | this.totalRecords = resultList.total |
63 | }, | 66 | }, |
64 | 67 | ||
65 | err => this.notificationsService.error('Error', err.message) | 68 | err => this.notificationsService.error(this.i18n('Error'), err.message) |
66 | ) | 69 | ) |
67 | } | 70 | } |
68 | } | 71 | } |