diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.html
index 8f35776a60..e5106b10c5 100644
--- a/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.html
+++ b/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.html
@@ -57,6 +57,8 @@
(deleteSecretsEvent)="openDeleteSecret($event)"
(newSecretEvent)="openNewSecretDialog()"
(editSecretEvent)="openEditSecret($event)"
+ (copySecretNameEvent)="copySecretName($event)"
+ (copySecretValueEvent)="copySecretValue($event)"
[secrets]="view.latestSecrets"
>
0" class="tw-ml-auto tw-mt-4 tw-max-w-max">
diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.ts
index fab91a1e30..2995ec28f3 100644
--- a/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.ts
+++ b/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.ts
@@ -11,7 +11,9 @@ import {
distinct,
} from "rxjs";
+import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
+import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { DialogService } from "@bitwarden/components";
import { ProjectListView } from "../models/view/project-list.view";
@@ -75,7 +77,9 @@ export class OverviewComponent implements OnInit, OnDestroy {
private secretService: SecretService,
private serviceAccountService: ServiceAccountService,
private dialogService: DialogService,
- private organizationService: OrganizationService
+ private organizationService: OrganizationService,
+ private platformUtilsService: PlatformUtilsService,
+ private i18nService: I18nService
) {
/**
* We want to remount the `sm-onboarding` component on route change.
@@ -222,4 +226,23 @@ 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"))
+ );
+ }
+
+ 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"))
+ );
+ }
}
diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-secrets.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-secrets.component.html
index 4d6963d9e8..4a1a430c11 100644
--- a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-secrets.component.html
+++ b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-secrets.component.html
@@ -9,6 +9,8 @@
(deleteSecretsEvent)="openDeleteSecret($event)"
(newSecretEvent)="openNewSecretDialog()"
(editSecretEvent)="openEditSecret($event)"
+ (copySecretNameEvent)="copySecretName($event)"
+ (copySecretValueEvent)="copySecretValue($event)"
[secrets]="secrets"
>
diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-secrets.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-secrets.component.ts
index 1fa7774fa2..b2f9212931 100644
--- a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-secrets.component.ts
+++ b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-secrets.component.ts
@@ -2,6 +2,8 @@ import { Component } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { combineLatestWith, Observable, startWith, switchMap } from "rxjs";
+import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
+import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { DialogService } from "@bitwarden/components";
import { SecretListView } from "../../models/view/secret-list.view";
@@ -29,7 +31,9 @@ export class ProjectSecretsComponent {
constructor(
private route: ActivatedRoute,
private secretService: SecretService,
- private dialogService: DialogService
+ private dialogService: DialogService,
+ private platformUtilsService: PlatformUtilsService,
+ private i18nService: I18nService
) {}
ngOnInit() {
@@ -75,4 +79,23 @@ export class ProjectSecretsComponent {
},
});
}
+
+ copySecretName(name: string) {
+ this.platformUtilsService.copyToClipboard(name);
+ this.platformUtilsService.showToast(
+ "success",
+ null,
+ this.i18nService.t("valueCopied", this.i18nService.t("name"))
+ );
+ }
+
+ 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"))
+ );
+ }
}
diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.component.html
index d706afa56e..4f3a9d2c47 100644
--- a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.component.html
+++ b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.component.html
@@ -6,6 +6,8 @@
(deleteSecretsEvent)="openDeleteSecret($event)"
(newSecretEvent)="openNewSecretDialog()"
(editSecretEvent)="openEditSecret($event)"
+ (copySecretNameEvent)="copySecretName($event)"
+ (copySecretValueEvent)="copySecretValue($event)"
[secrets]="secrets$ | async"
[search]="search"
>
diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.component.ts
index 0ddf04a275..d590826204 100644
--- a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.component.ts
+++ b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.component.ts
@@ -2,6 +2,8 @@ import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { combineLatestWith, Observable, startWith, switchMap } from "rxjs";
+import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
+import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { DialogService } from "@bitwarden/components";
import { SecretListView } from "../models/view/secret-list.view";
@@ -30,7 +32,9 @@ export class SecretsComponent implements OnInit {
constructor(
private route: ActivatedRoute,
private secretService: SecretService,
- private dialogService: DialogService
+ private dialogService: DialogService,
+ private platformUtilsService: PlatformUtilsService,
+ private i18nService: I18nService
) {}
ngOnInit() {
@@ -78,4 +82,23 @@ export class SecretsComponent implements OnInit {
},
});
}
+
+ copySecretName(name: string) {
+ this.platformUtilsService.copyToClipboard(name);
+ this.platformUtilsService.showToast(
+ "success",
+ null,
+ this.i18nService.t("valueCopied", this.i18nService.t("name"))
+ );
+ }
+
+ 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"))
+ );
+ }
}
diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/shared/secrets-list.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/shared/secrets-list.component.html
index 96f5dff87f..620bf270c8 100644
--- a/bitwarden_license/bit-web/src/app/secrets-manager/shared/secrets-list.component.html
+++ b/bitwarden_license/bit-web/src/app/secrets-manager/shared/secrets-list.component.html
@@ -97,7 +97,7 @@
{{ "editSecret" | i18n }}
-