From 23e7f120fd67ea8bf8ff554cd5e23b24a3ef4717 Mon Sep 17 00:00:00 2001 From: Jordan Aasen <166539328+jaasen-livefront@users.noreply.github.com> Date: Thu, 1 May 2025 13:03:11 -0700 Subject: [PATCH] [PM-19579] - add sshKey option to desktop (#14402) * add sshKey option to desktop * fix add new sshKey * revert removal of catch * revert removal of catch --- apps/desktop/src/main/menu/menu.file.ts | 6 ++++ .../app/vault/vault-items-v2.component.html | 4 +++ .../vault/app/vault/vault-v2.component.html | 1 - .../src/vault/app/vault/vault-v2.component.ts | 31 ++++++------------- .../src/vault/app/vault/vault.component.ts | 11 +++++++ 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/apps/desktop/src/main/menu/menu.file.ts b/apps/desktop/src/main/menu/menu.file.ts index 712e579515e..25db5b695e7 100644 --- a/apps/desktop/src/main/menu/menu.file.ts +++ b/apps/desktop/src/main/menu/menu.file.ts @@ -103,6 +103,12 @@ export class FileMenu extends FirstMenu implements IMenubarMenu { click: () => this.sendMessage("newSecureNote"), accelerator: "CmdOrCtrl+Shift+S", }, + { + id: "typeSshKey", + label: this.localize("typeSshKey"), + click: () => this.sendMessage("newSshKey"), + accelerator: "CmdOrCtrl+Shift+K", + }, ]; } diff --git a/apps/desktop/src/vault/app/vault/vault-items-v2.component.html b/apps/desktop/src/vault/app/vault/vault-items-v2.component.html index ff35e00fb0f..63e648e3cf3 100644 --- a/apps/desktop/src/vault/app/vault/vault-items-v2.component.html +++ b/apps/desktop/src/vault/app/vault/vault-items-v2.component.html @@ -88,5 +88,9 @@ {{ "typeSecureNote" | i18n }} + diff --git a/apps/desktop/src/vault/app/vault/vault-v2.component.html b/apps/desktop/src/vault/app/vault/vault-v2.component.html index 12f52502984..00e225f41d1 100644 --- a/apps/desktop/src/vault/app/vault/vault-v2.component.html +++ b/apps/desktop/src/vault/app/vault/vault-v2.component.html @@ -6,7 +6,6 @@ (onCipherClicked)="viewCipher($event)" (onCipherRightClicked)="viewCipherMenu($event)" (onAddCipher)="addCipher($event)" - (onAddCipherOptions)="addCipherOptions()" >
diff --git a/apps/desktop/src/vault/app/vault/vault-v2.component.ts b/apps/desktop/src/vault/app/vault/vault-v2.component.ts index 7e799899418..05c6c5e261e 100644 --- a/apps/desktop/src/vault/app/vault/vault-v2.component.ts +++ b/apps/desktop/src/vault/app/vault/vault-v2.component.ts @@ -208,6 +208,9 @@ export class VaultV2Component implements OnInit, OnDestroy { case "newSecureNote": await this.addCipher(CipherType.SecureNote).catch(() => {}); break; + case "newSshKey": + await this.addCipher(CipherType.SshKey).catch(() => {}); + break; case "focusSearch": (document.querySelector("#search") as HTMLInputElement)?.select(); detectChanges = false; @@ -531,28 +534,14 @@ export class VaultV2Component implements OnInit, OnDestroy { this.action = "add"; this.prefillCipherFromFilter(); await this.go().catch(() => {}); - } - addCipherOptions() { - const menu: RendererMenuItem[] = [ - { - label: this.i18nService.t("typeLogin"), - click: () => this.addCipherWithChangeDetection(CipherType.Login), - }, - { - label: this.i18nService.t("typeCard"), - click: () => this.addCipherWithChangeDetection(CipherType.Card), - }, - { - label: this.i18nService.t("typeIdentity"), - click: () => this.addCipherWithChangeDetection(CipherType.Identity), - }, - { - label: this.i18nService.t("typeSecureNote"), - click: () => this.addCipherWithChangeDetection(CipherType.SecureNote), - }, - ]; - invokeMenu(menu); + if (type === CipherType.SshKey) { + this.toastService.showToast({ + variant: "success", + title: "", + message: this.i18nService.t("sshKeyGenerated"), + }); + } } async savedCipher(cipher: CipherView) { diff --git a/apps/desktop/src/vault/app/vault/vault.component.ts b/apps/desktop/src/vault/app/vault/vault.component.ts index a21a285a428..6c0d5ef81d0 100644 --- a/apps/desktop/src/vault/app/vault/vault.component.ts +++ b/apps/desktop/src/vault/app/vault/vault.component.ts @@ -151,6 +151,9 @@ export class VaultComponent implements OnInit, OnDestroy { case "newSecureNote": await this.addCipher(CipherType.SecureNote); break; + case "newSshKey": + await this.addCipher(CipherType.SshKey); + break; case "focusSearch": (document.querySelector("#search") as HTMLInputElement).select(); detectChanges = false; @@ -470,6 +473,14 @@ export class VaultComponent implements OnInit, OnDestroy { this.cipherId = null; this.prefillNewCipherFromFilter(); this.go(); + + if (type === CipherType.SshKey) { + this.toastService.showToast({ + variant: "success", + title: "", + message: this.i18nService.t("sshKeyGenerated"), + }); + } } addCipherOptions() {