|
|
|
@ -1,6 +1,15 @@ |
|
|
|
import { Component, OnDestroy, OnInit } from "@angular/core"; |
|
|
|
import { Component, OnDestroy, OnInit } from "@angular/core"; |
|
|
|
import { ActivatedRoute } from "@angular/router"; |
|
|
|
import { ActivatedRoute, Router } from "@angular/router"; |
|
|
|
import { combineLatest, filter, Observable, startWith, Subject, switchMap, takeUntil } from "rxjs"; |
|
|
|
import { |
|
|
|
|
|
|
|
catchError, |
|
|
|
|
|
|
|
combineLatest, |
|
|
|
|
|
|
|
filter, |
|
|
|
|
|
|
|
Observable, |
|
|
|
|
|
|
|
startWith, |
|
|
|
|
|
|
|
Subject, |
|
|
|
|
|
|
|
switchMap, |
|
|
|
|
|
|
|
takeUntil, |
|
|
|
|
|
|
|
} from "rxjs"; |
|
|
|
|
|
|
|
|
|
|
|
import { DialogService } from "@bitwarden/components"; |
|
|
|
import { DialogService } from "@bitwarden/components"; |
|
|
|
|
|
|
|
|
|
|
|
@ -27,7 +36,8 @@ export class ProjectComponent implements OnInit, OnDestroy { |
|
|
|
constructor( |
|
|
|
constructor( |
|
|
|
private route: ActivatedRoute, |
|
|
|
private route: ActivatedRoute, |
|
|
|
private projectService: ProjectService, |
|
|
|
private projectService: ProjectService, |
|
|
|
private dialogService: DialogService |
|
|
|
private dialogService: DialogService, |
|
|
|
|
|
|
|
private router: Router |
|
|
|
) {} |
|
|
|
) {} |
|
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
ngOnInit(): void { |
|
|
|
@ -40,7 +50,8 @@ export class ProjectComponent implements OnInit, OnDestroy { |
|
|
|
this.project$ = combineLatest([this.route.params, currentProjectEdited]).pipe( |
|
|
|
this.project$ = combineLatest([this.route.params, currentProjectEdited]).pipe( |
|
|
|
switchMap(([params, _]) => { |
|
|
|
switchMap(([params, _]) => { |
|
|
|
return this.projectService.getByProjectId(params.projectId); |
|
|
|
return this.projectService.getByProjectId(params.projectId); |
|
|
|
}) |
|
|
|
}), |
|
|
|
|
|
|
|
catchError(async () => this.handleError()) |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
this.route.params.pipe(takeUntil(this.destroy$)).subscribe((params) => { |
|
|
|
this.route.params.pipe(takeUntil(this.destroy$)).subscribe((params) => { |
|
|
|
@ -49,6 +60,12 @@ export class ProjectComponent implements OnInit, OnDestroy { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleError = () => { |
|
|
|
|
|
|
|
const projectsListUrl = `/sm/${this.organizationId}/projects/`; |
|
|
|
|
|
|
|
this.router.navigate([projectsListUrl]); |
|
|
|
|
|
|
|
return new ProjectPermissionDetailsView(); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
ngOnDestroy(): void { |
|
|
|
ngOnDestroy(): void { |
|
|
|
this.destroy$.next(); |
|
|
|
this.destroy$.next(); |
|
|
|
this.destroy$.complete(); |
|
|
|
this.destroy$.complete(); |
|
|
|
|