1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 02:33:46 +00:00

[SM-632] fix copy secret value in Safari (#4974)

* add async copy method

* be more DRY
This commit is contained in:
Will Martin
2023-03-10 10:13:07 -05:00
committed by GitHub
parent 0b93a33f5a
commit e11e4db356
4 changed files with 80 additions and 39 deletions

View File

@@ -45,6 +45,7 @@ import {
ServiceAccountOperation,
} from "../service-accounts/dialog/service-account-dialog.component";
import { ServiceAccountService } from "../service-accounts/service-account.service";
import { SecretsListComponent } from "../shared/secrets-list.component";
type Tasks = {
[organizationId: string]: OrganizationTasks;
@@ -277,21 +278,15 @@ export class OverviewComponent implements OnInit, OnDestroy {
}
copySecretName(name: string) {
this.platformUtilsService.copyToClipboard(name);
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("valueCopied", this.i18nService.t("name"))
);
SecretsListComponent.copySecretName(name, this.platformUtilsService, this.i18nService);
}
async copySecretValue(id: string) {
const secret = await this.secretService.getBySecretId(id);
this.platformUtilsService.copyToClipboard(secret.value);
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("valueCopied", this.i18nService.t("value"))
copySecretValue(id: string) {
SecretsListComponent.copySecretValue(
id,
this.platformUtilsService,
this.i18nService,
this.secretService
);
}