mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
[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
This commit is contained in:
@@ -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",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -88,5 +88,9 @@
|
||||
<i class="bwi bwi-sticky-note tw-mr-1" aria-hidden="true"></i>
|
||||
{{ "typeSecureNote" | i18n }}
|
||||
</button>
|
||||
<button type="button" bitMenuItem (click)="addCipher(CipherType.SshKey)">
|
||||
<i class="bwi bwi-key tw-mr-1" aria-hidden="true"></i>
|
||||
{{ "typeSshKey" | i18n }}
|
||||
</button>
|
||||
</bit-menu>
|
||||
</ng-template>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
(onCipherClicked)="viewCipher($event)"
|
||||
(onCipherRightClicked)="viewCipherMenu($event)"
|
||||
(onAddCipher)="addCipher($event)"
|
||||
(onAddCipherOptions)="addCipherOptions()"
|
||||
>
|
||||
</app-vault-items-v2>
|
||||
<div class="details" *ngIf="!!action">
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user