@@ -3,6 +3,7 @@ import {useNavigate} from "react-router";
33import { Card , CardContent , CardDescription , CardHeader , CardTitle } from "@/components/Card"
44import { GitBranch } from "lucide-react" ;
55import { useTranslation } from "react-i18next" ;
6+ import { TaskStatus } from "@/pages/DataCleansing/cleansing.model" ;
67
78export default function OperatorTable ( { task } : { task : any } ) {
89 const navigate = useNavigate ( ) ;
@@ -83,23 +84,27 @@ export default function OperatorTable({ task }: { task: any }) {
8384 dataIndex : "status" ,
8485 key : "status" ,
8586 filters : [
86- { text : t ( "dataCleansing.detail.operatorTable.completed" ) , value : t ( "dataCleansing.detail.operatorTable.completed" ) } ,
87- { text : t ( "dataCleansing.detail.operatorTable.failed" ) , value : t ( "dataCleansing.detail.operatorTable.failed" ) } ,
88- { text : t ( "dataCleansing.detail.operatorTable.running" ) , value : t ( "dataCleansing.detail.operatorTable.running" ) } ,
87+ { text : t ( "dataCleansing.detail.operatorTable.completed" ) , value : "completed" } ,
88+ { text : t ( "dataCleansing.detail.operatorTable.failed" ) , value : "failed" } ,
89+ { text : t ( "dataCleansing.detail.operatorTable.running" ) , value : "running" } ,
90+ { text : t ( "dataCleansing.detail.operatorTable.partialSuccess" ) , value : "partialSuccess" } ,
8991 ] ,
90- onFilter : ( value : string , record : any ) => record . status === value ,
91- render : ( status : string ) => (
92- < Badge
93- status = {
94- status === t ( "dataCleansing.detail.operatorTable.completed" )
95- ? "success"
96- : status === t ( "dataCleansing.detail.operatorTable.running" )
97- ? "processing"
98- : "error"
99- }
100- text = { status }
101- />
102- ) ,
92+ onFilter : ( value : string , record : any ) => record . statusValue === value ,
93+ render : ( statusObj : { label : string ; value : TaskStatus } ) => {
94+ let badgeStatus : "default" | "processing" | "success" | "error" | "warning" = "default" ;
95+
96+ if ( statusObj ?. value === TaskStatus . COMPLETED ) {
97+ badgeStatus = "success" ;
98+ } else if ( statusObj ?. value === TaskStatus . RUNNING ) {
99+ badgeStatus = "processing" ;
100+ } else if ( statusObj ?. value === TaskStatus . PARTIAL_SUCCESS ) {
101+ badgeStatus = "warning" ;
102+ } else if ( statusObj ?. value === TaskStatus . FAILED ) {
103+ badgeStatus = "error" ;
104+ }
105+
106+ return < Badge status = { badgeStatus } text = { statusObj ?. label } /> ;
107+ } ,
103108 } ,
104109 ]
105110
@@ -114,7 +119,7 @@ export default function OperatorTable({ task }: { task: any }) {
114119 < CardDescription > { t ( "dataCleansing.detail.operatorTable.description" ) } </ CardDescription >
115120 </ CardHeader >
116121 < CardContent >
117- < Table
122+ < Table
118123 columns = { operatorColumns }
119124 dataSource = { Object . values ( task ?. instance ) . map ( ( item ) => ( {
120125 id : item ?. id ,
@@ -124,7 +129,8 @@ export default function OperatorTable({ task }: { task: any }) {
124129 ? new Date ( task . finishedAt ) . toLocaleTimeString ( )
125130 : '-' ,
126131 duration : task . duration ,
127- status : task . status . label ,
132+ status : task . status ,
133+ statusValue : task . status . value ,
128134 processedFiles : task . progress . finishedFileNum ,
129135 successRate : task ?. progress . successRate ,
130136 } ) ) }
0 commit comments