From cbc34891ca8bab4954848dce0fdd0123377cff95 Mon Sep 17 00:00:00 2001
From: caishi <1149225589@qq.com>
Date: Wed, 19 Apr 2023 11:29:42 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE-webhooks=E5=88=86=E9=A1=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Settings/Webhooks/sub/PushHistory.jsx | 28 +++++++++++++++----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/src/forge/Settings/Webhooks/sub/PushHistory.jsx b/src/forge/Settings/Webhooks/sub/PushHistory.jsx
index b9c6a462b..f375f33f7 100644
--- a/src/forge/Settings/Webhooks/sub/PushHistory.jsx
+++ b/src/forge/Settings/Webhooks/sub/PushHistory.jsx
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
-import { Button, Collapse , Tooltip , Spin } from 'antd';
+import { Button, Collapse , Tooltip , Spin , Pagination } from 'antd';
import axios from 'axios';
import Content from './historyContent';
import Fault from '../images/fault.png';
@@ -8,21 +8,30 @@ const { Panel } = Collapse;
function PushHistory({id,owner,projectsId,showNotification}) {
const [ list , setList ] = useState(undefined);
const [ isSpin , setIsSpin ] = useState(false);
+ const [ page , setPage ] = useState(1);
+ const [ total , setTotal ] = useState(0);
+ const pageSize = 10;
useEffect(()=>{
if(id && owner && projectsId){
- Init();
+ Init(1);
}
},[id,owner,projectsId])
- function Init() {
+ useEffect(()=>{
+ setList(undefined)
+ Init(page);
+ },[page])
+
+ function Init(page) {
const url = `/${owner}/${projectsId}/webhooks/${id}/tasks.json`;
axios.get(url,{
- params:{page:1,limit:10}
+ params:{page:page,limit:pageSize}
}).then(result=>{
if(result && result.data){
setList(result.data.tasks);
setIsSpin(false);
+ setTotal(result.data.total_count);
}
}).catch(error=>{})
}
@@ -49,7 +58,7 @@ function PushHistory({id,owner,projectsId,showNotification}) {
{
- list && list.length>0 &&
+ list && list.length>0 ?