Files
zitadel/console/src/app/modules/sidenav/sidenav.component.ts
T
d930a09cb0 fix: Improve Actions V2 Texts and reenable in settings (#9814)
# Which Problems Are Solved
This pr includes improved texts to make the usage of Actions V2 more
easy.
Since the removal of the Actions V2 Feature Flag we removed the code
that checks if it's enabled in the settings sidenav.

# How the Problems Are Solved
Added new texts to translations. Removed sidenav logic that checks for
Actions V2 Feature Flag

# Additional Context

- Part of #7248 
- Part of #9688

---------

Co-authored-by: Max Peintner <[email protected]>
Co-authored-by: Max Peintner <[email protected]>
2025-04-29 11:25:49 +00:00

79 lines
2.0 KiB
TypeScript

import { ChangeDetectionStrategy, Component, effect, EventEmitter, Input, Output, signal } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { PolicyComponentServiceType } from '../policies/policy-component-types.enum';
export interface SidenavSetting {
id: string;
i18nKey: string;
groupI18nKey?: string;
requiredRoles?: {
[PolicyComponentServiceType.MGMT]?: string[];
[PolicyComponentServiceType.ADMIN]?: string[];
};
showWarn?: boolean;
beta?: boolean;
}
@Component({
selector: 'cnsl-sidenav',
templateUrl: './sidenav.component.html',
styleUrls: ['./sidenav.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SidenavComponent {
@Input() public navigate: boolean = true;
@Input() public indented: boolean = false;
@Input({ required: true }) public settingsList: SidenavSetting[] = [];
@Input({ required: true })
public set setting(setting: SidenavSetting | null) {
if (!setting) {
return;
}
this.setting$.set(setting);
}
@Output()
public settingChange = new EventEmitter<SidenavSetting>();
protected readonly setting$ = signal<SidenavSetting | null>(null);
protected PolicyComponentServiceType = PolicyComponentServiceType;
constructor(
private readonly router: Router,
private readonly route: ActivatedRoute,
) {
effect(
() => {
const setting = this.setting$();
if (setting === null) {
return;
}
this.settingChange.emit(setting);
if (!this.navigate) {
return;
}
this.router
.navigate([], {
relativeTo: this.route,
queryParams: {
id: setting ? setting.id : undefined,
},
replaceUrl: true,
queryParamsHandling: 'merge',
skipLocationChange: false,
})
.then();
},
{ allowSignalWrites: true },
);
}
protected trackSettings(_: number, setting: SidenavSetting): string {
return setting.id;
}
}