load 3000 events
This commit is contained in:
parent
65d990af12
commit
fd2d51b662
4 changed files with 248 additions and 3 deletions
|
|
@ -40,7 +40,11 @@ export class Home implements OnInit, OnDestroy {
|
|||
showTable = false;
|
||||
showFilters = false;
|
||||
showEditForm = true;
|
||||
|
||||
selectionMode: 'none' | 'rectangle' | 'polygon' = 'none';
|
||||
selectedIds: Array<string | number> = [];
|
||||
batchAction: 'none' | 'changeWhat' | 'delete' = 'none';
|
||||
batchWhat = '';
|
||||
|
||||
// Nouvelles propriétés pour le rechargement automatique et la sélection de jours
|
||||
autoReloadEnabled = true;
|
||||
autoReloadInterval: any = null;
|
||||
|
|
@ -81,7 +85,7 @@ export class Home implements OnInit, OnDestroy {
|
|||
const params = {
|
||||
start: today.toISOString().split('T')[0],
|
||||
end: endDate.toISOString().split('T')[0],
|
||||
limit: 1000
|
||||
limit: 3000
|
||||
};
|
||||
|
||||
this.OedbApi.getEvents(params).subscribe((events: any) => {
|
||||
|
|
@ -226,6 +230,52 @@ export class Home implements OnInit, OnDestroy {
|
|||
this.loadEvents();
|
||||
}
|
||||
|
||||
// Selection from map
|
||||
onSelection(ids: Array<string | number>) {
|
||||
this.selectedIds = ids;
|
||||
}
|
||||
|
||||
startRectSelection() {
|
||||
this.selectionMode = this.selectionMode === 'rectangle' ? 'none' : 'rectangle';
|
||||
}
|
||||
startPolySelection() {
|
||||
this.selectionMode = this.selectionMode === 'polygon' ? 'none' : 'polygon';
|
||||
}
|
||||
clearSelection() {
|
||||
this.selectionMode = 'none';
|
||||
this.selectedIds = [];
|
||||
this.batchAction = 'none';
|
||||
this.batchWhat = '';
|
||||
}
|
||||
|
||||
async applyBatch() {
|
||||
if (!this.selectedIds.length || this.batchAction === 'none') return;
|
||||
if (this.batchAction === 'delete') {
|
||||
for (const id of this.selectedIds) {
|
||||
await new Promise<void>((resolve) => {
|
||||
this.OedbApi.deleteEvent(id).subscribe({ next: () => resolve(), error: () => resolve() });
|
||||
});
|
||||
}
|
||||
this.loadEvents();
|
||||
this.clearSelection();
|
||||
return;
|
||||
}
|
||||
if (this.batchAction === 'changeWhat') {
|
||||
const what = this.batchWhat.trim();
|
||||
if (!what) return;
|
||||
for (const id of this.selectedIds) {
|
||||
const feature = this.features.find(f => (f?.properties?.id ?? f?.id) === id);
|
||||
if (!feature) continue;
|
||||
const updated = { ...feature, properties: { ...feature.properties, what } };
|
||||
await new Promise<void>((resolve) => {
|
||||
this.OedbApi.updateEvent(id, updated).subscribe({ next: () => resolve(), error: () => resolve() });
|
||||
});
|
||||
}
|
||||
this.loadEvents();
|
||||
this.clearSelection();
|
||||
}
|
||||
}
|
||||
|
||||
onCanceled() {
|
||||
this.showEditForm = false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue