feat(console): user grant filtering, org domain verification improvements, fix membership detail link (#916)

* user grant filter

* add filter input

* org domain spinner and reload

* user grant filter templates

* single selection filter for grants, same dl btn

* filter margin

* lint style, remove duplicate code

* project count as observable

* deferred reload on delete

* fix user grant formfield

* lint styles

* fix event propagation on pin, change selection

* propagate counter change

* admin warn, localstorage, i18n, sidenav impv

* overlays

* adapt toolbar elevationn, card

* color vars, i18n, admin section

* fix lint

* selection clear on filter

* ts lint

* Update console/src/assets/i18n/de.json

Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>

* Update console/src/assets/i18n/de.json

Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>

* Update console/src/assets/i18n/en.json

Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>

Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>
This commit is contained in:
Max Peintner
2020-11-13 09:59:11 +01:00
committed by GitHub
parent 966e3850ed
commit 42effd8702
49 changed files with 599 additions and 227 deletions

View File

@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { Empty } from 'google-protobuf/google/protobuf/empty_pb';
import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
import { BehaviorSubject } from 'rxjs';
import {
AddMachineKeyRequest,
@@ -160,6 +161,9 @@ export type ResponseMapper<TResp, TMappedResp> = (resp: TResp) => TMappedResp;
providedIn: 'root',
})
export class ManagementService {
public ownedProjectsCount: BehaviorSubject<number> = new BehaviorSubject(0);
public grantedProjectsCount: BehaviorSubject<number> = new BehaviorSubject(0);
constructor(private readonly grpcService: GrpcService) { }
public SearchIdps(
@@ -393,11 +397,9 @@ export class ManagementService {
return this.grpcService.mgmt.removeMyOrgDomain(req);
}
public SearchMyOrgDomains(offset: number, limit: number, queryList?: OrgDomainSearchQuery[]):
public SearchMyOrgDomains(queryList?: OrgDomainSearchQuery[]):
Promise<OrgDomainSearchResponse> {
const req: OrgDomainSearchRequest = new OrgDomainSearchRequest();
req.setLimit(limit);
req.setOffset(offset);
if (queryList) {
req.setQueriesList(queryList);
}
@@ -834,13 +836,17 @@ export class ManagementService {
// USER GRANTS
public SearchUserGrants(
limit: number,
offset: number,
limit?: number,
offset?: number,
queryList?: UserGrantSearchQuery[],
): Promise<UserGrantSearchResponse> {
const req = new UserGrantSearchRequest();
req.setLimit(limit);
req.setOffset(offset);
if (limit) {
req.setLimit(limit);
}
if (offset) {
req.setOffset(offset);
}
if (queryList) {
req.setQueriesList(queryList);
}
@@ -929,14 +935,26 @@ export class ManagementService {
// project
public SearchProjects(
limit: number, offset: number, queryList?: ProjectSearchQuery[]): Promise<ProjectSearchResponse> {
limit?: number, offset?: number, queryList?: ProjectSearchQuery[]): Promise<ProjectSearchResponse> {
const req = new ProjectSearchRequest();
req.setLimit(limit);
req.setOffset(offset);
if (limit) {
req.setLimit(limit);
}
if (offset) {
req.setOffset(offset);
}
if (queryList) {
req.setQueriesList(queryList);
}
return this.grpcService.mgmt.searchProjects(req);
return this.grpcService.mgmt.searchProjects(req).then(value => {
const count = value.toObject().resultList.length;
if (count >= 0) {
this.ownedProjectsCount.next(count);
}
return value;
});
}
public SearchGrantedProjects(
@@ -947,10 +965,12 @@ export class ManagementService {
if (queryList) {
req.setQueriesList(queryList);
}
return this.grpcService.mgmt.searchGrantedProjects(req);
return this.grpcService.mgmt.searchGrantedProjects(req).then(value => {
this.grantedProjectsCount.next(value.toObject().resultList.length);
return value;
});
}
public GetZitadelDocs(): Promise<ZitadelDocs> {
const req = new Empty();
return this.grpcService.mgmt.getZitadelDocs(req);
@@ -972,7 +992,11 @@ export class ManagementService {
public CreateProject(project: ProjectCreateRequest.AsObject): Promise<Project> {
const req = new ProjectCreateRequest();
req.setName(project.name);
return this.grpcService.mgmt.createProject(req);
return this.grpcService.mgmt.createProject(req).then(value => {
const current = this.ownedProjectsCount.getValue();
this.ownedProjectsCount.next(current + 1);
return value;
});
}
public UpdateProject(id: string, projectView: ProjectView.AsObject): Promise<Project> {
@@ -1221,7 +1245,11 @@ export class ManagementService {
public RemoveProject(id: string): Promise<Empty> {
const req = new ProjectID();
req.setId(id);
return this.grpcService.mgmt.removeProject(req);
return this.grpcService.mgmt.removeProject(req).then(value => {
const current = this.ownedProjectsCount.getValue();
this.ownedProjectsCount.next(current > 0 ? current - 1 : 0);
return value;
});
}