mirror of
https://github.com/bitwarden/web
synced 2025-12-11 13:53:17 +00:00
Compare commits
1 Commits
bug/ps-136
...
feature/ex
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7fb394d28 |
@@ -17,8 +17,8 @@
|
|||||||
<li class="nav-item" routerLinkActive="active">
|
<li class="nav-item" routerLinkActive="active">
|
||||||
<a class="nav-link" routerLink="/reports">{{ "reports" | i18n }}</a>
|
<a class="nav-link" routerLink="/reports">{{ "reports" | i18n }}</a>
|
||||||
</li>
|
</li>
|
||||||
<li *ngIf="organizations.length >= 1" class="nav-item" routerLinkActive="active">
|
<li *ngIf="(organizations$ | async).length >= 1" class="nav-item" routerLinkActive="active">
|
||||||
<a class="nav-link" [routerLink]="['/organizations', organizations[0].id]">{{
|
<a class="nav-link" [routerLink]="['/organizations', (organizations$ | async)[0].id]">{{
|
||||||
"organizations" | i18n
|
"organizations" | i18n
|
||||||
}}</a>
|
}}</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component, NgZone, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
|
import { Observable, map } from "rxjs";
|
||||||
|
|
||||||
import { BroadcasterService } from "jslib-common/abstractions/broadcaster.service";
|
|
||||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
||||||
import { OrganizationService } from "jslib-common/abstractions/organization.service";
|
import { OrganizationService } from "jslib-common/abstractions/organization.service";
|
||||||
@@ -23,7 +23,7 @@ export class NavbarComponent implements OnInit {
|
|||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
providers: Provider[] = [];
|
providers: Provider[] = [];
|
||||||
organizations: Organization[] = [];
|
organizations$ = new Observable<Organization[]>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private messagingService: MessagingService,
|
private messagingService: MessagingService,
|
||||||
@@ -32,9 +32,7 @@ export class NavbarComponent implements OnInit {
|
|||||||
private providerService: ProviderService,
|
private providerService: ProviderService,
|
||||||
private syncService: SyncService,
|
private syncService: SyncService,
|
||||||
private organizationService: OrganizationService,
|
private organizationService: OrganizationService,
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService
|
||||||
private broadcasterService: BroadcasterService,
|
|
||||||
private ngZone: NgZone
|
|
||||||
) {
|
) {
|
||||||
this.selfHosted = this.platformUtilsService.isSelfHost();
|
this.selfHosted = this.platformUtilsService.isSelfHost();
|
||||||
}
|
}
|
||||||
@@ -52,26 +50,17 @@ export class NavbarComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
this.providers = await this.providerService.getAll();
|
this.providers = await this.providerService.getAll();
|
||||||
|
|
||||||
this.organizations = await this.buildOrganizations();
|
this.organizations$ = await this.buildOrganizations();
|
||||||
|
|
||||||
this.broadcasterService.subscribe(this.constructor.name, async (message: any) => {
|
|
||||||
this.ngZone.run(async () => {
|
|
||||||
switch (message.command) {
|
|
||||||
case "organizationCreated":
|
|
||||||
if (this.organizations.length < 1) {
|
|
||||||
this.organizations = await this.buildOrganizations();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async buildOrganizations() {
|
async buildOrganizations() {
|
||||||
const allOrgs = await this.organizationService.getAll();
|
return this.organizations$.pipe(
|
||||||
return allOrgs
|
map((orgs) => {
|
||||||
.filter((org) => OrgNavigationPermissionsService.canAccessAdmin(org))
|
return orgs
|
||||||
.sort(Utils.getSortFunction(this.i18nService, "name"));
|
.filter((org) => OrgNavigationPermissionsService.canAccessAdmin(org))
|
||||||
|
.sort(Utils.getSortFunction(this.i18nService, "name"));
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
lock() {
|
lock() {
|
||||||
|
|||||||
@@ -300,7 +300,6 @@ export class OrganizationPlansComponent implements OnInit {
|
|||||||
this.formPromise = doSubmit();
|
this.formPromise = doSubmit();
|
||||||
const organizationId = await this.formPromise;
|
const organizationId = await this.formPromise;
|
||||||
this.onSuccess.emit({ organizationId: organizationId });
|
this.onSuccess.emit({ organizationId: organizationId });
|
||||||
this.messagingService.send("organizationCreated", organizationId);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error(e);
|
this.logService.error(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user