fix: login v2 console feature toggle allow empty base uri (#11428)

# Which Problems Are Solved
The hosted login v2 required the base uri to be empty in the consoles
feature settings. The console however has a validator that checks if the
field is set to something.

# How the Problems Are Solved
Remove the required validator from the field.

# Additional Changes
Refactored the cnsl-login-v2-feature-toggle component to use the new
angular if statements.

# Additional Context
- Closes #11417
This commit is contained in:
Ramon
2026-02-11 08:32:56 +00:00
committed by GitHub
parent e545d7c5b1
commit 5dab2ba658
2 changed files with 32 additions and 31 deletions
@@ -1,27 +1,29 @@
<cnsl-feature-toggle @if (toggleState$ | async; as toggleState) {
*ngIf="toggleState$ | async as toggleState" <cnsl-feature-toggle
toggleStateKey="loginV2" toggleStateKey="loginV2"
[toggleState]="toggleState" [toggleState]="toggleState"
(toggleChange)="toggleState$.next($event); !$event.enabled && toggleChanged.emit($event)" (toggleChange)="toggleState$.next($event); !$event.enabled && toggleChanged.emit($event)"
> >
<cnsl-form-field *ngIf="toggleState.enabled"> @if (toggleState.enabled) {
<cnsl-label>{{ 'SETTING.FEATURES.LOGINV2_BASEURI' | translate }}</cnsl-label> <cnsl-form-field>
<input cnslInput [formControl]="baseUri" /> <cnsl-label>{{ 'SETTING.FEATURES.LOGINV2_BASEURI' | translate }}</cnsl-label>
<button <input cnslInput [formControl]="baseUri" />
matTooltip="{{ 'ACTIONS.SAVE' | translate }}" <button
mat-icon-button matTooltip="{{ 'ACTIONS.SAVE' | translate }}"
[disabled]="baseUri.invalid" mat-icon-button
color="primary" color="primary"
type="submit" type="submit"
(click)=" (click)="
toggleChanged.emit({ toggleChanged.emit({
source: toggleState.source, source: toggleState.source,
enabled: toggleState.enabled, enabled: toggleState.enabled,
baseUri: baseUri.value, baseUri: baseUri.value,
}) })
" "
> >
<i class="las la-save"></i> <i class="las la-save"></i>
</button> </button>
</cnsl-form-field> </cnsl-form-field>
</cnsl-feature-toggle> }
</cnsl-feature-toggle>
}
@@ -2,8 +2,8 @@ import { ChangeDetectionStrategy, Component, DestroyRef, EventEmitter, Input, Ou
import { FeatureToggleComponent } from '../feature-toggle.component'; import { FeatureToggleComponent } from '../feature-toggle.component';
import { ToggleStates } from 'src/app/components/features/features.component'; import { ToggleStates } from 'src/app/components/features/features.component';
import { distinctUntilKeyChanged, ReplaySubject } from 'rxjs'; import { distinctUntilKeyChanged, ReplaySubject } from 'rxjs';
import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms'; import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { AsyncPipe, NgIf } from '@angular/common'; import { AsyncPipe } from '@angular/common';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { InputModule } from 'src/app/modules/input/input.module'; import { InputModule } from 'src/app/modules/input/input.module';
import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe/has-role-pipe.module'; import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe/has-role-pipe.module';
@@ -17,7 +17,6 @@ import { MatTooltipModule } from '@angular/material/tooltip';
imports: [ imports: [
FeatureToggleComponent, FeatureToggleComponent,
AsyncPipe, AsyncPipe,
NgIf,
ReactiveFormsModule, ReactiveFormsModule,
InputModule, InputModule,
HasRolePipeModule, HasRolePipeModule,
@@ -36,7 +35,7 @@ export class LoginV2FeatureToggleComponent {
public toggleChanged = new EventEmitter<ToggleStates['loginV2']>(); public toggleChanged = new EventEmitter<ToggleStates['loginV2']>();
protected readonly toggleState$ = new ReplaySubject<ToggleStates['loginV2']>(1); protected readonly toggleState$ = new ReplaySubject<ToggleStates['loginV2']>(1);
protected readonly baseUri = new FormControl('', { nonNullable: true, validators: [Validators.required] }); protected readonly baseUri = new FormControl('', { nonNullable: true });
constructor(destroyRef: DestroyRef) { constructor(destroyRef: DestroyRef) {
this.toggleState$.pipe(distinctUntilKeyChanged('baseUri'), takeUntilDestroyed(destroyRef)).subscribe(({ baseUri }) => { this.toggleState$.pipe(distinctUntilKeyChanged('baseUri'), takeUntilDestroyed(destroyRef)).subscribe(({ baseUri }) => {