Browse Source

Merge pull request #5051 from rusikv/feature/copy-user-id-button

[3.3.1] UI: add copy user id button in user details
pull/5140/head
Igor Kulikov 5 years ago
committed by GitHub
parent
commit
cd4e456b79
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      ui-ngx/src/app/modules/home/pages/user/user.component.html
  2. 17
      ui-ngx/src/app/modules/home/pages/user/user.component.ts
  3. 4
      ui-ngx/src/assets/locale/locale.constant-en_US.json
  4. 4
      ui-ngx/src/assets/locale/locale.constant-ru_RU.json
  5. 4
      ui-ngx/src/assets/locale/locale.constant-uk_UA.json

11
ui-ngx/src/app/modules/home/pages/user/user.component.html

@ -53,6 +53,17 @@
[fxShow]="!hideDelete() && !isEdit">
{{'user.delete' | translate }}
</button>
<div fxLayout="row" fxLayout.xs="column">
<button mat-raised-button
ngxClipboard
(cbOnSuccess)="onUserIdCopied($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">

17
ui-ngx/src/app/modules/home/pages/user/user.component.ts

@ -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}});
}
onUserIdCopied($event) {
this.store.dispatch(new ActionNotificationShow(
{
message: this.translate.instant('user.idCopiedMessage'),
type: 'success',
duration: 750,
verticalPosition: 'bottom',
horizontalPosition: 'right'
}
))
}
}

4
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -2808,7 +2808,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",

4
ui-ngx/src/assets/locale/locale.constant-ru_RU.json

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

4
ui-ngx/src/assets/locale/locale.constant-uk_UA.json

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

Loading…
Cancel
Save