add route and params to link (#6103)
This commit is contained in:
parent
e8a5c5b337
commit
6eb57ff312
|
@ -2,7 +2,9 @@
|
|||
<bit-menu #environmentOptions>
|
||||
<a
|
||||
bitMenuItem
|
||||
[attr.href]="isUsServer ? 'javascript:void(0)' : 'https://vault.bitwarden.com'"
|
||||
[attr.href]="
|
||||
isUsServer ? 'javascript:void(0)' : 'https://vault.bitwarden.com' + routeAndParams
|
||||
"
|
||||
class="pr-4"
|
||||
>
|
||||
<i
|
||||
|
@ -19,7 +21,9 @@
|
|||
</a>
|
||||
<a
|
||||
bitMenuItem
|
||||
[attr.href]="isEuServer ? 'javascript:void(0)' : 'https://vault.bitwarden.eu'"
|
||||
[attr.href]="
|
||||
isEuServer ? 'javascript:void(0)' : 'https://vault.bitwarden.eu' + routeAndParams
|
||||
"
|
||||
class="pr-4"
|
||||
*ngIf="euServerFlagEnabled"
|
||||
>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Component, Input, OnInit } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { ConfigServiceAbstraction } from "@bitwarden/common/platform/abstractions/config/config.service.abstraction";
|
||||
|
@ -13,14 +14,17 @@ import { Utils } from "@bitwarden/common/platform/misc/utils";
|
|||
export class EnvironmentSelectorComponent implements OnInit {
|
||||
constructor(
|
||||
private configService: ConfigServiceAbstraction,
|
||||
private platformUtilsService: PlatformUtilsService
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
@Input() hasFlags: boolean;
|
||||
isEuServer: boolean;
|
||||
isUsServer: boolean;
|
||||
showRegionSelector = false;
|
||||
euServerFlagEnabled: boolean;
|
||||
selectedRegionImageName: string;
|
||||
routeAndParams: string;
|
||||
|
||||
async ngOnInit() {
|
||||
this.euServerFlagEnabled = await this.configService.getFeatureFlagBool(
|
||||
|
@ -31,6 +35,7 @@ export class EnvironmentSelectorComponent implements OnInit {
|
|||
this.isUsServer = domain.includes(RegionDomain.US) || domain.includes(RegionDomain.USQA);
|
||||
this.selectedRegionImageName = this.getRegionImage();
|
||||
this.showRegionSelector = !this.platformUtilsService.isSelfHost();
|
||||
this.routeAndParams = `/#${this.router.url}`;
|
||||
}
|
||||
|
||||
getRegionImage(): string {
|
||||
|
|
Loading…
Reference in New Issue