Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-16906] add close button to password history dialog #12790

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, the only reason to use the arrow function here would be if we wanted to use AsyncAction handlers

/** 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$));
}
};
}
}
Loading