diff --git a/src/public/js/ui/settings.js b/src/public/js/ui/settings.js index 49f020a3e..43bd567c6 100644 --- a/src/public/js/ui/settings.js +++ b/src/public/js/ui/settings.js @@ -373,8 +373,154 @@ PulseApp.ui.settings = (() => { } function renderAdditionalEndpoints() { - // This will be populated based on what additional endpoints exist in config - // For now, we'll support dynamic addition + const safeConfig = currentConfig || {}; + + // Find all additional PVE endpoints (those with _2, _3, etc suffixes) + const pveContainer = document.getElementById('pve-endpoints-container'); + const pbsContainer = document.getElementById('pbs-endpoints-container'); + + if (pveContainer) { + // Look for existing additional PVE endpoints in config + Object.keys(safeConfig).forEach(key => { + if (key.startsWith('PROXMOX_HOST_') && key !== 'PROXMOX_HOST') { + const suffix = key.replace('PROXMOX_HOST_', ''); + if (suffix && !isNaN(suffix)) { + addExistingPveEndpoint(parseInt(suffix), safeConfig); + } + } + }); + } + + if (pbsContainer) { + // Look for existing additional PBS endpoints in config + Object.keys(safeConfig).forEach(key => { + if (key.startsWith('PBS_HOST_') && key !== 'PBS_HOST') { + const suffix = key.replace('PBS_HOST_', ''); + if (suffix && !isNaN(suffix)) { + addExistingPbsEndpoint(parseInt(suffix), safeConfig); + } + } + }); + } + } + + function addExistingPveEndpoint(index, config) { + const container = document.getElementById('pve-endpoints-container'); + if (!container) return; + + // Hide empty state if this is the first endpoint + const emptyState = container.querySelector('.border-dashed'); + if (emptyState) { + emptyState.style.display = 'none'; + } + + const endpointHtml = ` +