Files
clients/apps/browser/src/auth/popup/environment.component.ts
André Bispo b9fe78796a [PM-1019] Environment selection clients (#5480)
* [PM-169][PM-142][PM-191] Add Environments to Web and Desktop (#5294)

* [PM-1351] Add property to server-config.response. Change config to be able to fetch without being authed.

* [PM-1351] fetch every hour.

* [PM-1351] fetch on vault sync.

* [PM-1351] browser desktop fetch configs on sync complete.

* [PM-1351] Add methods to retrieve feature flags

* [PM-1351] Add enum to use as key to get values feature flag values

* [PM-1351] Remove debug code

* [PM-1351] Get flags when unauthed. Add enums as params. Hourly always fetch.

* [PM-1351] add check for authed user using auth service

* [PM-169] Web: add drop down to select environment

* [PM-169] Fix pop up menu margins. Add DisplayEuEnvironmentFlag.

* [PM-169] Change menu name.

* [PM-169] Add environment selector ts and html. Add declaration and import on login.module

* [PM-169] Add environment selector to desktop.

* [PM-169] Ignore lint error.

* [PM-169] add takeUntil to subscribes

* [PM-191] PR Fixes, code format

* [PM-168] Add Environments to extension login/registration (#5434)
2023-05-19 17:35:42 +01:00

50 lines
1.6 KiB
TypeScript

import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { EnvironmentComponent as BaseEnvironmentComponent } from "@bitwarden/angular/components/environment.component";
import { ModalService } from "@bitwarden/angular/services/modal.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { BrowserEnvironmentService } from "../../services/browser-environment.service";
@Component({
selector: "app-environment",
templateUrl: "environment.component.html",
})
export class EnvironmentComponent extends BaseEnvironmentComponent implements OnInit {
showEditedManagedSettings = false;
constructor(
platformUtilsService: PlatformUtilsService,
public environmentService: BrowserEnvironmentService,
i18nService: I18nService,
private router: Router,
modalService: ModalService
) {
super(platformUtilsService, environmentService, i18nService, modalService);
this.showCustom = true;
}
async ngOnInit() {
this.showEditedManagedSettings = await this.environmentService.settingsHaveChanged();
}
async resetEnvironment() {
const urls = await this.environmentService.getManagedEnvironment();
this.baseUrl = urls.base;
this.webVaultUrl = urls.webVault;
this.apiUrl = urls.api;
this.iconsUrl = urls.icons;
this.identityUrl = urls.identity;
this.notificationsUrl = urls.notifications;
this.iconsUrl = urls.icons;
}
saved() {
super.saved();
this.router.navigate([""]);
}
}