mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-03 20:44:36 +00:00
unified standard
This commit is contained in:
@@ -16,10 +16,7 @@ import {
|
||||
FileText,
|
||||
RotateCcw,
|
||||
Filter,
|
||||
TrendingUp,
|
||||
Calendar,
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
} from 'lucide-react';
|
||||
import {
|
||||
Table,
|
||||
@@ -43,13 +40,7 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
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 { toast } from 'sonner';
|
||||
|
||||
@@ -142,7 +133,6 @@ export default function WorkflowExecutionsTab({
|
||||
// Statistics
|
||||
const [stats, setStats] = useState<WorkflowStats | null>(null);
|
||||
const [statsLoading, setStatsLoading] = useState(false);
|
||||
const [showStats, setShowStats] = useState(true);
|
||||
|
||||
// Logs
|
||||
const [executionLogs, setExecutionLogs] = useState<ExecutionLog[]>([]);
|
||||
@@ -331,107 +321,44 @@ export default function WorkflowExecutionsTab({
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
{/* Statistics Panel */}
|
||||
<Collapsible open={showStats} onOpenChange={setShowStats}>
|
||||
<CollapsibleTrigger asChild>
|
||||
<Button variant="ghost" className="w-full justify-between p-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<TrendingUp className="size-4" />
|
||||
<span className="font-medium">{t('workflows.statistics')}</span>
|
||||
{/* Monitoring Logs Panel */}
|
||||
<div>
|
||||
<p className="text-sm text-gray-500 dark:text-gray-400 mb-4">
|
||||
{t('workflows.monitoringDescription')}
|
||||
</p>
|
||||
{statsLoading ? (
|
||||
<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>
|
||||
{showStats ? (
|
||||
<ChevronUp className="size-4" />
|
||||
) : (
|
||||
<ChevronDown className="size-4" />
|
||||
)}
|
||||
</Button>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
{statsLoading ? (
|
||||
<div className="flex items-center justify-center py-8">
|
||||
<Loader2 className="size-6 animate-spin text-muted-foreground" />
|
||||
<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.successRate')}
|
||||
</div>
|
||||
<div className="text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1">
|
||||
{((stats.success_rate ?? 0) * 100).toFixed(1)}%
|
||||
</div>
|
||||
</div>
|
||||
) : stats ? (
|
||||
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 p-4">
|
||||
<Card>
|
||||
<CardHeader className="pb-2">
|
||||
<CardTitle className="text-sm font-medium text-muted-foreground">
|
||||
{t('workflows.totalExecutions', {
|
||||
count: stats.total_executions ?? 0,
|
||||
})}
|
||||
</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 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.monitoringErrorLogs')}
|
||||
</div>
|
||||
<div className="text-2xl font-bold text-red-600 dark:text-red-400 mt-1">
|
||||
{stats.failed_executions ?? 0}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center py-4 text-sm text-muted-foreground">
|
||||
{t('workflows.noExecutions')}
|
||||
</div>
|
||||
)}
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{/* Toolbar with Filters */}
|
||||
<div className="flex flex-col md:flex-row items-start md:items-center justify-between gap-4">
|
||||
|
||||
@@ -1419,7 +1419,10 @@ const enUS = {
|
||||
updatedAt: 'Updated At',
|
||||
// Executions tab
|
||||
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',
|
||||
successRate: 'Success Rate',
|
||||
averageDuration: 'Avg. Duration',
|
||||
|
||||
@@ -1436,7 +1436,10 @@ const esES = {
|
||||
updatedAt: 'Fecha de actualización',
|
||||
// Executions tab
|
||||
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',
|
||||
successRate: 'Tasa de éxito',
|
||||
averageDuration: 'Duración promedio',
|
||||
|
||||
@@ -1404,7 +1404,10 @@
|
||||
updatedAt: '更新日時',
|
||||
// Executions tab
|
||||
totalExecutions: '合計{{count}}件の実行',
|
||||
statistics: '統計分析',
|
||||
statistics: 'モニタリングログ',
|
||||
monitoringDescription: 'このワークフローの実行履歴とエラー情報を表示(過去24時間)',
|
||||
monitoringTotalMessages: '総メッセージ数',
|
||||
monitoringErrorLogs: 'エラーログ',
|
||||
successfulCount: '成功{{count}}件',
|
||||
successRate: '成功率',
|
||||
averageDuration: '平均所要時間',
|
||||
|
||||
@@ -1407,7 +1407,10 @@ const ruRU = {
|
||||
updatedAt: 'Дата обновления',
|
||||
// Executions tab
|
||||
totalExecutions: 'Всего {{count}} записей выполнения',
|
||||
statistics: 'Статистический анализ',
|
||||
statistics: 'Журналы мониторинга',
|
||||
monitoringDescription: 'Просмотр истории выполнения и ошибок этого рабочего процесса (за последние 24 часа)',
|
||||
monitoringTotalMessages: 'Всего сообщений',
|
||||
monitoringErrorLogs: 'Журналы ошибок',
|
||||
successfulCount: '{{count}} успешных',
|
||||
successRate: 'Процент успеха',
|
||||
averageDuration: 'Средняя длительность',
|
||||
|
||||
@@ -1376,7 +1376,10 @@ const thTH = {
|
||||
updatedAt: 'เวลาอัปเดต',
|
||||
// Executions tab
|
||||
totalExecutions: 'ทั้งหมด {{count}} บันทึกการดำเนินการ',
|
||||
statistics: 'สถิติการวิเคราะห์',
|
||||
statistics: 'บันทึกการตรวจสอบ',
|
||||
monitoringDescription: 'ดูประวัติการทำงานและข้อผิดพลาดของเวิร์กโฟลว์นี้ (24 ชั่วโมงล่าสุด)',
|
||||
monitoringTotalMessages: 'ข้อความทั้งหมด',
|
||||
monitoringErrorLogs: 'บันทึกข้อผิดพลาด',
|
||||
successfulCount: 'สำเร็จ {{count}} ครั้ง',
|
||||
successRate: 'อัตราความสำเร็จ',
|
||||
averageDuration: 'ระยะเวลาเฉลี่ย',
|
||||
|
||||
@@ -1398,7 +1398,10 @@ const viVN = {
|
||||
updatedAt: 'Thời gian cập nhật',
|
||||
// Executions tab
|
||||
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',
|
||||
successRate: 'Tỷ lệ thành công',
|
||||
averageDuration: 'Thời lượng trung bình',
|
||||
|
||||
@@ -1358,7 +1358,10 @@ const zhHans = {
|
||||
updatedAt: '更新时间',
|
||||
// Executions tab
|
||||
totalExecutions: '共 {{count}} 条执行记录',
|
||||
statistics: '统计分析',
|
||||
statistics: '监控日志',
|
||||
monitoringDescription: '查看此工作流的运行记录和错误信息(最近24小时)',
|
||||
monitoringTotalMessages: '总消息数',
|
||||
monitoringErrorLogs: '错误日志',
|
||||
successfulCount: '成功 {{count}} 次',
|
||||
successRate: '成功率',
|
||||
averageDuration: '平均耗时',
|
||||
|
||||
@@ -1339,7 +1339,10 @@ const zhHant = {
|
||||
updatedAt: '更新時間',
|
||||
// Executions tab
|
||||
totalExecutions: '共 {{count}} 次執行',
|
||||
statistics: '統計資訊',
|
||||
statistics: '監控日誌',
|
||||
monitoringDescription: '查看此工作流的運行記錄和錯誤信息(最近24小時)',
|
||||
monitoringTotalMessages: '總訊息數',
|
||||
monitoringErrorLogs: '錯誤日誌',
|
||||
successfulCount: '{{count}} 次成功',
|
||||
successRate: '成功率',
|
||||
averageDuration: '平均時長',
|
||||
|
||||
Reference in New Issue
Block a user