feat(console): grpc web interceptors, cleanup services (#631)

* managementservice, authservice, change all refs

* refactor grpc auth

* fix references

* interceptor logic

* new interceptor

* appinitializers, environment loader, interceptors

* remove circular dep

* init authconfig in grpc service

* authconfig

* lint

* update mgmt service

* fix references

* update clientid, fix interceptor

* rm unused authconfig

* todo auth interceptor
This commit is contained in:
Max Peintner
2020-08-29 10:43:35 +02:00
committed by GitHub
parent 40b8faaddd
commit eeea1f1c4b
81 changed files with 1877 additions and 2639 deletions
@@ -1,7 +1,7 @@
import { Component, Inject, OnInit } from '@angular/core';
import { AbstractControl, FormControl, FormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { ProjectService } from 'src/app/services/project.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
@Component({
@@ -13,7 +13,7 @@ export class ProjectRoleDetailComponent implements OnInit {
public projectId: string = '';
public formGroup!: FormGroup;
constructor(private projectService: ProjectService, private toast: ToastService,
constructor(private mgmtService: ManagementService, private toast: ToastService,
public dialogRef: MatDialogRef<ProjectRoleDetailComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) {
@@ -32,7 +32,7 @@ export class ProjectRoleDetailComponent implements OnInit {
submitForm(): void {
if (this.formGroup.valid && this.key?.value && this.group?.value && this.displayName?.value) {
this.projectService.ChangeProjectRole(this.projectId, this.key.value, this.key.value, this.group.value)
this.mgmtService.ChangeProjectRole(this.projectId, this.key.value, this.key.value, this.group.value)
.then(() => {
this.toast.showInfo('PROJECT.TOAST.ROLECHANGED', true);
this.dialogRef.close(true);
@@ -3,7 +3,7 @@ import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
import { BehaviorSubject, from, Observable, of } from 'rxjs';
import { catchError, finalize, map } from 'rxjs/operators';
import { ProjectRole } from 'src/app/proto/generated/management_pb';
import { ProjectService } from 'src/app/services/project.service';
import { ManagementService } from 'src/app/services/mgmt.service';
/**
* Data source for the ProjectMembers view. This class should
@@ -18,7 +18,7 @@ export class ProjectRolesDataSource extends DataSource<ProjectRole.AsObject> {
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
constructor(private projectService: ProjectService) {
constructor(private mgmtService: ManagementService) {
super();
}
@@ -26,7 +26,7 @@ export class ProjectRolesDataSource extends DataSource<ProjectRole.AsObject> {
const offset = pageIndex * pageSize;
this.loadingSubject.next(true);
from(this.projectService.SearchProjectRoles(projectId, pageSize, offset)).pipe(
from(this.mgmtService.SearchProjectRoles(projectId, pageSize, offset)).pipe(
map(resp => {
const response = resp.toObject();
this.totalResult = response.totalResult;
@@ -5,7 +5,7 @@ import { MatPaginator } from '@angular/material/paginator';
import { MatTable } from '@angular/material/table';
import { tap } from 'rxjs/operators';
import { ProjectRole } from 'src/app/proto/generated/management_pb';
import { ProjectService } from 'src/app/services/project.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { ProjectRoleDetailComponent } from './project-role-detail/project-role-detail.component';
@@ -30,8 +30,8 @@ export class ProjectRolesComponent implements AfterViewInit, OnInit {
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
public displayedColumns: string[] = ['select', 'key', 'displayname', 'group', 'creationDate'];
constructor(private projectService: ProjectService, private toast: ToastService, private dialog: MatDialog) {
this.dataSource = new ProjectRolesDataSource(this.projectService);
constructor(private mgmtService: ManagementService, private toast: ToastService, private dialog: MatDialog) {
this.dataSource = new ProjectRolesDataSource(this.mgmtService);
}
public ngOnInit(): void {
@@ -83,7 +83,7 @@ export class ProjectRolesComponent implements AfterViewInit, OnInit {
});
return Promise.all(this.selection.selected.map(role => {
return this.projectService.RemoveProjectRole(role.projectId, role.key);
return this.mgmtService.RemoveProjectRole(role.projectId, role.key);
})).then(() => {
this.toast.showInfo('PROJECT.TOAST.ROLEREMOVED', true);
indexes.forEach(index => {
@@ -99,7 +99,7 @@ export class ProjectRolesComponent implements AfterViewInit, OnInit {
}
public removeRole(role: ProjectRole.AsObject, index: number): void {
this.projectService
this.mgmtService
.RemoveProjectRole(role.projectId, role.key)
.then(() => {
this.toast.showInfo('PROJECT.TOAST.ROLEREMOVED', true);