Files
cameleer-server/ui/src/components/StartupLogPanel.tsx
hsiegeln 33b0bc4d98
Some checks failed
CI / cleanup-branch (push) Has been skipped
CI / docker (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / deploy-feature (push) Has been cancelled
CI / build (push) Has been cancelled
fix: cast LogEntryResponse to LogEntry for StartupLogPanel type safety
The DS LogViewer expects level as a string union, but the API response
type uses plain string. Cast at the call site to fix the TS build error.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 23:56:01 +02:00

48 lines
1.6 KiB
TypeScript

import { LogViewer } from '@cameleer/design-system';
import type { LogEntry } from '@cameleer/design-system';
import { useStartupLogs } from '../api/queries/logs';
import type { Deployment } from '../api/queries/admin/apps';
import styles from './StartupLogPanel.module.css';
interface StartupLogPanelProps {
deployment: Deployment;
appSlug: string;
envSlug: string;
}
export function StartupLogPanel({ deployment, appSlug, envSlug }: StartupLogPanelProps) {
const isStarting = deployment.status === 'STARTING';
const isFailed = deployment.status === 'FAILED';
const { data } = useStartupLogs(appSlug, envSlug, deployment.createdAt, isStarting);
const entries = data?.data ?? [];
if (entries.length === 0 && !isStarting) return null;
return (
<div className={styles.panel}>
<div className={styles.header}>
<div className={styles.headerLeft}>
<span className={styles.title}>Startup Logs</span>
{isStarting && (
<>
<span className={`${styles.badge} ${styles.badgeLive}`}> live</span>
<span className={styles.pollingHint}>polling every 3s</span>
</>
)}
{isFailed && (
<span className={`${styles.badge} ${styles.badgeStopped}`}>stopped</span>
)}
</div>
<span className={styles.lineCount}>{entries.length} lines</span>
</div>
{entries.length > 0 ? (
<LogViewer entries={entries as unknown as LogEntry[]} maxHeight={300} />
) : (
<div className={styles.empty}>Waiting for container output...</div>
)}
</div>
);
}