unified standard

This commit is contained in:
Typer_Body
2026-05-16 00:09:57 +08:00
parent c088dc114f
commit 27c0d344bf
9 changed files with 67 additions and 116 deletions
@@ -16,10 +16,7 @@ import {
FileText, FileText,
RotateCcw, RotateCcw,
Filter, Filter,
TrendingUp,
Calendar, Calendar,
ChevronDown,
ChevronUp,
} from 'lucide-react'; } from 'lucide-react';
import { import {
Table, Table,
@@ -43,13 +40,7 @@ import {
SelectTrigger, SelectTrigger,
SelectValue, SelectValue,
} from '@/components/ui/select'; } from '@/components/ui/select';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from '@/components/ui/collapsible';
import { ScrollArea } from '@/components/ui/scroll-area'; import { ScrollArea } from '@/components/ui/scroll-area';
import { toast } from 'sonner'; import { toast } from 'sonner';
@@ -142,7 +133,6 @@ export default function WorkflowExecutionsTab({
// Statistics // Statistics
const [stats, setStats] = useState<WorkflowStats | null>(null); const [stats, setStats] = useState<WorkflowStats | null>(null);
const [statsLoading, setStatsLoading] = useState(false); const [statsLoading, setStatsLoading] = useState(false);
const [showStats, setShowStats] = useState(true);
// Logs // Logs
const [executionLogs, setExecutionLogs] = useState<ExecutionLog[]>([]); const [executionLogs, setExecutionLogs] = useState<ExecutionLog[]>([]);
@@ -331,107 +321,44 @@ export default function WorkflowExecutionsTab({
return ( return (
<div className="space-y-4"> <div className="space-y-4">
{/* Statistics Panel */} {/* Monitoring Logs Panel */}
<Collapsible open={showStats} onOpenChange={setShowStats}> <div>
<CollapsibleTrigger asChild> <p className="text-sm text-gray-500 dark:text-gray-400 mb-4">
<Button variant="ghost" className="w-full justify-between p-2"> {t('workflows.monitoringDescription')}
<div className="flex items-center gap-2"> </p>
<TrendingUp className="size-4" /> {statsLoading ? (
<span className="font-medium">{t('workflows.statistics')}</span> <div className="flex items-center justify-center py-8">
<Loader2 className="size-6 animate-spin text-muted-foreground" />
</div>
) : stats ? (
<div className="grid grid-cols-3 gap-4 mb-6">
<div className="bg-white dark:bg-[#2a2a2e] rounded-lg border border-gray-200 dark:border-gray-700 p-4">
<div className="text-sm text-gray-500 dark:text-gray-400">
{t('workflows.monitoringTotalMessages')}
</div>
<div className="text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1">
{stats.total_executions ?? 0}
</div>
</div> </div>
{showStats ? ( <div className="bg-white dark:bg-[#2a2a2e] rounded-lg border border-gray-200 dark:border-gray-700 p-4">
<ChevronUp className="size-4" /> <div className="text-sm text-gray-500 dark:text-gray-400">
) : ( {t('workflows.successRate')}
<ChevronDown className="size-4" /> </div>
)} <div className="text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1">
</Button> {((stats.success_rate ?? 0) * 100).toFixed(1)}%
</CollapsibleTrigger> </div>
<CollapsibleContent>
{statsLoading ? (
<div className="flex items-center justify-center py-8">
<Loader2 className="size-6 animate-spin text-muted-foreground" />
</div> </div>
) : stats ? ( <div className="bg-white dark:bg-[#2a2a2e] rounded-lg border border-gray-200 dark:border-gray-700 p-4">
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 p-4"> <div className="text-sm text-gray-500 dark:text-gray-400">
<Card> {t('workflows.monitoringErrorLogs')}
<CardHeader className="pb-2"> </div>
<CardTitle className="text-sm font-medium text-muted-foreground"> <div className="text-2xl font-bold text-red-600 dark:text-red-400 mt-1">
{t('workflows.totalExecutions', { {stats.failed_executions ?? 0}
count: stats.total_executions ?? 0, </div>
})}
</CardTitle>
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">
{stats.total_executions ?? 0}
</div>
<p className="text-xs text-muted-foreground mt-1">
{t('workflows.successfulCount', {
count: stats.successful_executions ?? 0,
})}
</p>
</CardContent>
</Card>
<Card>
<CardHeader className="pb-2">
<CardTitle className="text-sm font-medium text-muted-foreground">
{t('workflows.successRate')}
</CardTitle>
</CardHeader>
<CardContent>
<div className="text-2xl font-bold text-green-600 dark:text-green-400">
{((stats.success_rate ?? 0) * 100).toFixed(1)}%
</div>
<p className="text-xs text-muted-foreground mt-1">
{stats.successful_executions ?? 0} /{' '}
{stats.total_executions ?? 0}
</p>
</CardContent>
</Card>
<Card>
<CardHeader className="pb-2">
<CardTitle className="text-sm font-medium text-muted-foreground">
{t('workflows.averageDuration')}
</CardTitle>
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">
{formatDuration((stats.average_duration_ms ?? 0) / 1000)}
</div>
<p className="text-xs text-muted-foreground mt-1">
{t('workflows.perExecution')}
</p>
</CardContent>
</Card>
<Card>
<CardHeader className="pb-2">
<CardTitle className="text-sm font-medium text-muted-foreground">
{t('workflows.failedExecutions')}
</CardTitle>
</CardHeader>
<CardContent>
<div className="text-2xl font-bold text-red-600 dark:text-red-400">
{stats.failed_executions ?? 0}
</div>
{stats.last_execution_time && (
<p className="text-xs text-muted-foreground mt-1">
{t('workflows.lastExecution')}:{' '}
{new Date(stats.last_execution_time).toLocaleDateString()}
</p>
)}
</CardContent>
</Card>
</div> </div>
) : ( </div>
<div className="text-center py-4 text-sm text-muted-foreground"> ) : null}
{t('workflows.noExecutions')} </div>
</div>
)}
</CollapsibleContent>
</Collapsible>
{/* Toolbar with Filters */} {/* Toolbar with Filters */}
<div className="flex flex-col md:flex-row items-start md:items-center justify-between gap-4"> <div className="flex flex-col md:flex-row items-start md:items-center justify-between gap-4">
+4 -1
View File
@@ -1419,7 +1419,10 @@ const enUS = {
updatedAt: 'Updated At', updatedAt: 'Updated At',
// Executions tab // Executions tab
totalExecutions: '{{count}} execution(s) total', totalExecutions: '{{count}} execution(s) total',
statistics: 'Statistics', statistics: 'Monitoring Logs',
monitoringDescription: 'View run history and errors for this workflow (last 24 hours)',
monitoringTotalMessages: 'Total Messages',
monitoringErrorLogs: 'Error Logs',
successfulCount: '{{count}} successful', successfulCount: '{{count}} successful',
successRate: 'Success Rate', successRate: 'Success Rate',
averageDuration: 'Avg. Duration', averageDuration: 'Avg. Duration',
+4 -1
View File
@@ -1436,7 +1436,10 @@ const esES = {
updatedAt: 'Fecha de actualización', updatedAt: 'Fecha de actualización',
// Executions tab // Executions tab
totalExecutions: 'Total de {{count}} registros de ejecución', totalExecutions: 'Total de {{count}} registros de ejecución',
statistics: 'Análisis estadístico', statistics: 'Registros de monitoreo',
monitoringDescription: 'Ver historial de ejecución y errores de este flujo de trabajo (últimas 24 horas)',
monitoringTotalMessages: 'Total de mensajes',
monitoringErrorLogs: 'Registros de errores',
successfulCount: '{{count}} éxitos', successfulCount: '{{count}} éxitos',
successRate: 'Tasa de éxito', successRate: 'Tasa de éxito',
averageDuration: 'Duración promedio', averageDuration: 'Duración promedio',
+4 -1
View File
@@ -1404,7 +1404,10 @@
updatedAt: '更新日時', updatedAt: '更新日時',
// Executions tab // Executions tab
totalExecutions: '合計{{count}}件の実行', totalExecutions: '合計{{count}}件の実行',
statistics: '統計分析', statistics: 'モニタリングログ',
monitoringDescription: 'このワークフローの実行履歴とエラー情報を表示(過去24時間)',
monitoringTotalMessages: '総メッセージ数',
monitoringErrorLogs: 'エラーログ',
successfulCount: '成功{{count}}件', successfulCount: '成功{{count}}件',
successRate: '成功率', successRate: '成功率',
averageDuration: '平均所要時間', averageDuration: '平均所要時間',
+4 -1
View File
@@ -1407,7 +1407,10 @@ const ruRU = {
updatedAt: 'Дата обновления', updatedAt: 'Дата обновления',
// Executions tab // Executions tab
totalExecutions: 'Всего {{count}} записей выполнения', totalExecutions: 'Всего {{count}} записей выполнения',
statistics: 'Статистический анализ', statistics: 'Журналы мониторинга',
monitoringDescription: 'Просмотр истории выполнения и ошибок этого рабочего процесса (за последние 24 часа)',
monitoringTotalMessages: 'Всего сообщений',
monitoringErrorLogs: 'Журналы ошибок',
successfulCount: '{{count}} успешных', successfulCount: '{{count}} успешных',
successRate: 'Процент успеха', successRate: 'Процент успеха',
averageDuration: 'Средняя длительность', averageDuration: 'Средняя длительность',
+4 -1
View File
@@ -1376,7 +1376,10 @@ const thTH = {
updatedAt: 'เวลาอัปเดต', updatedAt: 'เวลาอัปเดต',
// Executions tab // Executions tab
totalExecutions: 'ทั้งหมด {{count}} บันทึกการดำเนินการ', totalExecutions: 'ทั้งหมด {{count}} บันทึกการดำเนินการ',
statistics: 'สถิติการวิเคราะห์', statistics: 'บันทึกการตรวจสอบ',
monitoringDescription: 'ดูประวัติการทำงานและข้อผิดพลาดของเวิร์กโฟลว์นี้ (24 ชั่วโมงล่าสุด)',
monitoringTotalMessages: 'ข้อความทั้งหมด',
monitoringErrorLogs: 'บันทึกข้อผิดพลาด',
successfulCount: 'สำเร็จ {{count}} ครั้ง', successfulCount: 'สำเร็จ {{count}} ครั้ง',
successRate: 'อัตราความสำเร็จ', successRate: 'อัตราความสำเร็จ',
averageDuration: 'ระยะเวลาเฉลี่ย', averageDuration: 'ระยะเวลาเฉลี่ย',
+4 -1
View File
@@ -1398,7 +1398,10 @@ const viVN = {
updatedAt: 'Thời gian cập nhật', updatedAt: 'Thời gian cập nhật',
// Executions tab // Executions tab
totalExecutions: 'Tổng cộng {{count}} bản ghi thực thi', totalExecutions: 'Tổng cộng {{count}} bản ghi thực thi',
statistics: 'Phân tích thống kê', statistics: 'Nhật ký giám sát',
monitoringDescription: 'Xem lịch sử chạy và lỗi của quy trình làm việc này (24 giờ qua)',
monitoringTotalMessages: 'Tổng số tin nhắn',
monitoringErrorLogs: 'Nhật ký lỗi',
successfulCount: 'Thành công {{count}} lần', successfulCount: 'Thành công {{count}} lần',
successRate: 'Tỷ lệ thành công', successRate: 'Tỷ lệ thành công',
averageDuration: 'Thời lượng trung bình', averageDuration: 'Thời lượng trung bình',
+4 -1
View File
@@ -1358,7 +1358,10 @@ const zhHans = {
updatedAt: '更新时间', updatedAt: '更新时间',
// Executions tab // Executions tab
totalExecutions: '共 {{count}} 条执行记录', totalExecutions: '共 {{count}} 条执行记录',
statistics: '统计分析', statistics: '监控日志',
monitoringDescription: '查看此工作流的运行记录和错误信息(最近24小时)',
monitoringTotalMessages: '总消息数',
monitoringErrorLogs: '错误日志',
successfulCount: '成功 {{count}} 次', successfulCount: '成功 {{count}} 次',
successRate: '成功率', successRate: '成功率',
averageDuration: '平均耗时', averageDuration: '平均耗时',
+4 -1
View File
@@ -1339,7 +1339,10 @@ const zhHant = {
updatedAt: '更新時間', updatedAt: '更新時間',
// Executions tab // Executions tab
totalExecutions: '共 {{count}} 次執行', totalExecutions: '共 {{count}} 次執行',
statistics: '統計資訊', statistics: '監控日誌',
monitoringDescription: '查看此工作流的運行記錄和錯誤信息(最近24小時)',
monitoringTotalMessages: '總訊息數',
monitoringErrorLogs: '錯誤日誌',
successfulCount: '{{count}} 次成功', successfulCount: '{{count}} 次成功',
successRate: '成功率', successRate: '成功率',
averageDuration: '平均時長', averageDuration: '平均時長',