mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-04 05:12:16 +00:00
* instance routing * instance naming * org list * rm isonsystem * breadcrumb type * routing * instance members * fragment refresh org * settings pages * settings list, sidenav grouping, i18n * org-settings, policy changes * lint * grid * rename grid * fallback to general * cleanup * general settings, remove cards * sidenav for settings, label policy * i18n * header, nav backbuild * general, project nav rehaul * login text background adapt * org nav anim * org, instance settings, fix policy layout, roles * i18n, active route for project * lint
61 lines
2.0 KiB
TypeScript
61 lines
2.0 KiB
TypeScript
import { Component } from '@angular/core';
|
|
import { ActivatedRoute, Params, Router } from '@angular/router';
|
|
import { BehaviorSubject, take } from 'rxjs';
|
|
import { ProjectType } from 'src/app/modules/project-members/project-members-datasource';
|
|
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
|
|
import { ManagementService } from 'src/app/services/mgmt.service';
|
|
|
|
@Component({
|
|
selector: 'cnsl-projects',
|
|
templateUrl: './projects.component.html',
|
|
styleUrls: ['./projects.component.scss'],
|
|
})
|
|
export class ProjectsComponent {
|
|
public zitadelProjectId: string = '';
|
|
public projectType$: BehaviorSubject<any> = new BehaviorSubject(ProjectType.PROJECTTYPE_OWNED);
|
|
public ProjectType: any = ProjectType;
|
|
public grid: boolean = true;
|
|
constructor(
|
|
private route: ActivatedRoute,
|
|
private router: Router,
|
|
private activatedRoute: ActivatedRoute,
|
|
public mgmtService: ManagementService,
|
|
breadcrumbService: BreadcrumbService,
|
|
) {
|
|
this.activatedRoute.queryParams.pipe(take(1)).subscribe((params: Params) => {
|
|
const type = params.type;
|
|
if (type && type === 'owned') {
|
|
this.setType(ProjectType.PROJECTTYPE_OWNED);
|
|
} else if (type && type === 'granted') {
|
|
this.setType(ProjectType.PROJECTTYPE_GRANTED);
|
|
}
|
|
});
|
|
mgmtService.getIAM().then((iam) => {
|
|
this.zitadelProjectId = iam.iamProjectId;
|
|
});
|
|
|
|
const bread: Breadcrumb = {
|
|
type: BreadcrumbType.ORG,
|
|
routerLink: ['/org'],
|
|
};
|
|
breadcrumbService.setBreadcrumb([bread]);
|
|
}
|
|
|
|
public addProject(): void {
|
|
this.router.navigate(['/projects', 'create']);
|
|
}
|
|
|
|
public setType(type: ProjectType) {
|
|
this.projectType$.next(type);
|
|
this.router.navigate([], {
|
|
relativeTo: this.route,
|
|
queryParams: {
|
|
type:
|
|
type === ProjectType.PROJECTTYPE_OWNED ? 'owned' : type === ProjectType.PROJECTTYPE_GRANTED ? 'granted' : 'owned',
|
|
},
|
|
queryParamsHandling: 'merge',
|
|
skipLocationChange: false,
|
|
});
|
|
}
|
|
}
|