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";
|
|
|
|
|
2022-06-14 17:10:53 +02:00
|
|
|
import { EnvironmentComponent as BaseEnvironmentComponent } from "@bitwarden/angular/components/environment.component";
|
|
|
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|
|
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
2018-04-04 16:08:30 +02:00
|
|
|
|
2022-08-08 13:40:09 +02:00
|
|
|
import { BrowserEnvironmentService } from "../../services/browser-environment.service";
|
|
|
|
|
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,
|
|
|
|
private router: Router
|
|
|
|
) {
|
|
|
|
super(platformUtilsService, environmentService, i18nService);
|
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();
|
2018-04-04 20:19:44 +02:00
|
|
|
this.router.navigate([""]);
|
2018-04-04 16:08:30 +02:00
|
|
|
}
|
|
|
|
}
|