(src)
| 2112 | }; |
| 2113 | |
| 2114 | const fillForm = (src) => { |
| 2115 | if (!src || typeof src !== 'object') return; |
| 2116 | editingId = String(src.id || ''); |
| 2117 | formTitleEl.textContent = tf('source_edit', 'Edit Source'); |
| 2118 | if (sourceIdEl) { |
| 2119 | sourceIdEl.value = src.id || ''; |
| 2120 | sourceIdEl.disabled = true; |
| 2121 | } |
| 2122 | if (sourceNameEl) sourceNameEl.value = src.name || ''; |
| 2123 | if (sourceEnabledEl) sourceEnabledEl.checked = src.enabled !== false; |
| 2124 | if (sourceReadOnlyEl) sourceReadOnlyEl.checked = !!src.readOnly; |
| 2125 | if (sourceDisableTrashEl) sourceDisableTrashEl.checked = !!src.disableTrash; |
| 2126 | const type = (src.type || 'local').toLowerCase(); |
| 2127 | setType(type); |
| 2128 | const cfg = src.config || {}; |
| 2129 | if (localPathEl) localPathEl.value = cfg.path || cfg.root || ''; |
| 2130 | if (s3BucketEl) s3BucketEl.value = cfg.bucket || ''; |
| 2131 | if (s3RegionEl) s3RegionEl.value = cfg.region || ''; |
| 2132 | if (s3EndpointEl) s3EndpointEl.value = cfg.endpoint || ''; |
| 2133 | if (s3PrefixEl) s3PrefixEl.value = cfg.prefix || ''; |
| 2134 | if (s3PathStyleEl) s3PathStyleEl.checked = !!cfg.pathStyle; |
| 2135 | if (sftpHostEl) sftpHostEl.value = cfg.host || ''; |
| 2136 | if (sftpPortEl) sftpPortEl.value = cfg.port || ''; |
| 2137 | if (sftpUsernameEl) sftpUsernameEl.value = cfg.username || ''; |
| 2138 | if (sftpRootEl) sftpRootEl.value = cfg.root || cfg.path || ''; |
| 2139 | if (ftpHostEl) ftpHostEl.value = cfg.host || ''; |
| 2140 | if (ftpPortEl) ftpPortEl.value = cfg.port || ''; |
| 2141 | if (ftpUsernameEl) ftpUsernameEl.value = cfg.username || ''; |
| 2142 | if (ftpSslEl) ftpSslEl.checked = !!cfg.ssl; |
| 2143 | if (ftpPassiveEl) { |
| 2144 | const passive = (typeof cfg.passive === 'undefined') ? true : !!cfg.passive; |
| 2145 | ftpPassiveEl.checked = passive; |
| 2146 | } |
| 2147 | if (ftpRootEl) ftpRootEl.value = cfg.root || cfg.path || ''; |
| 2148 | if (webdavUrlEl) webdavUrlEl.value = cfg.baseUrl || cfg.url || ''; |
| 2149 | if (webdavUsernameEl) webdavUsernameEl.value = cfg.username || ''; |
| 2150 | if (webdavRootEl) webdavRootEl.value = cfg.root || cfg.path || ''; |
| 2151 | if (webdavVerifyTlsEl) { |
| 2152 | webdavVerifyTlsEl.checked = (typeof cfg.verifyTls === 'undefined') ? true : !!cfg.verifyTls; |
| 2153 | } |
| 2154 | if (smbHostEl) smbHostEl.value = cfg.host || ''; |
| 2155 | if (smbShareEl) smbShareEl.value = cfg.share || ''; |
| 2156 | if (smbUsernameEl) smbUsernameEl.value = cfg.username || ''; |
| 2157 | if (smbDomainEl) smbDomainEl.value = cfg.domain || ''; |
| 2158 | if (smbVersionEl) smbVersionEl.value = cfg.version || ''; |
| 2159 | if (smbRootEl) smbRootEl.value = cfg.root || cfg.path || ''; |
| 2160 | if (gdriveClientIdEl) gdriveClientIdEl.value = cfg.clientId || ''; |
| 2161 | if (gdriveRootIdEl) gdriveRootIdEl.value = cfg.rootId || ''; |
| 2162 | if (gdriveDriveIdEl) gdriveDriveIdEl.value = cfg.driveId || ''; |
| 2163 | if (onedriveClientIdEl) onedriveClientIdEl.value = cfg.clientId || ''; |
| 2164 | if (onedriveTenantEl) onedriveTenantEl.value = cfg.tenant || ''; |
| 2165 | if (onedriveDriveIdEl) onedriveDriveIdEl.value = cfg.driveId || ''; |
| 2166 | if (onedriveSiteIdEl) onedriveSiteIdEl.value = cfg.siteId || ''; |
| 2167 | if (onedriveRootPathEl) onedriveRootPathEl.value = cfg.rootPath || ''; |
| 2168 | if (dropboxAppKeyEl) dropboxAppKeyEl.value = cfg.appKey || ''; |
| 2169 | if (dropboxRootPathEl) dropboxRootPathEl.value = cfg.rootPath || ''; |
| 2170 | if (dropboxTeamMemberIdEl) dropboxTeamMemberIdEl.value = cfg.teamMemberId || ''; |
| 2171 | if (dropboxRootNamespaceIdEl) dropboxRootNamespaceIdEl.value = cfg.rootNamespaceId || ''; |
no test coverage detected