diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index d7a21ad6d6..61c92ba407 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -8354,5 +8354,8 @@ }, "verified": { "message": "Verified" + }, + "viewSecret": { + "message": "View secret" } } 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 255877e4e8..29cbf78464 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 @@ -65,6 +65,7 @@ (deleteSecretsEvent)="openDeleteSecret($event)" (newSecretEvent)="openNewSecretDialog()" (editSecretEvent)="openEditSecret($event)" + (viewSecretEvent)="openViewSecret($event)" (copySecretNameEvent)="copySecretName($event)" (copySecretValueEvent)="copySecretValue($event)" (copySecretUuidEvent)="copySecretUuid($event)" 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 56c02e1ed4..4c057e5698 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 @@ -41,6 +41,10 @@ import { SecretDialogComponent, SecretOperation, } from "../secrets/dialog/secret-dialog.component"; +import { + SecretViewDialogComponent, + SecretViewDialogParams, +} from "../secrets/dialog/secret-view-dialog.component"; import { SecretService } from "../secrets/secret.service"; import { ServiceAccountDialogComponent, @@ -277,6 +281,15 @@ export class OverviewComponent implements OnInit, OnDestroy { }); } + openViewSecret(secretId: string) { + this.dialogService.open(SecretViewDialogComponent, { + data: { + organizationId: this.organizationId, + secretId: secretId, + }, + }); + } + openDeleteSecret(event: SecretListView[]) { this.dialogService.open(SecretDeleteDialogComponent, { data: { 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 980f38ca15..1ab8b7e019 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 @@ -14,6 +14,7 @@ (deleteSecretsEvent)="openDeleteSecret($event)" (newSecretEvent)="openNewSecretDialog()" (editSecretEvent)="openEditSecret($event)" + (viewSecretEvent)="openViewSecret($event)" (copySecretNameEvent)="copySecretName($event)" (copySecretValueEvent)="copySecretValue($event)" (copySecretUuidEvent)="copySecretUuid($event)" 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 21d6e576a0..b766de1ebd 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 @@ -19,6 +19,10 @@ import { SecretDialogComponent, SecretOperation, } from "../../secrets/dialog/secret-dialog.component"; +import { + SecretViewDialogComponent, + SecretViewDialogParams, +} from "../../secrets/dialog/secret-view-dialog.component"; import { SecretService } from "../../secrets/secret.service"; import { SecretsListComponent } from "../../shared/secrets-list.component"; import { ProjectService } from "../project.service"; @@ -88,6 +92,15 @@ export class ProjectSecretsComponent { }); } + openViewSecret(secretId: string) { + this.dialogService.open(SecretViewDialogComponent, { + data: { + organizationId: this.organizationId, + secretId: secretId, + }, + }); + } + openDeleteSecret(event: SecretListView[]) { this.dialogService.open(SecretDeleteDialogComponent, { data: { diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-view-dialog.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-view-dialog.component.html new file mode 100644 index 0000000000..60fa1f268c --- /dev/null +++ b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-view-dialog.component.html @@ -0,0 +1,30 @@ +
+ + +
+ + {{ "name" | i18n }} + + + + {{ "value" | i18n }} + + +
+ + {{ "notes" | i18n }} + + +
+ + + +
+
diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-view-dialog.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-view-dialog.component.ts new file mode 100644 index 0000000000..a113fd2ffa --- /dev/null +++ b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/dialog/secret-view-dialog.component.ts @@ -0,0 +1,39 @@ +import { DIALOG_DATA } from "@angular/cdk/dialog"; +import { Component, Inject, OnInit } from "@angular/core"; +import { FormControl, FormGroup } from "@angular/forms"; + +import { SecretService } from "../secret.service"; + +export interface SecretViewDialogParams { + organizationId: string; + secretId: string; +} + +@Component({ + templateUrl: "./secret-view-dialog.component.html", +}) +export class SecretViewDialogComponent implements OnInit { + protected loading = true; + protected formGroup = new FormGroup({ + name: new FormControl(""), + value: new FormControl(""), + notes: new FormControl(""), + }); + + constructor( + private secretService: SecretService, + @Inject(DIALOG_DATA) private params: SecretViewDialogParams, + ) {} + + async ngOnInit() { + this.loading = true; + const secret = await this.secretService.getBySecretId(this.params.secretId); + this.formGroup.setValue({ + name: secret.name, + value: secret.value, + notes: secret.note, + }); + this.formGroup.disable(); + this.loading = false; + } +} 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 13595d9720..b12f5c9f18 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 @@ -10,6 +10,7 @@ (deleteSecretsEvent)="openDeleteSecret($event)" (newSecretEvent)="openNewSecretDialog()" (editSecretEvent)="openEditSecret($event)" + (viewSecretEvent)="openViewSecret($event)" (copySecretNameEvent)="copySecretName($event)" (copySecretValueEvent)="copySecretValue($event)" (copySecretUuidEvent)="copySecretUuid($event)" 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 2717f96a68..1744e97036 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 @@ -20,6 +20,10 @@ import { SecretDialogComponent, SecretOperation, } from "./dialog/secret-dialog.component"; +import { + SecretViewDialogComponent, + SecretViewDialogParams, +} from "./dialog/secret-view-dialog.component"; import { SecretService } from "./secret.service"; @Component({ @@ -77,6 +81,15 @@ export class SecretsComponent implements OnInit { }); } + openViewSecret(secretId: string) { + this.dialogService.open(SecretViewDialogComponent, { + data: { + organizationId: this.organizationId, + secretId: secretId, + }, + }); + } + openDeleteSecret(event: SecretListView[]) { this.dialogService.open(SecretDeleteDialogComponent, { data: { diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.module.ts b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.module.ts index 356021817b..2ae5bfa3b8 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.module.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/secrets/secrets.module.ts @@ -4,12 +4,18 @@ import { SecretsManagerSharedModule } from "../shared/sm-shared.module"; import { SecretDeleteDialogComponent } from "./dialog/secret-delete.component"; import { SecretDialogComponent } from "./dialog/secret-dialog.component"; +import { SecretViewDialogComponent } from "./dialog/secret-view-dialog.component"; import { SecretsRoutingModule } from "./secrets-routing.module"; import { SecretsComponent } from "./secrets.component"; @NgModule({ imports: [SecretsManagerSharedModule, SecretsRoutingModule], - declarations: [SecretDeleteDialogComponent, SecretDialogComponent, SecretsComponent], + declarations: [ + SecretDeleteDialogComponent, + SecretDialogComponent, + SecretViewDialogComponent, + SecretsComponent, + ], providers: [], }) export class SecretsModule {} 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 4b629ca488..859c7417eb 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 @@ -66,7 +66,7 @@
-
@@ -118,7 +118,7 @@