diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 06ff11ae21af544d9826869eaf1a5b177e2b1ad6..2c744415a07e4f794f0f01504d281c71ec595631 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -3,10 +3,10 @@ import { Routes, RouterModule, PreloadAllModules } from '@angular/router'; import { AppRoutes } from './routes'; export const routes: Routes = [ - { - path: AppRoutes.research.uri, - loadChildren: './geosource/geosource.module#GeosourceModule', - }, + // { + // path: AppRoutes.research.uri, + // loadChildren: './geosource/geosource.module#GeosourceModule', + // }, ]; @NgModule({ diff --git a/src/app/core/interceptors/auth-interceptor.ts b/src/app/core/interceptors/auth-interceptor.ts index 37f8d62fa9912a6de5972c14d1d0bbbbd29a3a0e..8815868614d70bbf451f9e7c2ac4ddc6d14f2b09 100644 --- a/src/app/core/interceptors/auth-interceptor.ts +++ b/src/app/core/interceptors/auth-interceptor.ts @@ -1,7 +1,6 @@ import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { environment } from '../../../environments/environment.prod'; @Injectable() export class AuthInterceptor implements HttpInterceptor { diff --git a/src/app/core/interceptors/http-error-response-interceptor.ts b/src/app/core/interceptors/http-error-response-interceptor.ts index f53810848d17a488364147c141cf64ea670e243c..0445fe9fc090af8487f6c34eb75b2b2d7d6a2989 100644 --- a/src/app/core/interceptors/http-error-response-interceptor.ts +++ b/src/app/core/interceptors/http-error-response-interceptor.ts @@ -6,10 +6,15 @@ import { HttpEvent, HttpResponse, HttpErrorResponse, } from '@angular/common/http'; import { tap } from 'rxjs/operators'; +import { environment } from '../../../environments/environment'; +import { Router } from '@angular/router'; +import { AppRoutes } from '../../routes'; @Injectable() export class HttpErrorResponseInterceptor implements HttpInterceptor { - constructor() { } + constructor( + private router: Router, + ) { } intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { return next.handle(req).pipe(tap( (event: HttpEvent<any>) => { @@ -23,6 +28,8 @@ export class HttpErrorResponseInterceptor implements HttpInterceptor { switch (err.status) { case 401: console.log('HTTP ERROR: Unauthorized'); + window.location.href = environment.oidcLoginEndpoint; + // this.router.navigate(['/', AppRoutes.signin.uri]) break; case 403: console.log('HTTP ERROR: Forbidden'); @@ -30,8 +37,6 @@ export class HttpErrorResponseInterceptor implements HttpInterceptor { case 404: console.log('HTTP ERROR: Not Found'); break; - case 301: - console.log('Redirection !!!!!!'); case 500: case 502: case 503: diff --git a/src/app/core/services/auth.service.ts b/src/app/core/services/auth.service.ts index a3c874b2ee5f2a308afae939757b8714a7549080..37be76aca3242b3ec3388be68c73fed25bf719d6 100644 --- a/src/app/core/services/auth.service.ts +++ b/src/app/core/services/auth.service.ts @@ -31,7 +31,7 @@ export class AuthService { exchangeOidcCode(code: string): Observable<boolean> { console.log('[x] Exchanging code'); - const url = `${env.kongUrl}/authentication/api/oidc/token?code=${code}`; + const url = `${env.kongUrl}/authentication/oidc/token?code=${code}`; return this._http.get<ILoginResponse>(url).pipe( map( (res) => { @@ -48,7 +48,7 @@ export class AuthService { exchangeGlcCode(code: string): Observable<boolean> { console.log('[x] Exchanging code'); - const url = `${env.kongUrl}/authentication/api/glc/token?code=${code}`; + const url = `${env.kongUrl}/authentication/glc/token?code=${code}`; return this._http.get<ILoginResponse>(url).pipe( map( (res) => { @@ -102,7 +102,7 @@ export class AuthService { } catch (error) { } - let url = `${env.kongUrl}/authentication/api/logout?`; + let url = `${env.kongUrl}/authentication/logout?`; url += `id_token=${idToken}&identity_provider=${identityProvider}`; window.location.href = url; diff --git a/src/app/editorialisation/editorialisation.module.ts b/src/app/editorialisation/editorialisation.module.ts index 080de402b2a42529009f69dfc0b59ae301b0b7eb..24092e52d9ce8d4d18b35288afb92e4a6a6a03a5 100644 --- a/src/app/editorialisation/editorialisation.module.ts +++ b/src/app/editorialisation/editorialisation.module.ts @@ -6,7 +6,6 @@ import { EditorialisationServices } from './services'; import { EditorialisationResolvers } from './resolvers'; import { SharedModule } from '../shared/shared.module'; import { GeosourceModule } from '../geosource/geosource.module'; -import { DatasetResearchService } from '../geosource/services'; @NgModule({ imports: [ diff --git a/src/app/editorialisation/services/actors.service.ts b/src/app/editorialisation/services/actors.service.ts index 523938c0147ef43793c91534ee1d70c81be661a2..984c23de2494ff7a4d71027f3156083c1b7e9005 100644 --- a/src/app/editorialisation/services/actors.service.ts +++ b/src/app/editorialisation/services/actors.service.ts @@ -13,7 +13,7 @@ export class ActorsService { ) { } getActors() { - return this._httpClient.get<IActor[]>(environment.backend.url + '/organizations').pipe( + return this._httpClient.get<IActor[]>(environment.organizations.url).pipe( map((actorsLoopback) => { const actors = []; actorsLoopback.forEach((actor) => { diff --git a/src/app/geosource/geosource-routing.module.ts b/src/app/geosource/geosource-routing.module.ts index e1ccd324ab818c99b91e3c33ef6bb5cff72a129f..d17b00236bc3147b151903bedc4a4d67e74e0fea 100644 --- a/src/app/geosource/geosource-routing.module.ts +++ b/src/app/geosource/geosource-routing.module.ts @@ -6,7 +6,7 @@ import { AppRoutes } from '../routes'; export const routes: Routes = [ { - path: '', + path: AppRoutes.research.uri, component: ResearchComponent, data: { title: AppRoutes.research.title, diff --git a/src/app/geosource/services/elasticsearch.service.ts b/src/app/geosource/services/elasticsearch.service.ts index 84f0a0a8f3ca9814825074d6891373bbfd5512cb..9a9b0a4b3f846b01a45eccd3348bd18a73972f62 100644 --- a/src/app/geosource/services/elasticsearch.service.ts +++ b/src/app/geosource/services/elasticsearch.service.ts @@ -28,7 +28,7 @@ export class ElasticsearchService { getFullDataList(options: ElasticsearchOptions): Observable<IElasticsearchResponse> { const requestOptions = this.constructElasticsearchRequest(options); const request = this._storageService.get('requestES'); - if (request === JSON.stringify(requestOptions)) { + if (environment.enableEsFrontCache === true && request === JSON.stringify(requestOptions)) { const jsonESResponse = JSON.parse(this._storageService.get('resultES')) as IElasticsearchResponse; return of(jsonESResponse); } diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index a4bb4a9e615e1842e8473dae6d705d569e8cdb19..c37be8b3e4cc13693320f55a101549ccd7d887f6 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -5,27 +5,29 @@ import { AppRoutes } from '../app/routes'; // `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`. const servicesProxyUrl = 'https://data-intothesky.alpha.grandlyon.com'; -const kongUrl = 'https://kong.alpha.grandlyon.com'; +const kongBaseUrl = 'https://kong.alpha.grandlyon.com'; export const environment = { - kongUrl, production: true, - oidcLoginEndpoint: kongUrl + '/authentication/api/oidc/login', - glcLoginEndpoint: kongUrl + '/authentication/api/glc/login', - logoutEndpoint: kongUrl + '/authentication/api/logout', + kongUrl: kongBaseUrl, + oidcLoginEndpoint: kongBaseUrl + '/authentication/oidc/login', + glcLoginEndpoint: kongBaseUrl + '/authentication/glc/login', + logoutEndpoint: kongBaseUrl + '/authentication/logout', // ElasticSearch elasticsearchUrl: { - full: kongUrl + '/elasticsearch/test-all-in-one-index.full.v8.quadtree', - meta: servicesProxyUrl + '/elasticsearch/*.meta', + full: kongBaseUrl + '/es-consumer-aware', + meta: kongBaseUrl + '/elasticsearch/*.meta', }, + enableEsFrontCache: false, + matomo: { url: 'https://matomo-intothesky.alpha.grandlyon.com', }, - backend: { - url: servicesProxyUrl + '/backend', + organizations: { + url: kongBaseUrl + '/organizations', }, // Path to the built app in a particular language diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 3ca6ad00c651dca3970952154f880022d4dab192..ec5d50ed000b915c784d7899cbb6f2c6f9e8ae1f 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -5,27 +5,30 @@ import { AppRoutes } from '../app/routes'; // `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`. const servicesProxyUrl = 'https://data-intothesky.alpha.grandlyon.com'; -const kongUrl = 'https://kong.alpha.grandlyon.com'; +const kongBaseUrl = 'https://kong.alpha.grandlyon.com'; export const environment = { - kongUrl, production: false, - oidcLoginEndpoint: '', + kongUrl: kongBaseUrl, + oidcLoginEndpoint: kongBaseUrl + '/authentication/oidc/login', glcLoginEndpoint: '', logoutEndpoint: '', // ElasticSearch elasticsearchUrl: { - full: servicesProxyUrl + '/elasticsearch2/test-all-in-one-index.full.v8.quadtree', + // full: servicesProxyUrl + '/elasticsearch2/test-all-in-one-index.full.v8.quadtree', + full: kongBaseUrl + '/es-consumer-aware', meta: servicesProxyUrl + '/elasticsearch/*.meta', }, + enableEsFrontCache: true, + matomo: { url: 'https://matomo-intothesky.alpha.grandlyon.com', }, - backend: { - url: 'http://localhost:3000', + organizations: { + url: kongBaseUrl + '/organizations', }, // Path to the built app in a particular language