import { StatCard, DataTable, ProgressBar } from '@cameleer/design-system'; import type { Column } from '@cameleer/design-system'; import { useClickHouseStatus, useClickHouseTables, useClickHousePerformance, useIndexerPipeline } from '../../api/queries/admin/clickhouse'; import styles from './ClickHouseAdminPage.module.css'; export default function ClickHouseAdminPage() { const { data: status, isError: statusError } = useClickHouseStatus(); const { data: tables } = useClickHouseTables(); const { data: perf } = useClickHousePerformance(); const { data: pipeline } = useIndexerPipeline(); const unreachable = statusError || (status && !status.reachable); const tableColumns: Column[] = [ { key: 'name', header: 'Table', sortable: true }, { key: 'engine', header: 'Engine' }, { key: 'rowCount', header: 'Rows', sortable: true, render: (v) => Number(v).toLocaleString() }, { key: 'dataSize', header: 'Size', sortable: true }, { key: 'partitionCount', header: 'Partitions', sortable: true }, ]; return (
{pipeline && (
Indexer Pipeline
0 ? (pipeline.queueDepth / pipeline.maxQueueSize) * 100 : 0} />
Queue: {pipeline.queueDepth}/{pipeline.maxQueueSize} Indexed: {pipeline.indexedCount.toLocaleString()} Failed: {pipeline.failedCount} Rate: {pipeline.indexingRate.toFixed(1)}/s
)} {perf && (
)}
Tables ({(tables || []).length})
({ ...t, id: t.name }))} sortable pageSize={20} flush />
); }