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

Function renderSourceOptions

public/js/adminPanel.js:3818–3841  ·  view source on GitHub ↗
(preferredId = '')

Source from the content-addressed store, hash-verified

3816 };
3817
3818 const renderSourceOptions = (preferredId = '') => {
3819 if (!sourceIdEl) return;
3820 let options = Array.isArray(state.sourceOptions) ? state.sourceOptions.slice() : [];
3821 if (!options.length) {
3822 options = [{ id: 'local', label: 'local - Local' }];
3823 }
3824 if (!options.some((s) => String(s.id || '') === 'local')) {
3825 options.unshift({ id: 'local', label: 'local - Local' });
3826 }
3827
3828 sourceIdEl.innerHTML = '';
3829 options.forEach((src) => {
3830 const id = String(src?.id || '').trim();
3831 if (!id) return;
3832 const option = document.createElement('option');
3833 option.value = id;
3834 option.textContent = String(src?.label || id);
3835 sourceIdEl.appendChild(option);
3836 });
3837
3838 const chosen = String(preferredId || sourceIdEl.value || 'local').trim() || 'local';
3839 const hasChosen = options.some((s) => String(s.id || '') === chosen);
3840 sourceIdEl.value = hasChosen ? chosen : 'local';
3841 };
3842
3843 const loadSourceOptions = async () => {
3844 try {

Callers 3

loadSourceOptionsFunction · 0.85
resetFormFunction · 0.85
fillFormFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected