Skip to content

Commit

Permalink
add close button to passoword history dialog (#12790)
Browse files Browse the repository at this point in the history
  • Loading branch information
audreyality authored Jan 14, 2025
1 parent 39a5add commit 0456648
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@
>
{{ "clearHistory" | i18n }}
</button>
<!-- FIXME: Remove the close button once the dialog doesn't overlap electron's
drag area.
-->
<button bitButton type="submit" buttonType="secondary" (click)="close()">
{{ "close" | i18n }}
</button>
</ng-container>
</bit-dialog>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { DialogRef } from "@angular/cdk/dialog";
import { CommonModule } from "@angular/common";
import { Component } from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
Expand Down Expand Up @@ -34,6 +35,7 @@ export class CredentialGeneratorHistoryDialogComponent {
private accountService: AccountService,
private history: GeneratorHistoryService,
private dialogService: DialogService,
private dialogRef: DialogRef,
) {
this.accountService.activeAccount$
.pipe(
Expand All @@ -52,7 +54,13 @@ export class CredentialGeneratorHistoryDialogComponent {
.subscribe(this.hasHistory$);
}

clear = async () => {
/** closes the dialog */
protected close() {
this.dialogRef.close();
}

/** Launches clear history flow */
protected async clear() {
const confirmed = await this.dialogService.openSimpleDialog({
title: { key: "clearGeneratorHistoryTitle" },
content: { key: "cleargGeneratorHistoryDescription" },
Expand All @@ -64,5 +72,5 @@ export class CredentialGeneratorHistoryDialogComponent {
if (confirmed) {
await this.history.clear(await firstValueFrom(this.userId$));
}
};
}
}

0 comments on commit 0456648

Please sign in to comment.