Commit 02061c8b27a4c8eb11dd9d076de4ddf554da3c62

Authored by rusikv
1 parent daac250c

UI: add copy user id button in user details

@@ -53,6 +53,17 @@ @@ -53,6 +53,17 @@
53 [fxShow]="!hideDelete() && !isEdit"> 53 [fxShow]="!hideDelete() && !isEdit">
54 {{'user.delete' | translate }} 54 {{'user.delete' | translate }}
55 </button> 55 </button>
  56 + <div fxLayout="row" fxLayout.xs="column">
  57 + <button mat-raised-button
  58 + ngxClipboard
  59 + (cbOnSuccess)="onUserCopiedId($event)"
  60 + [cbContent]="entity?.id?.id"
  61 + [disabled]="(isLoading$ | async)"
  62 + [fxShow]="!isEdit">
  63 + <mat-icon svgIcon="mdi:clipboard-arrow-left"></mat-icon>
  64 + <span translate>user.copyId</span>
  65 + </button>
  66 + </div>
56 </div> 67 </div>
57 <div class="mat-padding" fxLayout="column"> 68 <div class="mat-padding" fxLayout="column">
58 <form [formGroup]="entityForm"> 69 <form [formGroup]="entityForm">
@@ -25,6 +25,8 @@ import { map } from 'rxjs/operators'; @@ -25,6 +25,8 @@ import { map } from 'rxjs/operators';
25 import { Authority } from '@shared/models/authority.enum'; 25 import { Authority } from '@shared/models/authority.enum';
26 import { isDefinedAndNotNull, isUndefined } from '@core/utils'; 26 import { isDefinedAndNotNull, isUndefined } from '@core/utils';
27 import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; 27 import { EntityTableConfig } from '@home/models/entity/entities-table-config.models';
  28 +import { ActionNotificationShow } from '@app/core/notification/notification.actions';
  29 +import { TranslateService } from '@ngx-translate/core';
28 30
29 @Component({ 31 @Component({
30 selector: 'tb-user', 32 selector: 'tb-user',
@@ -44,7 +46,8 @@ export class UserComponent extends EntityComponent<User> { @@ -44,7 +46,8 @@ export class UserComponent extends EntityComponent<User> {
44 @Optional() @Inject('entity') protected entityValue: User, 46 @Optional() @Inject('entity') protected entityValue: User,
45 @Optional() @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<User>, 47 @Optional() @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<User>,
46 public fb: FormBuilder, 48 public fb: FormBuilder,
47 - protected cd: ChangeDetectorRef) { 49 + protected cd: ChangeDetectorRef,
  50 + protected translate: TranslateService) {
48 super(store, fb, entityValue, entitiesTableConfigValue, cd); 51 super(store, fb, entityValue, entitiesTableConfigValue, cd);
49 } 52 }
50 53
@@ -100,4 +103,16 @@ export class UserComponent extends EntityComponent<User> { @@ -100,4 +103,16 @@ export class UserComponent extends EntityComponent<User> {
100 isDefinedAndNotNull(entity.additionalInfo.homeDashboardHideToolbar) ? entity.additionalInfo.homeDashboardHideToolbar : true}}); 103 isDefinedAndNotNull(entity.additionalInfo.homeDashboardHideToolbar) ? entity.additionalInfo.homeDashboardHideToolbar : true}});
101 } 104 }
102 105
  106 + onUserCopiedId($event) {
  107 + this.store.dispatch(new ActionNotificationShow(
  108 + {
  109 + message: this.translate.instant('user.idCopiedMessage'),
  110 + type: 'success',
  111 + duration: 750,
  112 + verticalPosition: 'bottom',
  113 + horizontalPosition: 'right'
  114 + }
  115 + ))
  116 + }
  117 +
103 } 118 }
@@ -2809,7 +2809,9 @@ @@ -2809,7 +2809,9 @@
2809 "disable-account": "Disable User Account", 2809 "disable-account": "Disable User Account",
2810 "enable-account": "Enable User Account", 2810 "enable-account": "Enable User Account",
2811 "enable-account-message": "User account was successfully enabled!", 2811 "enable-account-message": "User account was successfully enabled!",
2812 - "disable-account-message": "User account was successfully disabled!" 2812 + "disable-account-message": "User account was successfully disabled!",
  2813 + "copyId": "Copy user Id",
  2814 + "idCopiedMessage": "User Id has been copied to clipboard"
2813 }, 2815 },
2814 "value": { 2816 "value": {
2815 "type": "Value type", 2817 "type": "Value type",
@@ -1510,7 +1510,9 @@ @@ -1510,7 +1510,9 @@
1510 "disable-account": "Отключить учетную запись пользователя", 1510 "disable-account": "Отключить учетную запись пользователя",
1511 "enable-account": "Включить учетную запись пользователя", 1511 "enable-account": "Включить учетную запись пользователя",
1512 "enable-account-message": "Учетная запись пользователя была успешно включена!", 1512 "enable-account-message": "Учетная запись пользователя была успешно включена!",
1513 - "disable-account-message": "Учетная запись пользователя была успешно отключена!" 1513 + "disable-account-message": "Учетная запись пользователя была успешно отключена!",
  1514 + "copyId": "Копировать ИД пользователя",
  1515 + "idCopiedMessage": "ИД пользователя скопирован в буфер обмена"
1514 }, 1516 },
1515 "value": { 1517 "value": {
1516 "type": "Тип значения", 1518 "type": "Тип значения",
@@ -2078,7 +2078,9 @@ @@ -2078,7 +2078,9 @@
2078 "disable-account": "Вимкнути обліковий запис користувача", 2078 "disable-account": "Вимкнути обліковий запис користувача",
2079 "enable-account": "Увімкнути обліковий запис користувача", 2079 "enable-account": "Увімкнути обліковий запис користувача",
2080 "enable-account-message": "Обліковий запис користувача успішно увімкнено!", 2080 "enable-account-message": "Обліковий запис користувача успішно увімкнено!",
2081 - "disabled-account-message": "Обліковий запис користувача успішно вимкнено!" 2081 + "disabled-account-message": "Обліковий запис користувача успішно вимкнено!",
  2082 + "copyId": "Копіювати Id користувача",
  2083 + "idCopiedMessage": "Id користувача було скопійовано в буфер обміну"
2082 }, 2084 },
2083 "value": { 2085 "value": {
2084 "type": "Тип значення", 2086 "type": "Тип значення",