Spaces:
Running
Running
Update flare-ui/src/app/components/activity-log/activity-log.component.ts
Browse files
flare-ui/src/app/components/activity-log/activity-log.component.ts
CHANGED
@@ -252,17 +252,28 @@ export class ActivityLogComponent implements OnInit {
|
|
252 |
this.loading = true;
|
253 |
this.currentPage = page;
|
254 |
|
255 |
-
|
256 |
-
|
|
|
|
|
|
|
257 |
).subscribe({
|
258 |
next: (response) => {
|
259 |
-
|
260 |
-
|
261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
this.loading = false;
|
263 |
},
|
264 |
error: (error) => {
|
265 |
console.error('Failed to load activities:', error);
|
|
|
266 |
this.loading = false;
|
267 |
}
|
268 |
});
|
|
|
252 |
this.loading = true;
|
253 |
this.currentPage = page;
|
254 |
|
255 |
+
// Backend sadece limit parametresi alıyor, page almıyor
|
256 |
+
const limit = this.pageSize * page; // Toplam kaç kayıt istediğimizi hesapla
|
257 |
+
|
258 |
+
this.http.get<ActivityLog[]>(
|
259 |
+
`/api/activity-log?limit=${limit}`
|
260 |
).subscribe({
|
261 |
next: (response) => {
|
262 |
+
// Response direkt array olarak geliyor
|
263 |
+
const allActivities = response || [];
|
264 |
+
|
265 |
+
// Manuel pagination yap
|
266 |
+
const startIndex = (page - 1) * this.pageSize;
|
267 |
+
const endIndex = startIndex + this.pageSize;
|
268 |
+
|
269 |
+
this.activities = allActivities.slice(startIndex, endIndex);
|
270 |
+
this.totalItems = allActivities.length;
|
271 |
+
this.totalPages = Math.ceil(allActivities.length / this.pageSize);
|
272 |
this.loading = false;
|
273 |
},
|
274 |
error: (error) => {
|
275 |
console.error('Failed to load activities:', error);
|
276 |
+
this.activities = []; // Hata durumunda boş array
|
277 |
this.loading = false;
|
278 |
}
|
279 |
});
|