mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-02 18:17:46 +01:00
Add warning dialog when clearing generator history (#11711)
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
parent
fa537638bf
commit
ab98bef28f
@ -1797,6 +1797,12 @@
|
|||||||
"generatorHistory": {
|
"generatorHistory": {
|
||||||
"message": "Generator history"
|
"message": "Generator history"
|
||||||
},
|
},
|
||||||
|
"clearGeneratorHistoryTitle": {
|
||||||
|
"message": "Clear generator history"
|
||||||
|
},
|
||||||
|
"cleargGeneratorHistoryDescription": {
|
||||||
|
"message": "If you continue, all entries will be permanently deleted from generator's history. Are you sure you want to continue?"
|
||||||
|
},
|
||||||
"back": {
|
"back": {
|
||||||
"message": "Back"
|
"message": "Back"
|
||||||
},
|
},
|
||||||
|
@ -6,7 +6,7 @@ import { BehaviorSubject, distinctUntilChanged, firstValueFrom, map, switchMap }
|
|||||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||||
import { UserId } from "@bitwarden/common/types/guid";
|
import { UserId } from "@bitwarden/common/types/guid";
|
||||||
import { ButtonModule, ContainerComponent } from "@bitwarden/components";
|
import { ButtonModule, ContainerComponent, DialogService } from "@bitwarden/components";
|
||||||
import {
|
import {
|
||||||
CredentialGeneratorHistoryComponent as CredentialGeneratorHistoryToolsComponent,
|
CredentialGeneratorHistoryComponent as CredentialGeneratorHistoryToolsComponent,
|
||||||
EmptyCredentialHistoryComponent,
|
EmptyCredentialHistoryComponent,
|
||||||
@ -42,6 +42,7 @@ export class CredentialGeneratorHistoryComponent {
|
|||||||
constructor(
|
constructor(
|
||||||
private accountService: AccountService,
|
private accountService: AccountService,
|
||||||
private history: GeneratorHistoryService,
|
private history: GeneratorHistoryService,
|
||||||
|
private dialogService: DialogService,
|
||||||
) {
|
) {
|
||||||
this.accountService.activeAccount$
|
this.accountService.activeAccount$
|
||||||
.pipe(
|
.pipe(
|
||||||
@ -61,6 +62,16 @@ export class CredentialGeneratorHistoryComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clear = async () => {
|
clear = async () => {
|
||||||
await this.history.clear(await firstValueFrom(this.userId$));
|
const confirmed = await this.dialogService.openSimpleDialog({
|
||||||
|
title: { key: "clearGeneratorHistoryTitle" },
|
||||||
|
content: { key: "cleargGeneratorHistoryDescription" },
|
||||||
|
type: "warning",
|
||||||
|
acceptButtonText: { key: "clearHistory" },
|
||||||
|
cancelButtonText: { key: "cancel" },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (confirmed) {
|
||||||
|
await this.history.clear(await firstValueFrom(this.userId$));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user