diff --git a/src/app/vault/vault.component.ts b/src/app/vault/vault.component.ts
index 4ccc0fa2af..856571ef52 100644
--- a/src/app/vault/vault.component.ts
+++ b/src/app/vault/vault.component.ts
@@ -43,9 +43,9 @@ export class VaultComponent implements OnInit {
@ViewChild(AddEditComponent) addEditComponent: AddEditComponent;
@ViewChild(CiphersComponent) ciphersComponent: CiphersComponent;
@ViewChild(GroupingsComponent) groupingsComponent: GroupingsComponent;
- @ViewChild('passwordGenerator', { read: ViewContainerRef }) passwordGeneratorModal: ViewContainerRef;
- @ViewChild('attachments', { read: ViewContainerRef }) attachmentsModal: ViewContainerRef;
- @ViewChild('folderAddEdit', { read: ViewContainerRef }) folderAddEditModal: ViewContainerRef;
+ @ViewChild('passwordGenerator', { read: ViewContainerRef }) passwordGeneratorModalRef: ViewContainerRef;
+ @ViewChild('attachments', { read: ViewContainerRef }) attachmentsModalRef: ViewContainerRef;
+ @ViewChild('folderAddEdit', { read: ViewContainerRef }) folderAddEditModalRef: ViewContainerRef;
action: string;
cipherId: string = null;
@@ -55,6 +55,10 @@ export class VaultComponent implements OnInit {
collectionId: string = null;
addType: CipherType = null;
+ private passwordGeneratorModal: ModalComponent = null;
+ private folderAddEditModal: ModalComponent = null;
+ private attachmentsModal: ModalComponent = null;
+
constructor(private route: ActivatedRoute, private router: Router, private location: Location,
private componentFactoryResolver: ComponentFactoryResolver, private i18nService: I18nService,
private broadcasterService: BroadcasterService, private changeDetectorRef: ChangeDetectorRef,
@@ -82,6 +86,13 @@ export class VaultComponent implements OnInit {
case 'newFolder':
await this.addFolder();
break;
+ case 'focusSearch':
+ (document.querySelector('#search') as HTMLInputElement).focus();
+ detectChanges = false;
+ break;
+ case 'openPasswordGenerator':
+ await this.openPasswordGenerator(false);
+ break;
default:
detectChanges = false;
break;
@@ -103,9 +114,10 @@ export class VaultComponent implements OnInit {
}
async load(params?: { [key: string]: any }) {
+ await this.groupingsComponent.load();
+
if (params == null) {
this.groupingsComponent.selectedAll = true;
- await this.groupingsComponent.load();
await this.ciphersComponent.load();
return;
}
@@ -138,7 +150,6 @@ export class VaultComponent implements OnInit {
await this.filterCollection(params.collectionId);
} else {
this.groupingsComponent.selectedAll = true;
- await this.groupingsComponent.load();
await this.ciphersComponent.load();
}
}
@@ -189,11 +200,20 @@ export class VaultComponent implements OnInit {
}
editCipherAttachments(cipher: CipherView) {
+ if (this.attachmentsModal != null) {
+ this.attachmentsModal.close();
+ }
+
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
- const modal = this.attachmentsModal.createComponent(factory).instance;
- const childComponent = modal.show
(AttachmentsComponent, this.attachmentsModal);
+ this.attachmentsModal = this.attachmentsModalRef.createComponent(factory).instance;
+ const childComponent = this.attachmentsModal.show(
+ AttachmentsComponent, this.attachmentsModalRef);
childComponent.cipherId = cipher.id;
+
+ this.attachmentsModal.onClosed.subscribe(() => {
+ this.attachmentsModal = null;
+ });
}
cancelledAddEdit(cipher: CipherView) {
@@ -242,48 +262,66 @@ export class VaultComponent implements OnInit {
this.go();
}
- async openPasswordGenerator() {
- const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
- const modal = this.passwordGeneratorModal.createComponent(factory).instance;
- const childComponent = modal.show(PasswordGeneratorComponent,
- this.passwordGeneratorModal);
+ async openPasswordGenerator(showSelect: boolean) {
+ if (this.passwordGeneratorModal != null) {
+ this.passwordGeneratorModal.close();
+ }
- childComponent.showSelect = true;
+ const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
+ this.passwordGeneratorModal = this.passwordGeneratorModalRef.createComponent(factory).instance;
+ const childComponent = this.passwordGeneratorModal.show(PasswordGeneratorComponent,
+ this.passwordGeneratorModalRef);
+
+ childComponent.showSelect = showSelect;
childComponent.onSelected.subscribe((password: string) => {
- modal.close();
+ this.passwordGeneratorModal.close();
if (this.addEditComponent != null && this.addEditComponent.cipher != null &&
this.addEditComponent.cipher.login != null) {
this.addEditComponent.cipher.login.password = password;
}
});
+
+ this.passwordGeneratorModal.onClosed.subscribe(() => {
+ this.passwordGeneratorModal = null;
+ });
}
async addFolder() {
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
- const modal = this.folderAddEditModal.createComponent(factory).instance;
- const childComponent = modal.show(FolderAddEditComponent, this.folderAddEditModal);
+ this.folderAddEditModal = this.folderAddEditModalRef.createComponent(factory).instance;
+ const childComponent = this.folderAddEditModal.show(
+ FolderAddEditComponent, this.folderAddEditModalRef);
childComponent.folderId = null;
childComponent.onSavedFolder.subscribe(async (folder: FolderView) => {
- modal.close();
+ this.folderAddEditModal.close();
await this.groupingsComponent.loadFolders();
});
+
+ this.folderAddEditModal.onClosed.subscribe(() => {
+ this.folderAddEditModal = null;
+ });
}
async editFolder(folderId: string) {
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
- const modal = this.folderAddEditModal.createComponent(factory).instance;
- const childComponent = modal.show(FolderAddEditComponent, this.folderAddEditModal);
+ this.folderAddEditModal = this.folderAddEditModalRef.createComponent(factory).instance;
+ const childComponent = this.folderAddEditModal.show(
+ FolderAddEditComponent, this.folderAddEditModalRef);
childComponent.folderId = folderId;
childComponent.onSavedFolder.subscribe(async (folder: FolderView) => {
- modal.close();
+ this.folderAddEditModal.close();
await this.groupingsComponent.loadFolders();
});
childComponent.onDeletedFolder.subscribe(async (folder: FolderView) => {
- modal.close();
+ this.folderAddEditModal.close();
await this.groupingsComponent.loadFolders();
});
+
+ this.folderAddEditModal.onClosed.subscribe(() => {
+ this.folderAddEditModal = null;
+ });
}
private clearFilters() {
diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json
index e0eb495721..918035f8a0 100644
--- a/src/locales/en/messages.json
+++ b/src/locales/en/messages.json
@@ -30,7 +30,7 @@
"message": "Collections"
},
"searchVault": {
- "message": "Search vault"
+ "message": "Search Vault"
},
"addItem": {
"message": "Add Item"
@@ -335,16 +335,16 @@
"message": "Avoid Ambiguous Characters"
},
"searchCollection": {
- "message": "Search collection"
+ "message": "Search Collection"
},
"searchFolder": {
- "message": "Search folder"
+ "message": "Search Folder"
},
"searchFavorites": {
- "message": "Search favorites"
+ "message": "Search Favorites"
},
"searchType": {
- "message": "Search type",
+ "message": "Search Type",
"description": "Search item type"
},
"newAttachment": {
@@ -624,5 +624,11 @@
},
"loading": {
"message": "Loading..."
+ },
+ "lock": {
+ "message": "Lock"
+ },
+ "passwordGenerator": {
+ "message": "Password Generator"
}
}
diff --git a/src/main/menu.main.ts b/src/main/menu.main.ts
index 589c42ae24..fbec86f384 100644
--- a/src/main/menu.main.ts
+++ b/src/main/menu.main.ts
@@ -18,7 +18,7 @@ export class MenuMain {
const template: MenuItemConstructorOptions[] = [
{
- label: 'File',
+ label: this.i18nService.t('file'),
submenu: [
{
label: this.i18nService.t('addNewLogin'),
@@ -34,25 +34,29 @@ export class MenuMain {
label: this.i18nService.t('typeLogin'),
click() {
self.send('newLogin');
- }
+ },
+ accelerator: 'Alt+L'
},
{
label: this.i18nService.t('typeCard'),
click() {
self.send('newCard');
- }
+ },
+ accelerator: 'Alt+C'
},
{
label: this.i18nService.t('typeIdentity'),
click() {
self.send('newIdentity');
- }
+ },
+ accelerator: 'Alt+I'
},
{
label: this.i18nService.t('typeSecureNote'),
click() {
self.send('newSecureNote');
- }
+ },
+ accelerator: 'Alt+S'
}
]
},
@@ -71,7 +75,7 @@ export class MenuMain {
}
},
{
- label: 'Lock',
+ label: this.i18nService.t('lock'),
click() {
self.send('lockApp');
},
@@ -94,22 +98,30 @@ export class MenuMain {
{
label: this.i18nService.t('view'),
submenu: [
- { role: 'reload' },
- { role: 'forcereload' },
- { role: 'toggledevtools' },
- { type: 'separator' },
{
- role: 'resetzoom',
- accelerator: 'CmdOrCtrl+0' },
+ label: this.i18nService.t('passwordGenerator'),
+ click() {
+ self.send('openPasswordGenerator');
+ },
+ accelerator: 'CmdOrCtrl+G'
+ },
{
- role: 'zoomin',
- accelerator: 'CmdOrCtrl+=' },
- {
- role: 'zoomout',
- accelerator: 'CmdOrCtrl+-'
+ label: this.i18nService.t('searchVault'),
+ click() {
+ self.send('focusSearch');
+ },
+ accelerator: 'CmdOrCtrl+F'
},
{ type: 'separator' },
- { role: 'togglefullscreen' }
+ { role: 'resetzoom', accelerator: 'CmdOrCtrl+0' },
+ { role: 'zoomin', accelerator: 'CmdOrCtrl+=' },
+ { role: 'zoomout', accelerator: 'CmdOrCtrl+-' },
+ { type: 'separator' },
+ { role: 'togglefullscreen' },
+ { type: 'separator' },
+ { role: 'reload', accelerator: 'Alt+Shift+R' },
+ { role: 'forcereload' },
+ { role: 'toggledevtools' },
]
},
{