-
+
{{ 'igo.geo.targetHtmlUrl' |
translate }}
@@ -111,7 +111,7 @@
-
+
{{ 'igo.geo.targetHtmlUrl' | translate }}
|
diff --git a/packages/common/src/lib/image/image-error.directive.ts b/packages/common/src/lib/image/image-error.directive.ts
new file mode 100644
index 0000000000..02f3bc26dd
--- /dev/null
+++ b/packages/common/src/lib/image/image-error.directive.ts
@@ -0,0 +1,28 @@
+import {
+ Directive,
+ HostListener,
+ Input,
+ ElementRef
+} from '@angular/core';
+
+@Directive({
+ selector: '[igoImageError]'
+})
+export class ImageErrorDirective {
+
+ @Input() errorImageUrl: string = '/assets/igo2/common/images/na.png';
+ @Input() hideError: boolean = false;
+
+ constructor(private el: ElementRef) {}
+
+ @HostListener("error", ['$event'])
+ public onError(event: any): void {
+ if (this.hideError) {
+ this.el.nativeElement.style.display = "none";
+ } else {
+ event.target.src = this.errorImageUrl;
+ }
+
+ }
+
+}
diff --git a/packages/common/src/lib/image/image.module.ts b/packages/common/src/lib/image/image.module.ts
index c6136f8121..0df301aa0f 100644
--- a/packages/common/src/lib/image/image.module.ts
+++ b/packages/common/src/lib/image/image.module.ts
@@ -1,10 +1,11 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
+import { ImageErrorDirective } from './image-error.directive';
import { SecureImagePipe } from './secure-image.pipe';
@NgModule({
imports: [],
- declarations: [SecureImagePipe],
- exports: [SecureImagePipe]
+ declarations: [SecureImagePipe, ImageErrorDirective],
+ exports: [SecureImagePipe, ImageErrorDirective]
})
export class IgoImageModule {
static forRoot(): ModuleWithProviders {
diff --git a/packages/common/src/lib/image/index.ts b/packages/common/src/lib/image/index.ts
index eeb8019a61..097cfc3bdf 100644
--- a/packages/common/src/lib/image/index.ts
+++ b/packages/common/src/lib/image/index.ts
@@ -1 +1,2 @@
+export * from './image-error.directive';
export * from './secure-image.pipe';
diff --git a/packages/common/src/lib/image/secure-image.pipe.ts b/packages/common/src/lib/image/secure-image.pipe.ts
index fa9699048b..6c7f0fad54 100644
--- a/packages/common/src/lib/image/secure-image.pipe.ts
+++ b/packages/common/src/lib/image/secure-image.pipe.ts
@@ -3,7 +3,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Cacheable } from 'ts-cacheable';
import { Observable } from 'rxjs';
-import { switchMap } from 'rxjs/operators';
+import { catchError, switchMap } from 'rxjs/operators';
import { ConfigService } from '@igo2/core';
@Pipe({
@@ -20,7 +20,8 @@ export class SecureImagePipe implements PipeTransform {
transform(url: string): Observable {
const headers = new HttpHeaders({
'Content-Type': 'text/plain',
- activityInterceptor: 'false'
+ activityInterceptor: 'false',
+ interceptError: 'false'
});
const regexDepot = new RegExp(this.configService?.getConfig('depot.url') + '.*?(?="|$)');
@@ -34,6 +35,11 @@ export class SecureImagePipe implements PipeTransform {
responseType: 'blob'
})
.pipe(
+ catchError((err) => {
+ err.error.caught = true;
+ err.error.toDisplay = false;
+ throw err;
+ }),
switchMap((blob) => {
return new Observable((observer) => {
const reader = new FileReader();
diff --git a/packages/core/src/lib/message/shared/message.service.ts b/packages/core/src/lib/message/shared/message.service.ts
index 2e858a4339..ceb350a415 100644
--- a/packages/core/src/lib/message/shared/message.service.ts
+++ b/packages/core/src/lib/message/shared/message.service.ts
@@ -23,7 +23,7 @@ interface ActiveMessageTranslation {
export class MessageService {
public messages$ = new BehaviorSubject([]);
private options: MessageOptions;
- private activeMessageTranslations: ActiveMessageTranslation[];
+ private activeMessageTranslations: ActiveMessageTranslation[] = [];
constructor(
@Inject(Injector) private injector: Injector,
diff --git a/packages/core/src/lib/request/error.interceptor.ts b/packages/core/src/lib/request/error.interceptor.ts
index cceddde761..2ba8f4324d 100644
--- a/packages/core/src/lib/request/error.interceptor.ts
+++ b/packages/core/src/lib/request/error.interceptor.ts
@@ -21,9 +21,16 @@ export class ErrorInterceptor implements HttpInterceptor {
) {}
intercept(
- req: HttpRequest,
+ originalReq: HttpRequest,
next: HttpHandler
): Observable> {
+ const interceptError = originalReq.headers.get('interceptError');
+ const req = originalReq.clone({
+ headers: originalReq.headers.delete('interceptError')
+ });
+ if (interceptError === 'false') {
+ return next.handle(req);
+ }
const errorContainer = { httpError: undefined };
return next.handle(req).pipe(
catchError(error => this.handleError(error, errorContainer)),
diff --git a/packages/geo/src/lib/feature/feature-details/feature-details.component.html b/packages/geo/src/lib/feature/feature-details/feature-details.component.html
index 1597b2819b..4357d104fd 100644
--- a/packages/geo/src/lib/feature/feature-details/feature-details.component.html
+++ b/packages/geo/src/lib/feature/feature-details/feature-details.component.html
@@ -33,7 +33,7 @@
-
+
|
diff --git a/packages/geo/src/lib/layer/layer-legend/layer-legend.component.html b/packages/geo/src/lib/layer/layer-legend/layer-legend.component.html
index d87c097ed0..7aac4dccc6 100644
--- a/packages/geo/src/lib/layer/layer-legend/layer-legend.component.html
+++ b/packages/geo/src/lib/layer/layer-legend/layer-legend.component.html
@@ -27,8 +27,8 @@ {{computeItemTitle(item) | async}}
-
{{'igo.geo.layer.legend.noLegendScale' | translate}}
|