Skip to content

Commit

Permalink
Took into account the case where, in synthese, we can export less tha…
Browse files Browse the repository at this point in the history
…n we can observe.
  • Loading branch information
Christophe-Ramet committed Jan 29, 2025
1 parent 7ee12c8 commit 4f4a6b9
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
4 changes: 2 additions & 2 deletions backend/geonature/utils/config_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ class Synthese(Schema):
# Formats d'export disponibles ["csv", "geojson", "shapefile", "gpkg"]
EXPORT_FORMAT = fields.List(fields.String(), load_default=["csv", "geojson", "shapefile"])
# Nombre max d'observation dans les exports
NB_MAX_OBS_EXPORT = fields.Integer(load_default=50000)
NB_MAX_OBS_EXPORT = fields.Integer(load_default=0)

# --------------------------------------------------------------------
# SYNTHESE - OBSERVATION DETAILS
Expand All @@ -398,7 +398,7 @@ class Synthese(Schema):
EXCLUDED_COLUMNS = fields.List(fields.String(), load_default=[])

# Nombre max d'observation à afficher sur la carte
NB_MAX_OBS_MAP = fields.Integer(load_default=50000)
NB_MAX_OBS_MAP = fields.Integer(load_default=1)
# Clusteriser les layers sur la carte
ENABLE_LEAFLET_CLUSTER = fields.Boolean(load_default=True)
# Nombre des "dernières observations" affichées à l'arrivée sur la synthese
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Téléchargement
</h5>
<h5
*ngIf="tooManyObs"
*ngIf="tooManyObs && !tooManyObsForExport"
class="modal-title"
id="modalLabel"
>
Expand Down Expand Up @@ -46,7 +46,7 @@
</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 +56,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 impossible !</b>
<p>Trop d'observations à exporter.</p>
<p>Un export depuis le modèle de synthèse ne peux dépasser {{ syntheseConfig.NB_MAX_OBS_EXPORT }} observations.
Merci de passer par le module d'export.
</div>

</div>
<div *ngIf="!tooManyObsForExport">
<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 4f4a6b9

Please sign in to comment.