From 776cf7ecab7e5d340f243411fb475354efd6d99a Mon Sep 17 00:00:00 2001 From: appel_c Date: Mon, 10 Feb 2025 13:42:07 +0100 Subject: [PATCH] wip --- .../src/app/core/remote-data.service.ts | 78 +++++++++---------- 1 file changed, 36 insertions(+), 42 deletions(-) diff --git a/frontend/bec_atlas/src/app/core/remote-data.service.ts b/frontend/bec_atlas/src/app/core/remote-data.service.ts index 0a34fe3..bd03dfe 100644 --- a/frontend/bec_atlas/src/app/core/remote-data.service.ts +++ b/frontend/bec_atlas/src/app/core/remote-data.service.ts @@ -104,47 +104,6 @@ export class AuthDataService extends RemoteDataService { } } -@Injectable({ - providedIn: 'root', -}) -export class ScanDataService extends RemoteDataService { - /** - * Method for getting the scan data - * @param sessionId Unique identifier for the session - * @param offset Pagination offset (default = 0) - * @param limit Number of records to retrieve (default = 100) - * @param fields List of fields to include in the response - * @param includeUserData Whether to include user-related data - * @param sort Sort order for the records as a dictionary - * @returns response from the server with the scan data - * @throws HttpErrorResponse if the request fails - * @throws TimeoutError if the request takes too long - */ - getScanData( - sessionId: string, - offset: number = 0, - limit: number = 100, - fields: Array | null = null, - includeUserData: boolean = false, - sort: { [key: string]: number } | null = null - ) { - let headers = new HttpHeaders(); - headers = headers.set('Content-Type', 'application/json; charset=utf-8'); - return this.get>( - 'scans/session', - { - session_id: sessionId, - offset: offset.toString(), - limit: limit.toString(), - fields: fields ? fields : '', - sort: sort ? JSON.stringify(sort) : '', - includeUserData: includeUserData.toString(), - }, - headers - ); - } -} - @Injectable({ providedIn: 'root', }) @@ -184,7 +143,42 @@ export class DeploymentDataService extends RemoteDataService { @Injectable({ providedIn: 'root', }) -export class ScanCountService extends RemoteDataService { +export class ScanDataService extends RemoteDataService { + /** + * Method for getting the scan data + * @param sessionId Unique identifier for the session + * @param offset Pagination offset (default = 0) + * @param limit Number of records to retrieve (default = 100) + * @param fields List of fields to include in the response + * @param includeUserData Whether to include user-related data + * @param sort Sort order for the records as a dictionary + * @returns response from the server with the scan data + * @throws HttpErrorResponse if the request fails + * @throws TimeoutError if the request takes too long + */ + getScanData( + sessionId: string, + offset: number = 0, + limit: number = 100, + fields: Array | null = null, + includeUserData: boolean = false, + sort: { [key: string]: number } | null = null + ) { + let headers = new HttpHeaders(); + headers = headers.set('Content-Type', 'application/json; charset=utf-8'); + return this.get>( + 'scans/session', + { + session_id: sessionId, + offset: offset.toString(), + limit: limit.toString(), + fields: fields ? fields : '', + sort: sort ? JSON.stringify(sort) : '', + includeUserData: includeUserData.toString(), + }, + headers + ); + } /** * Method for getting the scan count * @param sessionId Unique identifier for the session (Optional)