Add collapsible card sections with name filtering
Introduces CardSection class that wraps each card grid with a collapsible header and inline filter input. Collapse state persists in localStorage, filter value survives auto-refresh re-renders. When filter is active the add-card button is hidden. Applied to all 13 sections across Targets, Sources, and Profiles tabs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,8 +7,10 @@ import { fetchWithAuth, escapeHtml } from '../core/api.js';
|
||||
import { t } from '../core/i18n.js';
|
||||
import { showToast, showConfirm } from '../core/ui.js';
|
||||
import { Modal } from '../core/modal.js';
|
||||
import { CardSection } from '../core/card-sections.js';
|
||||
|
||||
const profileModal = new Modal('profile-editor-modal');
|
||||
const csProfiles = new CardSection('profiles', { titleKey: 'profiles.title', gridClass: 'devices-grid', addCardOnclick: "openProfileEditor()" });
|
||||
|
||||
// Re-render profiles when language changes (only if tab is active)
|
||||
document.addEventListener('languageChanged', () => {
|
||||
@@ -53,16 +55,10 @@ export async function loadProfiles() {
|
||||
function renderProfiles(profiles, runningTargetIds = new Set()) {
|
||||
const container = document.getElementById('profiles-content');
|
||||
|
||||
let html = '<div class="devices-grid">';
|
||||
for (const p of profiles) {
|
||||
html += createProfileCard(p, runningTargetIds);
|
||||
}
|
||||
html += `<div class="template-card add-template-card" onclick="openProfileEditor()">
|
||||
<div class="add-template-icon">+</div>
|
||||
</div>`;
|
||||
html += '</div>';
|
||||
const cardsHtml = profiles.map(p => createProfileCard(p, runningTargetIds)).join('');
|
||||
container.innerHTML = csProfiles.render(cardsHtml, profiles.length);
|
||||
csProfiles.bind();
|
||||
|
||||
container.innerHTML = html;
|
||||
// Localize data-i18n elements within the profiles container only
|
||||
// (calling global updateAllText() would trigger loadProfiles() again → infinite loop)
|
||||
container.querySelectorAll('[data-i18n]').forEach(el => {
|
||||
|
||||
Reference in New Issue
Block a user