feat: add vendor infrastructure page with PG/CH per-tenant view
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -94,3 +94,88 @@ export function useVendorAuditLog(filters: AuditLogFilters) {
|
||||
queryFn: () => api.get(`/vendor/audit?${params.toString()}`),
|
||||
});
|
||||
}
|
||||
|
||||
// --- Infrastructure ---
|
||||
|
||||
export interface PostgresOverview {
|
||||
version: string;
|
||||
databaseSizeBytes: number;
|
||||
activeConnections: number;
|
||||
}
|
||||
|
||||
export interface TenantPgStats {
|
||||
slug: string;
|
||||
schemaSizeBytes: number;
|
||||
tableCount: number;
|
||||
totalRows: number;
|
||||
}
|
||||
|
||||
export interface TableStats {
|
||||
tableName: string;
|
||||
rowCount: number;
|
||||
dataSizeBytes: number;
|
||||
indexSizeBytes: number;
|
||||
}
|
||||
|
||||
export interface ClickHouseOverview {
|
||||
version: string;
|
||||
uptimeSeconds: number;
|
||||
totalDiskBytes: number;
|
||||
totalUncompressedBytes: number;
|
||||
compressionRatio: number;
|
||||
totalRows: number;
|
||||
activeMerges: number;
|
||||
}
|
||||
|
||||
export interface TenantChStats {
|
||||
tenantId: string;
|
||||
totalRows: number;
|
||||
rowsByTable: Record<string, number>;
|
||||
}
|
||||
|
||||
export interface ChTableStats {
|
||||
tableName: string;
|
||||
rowCount: number;
|
||||
}
|
||||
|
||||
export interface InfraOverview {
|
||||
postgres: PostgresOverview;
|
||||
clickhouse: ClickHouseOverview;
|
||||
}
|
||||
|
||||
export function useInfraOverview() {
|
||||
return useQuery<InfraOverview>({
|
||||
queryKey: ['vendor', 'infrastructure'],
|
||||
queryFn: () => api.get('/vendor/infrastructure'),
|
||||
});
|
||||
}
|
||||
|
||||
export function useInfraPostgres() {
|
||||
return useQuery<{ overview: PostgresOverview; tenants: TenantPgStats[] }>({
|
||||
queryKey: ['vendor', 'infrastructure', 'postgres'],
|
||||
queryFn: () => api.get('/vendor/infrastructure/postgres'),
|
||||
});
|
||||
}
|
||||
|
||||
export function useInfraClickHouse() {
|
||||
return useQuery<{ overview: ClickHouseOverview; tenants: TenantChStats[] }>({
|
||||
queryKey: ['vendor', 'infrastructure', 'clickhouse'],
|
||||
queryFn: () => api.get('/vendor/infrastructure/clickhouse'),
|
||||
});
|
||||
}
|
||||
|
||||
export function useInfraPgDetail(slug: string) {
|
||||
return useQuery<TableStats[]>({
|
||||
queryKey: ['vendor', 'infrastructure', 'postgres', slug],
|
||||
queryFn: () => api.get(`/vendor/infrastructure/postgres/${slug}`),
|
||||
enabled: !!slug,
|
||||
});
|
||||
}
|
||||
|
||||
export function useInfraChDetail(tenantId: string) {
|
||||
return useQuery<ChTableStats[]>({
|
||||
queryKey: ['vendor', 'infrastructure', 'clickhouse', tenantId],
|
||||
queryFn: () => api.get(`/vendor/infrastructure/clickhouse/${tenantId}`),
|
||||
enabled: !!tenantId,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user