From dd147ce3382c6ad04e3b0c52439e2fccee9a2491 Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Thu, 11 Jun 2020 15:04:40 -0500 Subject: [PATCH] [Enterprise] Updated Environment Settings (#112) * Initial commit of enterprise environment option * Reverting API/EnvironmentUrls changes --- src/abstractions/environment.service.ts | 1 + src/angular/components/environment.component.ts | 4 ++++ src/services/environment.service.ts | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/src/abstractions/environment.service.ts b/src/abstractions/environment.service.ts index 455447bbf6..d68d6a6fc4 100644 --- a/src/abstractions/environment.service.ts +++ b/src/abstractions/environment.service.ts @@ -6,6 +6,7 @@ export abstract class EnvironmentService { iconsUrl: string; notificationsUrl: string; eventsUrl: string; + enterpriseUrl: string; getWebVaultUrl: () => string; setUrlsFromStorage: () => Promise; diff --git a/src/angular/components/environment.component.ts b/src/angular/components/environment.component.ts index 70db95d2ec..3a65af58a0 100644 --- a/src/angular/components/environment.component.ts +++ b/src/angular/components/environment.component.ts @@ -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')); diff --git a/src/services/environment.service.ts b/src/services/environment.service.ts index a5bfea2679..daf7b5c6b1 100644 --- a/src/services/environment.service.ts +++ b/src/services/environment.service.ts @@ -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) {