From 169d1db5ea6cf266d54aadcd2acaa8fdf044a0d1 Mon Sep 17 00:00:00 2001 From: Denis Coric Date: Fri, 20 Dec 2024 13:38:12 +0100 Subject: [PATCH] WIP: Enable pagination --- web/src/app/services/scheduler/scheduler.service.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/web/src/app/services/scheduler/scheduler.service.ts b/web/src/app/services/scheduler/scheduler.service.ts index 6b2a2ae..55a9788 100644 --- a/web/src/app/services/scheduler/scheduler.service.ts +++ b/web/src/app/services/scheduler/scheduler.service.ts @@ -13,8 +13,8 @@ import { SchedulerResourceInfo } from '@app/models/resource-info.model'; import { SchedulerHealthInfo } from '@app/models/scheduler-health-info.model'; import { CommonUtil } from '@app/utils/common.util'; import { NOT_AVAILABLE } from '@app/utils/constants'; -import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { Observable, of } from 'rxjs'; +import { map, catchError } from 'rxjs/operators'; import { EnvConfigService } from '../envconfig/envconfig.service'; @Injectable({ @@ -68,8 +68,8 @@ export class SchedulerService { ); } - fetchAppList(partitionId: string, queueId: string): Observable { - const appsUrl = `${this.envConfig.getUHSWebAddress()}/v1/partition/${partitionId}/queue/${queueId}/applications`; + fetchAppList(partitionId: string, queueId: string, offset: number = 0, limit: number = 10): Observable { + const appsUrl = `${this.envConfig.getUHSWebAddress()}/v1/partition/${partitionId}/queue/${queueId}/applications?limit=${limit}&offset=${offset}`; return this.httpClient.get(appsUrl).pipe( map((data: any) => { const result: AppInfo[] = []; @@ -132,6 +132,10 @@ export class SchedulerService { } return result; + }), + catchError((error) => { + console.error('Error fetching app list:', error); + return of([]); }) ); }