forgeplus-react/src/forge/DevOps/Dispose/List.jsx

97 lines
2.6 KiB
JavaScript

import React from 'react';
import { Table , Popconfirm } from 'antd';
import { Link } from 'react-router-dom';
const STATUS = {
running:"运行中",
failure:"未通过",
error:"未通过",
success:"已通过",
killed:"已撤销",
pending:"准备中"
}
function List({ list, operate , projectsId , owner , showModal , deleteFunc }){
const columns = [
{
title:"流水线名称",
dataIndex:"pipeline_name",
key:1,
ellipsis:true,
render:(txt,item)=>{
return(
<span onDoubleClick={()=>showModal(txt,item.id,item.branch,item.event)} style={{display:"block",cursor:"pointer"}}>{txt}</span>
)
}
},
{
title:"文件名称",
dataIndex:"file_name",
key:1,
width:"15%",
ellipsis:true,
render:(value,item)=>{
return(
<Link to={`/projects/${owner}/${projectsId}/branch/${item.branch}?url=${value}`} className="color-blue">{value}</Link>
)
}
},
{
title:"触发分支",
dataIndex:"branch",
key:1,
width:"10%",
ellipsis:true
},
{
title:"触发事件",
dataIndex:"event",
key:1,
width:"10%",
ellipsis:true
},
{
title:"最近构建时间",
dataIndex:"last_build_time",
key:1,
width:"15%",
ellipsis:true
},
{
title:"最近构建状态",
dataIndex:"pipeline_status",
key:1,
width:"10%",
ellipsis:true,
render:(txt)=>{
return(STATUS[txt])
}
},
{
title:"操作",
dataIndex:"operation",
key:1,
width:"21%",
render:(txt,item)=>{
return(
<span>
{ operate ?
<Link to={`/projects/${owner}/${projectsId}/devops/dispose/${item.id}`} className="mr10 color-grey-6">
<i className="iconfont icon-zaibianji font-13 mr3"></i></Link> :""
}
{ operate ?
<Popconfirm title={"确定要删除此流水线?"} onConfirm={()=>deleteFunc(item.id)} okText="确定" cancelText={"取消"}>
<a className="mr10 color-grey-6"><i className="iconfont icon-lajitong font-13 mr3"></i></a>
</Popconfirm>:""
}
<Link to={`/projects/${owner}/${projectsId}/devops/list/${item.branch}`} className="color-grey-6"><i className="iconfont icon-yunhang font-13 mr3"></i></Link>
</span>
)
}
}
]
return(
<Table size="small" columns={columns} dataSource={list} rowKey={(row)=>row.id} pagination={false}></Table>
)
}
export default List;