From d82a88bcc6d5b022bc02ba170fa965a1da11b87c Mon Sep 17 00:00:00 2001 From: Aaron Davison Date: Mon, 18 Oct 2021 16:00:17 +1300 Subject: [PATCH] added additional options for vault remember password --- .../components/unlockVaultModal.component.pug | 4 ++-- .../components/unlockVaultModal.component.ts | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tabby-core/src/components/unlockVaultModal.component.pug b/tabby-core/src/components/unlockVaultModal.component.pug index 5e2bde35..75c77785 100644 --- a/tabby-core/src/components/unlockVaultModal.component.pug +++ b/tabby-core/src/components/unlockVaultModal.component.pug @@ -3,7 +3,7 @@ h3.m-0 Vault is locked .ml-auto(ngbDropdown, placement='bottom-right') button.btn.btn-link(ngbDropdownToggle, (click)='$event.stopPropagation()') - span(*ngIf='rememberFor') Remember for {{rememberFor}} min + span(*ngIf='rememberFor') Remember for {{getRememberForDisplay(rememberFor)}} span(*ngIf='!rememberFor') Do not remember div(ngbDropdownMenu) button.dropdown-item( @@ -12,7 +12,7 @@ button.dropdown-item( *ngFor='let x of rememberOptions', (click)='rememberFor = x', - ) {{x}} min + ) {{getRememberForDisplay(x)}} .input-group input.form-control.form-control-lg( diff --git a/tabby-core/src/components/unlockVaultModal.component.ts b/tabby-core/src/components/unlockVaultModal.component.ts index 39833332..6142498d 100644 --- a/tabby-core/src/components/unlockVaultModal.component.ts +++ b/tabby-core/src/components/unlockVaultModal.component.ts @@ -8,7 +8,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' export class UnlockVaultModalComponent { passphrase: string rememberFor = 1 - rememberOptions = [1, 5, 15, 60] + rememberOptions = [1, 5, 15, 60, 1440, 10080] @ViewChild('input') input: ElementRef constructor ( @@ -33,4 +33,19 @@ export class UnlockVaultModalComponent { cancel (): void { this.modalInstance.close(null) } + + getRememberForDisplay (rememberOption): string { + if (rememberOption >= 1440) + { + return `${Math.round((rememberOption/1440)*10)/10} day` + } + else if (rememberOption >= 60) + { + return `${Math.round((rememberOption/60)*10)/10} hour` + } + else + { + return `${rememberOption} min` + } + } }