mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-28 06:58:54 +00:00
feat: rehauled console (#3525)
* new console * move npm ci to angular build * rel path for assets * local grpc copy * login policy, rm clear views, features rel path * lock Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
co-authored by
Livio Amstutz
parent
00f7dbe875
commit
08ae39ae19
@@ -4,14 +4,14 @@ import { RouterModule, Routes } from '@angular/router';
|
||||
import { GrantsComponent } from './grants.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: GrantsComponent,
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
component: GrantsComponent,
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class GrantsRoutingModule { }
|
||||
export class GrantsRoutingModule {}
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
<div class="enlarged-container">
|
||||
<div class="max-width-container">
|
||||
<div class="enlarged-container">
|
||||
<h1>{{ 'GRANTS.TITLE' | translate }}</h1>
|
||||
<p class="desc">{{'GRANTS.DESC' | translate }}</p>
|
||||
<cnsl-user-grants [displayedColumns]="['select', 'user', 'org', 'projectId', 'creationDate','changeDate', 'roleNamesList']"
|
||||
[disableWrite]="((['user.grant.write$'] | hasRole) | async) === false"
|
||||
[disableDelete]="((['user.grant.delete$'] | hasRole) | async) === false"
|
||||
[refreshOnPreviousRoutes]="['/grant-create']">
|
||||
<p class="desc cnsl-secondary-text">{{'GRANTS.DESC' | translate }}</p>
|
||||
<cnsl-user-grants *ngIf="grantContext === UserGrantContext.NONE"
|
||||
[displayedColumns]="['select', 'user', 'org', 'projectId','type', 'creationDate','changeDate', 'roleNamesList', 'actions']"
|
||||
[disableWrite]="((['user.grant.write$'] | hasRole) | async) === false"
|
||||
[disableDelete]="((['user.grant.delete$'] | hasRole) | async) === false"
|
||||
[refreshOnPreviousRoutes]="['/grant-create']">
|
||||
</cnsl-user-grants>
|
||||
|
||||
<cnsl-user-grants *ngIf="grantContext === UserGrantContext.OWNED_PROJECT" [context]="UserGrantContext.OWNED_PROJECT"
|
||||
[projectId]="projectId" [refreshOnPreviousRoutes]="['/grant-create/project/'+projectId]"
|
||||
[disableWrite]="((['user.grant.write$', 'user.grant.write:'+projectId] | hasRole) | async) === false"
|
||||
[disableDelete]="((['user.grant.delete$','user.grant.delete:'+projectId] | hasRole) | async) === false">
|
||||
</cnsl-user-grants>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3,7 +3,6 @@ h1 {
|
||||
}
|
||||
|
||||
.desc {
|
||||
color: var(--grey);
|
||||
margin-bottom: 2rem;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,83 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, OnDestroy } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Subject, takeUntil } from 'rxjs';
|
||||
import { UserGrantContext } from 'src/app/modules/user-grants/user-grants-datasource';
|
||||
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
|
||||
export enum GrantType {
|
||||
ORG = 'org',
|
||||
PROJECT = 'project',
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-grants',
|
||||
templateUrl: './grants.component.html',
|
||||
styleUrls: ['./grants.component.scss'],
|
||||
})
|
||||
export class GrantsComponent { }
|
||||
export class GrantsComponent implements OnDestroy {
|
||||
public grantContext: UserGrantContext = UserGrantContext.NONE;
|
||||
public projectId: string = '';
|
||||
public UserGrantContext: any = UserGrantContext;
|
||||
public isZitadel: boolean = false;
|
||||
public destroy$: Subject<void> = new Subject();
|
||||
|
||||
constructor(
|
||||
public translate: TranslateService,
|
||||
activatedRoute: ActivatedRoute,
|
||||
private mgmtService: ManagementService,
|
||||
private breadcrumbService: BreadcrumbService,
|
||||
) {
|
||||
activatedRoute.data.pipe(takeUntil(this.destroy$)).subscribe((params) => {
|
||||
const { context } = params;
|
||||
this.grantContext = context;
|
||||
if (context === UserGrantContext.OWNED_PROJECT) {
|
||||
const projectId = activatedRoute.snapshot.paramMap.get('projectid');
|
||||
if (projectId) {
|
||||
this.projectId = projectId;
|
||||
|
||||
this.mgmtService.getIAM().then((iam) => {
|
||||
this.isZitadel = iam.iamProjectId === this.projectId;
|
||||
|
||||
const breadcrumbs = [
|
||||
new Breadcrumb({
|
||||
type: BreadcrumbType.IAM,
|
||||
name: 'IAM',
|
||||
routerLink: ['/system'],
|
||||
}),
|
||||
new Breadcrumb({
|
||||
type: BreadcrumbType.ORG,
|
||||
routerLink: ['/org'],
|
||||
}),
|
||||
new Breadcrumb({
|
||||
type: BreadcrumbType.PROJECT,
|
||||
name: '',
|
||||
param: { key: 'projectid', value: this.projectId },
|
||||
routerLink: ['/projects', this.projectId],
|
||||
isZitadel: this.isZitadel,
|
||||
}),
|
||||
];
|
||||
this.breadcrumbService.setBreadcrumb(breadcrumbs);
|
||||
});
|
||||
}
|
||||
} else if (context === UserGrantContext.NONE) {
|
||||
const iambread = new Breadcrumb({
|
||||
type: BreadcrumbType.IAM,
|
||||
name: 'IAM',
|
||||
routerLink: ['/system'],
|
||||
});
|
||||
const bread: Breadcrumb = {
|
||||
type: BreadcrumbType.ORG,
|
||||
routerLink: ['/org'],
|
||||
};
|
||||
breadcrumbService.setBreadcrumb([iambread, bread]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public ngOnDestroy(): void {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user