Skip to content

Commit a209805

Browse files
committed
fix: The issue of total data consumption flex height when the main control list on the home page exceeds 4
1 parent a8139cf commit a209805

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

web/src/components/ui/file-log-viewer.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ export const FileLogViewer: React.FC<FileLogViewerProps> = ({
8989

9090
const data = await response.json();
9191

92-
if (data.success && Array.isArray(data.logs)) {
93-
setLogs(data.logs);
94-
onLogsChangeRef.current?.(data.logs);
92+
if (data.success && data.data && Array.isArray(data.data.logs)) {
93+
// 转换API返回的格式到FileLogEntry格式
94+
const convertedLogs: FileLogEntry[] = data.data.logs.map((log: any) => ({
95+
timestamp: log.timestamp || new Date().toISOString(),
96+
content: log.message || log.content || '',
97+
filePath: log.filePath || 'file'
98+
}));
99+
setLogs(convertedLogs);
100+
onLogsChangeRef.current?.(convertedLogs);
95101
// 延迟滚动到底部
96102
setTimeout(scrollToBottom, 100);
97103
} else {
@@ -264,10 +270,10 @@ export const FileLogViewer: React.FC<FileLogViewerProps> = ({
264270
const lines = log.content.split('\n').filter(line => line.length > 0);
265271
return lines.map((line, lineIndex) => (
266272
<div key={`${index}-${lineIndex}`} className="text-gray-300 leading-5">
267-
<span
268-
className="break-all"
269-
dangerouslySetInnerHTML={{
270-
__html: processAnsiColors(line)
273+
<span
274+
className="break-all"
275+
dangerouslySetInnerHTML={{
276+
__html: line // API已经处理过ANSI颜色,直接使用
271277
}}
272278
/>
273279
</div>

web/src/components/ui/traffic-overview-chart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ function TrafficOverviewChartComponent({
311311
}
312312

313313
return (
314-
<Card as="dl" className="h-full min-h-[400px] dark:border-default-100 border border-transparent">
314+
<Card as="dl" className="h-[470px] dark:border-default-100 border border-transparent">
315315
<section className="flex flex-col flex-nowrap h-full">
316316
<div className="flex flex-col justify-between gap-y-2 p-5 flex-shrink-0">
317317
<div className="flex flex-col gap-y-2">

web/src/pages/dashboard/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,13 +679,13 @@ export default function DashboardPage() {
679679

680680
{/* 主控列表 - 右侧卡片 */}
681681
<div className="lg:h-full">
682-
<Card className="h-full min-h-[400px] dark:border-default-100 border border-transparent">
682+
<Card className=" h-[469px] dark:border-default-100 border border-transparent">
683683
<CardHeader className="p-5 pb-0">
684684
<div className="flex flex-col items-start gap-1 w-full">
685685
<span className="text-base font-semibold text-foreground">主控列表</span>
686686
</div>
687687
</CardHeader>
688-
<CardBody className="p-5 pt-3">
688+
<CardBody className="p-5 pt-3 overflow-y-auto scrollbar-hide">
689689
<div className="space-y-3">
690690
{loading ? (
691691
// 加载状态骨架屏

0 commit comments

Comments
 (0)