mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
* [PM-15506] Wire up vNextOrganizationService for libs/common and libs/angular (#12683) * Wire up vNextOrganizationService in PolicyService * Wire vNextOrganizationService in SyncService * wire vNextOrganizationService for EventCollectionService * wire vNextOrganizationService for KeyConnectorService * wire up vNextOrganizationService for CipherAuthorizationService * Wire up vNextOrganizationService in PolicyService * Wire vNextOrganizationService in SyncService * wire vNextOrganizationService for EventCollectionService * wire vNextOrganizationService for KeyConnectorService * wire up vNextOrganizationService for CipherAuthorizationService * wire vNextOrganizationService for share.component * wire vNextOrganizationService for collections.component * wire vNextOrganizationServcie for add-account-credit-dialog * wire vNextOrganizationService for vault-filter.service * fix browser errors for vNextOrganizationService implementation in libs * fix desktop errors for vNextOrganizationService implementation for libs * fix linter errors * fix CLI errors on vNextOrganizationServcie implementations for libs * [PM-15506] Wire up vNextOrganizationService for web client (#12810) PR to a feature branch, no need to review until this goes to main. * implement vNextOrganization service for browser client (#12844) PR to feature branch, no need for review yet. * wire vNextOrganizationService for licence and some web router guards * wire vNextOrganizationService in tests * remove vNext notation for OrganizationService and related * Merge branch 'main' into ac/pm-15506-vNextOrganizationService * fix tsstrict error * fix test, fix ts strict error
98 lines
2.9 KiB
TypeScript
98 lines
2.9 KiB
TypeScript
// FIXME: Update this file to be type safe and remove this and next line
|
|
// @ts-strict-ignore
|
|
import { Component, OnDestroy, OnInit } from "@angular/core";
|
|
import { ActivatedRoute } from "@angular/router";
|
|
import { Subject, takeUntil, concatMap, firstValueFrom } from "rxjs";
|
|
|
|
import {
|
|
getOrganizationById,
|
|
OrganizationService,
|
|
} from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
|
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
|
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
|
import { DialogService } from "@bitwarden/components";
|
|
|
|
import {
|
|
ProjectDialogComponent,
|
|
ProjectOperation,
|
|
} from "../projects/dialog/project-dialog.component";
|
|
import {
|
|
OperationType,
|
|
SecretDialogComponent,
|
|
SecretOperation,
|
|
} from "../secrets/dialog/secret-dialog.component";
|
|
import {
|
|
ServiceAccountDialogComponent,
|
|
ServiceAccountOperation,
|
|
} from "../service-accounts/dialog/service-account-dialog.component";
|
|
|
|
@Component({
|
|
selector: "sm-new-menu",
|
|
templateUrl: "./new-menu.component.html",
|
|
})
|
|
export class NewMenuComponent implements OnInit, OnDestroy {
|
|
private organizationId: string;
|
|
private organizationEnabled: boolean;
|
|
private destroy$: Subject<void> = new Subject<void>();
|
|
constructor(
|
|
private route: ActivatedRoute,
|
|
private dialogService: DialogService,
|
|
private organizationService: OrganizationService,
|
|
private accountService: AccountService,
|
|
) {}
|
|
|
|
ngOnInit() {
|
|
this.route.params
|
|
.pipe(
|
|
concatMap(async (params) => {
|
|
const userId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
|
|
return await firstValueFrom(
|
|
this.organizationService
|
|
.organizations$(userId)
|
|
.pipe(getOrganizationById(params.organizationId)),
|
|
);
|
|
}),
|
|
takeUntil(this.destroy$),
|
|
)
|
|
.subscribe((org) => {
|
|
this.organizationId = org.id;
|
|
this.organizationEnabled = org.enabled;
|
|
});
|
|
}
|
|
|
|
ngOnDestroy(): void {
|
|
this.destroy$.next();
|
|
this.destroy$.complete();
|
|
}
|
|
|
|
openSecretDialog() {
|
|
this.dialogService.open<unknown, SecretOperation>(SecretDialogComponent, {
|
|
data: {
|
|
organizationId: this.organizationId,
|
|
operation: OperationType.Add,
|
|
organizationEnabled: this.organizationEnabled,
|
|
},
|
|
});
|
|
}
|
|
|
|
openProjectDialog() {
|
|
this.dialogService.open<unknown, ProjectOperation>(ProjectDialogComponent, {
|
|
data: {
|
|
organizationId: this.organizationId,
|
|
operation: OperationType.Add,
|
|
organizationEnabled: this.organizationEnabled,
|
|
},
|
|
});
|
|
}
|
|
|
|
openServiceAccountDialog() {
|
|
this.dialogService.open<unknown, ServiceAccountOperation>(ServiceAccountDialogComponent, {
|
|
data: {
|
|
organizationId: this.organizationId,
|
|
operation: OperationType.Add,
|
|
organizationEnabled: this.organizationEnabled,
|
|
},
|
|
});
|
|
}
|
|
}
|