[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; iconsUrl: string;
notificationsUrl: string; notificationsUrl: string;
eventsUrl: string; eventsUrl: string;
enterpriseUrl: string;
getWebVaultUrl: () => string; getWebVaultUrl: () => string;
setUrlsFromStorage: () => Promise<void>; setUrlsFromStorage: () => Promise<void>;

View File

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

View File

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