PM-3632 - Vault Timeout Input comp (all clients) - resolve bug where logic which was supposed to initialize the custom vault timeout timeframe if coming from a previously selected numeric timeout was not working properly. (#6102)
This commit is contained in:
parent
c8c314dd35
commit
3930189c4e
|
@ -76,14 +76,17 @@ export class VaultTimeoutInputComponent
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Assign the previous value to the custom fields
|
// Assign the current value to the custom fields
|
||||||
|
// so that if the user goes from a numeric value to custom
|
||||||
|
// we can initialize the custom fields with the current value
|
||||||
|
// ex: user picks 5 min, goes to custom, we want to show 0 hr, 5 min in the custom fields
|
||||||
this.form.controls.vaultTimeout.valueChanges
|
this.form.controls.vaultTimeout.valueChanges
|
||||||
.pipe(
|
.pipe(
|
||||||
filter((value) => value !== VaultTimeoutInputComponent.CUSTOM_VALUE),
|
filter((value) => value !== VaultTimeoutInputComponent.CUSTOM_VALUE),
|
||||||
takeUntil(this.destroy$)
|
takeUntil(this.destroy$)
|
||||||
)
|
)
|
||||||
.subscribe((_) => {
|
.subscribe((value) => {
|
||||||
const current = Math.max(this.form.value.vaultTimeout, 0);
|
const current = Math.max(value, 0);
|
||||||
this.form.patchValue({
|
this.form.patchValue({
|
||||||
custom: {
|
custom: {
|
||||||
hours: Math.floor(current / 60),
|
hours: Math.floor(current / 60),
|
||||||
|
|
Loading…
Reference in New Issue