diff --git a/static/script.js b/static/script.js index 4210cd3..30f46d0 100644 --- a/static/script.js +++ b/static/script.js @@ -91,6 +91,7 @@ function initializeEventListeners() { // Model management document.getElementById('btn-install').addEventListener('click', openInstallModal); document.getElementById('btn-refresh-models').addEventListener('click', loadModels); + document.getElementById('btn-collapse-all').addEventListener('click', toggleAllFamilies); // Install options document.querySelectorAll('.install-option').forEach(option => { @@ -270,6 +271,8 @@ function renderModels(models) { // Render grouped models container.innerHTML = sortedFamilies.map(family => { const familyModels = grouped[family]; + const installedCount = familyModels.filter(m => m.installed).length; + const notInstalledCount = familyModels.length - installedCount; const familyId = `family-${family.replace(/[^a-zA-Z0-9]/g, '-')}`; return ` @@ -278,7 +281,7 @@ function renderModels(models) {
${escapeHtml(family)} - (${familyModels.length}) + (${installedCount} installed / ${notInstalledCount} not installed)
@@ -391,6 +394,30 @@ function toggleModelFamily(familyId) { } } +function toggleAllFamilies() { + const allContents = document.querySelectorAll('.model-family-content'); + const button = document.getElementById('btn-collapse-all'); + + // Check if any are expanded + const anyExpanded = Array.from(allContents).some(content => !content.classList.contains('collapsed')); + + allContents.forEach(content => { + const header = content.previousElementSibling; + const icon = header.querySelector('.model-family-icon'); + + if (anyExpanded) { + content.classList.add('collapsed'); + icon.textContent = '▶'; + } else { + content.classList.remove('collapsed'); + icon.textContent = '▼'; + } + }); + + // Update button text + button.textContent = anyExpanded ? 'Expand All' : 'Collapse All'; +} + async function deleteModel(modelName) { if (!confirm(`Are you sure you want to delete "${modelName}"?`)) { return; diff --git a/static/style.css b/static/style.css index 4284f66..14f2b9f 100644 --- a/static/style.css +++ b/static/style.css @@ -347,6 +347,14 @@ body { font-weight: 400; } +.count-installed { + color: var(--success); +} + +.count-not-installed { + color: var(--warning); +} + .model-family-content { display: grid; gap: 15px; diff --git a/templates/index.html b/templates/index.html index 174a7af..f7961e6 100644 --- a/templates/index.html +++ b/templates/index.html @@ -63,6 +63,7 @@

Available Models

+