Swapped the two ssh-blocks so Select Private Key dropdown appears first, followed by SSH Private Key Path input.

This commit is contained in:
2026-02-10 16:09:40 +01:00
parent 337d199143
commit 339118d89f
2 changed files with 41 additions and 6 deletions

View File

@@ -406,6 +406,41 @@ function populateSSHKeySelect(keys, selected) {
if (typeof updateTranslations === 'function') {
updateTranslations();
}
// Sync readonly state of the path input
syncSSHKeyPathReadonly();
// Attach change handler once
initSSHKeySelectHandler();
}
// Toggle the SSH key path input between readonly (key selected) and editable (manual entry).
function syncSSHKeyPathReadonly() {
var select = document.getElementById('serverSSHKeySelect');
var input = document.getElementById('serverSSHKey');
if (!select || !input) return;
if (select.value) {
input.readOnly = true;
input.classList.add('bg-gray-100', 'text-gray-500');
} else {
input.readOnly = false;
input.classList.remove('bg-gray-100', 'text-gray-500');
}
}
// Attach a change listener on the select dropdown (once).
var _sshKeySelectHandlerBound = false;
function initSSHKeySelectHandler() {
if (_sshKeySelectHandlerBound) return;
var select = document.getElementById('serverSSHKeySelect');
if (!select) return;
_sshKeySelectHandlerBound = true;
select.addEventListener('change', function() {
var input = document.getElementById('serverSSHKey');
if (!input) return;
if (select.value) {
input.value = select.value;
}
syncSSHKeyPathReadonly();
});
}
function loadSSHKeys() {