From ff70c92c4bb21b84e103ea6653729e261892b4cd Mon Sep 17 00:00:00 2001 From: root Date: Mon, 21 Apr 2025 17:29:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E6=B0=B4=E7=BA=BF=E5=8D=A1=E7=89=87?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=B7=BB=E5=8A=A0=E7=BF=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/DevOps/cardList/index.jsx | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/forge/DevOps/cardList/index.jsx b/src/forge/DevOps/cardList/index.jsx index 93faf13da..06693a032 100644 --- a/src/forge/DevOps/cardList/index.jsx +++ b/src/forge/DevOps/cardList/index.jsx @@ -1,4 +1,4 @@ -import { message, Popover, Button, Divider, Switch, Modal } from "antd"; +import { message, Popover, Button, Divider, Switch, Modal, Pagination } from "antd"; import React, { useEffect, useState } from "react"; import './index.scss'; import { secondsToTimeFormat, timeAgo } from "../../../common/DateUtil"; @@ -13,13 +13,15 @@ function CardDevops(props) { const {owner, projectsId} = match.params; const [list, setList] = useState([]) const [ visible , setVisible ] = useState(false); + const [ pageNum , setPageNum ] = useState(1); + const [ total , setTotal ] = useState(0); + const pageSize = 20; -let settings = JSON.parse(localStorage.chromesetting); -let pipelineUrl = settings && settings.common.pipeline; + let settings = JSON.parse(localStorage.chromesetting); + let pipelineUrl = settings && settings.common.pipeline; useEffect(() => { - const { author, name } = project || {} document.title = `流水线-${owner}/${projectsId}`; }, []) @@ -29,15 +31,16 @@ let pipelineUrl = settings && settings.common.pipeline; getList(); }, 10000); return () => clearInterval(intervalId); - }, []) + }, [pageNum]) function getList(){ - getCardList(owner, projectsId).then(res => { + getCardList(owner, projectsId, { limit: pageSize, page: pageNum }).then(res => { if (res.status === 0) { setList(res.pipelines.map(e => { e.run_data = e.run_data || {} return e })) + setTotal(res.count) } }) } @@ -151,6 +154,18 @@ let pipelineUrl = settings && settings.common.pipeline; })} {list && !list.length &&
} + { + total > pageSize && +
+ +
+ } }