INNER CODE UNIT · JavaScript
populateSourceFilter
Dsadd4/AgentFigureGallery · frontend/reference_gallery/app.js:87
function populateSourceFilter() {
const current = el.sourceFilter.value || "all";
const sources = new Set();
for (const candidate of state.session.candidates || []) {
if (candidate.source_repo) sources.add(candidate.source_repo);
}
el.sourceFilter.innerHTML = '<option value="all">All sources</option>';
for (const source of Array.from(sources).sort()) {
const option = document.createElement("option");
option.value = source;
option.textContent = source;
el.sourceFilter.appendChild(option);
}
el.sourceFilter.value = Array.from(sources).includes(current) ? current : "all";
state.source = el.sourceFilter.value;
}
function statusCounts() {