fix(console): project member grants, user grants (#329)

* checkbox color

* project grant preview

* project grante expandable row

* add grant detail component

* proto regen

* project grant members shared module

* fix project grant members dialog

* fix create dialog

* lint

* add avatar colors, meta component styling

* light theme

* dl report

* styles

* move grants out of user context, grant detail

* i18n grant pipe

* lint

* user grants

* clear expandable view project grants

* fix project member routing

* fix granted members routing

* fix group label

* rename project grant

* disable zitadel grant members

* fix routing user grant creation

* rest member writes

* ignore case searches

* forkjoin observables for project search

* fix grant creation with users

* fix projectid reference

* formfield table style, user grant dynamic load

* show key if no displayvalue is set

* Delete report.20200630.163913.44081.0.001.json

Co-authored-by: Silvan <[email protected]>
This commit is contained in:
Max Peintner
2020-07-01 17:48:34 +02:00
committed by GitHub
co-authored by Silvan
parent c5a4eb3555
commit 9c07711aab
135 changed files with 1470 additions and 678 deletions
@@ -3,28 +3,33 @@
<button (click)="close()" mat-icon-button>
<mat-icon>close</mat-icon>
</button>
<span class="abort">{{ 'USER.GRANTS.CREATE.TITLE' | translate }}</span><span class="abort-2">Step
<span class="abort">{{ 'GRANTS.CREATE.TITLE' | translate }}</span><span class="abort-2">Step
{{ currentCreateStep }} of
{{ STEPS }}</span>
</div>
<ng-container *ngIf="currentCreateStep === 1">
<h1>{{'PROJECT.GRANT.CREATE.ORG_TITLE' | translate}}</h1>
<p class="desc">
{{'PROJECT.GRANT.CREATE.ORG_DESCRIPTION' | translate: org}}
<br>
{{'PROJECT.GRANT.CREATE.ORG_DESCRIPTION_DESC' | translate}}
</p>
<p class="desc">{{'PROJECT.GRANT.CREATE.ORG_DESCRIPTION' | translate: org}}</p>
<p class="org" *ngIf="org">{{org?.name}}</p>
<ng-container *ngIf="filter && filter == UserGrantSearchKey.USERGRANTSEARCHKEY_USER_ID">
<h1>{{'PROJECT.GRANT.CREATE.SEL_PROJECT' | translate}}</h1>
<p class="desc">{{'PROJECT.GRANT.CREATE.ORG_DESCRIPTION_DESC' | translate}}</p>
<!-- <app-search-org-autocomplete class="block" singleOutput="true" (selectionChanged)="selectOrg($event)">
</app-search-org-autocomplete> -->
</ng-container>
<app-search-project-autocomplete class="block" singleOutput="true"
(selectionChanged)="selectProject($event)">
</app-search-project-autocomplete>
</ng-container>
<ng-container *ngIf="currentCreateStep === 2">
<h1>{{'PROJECT.GRANT.CREATE.SEL_PROJECT' | translate}}</h1>
<ng-container *ngIf="filter && filter == UserGrantSearchKey.USERGRANTSEARCHKEY_PROJECT_ID">
<h1>{{'PROJECT.GRANT.CREATE.SEL_PROJECT' | translate}}</h1>
<app-search-project-autocomplete class="block" singleOutput="true" (selectionChanged)="selectProject($event)">
</app-search-project-autocomplete>
<app-search-user-autocomplete class="block" singleOutput="true" (selectionChanged)="selectUser($event)">
</app-search-user-autocomplete>
</ng-container>
</ng-container>
<ng-container *ngIf="currentCreateStep === STEPS">
@@ -37,24 +42,13 @@
<div class="btn-container">
<ng-container *ngIf="currentCreateStep === 1">
<!-- <span></span> -->
<button [disabled]="!org || !userId" (click)="next()" color="primary" mat-raised-button class="big-button"
cdkFocusInitial>
<button
[disabled]="!org || (filter == UserGrantSearchKey.USERGRANTSEARCHKEY_PROJECT_ID && !projectId) || (filter == UserGrantSearchKey.USERGRANTSEARCHKEY_USER_ID && !userId)"
(click)="next()" color="primary" mat-raised-button class="big-button" cdkFocusInitial>
{{ 'ACTIONS.CONTINUE' | translate }}
</button>
</ng-container>
<ng-container *ngIf="currentCreateStep === 2">
<button (click)="previous()" color="primary" mat-button class="small-button" cdkFocusInitial>
{{ 'ACTIONS.BACK' | translate }}
</button>
<button [disabled]="!org || !userId" (click)="next()" color="primary" mat-raised-button class="big-button"
cdkFocusInitial>
{{ 'ACTIONS.CONTINUE' | translate }}
</button>
</ng-container>
<ng-container *ngIf="currentCreateStep === STEPS">
<button (click)="previous()" color="primary" mat-button class="small-button" cdkFocusInitial>
{{ 'ACTIONS.BACK' | translate }}
@@ -19,12 +19,7 @@
}
.desc {
color: #81868a;
}
.org {
padding: 1rem 0;
font-size: 1.2rem;
color: #8795a1;
}
}
@@ -3,7 +3,14 @@ import { Component, OnDestroy } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { Subscription } from 'rxjs';
import { Org } from 'src/app/proto/generated/auth_pb';
import { ProjectGrantView, ProjectRole, ProjectView, UserGrant } from 'src/app/proto/generated/management_pb';
import {
ProjectGrantView,
ProjectRole,
ProjectView,
User,
UserGrant,
UserGrantSearchKey,
} from 'src/app/proto/generated/management_pb';
import { AuthService } from 'src/app/services/auth.service';
import { MgmtUserService } from 'src/app/services/mgmt-user.service';
import { ToastService } from 'src/app/services/toast.service';
@@ -20,10 +27,15 @@ export class UserGrantCreateComponent implements OnDestroy {
public grantId: string = '';
public rolesList: string[] = [];
public STEPS: number = 3; // org, project, roles
public STEPS: number = 2; // project, roles
public currentCreateStep: number = 1;
public filter!: UserGrantSearchKey;
public filterValue: string = '';
private subscription: Subscription = new Subscription();
public UserGrantSearchKey: any = UserGrantSearchKey;
constructor(
private authService: AuthService,
private userService: MgmtUserService,
@@ -31,8 +43,20 @@ export class UserGrantCreateComponent implements OnDestroy {
private _location: Location,
private route: ActivatedRoute,
) {
this.subscription = this.route.params.subscribe(({ id }: Params) => {
this.userId = id;
this.subscription = this.route.params.subscribe((params: Params) => {
console.log(params);
const { filter, filterValue } = params;
this.filter = filter;
switch (filter) {
case (`${UserGrantSearchKey.USERGRANTSEARCHKEY_PROJECT_ID}`):
this.projectId = filterValue;
break;
case (`${UserGrantSearchKey.USERGRANTSEARCHKEY_USER_ID}`):
this.userId = filterValue;
break;
}
console.log(this.projectId, this.userId);
});
this.authService.GetActiveOrg().then(org => {
@@ -57,7 +81,13 @@ export class UserGrantCreateComponent implements OnDestroy {
}
public selectProject(project: ProjectView.AsObject | ProjectGrantView.AsObject | any): void {
this.projectId = project.id ? project.id : project.projectId ? project.projectId : undefined;
console.log(project);
this.projectId = project.projectId;
}
public selectUser(user: User.AsObject): void {
console.log(user);
this.userId = user.id;
}
public selectRoles(roles: ProjectRole.AsObject[]): void {
@@ -7,6 +7,7 @@ import { CardModule } from 'src/app/modules/card/card.module';
import {
SearchProjectAutocompleteModule,
} from 'src/app/modules/search-project-autocomplete/search-project-autocomplete.module';
import { SearchUserAutocompleteModule } from 'src/app/modules/search-user-autocomplete/search-user-autocomplete.module';
import { ProjectRolesModule } from '../../modules/project-roles/project-roles.module';
import { UserGrantCreateRoutingModule } from './user-grant-create-routing.module';
@@ -24,6 +25,7 @@ import { UserGrantCreateComponent } from './user-grant-create.component';
TranslateModule,
CardModule,
SearchProjectAutocompleteModule,
SearchUserAutocompleteModule,
ProjectRolesModule,
],
schemas: [