Adding UUID under the secret name on secrets list (#5773)

* adding UUID under the secret name on secrets list

* thomas' suggested changes

* Adding small attribute to bitbutton

* Copying a secret will work on all pages now that show secrets
This commit is contained in:
cd-bitwarden 2023-08-04 16:18:17 -04:00 committed by GitHub
parent b7fbab84f5
commit c0810c96cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 59 additions and 3 deletions

View File

@ -717,6 +717,9 @@
"yourVaultIsLocked": {
"message": "Your vault is locked. Verify your master password to continue."
},
"uuid":{
"message" : "UUID"
},
"unlock": {
"message": "Unlock"
},
@ -948,6 +951,9 @@
"copyVerificationCode": {
"message": "Copy verification code"
},
"copyUuid": {
"message": "Copy UUID"
},
"warning": {
"message": "Warning"
},

View File

@ -63,6 +63,7 @@
(editSecretEvent)="openEditSecret($event)"
(copySecretNameEvent)="copySecretName($event)"
(copySecretValueEvent)="copySecretValue($event)"
(copySecretUuidEvent)="copySecretUuid($event)"
[secrets]="view.latestSecrets"
></sm-secrets-list>
<div *ngIf="view.allSecrets.length > 0" class="tw-ml-auto tw-mt-4 tw-max-w-max">

View File

@ -290,6 +290,10 @@ export class OverviewComponent implements OnInit, OnDestroy {
);
}
copySecretUuid(id: string) {
SecretsListComponent.copySecretUuid(id, this.platformUtilsService, this.i18nService);
}
protected hideOnboarding() {
this.showOnboarding = false;
this.saveCompletedTasks(this.organizationId, {

View File

@ -16,6 +16,7 @@
(editSecretEvent)="openEditSecret($event)"
(copySecretNameEvent)="copySecretName($event)"
(copySecretValueEvent)="copySecretValue($event)"
(copySecretUuidEvent)="copySecretUuid($event)"
[secrets]="projectSecrets.secrets"
></sm-secrets-list>
</ng-container>

View File

@ -109,4 +109,8 @@ export class ProjectSecretsComponent {
this.secretService
);
}
copySecretUuid(id: string) {
SecretsListComponent.copySecretUuid(id, this.platformUtilsService, this.i18nService);
}
}

View File

@ -12,6 +12,7 @@
(editSecretEvent)="openEditSecret($event)"
(copySecretNameEvent)="copySecretName($event)"
(copySecretValueEvent)="copySecretValue($event)"
(copySecretUuidEvent)="copySecretUuid($event)"
[secrets]="secrets$ | async"
[search]="search"
></sm-secrets-list>

View File

@ -96,4 +96,8 @@ export class SecretsComponent implements OnInit {
this.secretService
);
}
copySecretUuid(id: string) {
SecretsListComponent.copySecretUuid(id, this.platformUtilsService, this.i18nService);
}
}

View File

@ -64,9 +64,30 @@
<td bitCell>
<div class="tw-flex tw-items-center tw-gap-4 tw-break-all">
<i class="bwi bwi-key tw-text-muted" aria-hidden="true"></i>
<button type="button" bitLink (click)="editSecretEvent.emit(secret.id)" *ngIf="!trash">
{{ secret.name }}
</button>
<div>
<div>
<button
type="button"
bitLink
(click)="editSecretEvent.emit(secret.id)"
*ngIf="!trash"
>
{{ secret.name }}
</button>
</div>
<div class="tw-text-sm tw-text-muted">
{{ secret.id }}
<button
type="button"
bitIconButton="bwi-clone"
buttonType="main"
size="small"
[title]="'copyUuid' | i18n"
[attr.aria-label]="'copyUuid' | i18n"
(click)="copySecretUuidEvent.emit(secret.id)"
></button>
</div>
</div>
<div *ngIf="trash">{{ secret.name }}</div>
</div>
</td>

View File

@ -38,6 +38,7 @@ export class SecretsListComponent implements OnDestroy {
@Output() editSecretEvent = new EventEmitter<string>();
@Output() copySecretNameEvent = new EventEmitter<string>();
@Output() copySecretValueEvent = new EventEmitter<string>();
@Output() copySecretUuidEvent = new EventEmitter<string>();
@Output() onSecretCheckedEvent = new EventEmitter<string[]>();
@Output() deleteSecretsEvent = new EventEmitter<SecretListView[]>();
@Output() newSecretEvent = new EventEmitter();
@ -149,6 +150,19 @@ export class SecretsListComponent implements OnDestroy {
});
}
static copySecretUuid(
id: string,
platformUtilsService: PlatformUtilsService,
i18nService: I18nService
) {
platformUtilsService.copyToClipboard(id);
platformUtilsService.showToast(
"success",
null,
i18nService.t("valueCopied", i18nService.t("uuid"))
);
}
/**
* TODO: Remove in favor of updating `PlatformUtilsService.copyToClipboard`
*/