Skip to content

Commit

Permalink
fix(synthese): Added a warning message on a special case in synthese
Browse files Browse the repository at this point in the history
Added a message when the max number of observation was greater than the max number of export.
  • Loading branch information
Christophe-Ramet committed Feb 3, 2025
1 parent 9b6fdfc commit 9bcb079
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@
<b>seulement</b>
les {{ syntheseConfig.NB_MAX_OBS_MAP }} dernières observations correspondant à votre requête.
</div>

<div
*ngIf="syntheseConfig.NB_MAX_OBS_EXPORT > syntheseConfig.NB_MAX_OBS_MAP"
*ngIf="!tooManyObsForExport"
class="alert alert-warning"
role="alert"
>
Expand All @@ -56,7 +55,19 @@
</div>
</div>

<div *ngIf="!tooManyObs || syntheseConfig.NB_MAX_OBS_EXPORT > syntheseConfig.NB_MAX_OBS_MAP">
<div *ngIf="tooManyObsForExport">
<div
class="alert alert-danger"
role="alert"
>
<b>Export Limité !</b>
<p>Trop d'observations à exporter.</p>
<p>En exportant les données, vous ne pourrez télécharger que les <b>{{ syntheseConfig.NB_MAX_OBS_EXPORT }}</b> observations
les plus récentes.
</div>

</div>
<div >
<div class="my-3 pt-2">
<h5 class="second-color">Télécharger les observations</h5>
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class SyntheseModalDownloadComponent {
public syntheseConfig = null;

@Input() tooManyObs = false;

@Input() tooManyObsForExport = false;
constructor(
public activeModal: NgbActiveModal,
public _dataService: SyntheseDataService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { CruvedStoreService } from '@geonature_common/service/cruved-store.servi
import { SyntheseInfoObsComponent } from '@geonature/shared/syntheseSharedModule/synthese-info-obs/synthese-info-obs.component';
import { ConfigService } from '@geonature/services/config.service';
import { FormArray, FormControl } from '@angular/forms';
import {SyntheseStoreService} from "@geonature/syntheseModule/services/store.service";
@Component({
selector: 'pnx-synthese-list',
templateUrl: 'synthese-list.component.html',
Expand Down Expand Up @@ -53,7 +54,8 @@ export class SyntheseListComponent implements OnInit, OnChanges, AfterContentChe
public sanitizer: DomSanitizer,
public ref: ChangeDetectorRef,
public _cruvedStore: CruvedStoreService,
public config: ConfigService
public config: ConfigService,
private _syntheseStore: SyntheseStoreService
) {
this.SYNTHESE_CONFIG = this.config.SYNTHESE;
}
Expand Down Expand Up @@ -167,9 +169,10 @@ export class SyntheseListComponent implements OnInit, OnChanges, AfterContentChe
}

openDownloadModal() {
this.ngbModal.open(SyntheseModalDownloadComponent, {
const modalRef = this.ngbModal.open(SyntheseModalDownloadComponent, {
size: 'lg',
});
modalRef.componentInstance.tooManyObsForExport = (this._syntheseStore.idSyntheseList.length > this.config.SYNTHESE.NB_MAX_OBS_EXPORT)
}

getRowClass() {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/syntheseModule/synthese.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export class SyntheseComponent implements OnInit {
});
modalRef.componentInstance.queryString = this.searchService.buildQueryUrl(formParams);
modalRef.componentInstance.tooManyObs = true;
modalRef.componentInstance.tooManyObsForExport = (this._syntheseStore.idSyntheseList.length > this.config.SYNTHESE.NB_MAX_OBS_EXPORT)
}

// Store geojson
Expand Down

0 comments on commit 9bcb079

Please sign in to comment.