1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-06 00:48:08 +02:00

[Enterprise] Updated Environment Settings (#112)

* Initial commit of enterprise environment option

* Reverting API/EnvironmentUrls changes
This commit is contained in:
Vincent Salucci 2020-06-11 15:04:40 -05:00 committed by GitHub
parent 2b6657a293
commit dd147ce338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -6,6 +6,7 @@ export abstract class EnvironmentService {
iconsUrl: string;
notificationsUrl: string;
eventsUrl: string;
enterpriseUrl: string;
getWebVaultUrl: () => string;
setUrlsFromStorage: () => Promise<void>;

View File

@ -17,6 +17,7 @@ export class EnvironmentComponent {
notificationsUrl: string;
baseUrl: string;
showCustom = false;
enterpriseUrl: string;
constructor(protected platformUtilsService: PlatformUtilsService, protected environmentService: EnvironmentService,
protected i18nService: I18nService) {
@ -26,6 +27,7 @@ export class EnvironmentComponent {
this.identityUrl = environmentService.identityUrl || '';
this.iconsUrl = environmentService.iconsUrl || '';
this.notificationsUrl = environmentService.notificationsUrl || '';
this.enterpriseUrl = environmentService.enterpriseUrl || '';
}
async submit() {
@ -36,6 +38,7 @@ export class EnvironmentComponent {
webVault: this.webVaultUrl,
icons: this.iconsUrl,
notifications: this.notificationsUrl,
enterprise: this.enterpriseUrl,
});
// re-set urls since service can change them, ex: prefixing https://
@ -45,6 +48,7 @@ export class EnvironmentComponent {
this.webVaultUrl = resUrls.webVault;
this.iconsUrl = resUrls.icons;
this.notificationsUrl = resUrls.notifications;
this.enterpriseUrl = resUrls.enterprise;
this.platformUtilsService.eventTrack('Set Environment URLs');
this.platformUtilsService.showToast('success', null, this.i18nService.t('environmentSaved'));

View File

@ -15,6 +15,7 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
iconsUrl: string;
notificationsUrl: string;
eventsUrl: string;
enterpriseUrl: string;
constructor(private apiService: ApiService, private storageService: StorageService,
private notificationsService: NotificationsService) { }
@ -38,6 +39,7 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
notifications: null,
events: null,
webVault: null,
enterprise: null,
};
const envUrls = new EnvironmentUrls();
@ -54,6 +56,7 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
this.iconsUrl = urls.icons;
this.notificationsUrl = urls.notifications;
this.eventsUrl = envUrls.events = urls.events;
this.enterpriseUrl = urls.enterprise;
this.apiService.setUrls(envUrls);
}
@ -65,6 +68,7 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
urls.icons = this.formatUrl(urls.icons);
urls.notifications = this.formatUrl(urls.notifications);
urls.events = this.formatUrl(urls.events);
urls.enterprise = this.formatUrl(urls.enterprise);
await this.storageService.save(ConstantsService.environmentUrlsKey, {
base: urls.base,
@ -74,6 +78,7 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
icons: urls.icons,
notifications: urls.notifications,
events: urls.events,
enterprise: urls.enterprise,
});
this.baseUrl = urls.base;
@ -83,6 +88,7 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
this.iconsUrl = urls.icons;
this.notificationsUrl = urls.notifications;
this.eventsUrl = urls.events;
this.enterpriseUrl = urls.enterprise;
const envUrls = new EnvironmentUrls();
if (this.baseUrl) {