// ========================================== // INDEX MANAGER COMPONENT // ========================================== // Manages CodexLens code indexes (vector and normal) // State let indexData = null; let indexLoading = false; /** * Initialize index manager */ async function initIndexManager() { await loadIndexStats(); } /** * Load index statistics from API */ async function loadIndexStats() { if (indexLoading) return; indexLoading = true; try { const res = await fetch('/api/codexlens/indexes'); if (!res.ok) throw new Error('Failed to load index stats'); indexData = await res.json(); renderIndexCard(); } catch (err) { console.error('Failed to load index stats:', err); renderIndexCardError(err.message); } finally { indexLoading = false; } } /** * Render index card in the dashboard */ function renderIndexCard() { const container = document.getElementById('indexCard'); if (!container) { console.warn('[IndexManager] Container not found'); return; } // Handle case when data is not loaded yet if (!indexData) { container.innerHTML = `
| ${t('index.projectId') || 'Project ID'} | ${t('index.size') || 'Size'} | ${t('index.type') || 'Type'} | ${t('index.lastModified') || 'Modified'} |
|---|
${escapeHtml(errorMessage)}