diff --git a/backend/app/api/v1/commons/hce.py b/backend/app/api/v1/commons/hce.py index a9bc0a1f..0b367d29 100644 --- a/backend/app/api/v1/commons/hce.py +++ b/backend/app/api/v1/commons/hce.py @@ -24,8 +24,10 @@ async def getData(start_datetime: date, end_datetime: date, size: int, offset: i await es.close() tasks = [item['_source'] for item in response['data']] jobs = pd.json_normalize(tasks) + if len(jobs) == 0: + return({'data':jobs, 'total': response['total']}) + jobs[['group']] = jobs[['group']].fillna(0) jobs.fillna('', inplace=True) - if len(jobs) == 0: - return({'data':jobs, 'total': 0}) + return ({'data':jobs, 'total': response['total']}) diff --git a/backend/app/api/v1/commons/ocm.py b/backend/app/api/v1/commons/ocm.py index 15b23bea..066c7b30 100644 --- a/backend/app/api/v1/commons/ocm.py +++ b/backend/app/api/v1/commons/ocm.py @@ -26,7 +26,7 @@ async def getData(start_datetime: date, end_datetime: date, size:int, offset:int tasks = [item['_source'] for item in response['data']] jobs = pd.json_normalize(tasks) if len(jobs) == 0: - return {"data":jobs,"total": 0} + return {"data":jobs,"total": response["total"]} if 'buildUrl' not in jobs.columns: jobs.insert(len(jobs.columns), "buildUrl", "") diff --git a/backend/app/api/v1/commons/ocp.py b/backend/app/api/v1/commons/ocp.py index d682a787..a92c3296 100644 --- a/backend/app/api/v1/commons/ocp.py +++ b/backend/app/api/v1/commons/ocp.py @@ -27,7 +27,8 @@ async def getData(start_datetime: date, end_datetime: date, size:int, offset:int tasks = [item['_source'] for item in response["data"]] jobs = pd.json_normalize(tasks) if len(jobs) == 0: - return ({'data':jbs, 'total': 0}) + return ({'data':jobs, 'total': response['total']}) + jobs[['masterNodesCount', 'workerNodesCount', 'infraNodesCount', 'totalNodesCount']] = jobs[['masterNodesCount', 'workerNodesCount', 'infraNodesCount', 'totalNodesCount']].fillna(0) jobs.fillna('', inplace=True) diff --git a/backend/app/api/v1/commons/quay.py b/backend/app/api/v1/commons/quay.py index d98e1f69..9ecf1a75 100644 --- a/backend/app/api/v1/commons/quay.py +++ b/backend/app/api/v1/commons/quay.py @@ -27,7 +27,7 @@ async def getData(start_datetime: date, end_datetime: date, size, offset, config tasks = [item['_source'] for item in response['data']] jobs = pd.json_normalize(tasks) if len(jobs) == 0: - return ({'data':jbs, 'total': 0}) + return ({'data':jobs, 'total': response['total']}) jobs[['masterNodesCount', 'workerNodesCount', 'infraNodesCount', 'totalNodesCount']] = jobs[['masterNodesCount', 'workerNodesCount', 'infraNodesCount', 'totalNodesCount']].fillna(0) diff --git a/backend/app/api/v1/commons/telco.py b/backend/app/api/v1/commons/telco.py index 199cd181..55316bca 100644 --- a/backend/app/api/v1/commons/telco.py +++ b/backend/app/api/v1/commons/telco.py @@ -65,7 +65,5 @@ async def getData(start_datetime: date, end_datetime: date, size: int, offset: i }) jobs = pd.json_normalize(mapped_list) - if len(jobs) == 0: - return {'data':jobs, 'total': 0} - return {'data':jobs, 'total':response['total']} + return {'data':jobs, 'total': response['total']}