diff --git a/src/app/core/components/feedback/feedback.component.html b/src/app/core/components/feedback/feedback.component.html index 752b8b2bbb2cbed951c47ce5ae0cdf5168029d60..4573b248d1c675fcb01a522db297274420e30159 100644 --- a/src/app/core/components/feedback/feedback.component.html +++ b/src/app/core/components/feedback/feedback.component.html @@ -1,17 +1,19 @@ -<button tabindex="0" class="feedback-header" (click)="toogle()" [ngClass]="{'expended': isExpended, 'closed': shouldBeAnimated}"> - <svg xmlns="http://www.w3.org/2000/svg" id="chevron" viewBox="0 0 15 9"> - <path d="M7.5 7.5c-.1 0-.3-.1-.4-.1l-6-6C1 1.1 1 .8 1.1.6s.5-.2.7 0l5.6 5.6L13 .6c.2-.2.5-.2.7 0s.2.5 0 .7l-6 6c.1.1-.1.2-.2.2z" - class="brandcolor" /> - <path d="M7.5 7.5c-.1 0-.3-.1-.4-.1l-6-6C1 1.1 1 .8 1.1.6s.5-.2.7 0l5.6 5.6L13 .6c.2-.2.5-.2.7 0s.2.5 0 .7l-6 6c.1.1-.1.2-.2.2z" - class="brandcolor" /> - </svg> - <span i18n="@@feedback.giveYourFeedback">Gives us your opinion</span> -</button> -<form [formGroup]="feedbackForm" (ngSubmit)="sendFeedback()" [ngClass]="{'expended': isExpended, 'closed': shouldBeAnimated}"> - <textarea id="message" formControlName="message" [placeholder]="feedback.placeholder"></textarea> - <div class="action"> - <button type="submit" class="button" i18n="@@feedback.send" [disabled]="feedbackForm.invalid"> - Send - </button> - </div> -</form> +<div class="feedback-container"> + <button tabindex="0" class="feedback-header" (click)="toogle()" [ngClass]="{'expended': isExpended, 'closed': shouldBeAnimated}"> + <svg xmlns="http://www.w3.org/2000/svg" id="chevron" viewBox="0 0 15 9"> + <path d="M7.5 7.5c-.1 0-.3-.1-.4-.1l-6-6C1 1.1 1 .8 1.1.6s.5-.2.7 0l5.6 5.6L13 .6c.2-.2.5-.2.7 0s.2.5 0 .7l-6 6c.1.1-.1.2-.2.2z" + class="brandcolor" /> + <path d="M7.5 7.5c-.1 0-.3-.1-.4-.1l-6-6C1 1.1 1 .8 1.1.6s.5-.2.7 0l5.6 5.6L13 .6c.2-.2.5-.2.7 0s.2.5 0 .7l-6 6c.1.1-.1.2-.2.2z" + class="brandcolor" /> + </svg> + <span i18n="@@feedback.giveYourFeedback">Gives us your opinion</span> + </button> + <form [formGroup]="feedbackForm" (ngSubmit)="sendFeedback()" [ngClass]="{'expended': isExpended, 'closed': shouldBeAnimated}"> + <textarea id="message" formControlName="message" [placeholder]="feedback.placeholder"></textarea> + <div class="action"> + <button type="submit" class="button" i18n="@@feedback.send" [disabled]="feedbackForm.invalid"> + Send + </button> + </div> + </form> +</div> diff --git a/src/app/core/components/notifications/notifications.component.scss b/src/app/core/components/notifications/notifications.component.scss index 5380e0399e9f5d170f96614a74586b39587e5312..0888fb53f0e6bb905f8ba2f20a66931a15dc386a 100644 --- a/src/app/core/components/notifications/notifications.component.scss +++ b/src/app/core/components/notifications/notifications.component.scss @@ -4,7 +4,7 @@ $app-notification-width: 29rem; .app-notifications { position: fixed; - z-index: 1; + z-index: 10; bottom: 0.5rem; right: 0.5rem; diff --git a/src/app/geosource/components/dataset-detail/dataset-detail.component.html b/src/app/geosource/components/dataset-detail/dataset-detail.component.html index 2253de5795763989289096c93e59e6282c31f230..ed7db459004034c44638202ad8c845f50c83c2bf 100644 --- a/src/app/geosource/components/dataset-detail/dataset-detail.component.html +++ b/src/app/geosource/components/dataset-detail/dataset-detail.component.html @@ -1,7 +1,7 @@ <div class="page-details-background-image"></div> <div class="page-container has-white-background" *ngIf="metadata" [ngClass]="{'blury' : isLoading}"> <div class="details-header"> - <app-page-header [pageInfo]="pageHeaderInfo"></app-page-header> + <app-page-header [pageInfo]="pageHeaderInfo" [customGoToPreviousPage]="goToPreviousPage"></app-page-header> </div> <div class="tabulations"> diff --git a/src/app/geosource/components/results/result-dataset/result-dataset.component.ts b/src/app/geosource/components/results/result-dataset/result-dataset.component.ts index e576141954c6eeabc31e174d7b858bfe414353c2..f01dd90521bfc84d8c3779e651203d23c472c124 100644 --- a/src/app/geosource/components/results/result-dataset/result-dataset.component.ts +++ b/src/app/geosource/components/results/result-dataset/result-dataset.component.ts @@ -21,8 +21,6 @@ export class ResultDatasetComponent implements OnInit { constructor() { } - ngOnInit() { - console.log(this.dataset.metadata.type); - } + ngOnInit() {} } diff --git a/src/app/map/services/map.service.ts b/src/app/map/services/map.service.ts index 570d6770ad36d02d9e2d6539b2c51a085255634f..48cd62fc563fc13f7e09c2620885973344afc088 100644 --- a/src/app/map/services/map.service.ts +++ b/src/app/map/services/map.service.ts @@ -1,9 +1,9 @@ import { Injectable } from '@angular/core'; -import { Observable, Subject, BehaviorSubject, of } from 'rxjs'; +import { Observable, Subject, BehaviorSubject, of, fromEvent, Subscription } from 'rxjs'; import { Metadata, IMetadataLink } from '../../geosource/models'; import { Notification } from '../../core/models'; import * as mapboxgl from 'mapbox-gl'; -import { map, catchError } from 'rxjs/operators'; +import { map, catchError, debounceTime } from 'rxjs/operators'; import { ElasticsearchService } from '../../geosource/services/elasticsearch.service'; import { NotificationService } from '../../core/services'; import { notificationMessages } from '../../../i18n/traductions.fr'; @@ -37,6 +37,7 @@ export class MapService { private _mapSubject = new Subject<any>(); private _panelState = new BehaviorSubject<any>({ state: false }); + private _errorSubscription: Subscription; selectedFeature; // Contains the gid of the selected feature @@ -66,11 +67,20 @@ export class MapService { this.selectedBaseLayer = baseLayer; this.url = url; - this._map = new mapboxgl.Map(options).on('error', (error) => { - this._notificationService.notify(new Notification({ - message: notificationMessages.geosource.mapError, - type: 'error', - })); + this._map = new mapboxgl.Map(options); + + // Create an observable from the map error event and only emit after 1s in order + // to avoid to many error at the same time + const errorObservable = fromEvent(this._map, 'error').pipe(debounceTime(1000)); + + // Subscribe to the error observable and send a notification + this._errorSubscription = errorObservable.subscribe((v) => { + this._notificationService.notify( + new Notification({ + message: notificationMessages.geosource.mapError, + type: 'error', + }), + ); }); if (addControls) { @@ -458,6 +468,7 @@ export class MapService { destroyMap() { this._map.remove(); + this._errorSubscription.unsubscribe(); } switch3DLayer() { diff --git a/src/app/shared/components/page-header/page-header.component.ts b/src/app/shared/components/page-header/page-header.component.ts index 3166c6e3ce8d934a71d8988783e7d5f943d8add5..e5bb17ba867315d6ae3a6eaab4ce84b1423a457b 100644 --- a/src/app/shared/components/page-header/page-header.component.ts +++ b/src/app/shared/components/page-header/page-header.component.ts @@ -17,19 +17,24 @@ export class PageHeaderComponent implements OnInit { ) { } @Input() pageInfo: IPageHeaderInfo; + @Input() customGoToPreviousPage: any; ngOnInit() { } goToPreviousPage() { - const index = 1; // Start to retrieve the previous element - let url = this._navigationHistoryService.getFromLast(index); + if (this.customGoToPreviousPage) { + this.customGoToPreviousPage(); + } else { + const index = 1; // Start to retrieve the previous element + let url = this._navigationHistoryService.getFromLast(index); - // If url is null then redirect to home page - if (url == null) { - url = `/${AppRoutes.home.uri}`; + // If url is null then redirect to home page + if (url == null) { + url = `/${AppRoutes.home.uri}`; + } + this._router.navigateByUrl(url); } - this._router.navigateByUrl(url); } }