同步记录列表增加状态显示

This commit is contained in:
谢思 2024-05-08 14:11:05 +08:00
parent dbd1904b5a
commit 33bc4686bd
2 changed files with 9 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import React, {useState} from "react";
import { Table, Modal, Button, message, Breadcrumb, Divider } from 'antd';
import { Table, Breadcrumb, Divider } from 'antd';
import { Link } from "react-router-dom";
// import gitHub1 from '../../img/github2.svg';
// import gitee1 from '../../img/gitee1.svg';
@ -9,6 +9,7 @@ import '../index.scss';
import { useEffect } from "react";
import axios from "axios";
import Nodata from "../../../Nodata";
import { sync_status } from "./storeList";
function RecordList(props){
const { owner, projectsId, type, syncIds } = props.match.params;
@ -47,6 +48,7 @@ function RecordList(props){
{ title: '序号', dataIndex: 'index', className:"recordColumns", render: (text, item, index) => <span>{(current-1)*pageSize+index + 1}</span> },
{ title: '代码变更方', dataIndex: 'change_from', className:"recordColumns"},
{ title: '同步时间', dataIndex: 'sync_time', className:"recordColumns"},
{ title: '同步状态', dataIndex: 'sync_status', className:"recordColumns", render: (text)=>sync_status(text)},
{ title: 'commit id', dataIndex: 'commit_id', className:"primaryColor recordColumns"},
{ title: '同步日志', dataIndex: 'action', align: 'center', className:"primaryColor recordColumns"},
]
@ -99,7 +101,7 @@ function RecordList(props){
columns={columns}
dataSource={data.logs}
expandedRowRender={expandRow}
expandIconColumnIndex={4}
expandIconColumnIndex={5}
expandIconAsCell={false}
expandIcon={customExpandIcon}
rowKey={'id'}

View File

@ -17,6 +17,10 @@ export function unique(arr) {
return arr.filter((item) => !data.has(item.type) && data.set(item.type, 1))
}
export const sync_status = (status) =>{
return status === "failure" ? <Badge status="error" text="失败" className="deleteRecord"/> : status === "success" ? <Badge status="success" text="成功" className="success"/> : ""
}
function StoreList(props){
const { storeDetail, form, reflushRepos} = props;
const { getFieldDecorator, validateFields , setFieldsValue, setFields, getFieldsValue } = form;
@ -126,7 +130,7 @@ function StoreList(props){
</span> },
{ title: 'GitLink分支', dataIndex: 'gitlink_branch_name', className:"recordColumns"},
{ title: '最后一次同步时间', dataIndex: 'sync_time', className:"primaryColor recordColumns"},
{ title: '同步状态', dataIndex: 'sync_status', className:"recordColumns", render: (text)=>text === "failure" ? <Badge status="error" text="失败" className="deleteRecord"/> : text === "success" ? <Badge status="success" text="成功" className="success"/> : ""},
{ title: '同步状态', dataIndex: 'sync_status', className:"recordColumns", render: (text)=>sync_status(text)},
{ title: '操作', dataIndex: 'enable', align: 'center', className:"primaryColor recordColumns", render: (text, item)=>{
const branch = item[platform === 'GitHub' ? 'github_branch': 'gitee_branch']
return <div>