1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-22 11:13:46 +00:00

[PM-17820] - Browser/Web - update button and label state in username generator (#13189)

* add event handling for username generator

* fix specs. change function name to not be of an event type

* update specs

* rename function

* revert name change

* fix spec

* bubble algorithmSelected up to generator components. add disabled button tests

* add typeSelected event

* revert addition of onType.

* apply same logic in onAlgorithmSelected to web and desktop
This commit is contained in:
Jordan Aasen
2025-03-03 11:44:34 -08:00
committed by GitHub
parent d01f0c6bc4
commit 13213585b2
9 changed files with 205 additions and 97 deletions

View File

@@ -4,7 +4,7 @@
<vault-cipher-form-generator
[type]="data.type"
(valueGenerated)="onCredentialGenerated($event)"
[onAlgorithmSelected]="onAlgorithmSelected"
(algorithmSelected)="onAlgorithmSelected($event)"
/>
<bit-item>
<button

View File

@@ -3,6 +3,7 @@ import { CommonModule } from "@angular/common";
import { Component, Inject } from "@angular/core";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import {
ButtonModule,
DialogModule,
@@ -44,16 +45,17 @@ export class CredentialGeneratorDialogComponent {
constructor(
@Inject(DIALOG_DATA) protected data: CredentialGeneratorParams,
private dialogService: DialogService,
private i18nService: I18nService,
) {}
onAlgorithmSelected = (selected?: AlgorithmInfo) => {
if (selected) {
this.buttonLabel = selected.useGeneratedValue;
} else {
// clear the credential value when the user is
// selecting the credential generation algorithm
this.credentialValue = undefined;
// default to email
this.buttonLabel = this.i18nService.t("useThisEmail");
}
this.credentialValue = undefined;
};
applyCredentials = () => {