b8db7f3b73
CI/CD Pipeline / Check if frontend-only change (push) Has been cancelled
CI/CD Pipeline / Validate - Code Quality (push) Has been cancelled
CI/CD Pipeline / Validate - Type Check (mypy) (push) Has been cancelled
CI/CD Pipeline / Validate - Migration (alembic) (push) Has been cancelled
CI/CD Pipeline / Unit Tests (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (push) Has been cancelled
CI/CD Pipeline / PR Build API Image (push) Has been cancelled
CI/CD Pipeline / PR Build Web Image (push) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (push) Has been cancelled
CI/CD Pipeline / Build Staging API Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Web Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Worker Image (push) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (push) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (push) Has been cancelled
CI/CD Pipeline / Build Production API Image (push) Has been cancelled
CI/CD Pipeline / Build Production Web Image (push) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (push) Has been cancelled
CI/CD Pipeline / Deploy Production (push) Has been cancelled
CI/CD Pipeline / Production Browser E2E (push) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (push) Has been cancelled
CI/CD Pipeline / Canary Release to Production (push) Has been cancelled
CI/CD Pipeline / CI Gate (push) Has been cancelled
91 lines
2.0 KiB
TypeScript
Executable File
91 lines
2.0 KiB
TypeScript
Executable File
/**
|
|
* 任务历史页面 — V21 设计系统
|
|
* 页面头部 + 圆角胶囊 Tab 筛选(含计数)+ 卡片式任务列表 + 分页 + 空状态
|
|
*/
|
|
import React from "react"
|
|
import { PageHeader, LoadingState, ErrorState, EmptyState } from "./components/States"
|
|
import { HistoryTabs, TaskItem, Pagination } from "./components/TaskList"
|
|
import { useTaskHistory } from "./hooks/useTaskHistory"
|
|
import "./history.css"
|
|
|
|
const TaskHistory: React.FC = () => {
|
|
const {
|
|
activeTab,
|
|
currentPage,
|
|
totalPages,
|
|
tabs,
|
|
tabCounts,
|
|
paginatedTasks,
|
|
isLoading,
|
|
isError,
|
|
error,
|
|
retryLoading,
|
|
setCurrentPage,
|
|
handleTabChange,
|
|
handleRetry,
|
|
handleView,
|
|
refetch,
|
|
} = useTaskHistory()
|
|
|
|
// Loading 状态
|
|
if (isLoading) {
|
|
return (
|
|
<div className="xx-history-page">
|
|
<PageHeader />
|
|
<LoadingState />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
// Error 状态
|
|
if (isError) {
|
|
return (
|
|
<div className="xx-history-page">
|
|
<PageHeader />
|
|
<ErrorState message={error?.message} onRetry={() => refetch()} />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
const totalCount = tabCounts[activeTab] ?? paginatedTasks.length
|
|
|
|
return (
|
|
<div className="xx-history-page">
|
|
<PageHeader />
|
|
|
|
<HistoryTabs
|
|
tabs={tabs}
|
|
activeTab={activeTab}
|
|
tabCounts={tabCounts}
|
|
onChange={handleTabChange}
|
|
/>
|
|
|
|
{/* 任务列表 */}
|
|
{paginatedTasks.length === 0 ? (
|
|
<EmptyState activeTab={activeTab} />
|
|
) : (
|
|
<div className="xx-history-task-list">
|
|
{paginatedTasks.map((task) => (
|
|
<TaskItem
|
|
key={task.id}
|
|
task={task}
|
|
onRetry={handleRetry}
|
|
onView={handleView}
|
|
retryLoading={retryLoading}
|
|
/>
|
|
))}
|
|
</div>
|
|
)}
|
|
|
|
<Pagination
|
|
currentPage={currentPage}
|
|
totalPages={totalPages}
|
|
total={totalCount}
|
|
onChange={setCurrentPage}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default TaskHistory
|