UI: add copy user id button in user details

This commit is contained in:
rusikv 2021-08-06 17:04:54 +03:00
parent daac250c2e
commit 02061c8b27
5 changed files with 36 additions and 4 deletions

View File

@ -53,6 +53,17 @@
[fxShow]="!hideDelete() && !isEdit">
{{'user.delete' | translate }}
</button>
<div fxLayout="row" fxLayout.xs="column">
<button mat-raised-button
ngxClipboard
(cbOnSuccess)="onUserCopiedId($event)"
[cbContent]="entity?.id?.id"
[disabled]="(isLoading$ | async)"
[fxShow]="!isEdit">
<mat-icon svgIcon="mdi:clipboard-arrow-left"></mat-icon>
<span translate>user.copyId</span>
</button>
</div>
</div>
<div class="mat-padding" fxLayout="column">
<form [formGroup]="entityForm">

View File

@ -25,6 +25,8 @@ import { map } from 'rxjs/operators';
import { Authority } from '@shared/models/authority.enum';
import { isDefinedAndNotNull, isUndefined } from '@core/utils';
import { EntityTableConfig } from '@home/models/entity/entities-table-config.models';
import { ActionNotificationShow } from '@app/core/notification/notification.actions';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'tb-user',
@ -44,7 +46,8 @@ export class UserComponent extends EntityComponent<User> {
@Optional() @Inject('entity') protected entityValue: User,
@Optional() @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<User>,
public fb: FormBuilder,
protected cd: ChangeDetectorRef) {
protected cd: ChangeDetectorRef,
protected translate: TranslateService) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
}
@ -100,4 +103,16 @@ export class UserComponent extends EntityComponent<User> {
isDefinedAndNotNull(entity.additionalInfo.homeDashboardHideToolbar) ? entity.additionalInfo.homeDashboardHideToolbar : true}});
}
onUserCopiedId($event) {
this.store.dispatch(new ActionNotificationShow(
{
message: this.translate.instant('user.idCopiedMessage'),
type: 'success',
duration: 750,
verticalPosition: 'bottom',
horizontalPosition: 'right'
}
))
}
}

View File

@ -2809,7 +2809,9 @@
"disable-account": "Disable User Account",
"enable-account": "Enable User Account",
"enable-account-message": "User account was successfully enabled!",
"disable-account-message": "User account was successfully disabled!"
"disable-account-message": "User account was successfully disabled!",
"copyId": "Copy user Id",
"idCopiedMessage": "User Id has been copied to clipboard"
},
"value": {
"type": "Value type",

View File

@ -1510,7 +1510,9 @@
"disable-account": "Отключить учетную запись пользователя",
"enable-account": "Включить учетную запись пользователя",
"enable-account-message": "Учетная запись пользователя была успешно включена!",
"disable-account-message": "Учетная запись пользователя была успешно отключена!"
"disable-account-message": "Учетная запись пользователя была успешно отключена!",
"copyId": "Копировать ИД пользователя",
"idCopiedMessage": "ИД пользователя скопирован в буфер обмена"
},
"value": {
"type": "Тип значения",

View File

@ -2078,7 +2078,9 @@
"disable-account": "Вимкнути обліковий запис користувача",
"enable-account": "Увімкнути обліковий запис користувача",
"enable-account-message": "Обліковий запис користувача успішно увімкнено!",
"disabled-account-message": "Обліковий запис користувача успішно вимкнено!"
"disabled-account-message": "Обліковий запис користувача успішно вимкнено!",
"copyId": "Копіювати Id користувача",
"idCopiedMessage": "Id користувача було скопійовано в буфер обміну"
},
"value": {
"type": "Тип значення",