2022-04-28 12:35:02 +02:00
|
|
|
import { ConnectedPosition, ConnectionPositionPair } from '@angular/cdk/overlay';
|
|
|
|
import { Component, ElementRef, EventEmitter, Input, OnDestroy, Output, ViewChild } from '@angular/core';
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
import { BehaviorSubject, Observable, of, Subject } from 'rxjs';
|
|
|
|
import { Org } from 'src/app/proto/generated/zitadel/org_pb';
|
|
|
|
import { LabelPolicy } from 'src/app/proto/generated/zitadel/policy_pb';
|
|
|
|
import { User } from 'src/app/proto/generated/zitadel/user_pb';
|
|
|
|
import { AuthenticationService } from 'src/app/services/authentication.service';
|
|
|
|
import { BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
|
|
|
|
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
|
|
|
import { ManagementService } from 'src/app/services/mgmt.service';
|
|
|
|
|
|
|
|
import { ActionKeysType } from '../action-keys/action-keys.component';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'cnsl-header',
|
|
|
|
templateUrl: './header.component.html',
|
|
|
|
styleUrls: ['./header.component.scss'],
|
|
|
|
})
|
|
|
|
export class HeaderComponent implements OnDestroy {
|
|
|
|
@ViewChild('input', { static: false }) input!: ElementRef;
|
|
|
|
|
|
|
|
@Input() public isDarkTheme: boolean = true;
|
|
|
|
@Input() public user!: User.AsObject;
|
|
|
|
@Input() public labelpolicy!: LabelPolicy.AsObject;
|
|
|
|
public showOrgContext: boolean = false;
|
|
|
|
|
|
|
|
public orgs$: Observable<Org.AsObject[]> = of([]);
|
|
|
|
@Input() public org!: Org.AsObject;
|
|
|
|
@Output() public changedActiveOrg: EventEmitter<Org.AsObject> = new EventEmitter();
|
|
|
|
public orgLoading$: BehaviorSubject<any> = new BehaviorSubject(false);
|
|
|
|
public showAccount: boolean = false;
|
|
|
|
private destroy$: Subject<void> = new Subject();
|
|
|
|
public BreadcrumbType: any = BreadcrumbType;
|
|
|
|
public ActionKeysType: any = ActionKeysType;
|
|
|
|
|
|
|
|
public positions: ConnectedPosition[] = [
|
|
|
|
new ConnectionPositionPair({ originX: 'start', originY: 'bottom' }, { overlayX: 'start', overlayY: 'top' }, 0, 10),
|
|
|
|
new ConnectionPositionPair({ originX: 'end', originY: 'bottom' }, { overlayX: 'end', overlayY: 'top' }, 0, 10),
|
|
|
|
];
|
|
|
|
constructor(
|
|
|
|
public authenticationService: AuthenticationService,
|
|
|
|
private authService: GrpcAuthService,
|
|
|
|
public mgmtService: ManagementService,
|
|
|
|
public breadcrumbService: BreadcrumbService,
|
|
|
|
public router: Router,
|
|
|
|
) {}
|
|
|
|
|
|
|
|
public ngOnDestroy() {
|
|
|
|
this.destroy$.next();
|
|
|
|
this.destroy$.complete();
|
|
|
|
}
|
|
|
|
|
|
|
|
public closeAccountCard(): void {
|
|
|
|
if (this.showAccount) {
|
|
|
|
this.showAccount = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public setActiveOrg(org: Org.AsObject): void {
|
|
|
|
this.org = org;
|
|
|
|
this.authService.setActiveOrg(org);
|
|
|
|
this.changedActiveOrg.emit(org);
|
|
|
|
}
|
|
|
|
|
|
|
|
public get isOnMe(): boolean {
|
|
|
|
return this.router.url === '/users/me';
|
|
|
|
}
|
feat: console flat navigation, settings (#3581)
* instance routing
* instance naming
* org list
* rm isonsystem
* breadcrumb type
* routing
* instance members
* fragment refresh org
* settings pages
* settings list, sidenav grouping, i18n
* org-settings, policy changes
* lint
* grid
* rename grid
* fallback to general
* cleanup
* general settings, remove cards
* sidenav for settings, label policy
* i18n
* header, nav backbuild
* general, project nav rehaul
* login text background adapt
* org nav anim
* org, instance settings, fix policy layout, roles
* i18n, active route for project
* lint
2022-05-09 15:01:36 +02:00
|
|
|
|
|
|
|
public get isOnInstance(): boolean {
|
|
|
|
return (
|
|
|
|
['/instance', '/views', '/orgs', '/settings', '/failed-events', '/instance/members'].includes(this.router.url) ||
|
|
|
|
this.router.url.includes('/settings')
|
|
|
|
);
|
|
|
|
}
|
2022-04-28 12:35:02 +02:00
|
|
|
}
|