fix: align frontend interfaces with backend DTO field names

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-03-17 16:36:11 +01:00
parent 329e4b0b16
commit 038b663b8c
7 changed files with 153 additions and 168 deletions

View File

@@ -2,47 +2,54 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { adminFetch } from './admin-api';
export interface OpenSearchStatus {
connected: boolean;
clusterName: string;
reachable: boolean;
clusterHealth: string;
version: string;
numberOfNodes: number;
nodeCount: number;
host: string;
}
export interface PipelineStats {
queueDepth: number;
maxQueueSize: number;
totalIndexed: number;
totalFailed: number;
avgLatencyMs: number;
indexedCount: number;
failedCount: number;
debounceMs: number;
indexingRate: number;
lastIndexedAt: string | null;
}
export interface IndexInfo {
name: string;
health: string;
status: string;
docsCount: number;
storeSize: string;
docCount: number;
size: string;
sizeBytes: number;
primaryShards: number;
replicas: number;
replicaShards: number;
}
export interface IndicesPageResponse {
indices: IndexInfo[];
totalIndices: number;
totalDocs: number;
totalSize: string;
page: number;
pageSize: number;
totalPages: number;
}
export interface PerformanceStats {
queryCacheHitRate: number;
requestCacheHitRate: number;
avgQueryLatencyMs: number;
avgIndexLatencyMs: number;
jvmHeapUsedPercent: number;
searchLatencyMs: number;
indexingLatencyMs: number;
jvmHeapUsedBytes: number;
jvmHeapMaxBytes: number;
}
export interface IndicesParams {
search?: string;
health?: string;
sortBy?: string;
sortDir?: 'asc' | 'desc';
page?: number;
size?: number;
}
@@ -65,9 +72,6 @@ export function usePipelineStats() {
export function useIndices(params: IndicesParams) {
const query = new URLSearchParams();
if (params.search) query.set('search', params.search);
if (params.health) query.set('health', params.health);
if (params.sortBy) query.set('sortBy', params.sortBy);
if (params.sortDir) query.set('sortDir', params.sortDir);
if (params.page !== undefined) query.set('page', String(params.page));
if (params.size !== undefined) query.set('size', String(params.size));
const qs = query.toString();
@@ -75,7 +79,7 @@ export function useIndices(params: IndicesParams) {
return useQuery({
queryKey: ['admin', 'opensearch', 'indices', params],
queryFn: () =>
adminFetch<{ indices: IndexInfo[]; total: number }>(
adminFetch<IndicesPageResponse>(
`/opensearch/indices${qs ? `?${qs}` : ''}`,
),
});