MCPcopy Create free account
hub / github.com/error311/FileRise / populateMoveSourceSelect

Function populateMoveSourceSelect

public/js/folderManager.js:288–308  ·  view source on GitHub ↗
(selectEl, sources, activeId)

Source from the content-addressed store, hash-verified

286}
287
288function populateMoveSourceSelect(selectEl, sources, activeId) {
289 if (!selectEl) return;
290 selectEl.innerHTML = '';
291 sources.forEach(src => {
292 if (!src || typeof src !== 'object') return;
293 const id = String(src.id || '');
294 if (!id) return;
295 const name = String(src.name || id);
296 const type = String(src.type || '');
297 const ro = src.readOnly ? ` \uD83D\uDD12 ${t('read_only')}` : '';
298 const label = type ? `${name} (${type})${ro}` : `${name}${ro}`;
299 const opt = document.createElement('option');
300 opt.value = id;
301 opt.textContent = label;
302 if (src.readOnly) opt.disabled = true;
303 selectEl.appendChild(opt);
304 });
305 if (!selectEl.options.length) return;
306 const hasActive = Array.from(selectEl.options).some(opt => opt.value === activeId && !opt.disabled);
307 selectEl.value = hasActive ? activeId : selectEl.options[0].value;
308}
309
310async function loadMoveFolderTargets(sourceFolder, sourceId) {
311 const targetSel = document.getElementById('moveFolderTarget');

Callers 1

Calls 1

tFunction · 0.85

Tested by

no test coverage detected