2022-08-08 13:40:09 +02:00
|
|
|
import { Component, OnInit } from "@angular/core";
|
2018-04-04 16:08:30 +02:00
|
|
|
import { Router } from "@angular/router";
|
|
|
|
|
2023-10-19 10:03:32 +02:00
|
|
|
import { EnvironmentComponent as BaseEnvironmentComponent } from "@bitwarden/angular/auth/components/environment.component";
|
2023-05-19 18:35:42 +02:00
|
|
|
import { ModalService } from "@bitwarden/angular/services/modal.service";
|
2023-06-06 22:34:53 +02:00
|
|
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
|
|
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
2018-04-04 16:08:30 +02:00
|
|
|
|
2023-06-06 22:34:53 +02:00
|
|
|
import { BrowserEnvironmentService } from "../../platform/services/browser-environment.service";
|
2022-08-08 13:40:09 +02:00
|
|
|
|
2018-04-04 16:08:30 +02:00
|
|
|
@Component({
|
|
|
|
selector: "app-environment",
|
2018-04-06 17:48:45 +02:00
|
|
|
templateUrl: "environment.component.html",
|
2018-04-04 16:08:30 +02:00
|
|
|
})
|
2022-08-08 13:40:09 +02:00
|
|
|
export class EnvironmentComponent extends BaseEnvironmentComponent implements OnInit {
|
|
|
|
showEditedManagedSettings = false;
|
|
|
|
|
2018-10-03 06:21:22 +02:00
|
|
|
constructor(
|
|
|
|
platformUtilsService: PlatformUtilsService,
|
2022-08-08 13:40:09 +02:00
|
|
|
public environmentService: BrowserEnvironmentService,
|
2018-10-03 06:21:22 +02:00
|
|
|
i18nService: I18nService,
|
2023-05-19 18:35:42 +02:00
|
|
|
private router: Router,
|
|
|
|
modalService: ModalService,
|
2018-10-03 06:21:22 +02:00
|
|
|
) {
|
2023-05-19 18:35:42 +02:00
|
|
|
super(platformUtilsService, environmentService, i18nService, modalService);
|
2018-04-04 20:19:44 +02:00
|
|
|
this.showCustom = true;
|
2018-04-04 16:08:30 +02:00
|
|
|
}
|
|
|
|
|
2022-08-08 13:40:09 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2018-04-04 16:08:30 +02:00
|
|
|
saved() {
|
|
|
|
super.saved();
|
2024-02-02 21:13:37 +01:00
|
|
|
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
2018-04-04 20:19:44 +02:00
|
|
|
this.router.navigate([""]);
|
2018-04-04 16:08:30 +02:00
|
|
|
}
|
|
|
|
}
|