From cd33a3a0b53ff726ab9c617c24e19f3aaef91a9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?=
<7397743+pelord@users.noreply.github.com>
Date: Tue, 10 Oct 2023 11:44:55 -0400
Subject: [PATCH] feat(*): add types for app environment and config
* refactor(portal): subtitute authconfig by authservice check.
* refactor(environment): now based on env from igo2-lib
* feat(app): add function to compute app version
* feat(*): substitute default value calculation to the getConfig method
* refactor(*): minor interface changes
* feat(app): adding environnement for app extending the lib
* refactor(portal): simplify config handling
---
src/app/app.component.ts | 28 ++---
src/app/app.module.ts | 2 +-
src/app/app.utils.ts | 9 ++
.../map-overlay/map-overlay.component.ts | 6 +-
src/app/pages/portal/portal.component.html | 18 +--
src/app/pages/portal/portal.component.ts | 114 +++++++-----------
.../pages/portal/sidenav/sidenav.component.ts | 3 +-
.../toast-panel/toast-panel.component.ts | 6 +-
.../welcome-window.component.ts | 14 +--
.../welcome-window/welcome-window.service.ts | 17 +--
src/config/config.json | 8 +-
src/environments/environment.github.ts | 39 +-----
src/environments/environment.prod.ts | 42 +------
src/environments/environment.ts | 91 ++++----------
src/environments/environnement.interface.ts | 46 ++++---
15 files changed, 156 insertions(+), 287 deletions(-)
create mode 100644 src/app/app.utils.ts
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index b308a6366..1b78dd387 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -4,7 +4,7 @@ import { Title, Meta } from '@angular/platform-browser';
import { DomUtils, userAgent } from '@igo2/utils';
import { LanguageService, ConfigService, MessageService } from '@igo2/core';
import { AuthOptions } from '@igo2/auth';
-import { AnalyticsListenerService } from '@igo2/integration';
+import { AnalyticsListenerService, AppOptions } from '@igo2/integration';
import { PwaService } from './services/pwa.service';
import { NavigationEnd, Router } from '@angular/router';
import { delay, first } from 'rxjs';
@@ -31,7 +31,7 @@ export class AppComponent implements OnInit {
private pwaService: PwaService,
private router: Router
) {
- this.authConfig = this.configService.getConfig('auth');
+ this.authConfig = this.configService.getConfig('auth', {});
this.readTitleConfig();
this.readDescriptionConfig();
@@ -40,15 +40,8 @@ export class AppComponent implements OnInit {
this.detectOldBrowser();
- this.hasHeader =
- this.configService.getConfig('header.hasHeader') === undefined
- ? false
- : this.configService.getConfig('header.hasHeader');
-
- this.hasFooter =
- this.configService.getConfig('hasFooter') === undefined
- ? false
- : this.configService.getConfig('hasFooter');
+ this.hasHeader = this.configService.getConfig('header.hasHeader', false);
+ this.hasFooter = this.configService.getConfig('hasFooter', false);
this.setManifest();
this.installPrompt();
@@ -88,7 +81,7 @@ export class AppComponent implements OnInit {
private readTitleConfig() {
this.languageService.translate
- .get(this.configService.getConfig('title'))
+ .get(this.configService.getConfig('title', ''))
.subscribe((title) => {
if (title) {
this.titleService.setTitle(title);
@@ -98,10 +91,11 @@ export class AppComponent implements OnInit {
}
private setManifest() {
- const appConfig = this.configService.getConfig('app');
- if (appConfig?.install?.enabled) {
- const manifestPath =
- appConfig.install.manifestPath || 'manifest.webmanifest';
+ if (this.configService.getConfig('app.install.enabled')) {
+ const manifestPath = this.configService.getConfig(
+ 'app.install.manifestPath',
+ 'manifest.webmanifest'
+ );
document
.querySelector('#igoManifestByConfig')
.setAttribute('href', manifestPath);
@@ -109,7 +103,7 @@ export class AppComponent implements OnInit {
}
private installPrompt() {
- const appConfig = this.configService.getConfig('app');
+ const appConfig: AppOptions = this.configService.getConfig('app');
if (appConfig?.install?.enabled && appConfig?.install?.promote) {
if (userAgent.getOSName() !== 'iOS') {
window.addEventListener(
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index ac8eb2001..ba2f1c9b2 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -133,7 +133,7 @@ function appInitializerFactory(
languageService.translate.setTranslation(lang, translations);
const configService = injector.get(ConfigService);
- const theme = configService.getConfig('theme') || DEFAULT_THEME;
+ const theme = configService.getConfig('theme', DEFAULT_THEME);
loadTheme(document, theme);
const titleKey = configService.getConfig('title');
diff --git a/src/app/app.utils.ts b/src/app/app.utils.ts
new file mode 100644
index 000000000..1d1870c9a
--- /dev/null
+++ b/src/app/app.utils.ts
@@ -0,0 +1,9 @@
+import { ConfigService, version } from '@igo2/core';
+
+export function getAppVersion(configService: ConfigService): string {
+ return (
+ configService.getConfig('version.app') ||
+ configService.getConfig('version.lib') ||
+ version.lib
+ );
+}
diff --git a/src/app/pages/portal/map-overlay/map-overlay.component.ts b/src/app/pages/portal/map-overlay/map-overlay.component.ts
index ff12b322a..35fa3be30 100644
--- a/src/app/pages/portal/map-overlay/map-overlay.component.ts
+++ b/src/app/pages/portal/map-overlay/map-overlay.component.ts
@@ -37,14 +37,14 @@ export class MapOverlayComponent implements AfterViewInit, OnDestroy {
}
private handleContextChange(context: Context) {
- let mapOverlay = [];
+ let mapOverlay: MapOverlay[] = [];
if (context !== undefined) {
this.mapOverlay = [];
if (context['mapOverlay']) {
mapOverlay = context['mapOverlay'];
- } else if (this.configService.getConfig('mapOverlay')) {
- mapOverlay = this.configService.getConfig('mapOverlay');
+ } else {
+ mapOverlay = this.configService.getConfig('mapOverlay', []);
}
for (const overlay of mapOverlay) {
// If no media define use default to desktop, display only if current media is on context definition
diff --git a/src/app/pages/portal/portal.component.html b/src/app/pages/portal/portal.component.html
index aa29faf2f..ecdfbd6ef 100644
--- a/src/app/pages/portal/portal.component.html
+++ b/src/app/pages/portal/portal.component.html
@@ -20,7 +20,7 @@
[termSplitter]="termSplitter"
[minLength]="minSearchTermLength"
[searchSettings]="true"
- [forceNA]="forceCoordsNA"
+ [forceNA]="appConfig.app?.forceCoordsNA"
[store]="searchStore"
(searchTermChange)="onSearchTermChange($event)"
[pointerSummaryEnabled]="igoSearchPointerSummaryEnabled"
@@ -89,13 +89,13 @@
>
= new BehaviorSubject(
undefined
);
public sidenavOpened$: BehaviorSubject = new BehaviorSubject(false);
public minSearchTermLength = 2;
- public hasExpansionPanel = false;
public hasGeolocateButton = true;
- public hasHomeExtentButton = false;
public showMenuButton = true;
public showSearchBar = true;
- public showOfflineButton = false;
- public showWakeLockButton = false;
- public showRotationButtonIfNoRotation = false;
- public hasFeatureEmphasisOnSelection: Boolean = false;
public workspaceNotAvailableMessage: string = 'workspace.disabled.resolution';
public workspacePaginator: MatPaginator;
public workspaceEntitySortChange$: BehaviorSubject =
@@ -156,7 +153,6 @@ export class PortalComponent implements OnInit, OnDestroy {
public termSplitter = '|';
public termDefinedInUrlTriggered = false;
private addedLayers$$: Subscription[] = [];
- public forceCoordsNA = false;
public contextMenuStore = new ActionStore([]);
private contextMenuCoord: [number, number];
@@ -199,10 +195,6 @@ export class PortalComponent implements OnInit, OnDestroy {
this.sidenavOpened$.next(value);
}
- get auth(): AuthOptions {
- return this.configService.getConfig('auth') || [];
- }
-
get toastPanelOpened(): boolean {
return this._toastPanelOpened;
}
@@ -256,10 +248,6 @@ export class PortalComponent implements OnInit, OnDestroy {
: undefined;
}
- get toastPanelShown(): boolean {
- return true;
- }
-
get expansionPanelBackdropShown(): boolean {
return this.expansionPanelExpanded && this.toastPanelForExpansionOpened;
}
@@ -345,44 +333,11 @@ export class PortalComponent implements OnInit, OnDestroy {
private directionState: DirectionState,
private configFileToGeoDBService: ConfigFileToGeoDBService
) {
+ this.handleAppConfigs();
+ this.storageService.set('version', getAppVersion(this.configService));
this.fullExtent = this.storageService.get('fullExtent') as boolean;
this._toastPanelOpened =
(this.storageService.get('toastOpened') as boolean) !== false;
- this.hasExpansionPanel = this.configService.getConfig('hasExpansionPanel');
- this.hasHomeExtentButton =
- this.configService.getConfig('homeExtentButton') === undefined
- ? false
- : true;
- this.hasGeolocateButton =
- this.configService.getConfig('hasGeolocateButton') === undefined
- ? true
- : this.configService.getConfig('hasGeolocateButton');
- this.showRotationButtonIfNoRotation =
- this.configService.getConfig('showRotationButtonIfNoRotation') ===
- undefined
- ? false
- : this.configService.getConfig('showRotationButtonIfNoRotation');
- const showMenuConfig = this.configService.getConfig('menu.button.show');
- this.showMenuButton = showMenuConfig !== undefined ? showMenuConfig : true;
-
- this.showSearchBar =
- this.configService.getConfig('searchBar.showSearchBar') === undefined
- ? true
- : this.configService.getConfig('searchBar.showSearchBar');
- this.showOfflineButton =
- this.configService.getConfig('offlineButton') === undefined
- ? false
- : this.configService.getConfig('offlineButton');
- this.showWakeLockButton =
- this.configService.getConfig('wakeLockApiButton') === undefined
- ? false
- : this.configService.getConfig('wakeLockApiButton');
-
- this.forceCoordsNA = this.configService.getConfig('app.forceCoordsNA');
- this.hasFeatureEmphasisOnSelection = this.configService.getConfig(
- 'hasFeatureEmphasisOnSelection'
- );
-
this.igoSearchPointerSummaryEnabled = this.configService.getConfig(
'hasSearchPointerSummary'
);
@@ -445,7 +400,7 @@ export class PortalComponent implements OnInit, OnDestroy {
prevCnt === 0 &&
currentCnt !== prevCnt &&
this.isMobile() &&
- this.hasExpansionPanel &&
+ this.appConfig.hasExpansionPanel &&
this.expansionPanelExpanded &&
this.toastPanelOpened
) {
@@ -454,12 +409,9 @@ export class PortalComponent implements OnInit, OnDestroy {
});
this.map.ol.once('rendercomplete', () => {
this.readQueryParams();
- if (
- this.configService.getConfig('geolocate.activateDefault') !== undefined
- ) {
- this.map.geolocationController.tracking = this.configService.getConfig(
- 'geolocate.activateDefault'
- );
+ if (this.appConfig.geolocate?.activateDefault !== undefined) {
+ this.map.geolocationController.tracking =
+ this.appConfig.geolocate?.activateDefault;
}
});
@@ -473,9 +425,11 @@ export class PortalComponent implements OnInit, OnDestroy {
}
});
- this.workspaceState.workspaceEnabled$.next(this.hasExpansionPanel);
+ this.workspaceState.workspaceEnabled$.next(
+ this.appConfig.hasExpansionPanel
+ );
this.workspaceState.store.empty$.subscribe((workspaceEmpty) => {
- if (!this.hasExpansionPanel) {
+ if (!this.appConfig.hasExpansionPanel) {
return;
}
this.workspaceState.workspaceEnabled$.next(workspaceEmpty ? false : true);
@@ -549,16 +503,33 @@ export class PortalComponent implements OnInit, OnDestroy {
this.computeToastPanelOffsetX();
});
- if (this.configService.getConfig('importExport')) {
- const configFileToGeoDBService = this.configService.getConfig(
- 'importExport.configFileToGeoDBService'
+ if (this.appConfig.importExport?.configFileToGeoDBService) {
+ this.configFileToGeoDBService.load(
+ this.appConfig.importExport.configFileToGeoDBService
);
- if (configFileToGeoDBService) {
- this.configFileToGeoDBService.load(configFileToGeoDBService);
- }
}
}
+ private handleAppConfigs() {
+ this.appConfig = this.configService.getConfigs();
+
+ this.hasGeolocateButton = this.configService.getConfig(
+ 'geolocate.button.visible',
+ true
+ );
+ this.showMenuButton = this.configService.getConfig(
+ 'menu.button.visible',
+ true
+ );
+
+ this.showSearchBar = this.configService.getConfig(
+ 'searchBar.showSearchBar',
+ true
+ );
+ this.igoSearchPointerSummaryEnabled =
+ this.appConfig.hasSearchPointerSummary;
+ }
+
setToastPanelHtmlDisplay(value) {
this.toastPanelHtmlDisplay = value;
this.computeToastPanelOffsetX();
@@ -903,7 +874,7 @@ export class PortalComponent implements OnInit, OnDestroy {
private handleExpansionAndToastOnMobile() {
if (
this.isMobile() &&
- this.hasExpansionPanel &&
+ this.appConfig.hasExpansionPanel &&
this.expansionPanelExpanded &&
this.toastPanelOpened
) {
@@ -969,13 +940,16 @@ export class PortalComponent implements OnInit, OnDestroy {
updateMapBrowserClass() {
const header = this.queryState.store.entities$.value.length > 0;
- if (this.hasExpansionPanel && this.workspaceState.workspaceEnabled$.value) {
+ if (
+ this.appConfig.hasExpansionPanel &&
+ this.workspaceState.workspaceEnabled$.value
+ ) {
this.mapBrowser.nativeElement.classList.add('has-expansion-panel');
} else {
this.mapBrowser.nativeElement.classList.remove('has-expansion-panel');
}
- if (this.hasExpansionPanel && this.expansionPanelExpanded) {
+ if (this.appConfig.hasExpansionPanel && this.expansionPanelExpanded) {
if (this.workspaceState.workspaceMaximize$.value) {
this.mapBrowser.nativeElement.classList.add(
'expansion-offset-maximized'
@@ -1592,7 +1566,7 @@ export class PortalComponent implements OnInit, OnDestroy {
}
private initWelcomeWindow(): void {
- if (this.auth?.url) {
+ if (this.authService.hasAuthService) {
this.authService.logged$.subscribe((logged) => {
if (logged) {
this.createWelcomeWindow();
diff --git a/src/app/pages/portal/sidenav/sidenav.component.ts b/src/app/pages/portal/sidenav/sidenav.component.ts
index f53b3345c..3b6327476 100644
--- a/src/app/pages/portal/sidenav/sidenav.component.ts
+++ b/src/app/pages/portal/sidenav/sidenav.component.ts
@@ -64,8 +64,7 @@ export class SidenavComponent implements OnInit, OnDestroy {
ngOnInit() {
this.activeTool$$ = this.toolbox.activeTool$.subscribe((tool: Tool) => {
- const sidenavTitle =
- this.configService.getConfig('sidenavTitle') || 'IGO';
+ const sidenavTitle = this.configService.getConfig('sidenavTitle', 'IGO');
if (tool) {
if (tool.name === 'catalogBrowser') {
for (const catalog of this.catalogState.catalogStore.all()) {
diff --git a/src/app/pages/portal/toast-panel/toast-panel.component.ts b/src/app/pages/portal/toast-panel/toast-panel.component.ts
index 513b00870..5a12576c6 100644
--- a/src/app/pages/portal/toast-panel/toast-panel.component.ts
+++ b/src/app/pages/portal/toast-panel/toast-panel.component.ts
@@ -71,7 +71,7 @@ export class ToastPanelComponent implements OnInit, OnDestroy {
DOWN: 'swipedown'
};
- public tabsMode = false;
+ public tabsMode: boolean;
get storageService(): StorageService {
return this.storageState.storageService;
@@ -308,9 +308,7 @@ export class ToastPanelComponent implements OnInit, OnDestroy {
private propertyTypeDetectorService: PropertyTypeDetectorService,
private layerService: LayerService
) {
- this.tabsMode = this.configService.getConfig('queryTabs')
- ? this.configService.getConfig('queryTabs')
- : false;
+ this.tabsMode = this.configService.getConfig('queryTabs', false);
this.opened = this.storageService.get('toastOpened') as boolean;
this.zoomAuto = this.storageService.get('zoomAuto') as boolean;
this.fullExtent = this.storageService.get('fullExtent') as boolean;
diff --git a/src/app/pages/portal/welcome-window/welcome-window.component.ts b/src/app/pages/portal/welcome-window/welcome-window.component.ts
index 608eb3ba7..49af50226 100644
--- a/src/app/pages/portal/welcome-window/welcome-window.component.ts
+++ b/src/app/pages/portal/welcome-window/welcome-window.component.ts
@@ -4,6 +4,7 @@ import { ConfigService, LanguageService } from '@igo2/core';
import { BehaviorSubject, Observable, of, Subscription } from 'rxjs';
import { map } from 'rxjs/operators';
import { WelcomeWindowService } from './welcome-window.service';
+import { getAppVersion } from 'src/app/app.utils';
@Component({
selector: 'app-welcome-window',
@@ -24,8 +25,10 @@ export class WelcomeWindowComponent implements OnInit, OnDestroy {
protected languageService: LanguageService
) {
this.discoverTitleInLocale$ = of(
- this.configService.getConfig('welcomeWindow.discoverTitleInLocale') ||
+ this.configService.getConfig(
+ 'welcomeWindow.discoverTitleInLocale',
this.configService.getConfig('title')
+ )
);
}
@@ -77,16 +80,13 @@ export class WelcomeWindowComponent implements OnInit, OnDestroy {
}
this.title$$ = this.languageService.translate
- .get(this.configService.getConfig('title') || '')
+ .get(this.configService.getConfig('title', ''))
.pipe(
map((title) => {
return this.languageService.translate.instant('welcomeWindow.html', {
title,
- description: this.configService.getConfig('description') || '',
- version:
- this.configService.getConfig('version.app') ||
- this.configService.getConfig('version.lib') ||
- '',
+ description: this.configService.getConfig('description', ''),
+ version: getAppVersion(this.configService),
releaseDate: releaseDateString || ''
});
})
diff --git a/src/app/pages/portal/welcome-window/welcome-window.service.ts b/src/app/pages/portal/welcome-window/welcome-window.service.ts
index c03c754fb..ebd589d00 100644
--- a/src/app/pages/portal/welcome-window/welcome-window.service.ts
+++ b/src/app/pages/portal/welcome-window/welcome-window.service.ts
@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import { ConfigService, StorageService } from '@igo2/core';
import { MatDialogConfig } from '@angular/material/dialog';
+import { getAppVersion } from 'src/app/app.utils';
@Injectable({
providedIn: 'root'
@@ -26,22 +27,12 @@ export class WelcomeWindowService {
}
this.storageService.set('welcomeWindow_nbVisit', (this.nbVisit += 1));
- this.storageService.set(
- 'version',
- this.configService.getConfig('version.lib')
- );
}
isVersionDifferentFromStorage(): boolean {
- if (
- this.storageService.get('version') &&
- this.storageService.get('version') !==
- this.configService.getConfig('version.lib')
- ) {
- return true;
- } else {
- return false;
- }
+ return (
+ this.storageService.get('version') !== getAppVersion(this.configService)
+ );
}
hasWelcomeWindow(): boolean {
diff --git a/src/config/config.json b/src/config/config.json
index 338a47810..ca6c7ad85 100644
--- a/src/config/config.json
+++ b/src/config/config.json
@@ -13,11 +13,15 @@
},
"hasFooter": false,
"hasExpansionPanel": true,
- "hasGeolocateButton": true,
+ "geolocation": {
+ "button": {
+ "visible": true
+ }
+ },
"showRotationButtonIfNoRotation": false,
"menu": {
"button": {
- "show": true,
+ "visible": true,
"useThemeColor": false
}
},
diff --git a/src/environments/environment.github.ts b/src/environments/environment.github.ts
index c04510d94..7aaf5fa23 100644
--- a/src/environments/environment.github.ts
+++ b/src/environments/environment.github.ts
@@ -1,41 +1,6 @@
-import { LanguageOptions } from '@igo2/core';
-import {
- SearchSourceOptions,
- ImportExportServiceOptions,
- CatalogServiceOptions,
- Projection,
- CommonVectorStyleOptions
-} from '@igo2/geo';
+import { AppEnvironmentOptions } from './environnement.interface';
-import {
- AppOptions,
- InteractiveTourConfigOptions
-} from './environnement.interface';
-interface Environment {
- production: boolean;
- igo: {
- app: AppOptions;
- catalog?: CatalogServiceOptions;
- importExport?: ImportExportServiceOptions;
- language?: LanguageOptions;
- searchSources?: { [key: string]: SearchSourceOptions };
- projections?: Projection[];
- interactiveTour?: InteractiveTourConfigOptions;
- depot?: { url: string; trainingGuides?: string[] };
- queryOverlayStyle?: {
- base?: CommonVectorStyleOptions;
- selection?: CommonVectorStyleOptions;
- focus?: CommonVectorStyleOptions;
- };
- searchOverlayStyle?: {
- base?: CommonVectorStyleOptions;
- selection?: CommonVectorStyleOptions;
- focus?: CommonVectorStyleOptions;
- };
- };
-}
-
-export const environment: Environment = {
+export const environment: AppEnvironmentOptions = {
production: true,
igo: {
app: {
diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts
index 3906290a7..b6728fe5f 100644
--- a/src/environments/environment.prod.ts
+++ b/src/environments/environment.prod.ts
@@ -1,44 +1,6 @@
-import { LanguageOptions } from '@igo2/core';
-import {
- SearchSourceOptions,
- ImportExportServiceOptions,
- OptionsApiOptions,
- Projection,
- SpatialFilterOptions,
- CommonVectorStyleOptions
-} from '@igo2/geo';
+import { AppEnvironmentOptions } from './environnement.interface';
-import {
- AppOptions,
- InteractiveTourConfigOptions
-} from './environnement.interface';
-
-export interface Environment {
- production: boolean;
- igo: {
- app: AppOptions;
- importExport?: ImportExportServiceOptions;
- language?: LanguageOptions;
- searchSources?: { [key: string]: SearchSourceOptions };
- optionsApi?: OptionsApiOptions;
- projections?: Projection[];
- spatialFilter?: SpatialFilterOptions;
- interactiveTour?: InteractiveTourConfigOptions;
- depot?: { url: string; trainingGuides?: string[] };
- queryOverlayStyle?: {
- base?: CommonVectorStyleOptions;
- selection?: CommonVectorStyleOptions;
- focus?: CommonVectorStyleOptions;
- };
- searchOverlayStyle?: {
- base?: CommonVectorStyleOptions;
- selection?: CommonVectorStyleOptions;
- focus?: CommonVectorStyleOptions;
- };
- };
-}
-
-export const environment: Environment = {
+export const environment: AppEnvironmentOptions = {
production: true,
igo: {
app: {
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index 32fcdc931..061363ecd 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -3,51 +3,9 @@
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
-import { AuthOptions, AuthStorageOptions } from '@igo2/auth';
-import { DOMOptions } from '@igo2/common';
-import { ContextServiceOptions } from '@igo2/context';
-import { LanguageOptions } from '@igo2/core';
-import {
- SearchSourceOptions,
- CatalogServiceOptions,
- Projection,
- ImportExportServiceOptions,
- CommonVectorStyleOptions
-} from '@igo2/geo';
-import {
- AppOptions,
- InteractiveTourConfigOptions
-} from './environnement.interface';
+import { AppEnvironmentOptions } from './environnement.interface';
-interface Environment {
- production: boolean;
- igo: {
- app: AppOptions;
- auth?: AuthOptions;
- storage: AuthStorageOptions;
- catalog?: CatalogServiceOptions;
- context?: ContextServiceOptions;
- importExport?: ImportExportServiceOptions;
- language?: LanguageOptions;
- searchSources?: { [key: string]: SearchSourceOptions };
- projections?: Projection[];
- interactiveTour?: InteractiveTourConfigOptions;
- depot?: { url: string; trainingGuides?: string[] };
- dom?: DOMOptions[];
- queryOverlayStyle?: {
- base?: CommonVectorStyleOptions;
- selection?: CommonVectorStyleOptions;
- focus?: CommonVectorStyleOptions;
- };
- searchOverlayStyle?: {
- base?: CommonVectorStyleOptions;
- selection?: CommonVectorStyleOptions;
- focus?: CommonVectorStyleOptions;
- };
- };
-}
-
-export const environment: Environment = {
+export const environment: AppEnvironmentOptions = {
production: false,
igo: {
app: {
@@ -64,18 +22,23 @@ export const environment: Environment = {
url: '/apis/users',
tokenKey: 'id_token_igo',
allowAnonymous: true,
- trustHosts: ['geoegl.msp.gouv.qc.ca']
- /*,hostsByKey: [{
- domainRegFilters: '(https:\/\/|http:\/\/)?(.*domain.com)(.*)',
- keyProperty: 'key',
- keyValue: '123456',
- }]*/
+ trustHosts: ['geoegl.msp.gouv.qc.ca'],
+ hostsByKey: [
+ {
+ domainRegFilters: '(https://|http://)?(.*domain.com)(.*)',
+ keyProperty: 'key',
+ keyValue: '123456'
+ }
+ ]
},
storage: {
url: '/user/igo',
key: 'igo'
},
-
+ /*context: {
+ url: '/apis/igo2',
+ defaultContextUri: '5'
+ },*/
catalog: {
sources: [
{
@@ -251,28 +214,18 @@ export const environment: Environment = {
}
]
},
- // context: {
- // url: '/apis/igo2',
- // defaultContextUri: '5'
- // },
depot: {
url: '/apis/depot'
},
dom: [
- // {
- // id: 1,
- // name: 'test-dom',
- // values: [
- // {
- // id: "Radar photo fixe",
- // value: "Radar photo fixe"
- // },
- // {
- // id: "Radar photo mobile",
- // value: "Radar photo mobile"
- // }
- // ]
- // },
+ {
+ id: 1,
+ name: 'test-dom',
+ values: [
+ { id: 'Radar photo fixe', value: 'Radar photo fixe' },
+ { id: 'Radar photo mobile', value: 'Radar photo mobile' }
+ ]
+ },
{
id: 1,
name: 'dom_test',
diff --git a/src/environments/environnement.interface.ts b/src/environments/environnement.interface.ts
index 003003b3f..db297decb 100644
--- a/src/environments/environnement.interface.ts
+++ b/src/environments/environnement.interface.ts
@@ -1,17 +1,35 @@
-export interface AppOptions {
- forceCoordsNA: boolean;
- install: {
- enabled?: boolean;
- promote?: boolean;
- manifestPath?: string;
- };
- pwa?: {
- enabled?: boolean;
- path?: string;
- };
+import { AllEnvironmentOptions } from '@igo2/integration';
+import { EnvironmentOptions as IntegrationEnvironmentOptions } from '@igo2/integration';
+import { MapOverlay } from 'src/app/pages/portal/map-overlay/map-overlay.interface';
+
+export interface AppEnvironmentOptions extends IntegrationEnvironmentOptions {
+ igo: EnvironmentOptions;
}
-export interface InteractiveTourConfigOptions {
- tourInMobile: boolean;
- pathToConfigFile: string;
+export interface EnvironmentOptions extends AllEnvironmentOptions {
+ header?: {
+ hasHeader?: boolean;
+ logo?: string;
+ logoPrint?: string;
+ };
+ hasFooter?: boolean;
+ title?: string;
+ theme?: string; // enum?
+ sidenavTitle?: string;
+ description?: string;
+ favoriteContext4NonAuthenticated?: boolean;
+ mapOverlay?: MapOverlay[];
+ queryTabs?: boolean;
+ welcomeWindow?: {
+ discoverTitleInLocale?: string;
+ nbVisitToShow?: number;
+ nbVisitToShowAgain?: number;
+ showAgainOnNewIGOVersion?: boolean;
+ };
+ hasExpansionPanel?: boolean;
+ showRotationButtonIfNoRotation?: boolean;
+ offlineButton?: boolean;
+ wakeLockApiButton?: boolean;
+ hasFeatureEmphasisOnSelection?: boolean;
+ hasSearchPointerSummary?: boolean;
}