1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-13 23:03:32 +00:00

add route and params to link (#6103)

This commit is contained in:
rr-bw
2023-09-06 12:05:24 -07:00
committed by GitHub
parent e8a5c5b337
commit 6eb57ff312
2 changed files with 12 additions and 3 deletions

View File

@@ -2,7 +2,9 @@
<bit-menu #environmentOptions> <bit-menu #environmentOptions>
<a <a
bitMenuItem 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" class="pr-4"
> >
<i <i
@@ -19,7 +21,9 @@
</a> </a>
<a <a
bitMenuItem 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" class="pr-4"
*ngIf="euServerFlagEnabled" *ngIf="euServerFlagEnabled"
> >

View File

@@ -1,4 +1,5 @@
import { Component, Input, OnInit } from "@angular/core"; import { Component, Input, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigServiceAbstraction } from "@bitwarden/common/platform/abstractions/config/config.service.abstraction"; 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 { export class EnvironmentSelectorComponent implements OnInit {
constructor( constructor(
private configService: ConfigServiceAbstraction, private configService: ConfigServiceAbstraction,
private platformUtilsService: PlatformUtilsService private platformUtilsService: PlatformUtilsService,
private router: Router
) {} ) {}
@Input() hasFlags: boolean; @Input() hasFlags: boolean;
isEuServer: boolean; isEuServer: boolean;
isUsServer: boolean; isUsServer: boolean;
showRegionSelector = false; showRegionSelector = false;
euServerFlagEnabled: boolean; euServerFlagEnabled: boolean;
selectedRegionImageName: string; selectedRegionImageName: string;
routeAndParams: string;
async ngOnInit() { async ngOnInit() {
this.euServerFlagEnabled = await this.configService.getFeatureFlagBool( 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.isUsServer = domain.includes(RegionDomain.US) || domain.includes(RegionDomain.USQA);
this.selectedRegionImageName = this.getRegionImage(); this.selectedRegionImageName = this.getRegionImage();
this.showRegionSelector = !this.platformUtilsService.isSelfHost(); this.showRegionSelector = !this.platformUtilsService.isSelfHost();
this.routeAndParams = `/#${this.router.url}`;
} }
getRegionImage(): string { getRegionImage(): string {