-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add show secret functionality to vault
- Loading branch information
Sibren van Setten
committed
Aug 30, 2023
1 parent
dc9a7d8
commit 8bc2375
Showing
5 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
tabby-settings/src/components/showSecretModal.component.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
h4.modal-header.m-0.pb-0 {{title}} | ||
.modal-body | ||
.input-group.w-100 | ||
input.form-control( | ||
type='text', | ||
[(ngModel)]='secret.value', | ||
disabled | ||
) | ||
button.btn.btn-secondary( | ||
(click)='copySecret()' | ||
) | ||
i.fas.fa-copy | ||
|
||
.modal-footer | ||
button.btn.btn-primary((click)='close()', translate) Close |
27 changes: 27 additions & 0 deletions
27
tabby-settings/src/components/showSecretModal.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Component, Input } from '@angular/core' | ||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' | ||
import {NotificationsService, VaultFileSecret} from "tabby-core"; | ||
Check failure on line 3 in tabby-settings/src/components/showSecretModal.component.ts
|
||
|
||
/** @hidden */ | ||
@Component({ | ||
templateUrl: './showSecretModal.component.pug', | ||
}) | ||
export class ShowSecretModalComponent { | ||
@Input() title: String | ||
@Input() secret: VaultFileSecret | ||
|
||
constructor ( | ||
public modalInstance: NgbActiveModal, | ||
private notifications: NotificationsService | ||
) { } | ||
|
||
close (): void { | ||
this.modalInstance.dismiss() | ||
} | ||
|
||
copySecret (): void { | ||
navigator.clipboard.writeText(this.secret.value) | ||
// Show a notification | ||
this.notifications.info('Copied to clipboard') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters