(selectEl, sources, activeId)
| 286 | } |
| 287 | |
| 288 | function 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 | |
| 310 | async function loadMoveFolderTargets(sourceFolder, sourceId) { |
| 311 | const targetSel = document.getElementById('moveFolderTarget'); |
no test coverage detected