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

93 lines
2.4 KiB
React
Raw Normal View History

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