Skip to content

Commit 726c9d4

Browse files
authored
fixes the status column on RHOSO tab (#291)
the status column displaying the wrong status as others instead of success this PR transform the right value using the constant map and help to display the right value. Fixes issue #290
1 parent 7493013 commit 726c9d4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

backend/app/api/v1/commons/oso.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
import pandas as pd
44

5-
from app.api.v1.commons.constants import OSO_FIELD_CONSTANT_DICT
5+
from app.api.v1.commons.constants import (
6+
JOB_STATUS_MAP,
7+
JOB_STATUS_OTHERS,
8+
OSO_FIELD_CONSTANT_DICT,
9+
)
610
import app.api.v1.commons.utils as utils
711
from app.services.search import ElasticService
812

@@ -51,6 +55,13 @@ async def getData(
5155
if len(jobs) == 0:
5256
return {"data": jobs, "total": response["total"]}
5357

58+
jobs["jobStatus"] = jobs["jobStatus"].apply(
59+
lambda v: (
60+
JOB_STATUS_MAP.get(str(v).lower(), JOB_STATUS_OTHERS)
61+
if pd.notna(v) and str(v).strip()
62+
else JOB_STATUS_OTHERS
63+
)
64+
)
5465
return {"data": jobs, "total": response["total"]}
5566

5667

backend/tests/functional/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
script this from outside the pod; so we run this little Python program
99
inside the Opensearch container.
1010
"""
11+
1112
import os
1213
import time
1314

0 commit comments

Comments
 (0)