mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-17 07:15:13 +02:00
Update EnvironmentSelectorComponent text based on feature flag.
This commit is contained in:
parent
c8e404cb9b
commit
c13bded29b
@ -4,11 +4,15 @@ import { Component, EventEmitter, Output } from "@angular/core";
|
|||||||
import { Router } from "@angular/router";
|
import { Router } from "@angular/router";
|
||||||
import { Observable, map } from "rxjs";
|
import { Observable, map } from "rxjs";
|
||||||
|
|
||||||
|
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||||
|
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||||
import {
|
import {
|
||||||
EnvironmentService,
|
EnvironmentService,
|
||||||
Region,
|
Region,
|
||||||
RegionConfig,
|
RegionConfig,
|
||||||
} from "@bitwarden/common/platform/abstractions/environment.service";
|
} from "@bitwarden/common/platform/abstractions/environment.service";
|
||||||
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "environment-selector",
|
selector: "environment-selector",
|
||||||
@ -37,6 +41,7 @@ import {
|
|||||||
export class EnvironmentSelectorComponent {
|
export class EnvironmentSelectorComponent {
|
||||||
@Output() onOpenSelfHostedSettings = new EventEmitter();
|
@Output() onOpenSelfHostedSettings = new EventEmitter();
|
||||||
protected isOpen = false;
|
protected isOpen = false;
|
||||||
|
protected accessingString: string;
|
||||||
protected ServerEnvironmentType = Region;
|
protected ServerEnvironmentType = Region;
|
||||||
protected overlayPosition: ConnectedPosition[] = [
|
protected overlayPosition: ConnectedPosition[] = [
|
||||||
{
|
{
|
||||||
@ -56,8 +61,27 @@ export class EnvironmentSelectorComponent {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected environmentService: EnvironmentService,
|
protected environmentService: EnvironmentService,
|
||||||
|
protected configService: ConfigService,
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
) {}
|
protected logService: LogService,
|
||||||
|
private i18nService: I18nService,
|
||||||
|
) {
|
||||||
|
this.setAccessingString().catch((e) => {
|
||||||
|
this.logService.error(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text in front of the dropdown to either "Accessing" or "Logging In On" based on whether the
|
||||||
|
* UnauthenticatedExtensionUIRefresh feature flag is set.
|
||||||
|
*/
|
||||||
|
private async setAccessingString() {
|
||||||
|
const isUnauthenticatedExtensionUIRefreshEnabled = await this.configService.getFeatureFlag(
|
||||||
|
FeatureFlag.UnauthenticatedExtensionUIRefresh,
|
||||||
|
);
|
||||||
|
const translationKey = isUnauthenticatedExtensionUIRefreshEnabled ? "accessing" : "loggingInOn";
|
||||||
|
this.accessingString = this.i18nService.t(translationKey);
|
||||||
|
}
|
||||||
|
|
||||||
async toggle(option: Region) {
|
async toggle(option: Region) {
|
||||||
this.isOpen = !this.isOpen;
|
this.isOpen = !this.isOpen;
|
||||||
|
Loading…
Reference in New Issue
Block a user