diff --git a/editor/js/ui/projects/projectUserSettings.js b/editor/js/ui/projects/projectUserSettings.js index 021d47736..a4501bb0f 100644 --- a/editor/js/ui/projects/projectUserSettings.js +++ b/editor/js/ui/projects/projectUserSettings.js @@ -44,32 +44,44 @@ RED.projects.userSettings = (function() { function createSSHKeySection(pane) { var container = $('
').appendTo(pane); var popover; - var title = $('').text("SSH Keys").appendTo(container); + var title = $('').text("SSH Keys").appendTo(container); + var subtitle = $('').appendTo(container).text("Allows you to create secure connections to remote git repositories."); - var addKeyButton = $('') - .appendTo(title) + var addKeyButton = $('') + .appendTo(subtitle) .click(function(evt) { addKeyButton.attr('disabled',true); + saveButton.attr('disabled',true); + // bg.children().removeClass("selected"); + // addLocalButton.click(); addKeyDialog.slideDown(200); keyNameInput.focus(); - saveButton.attr('disabled',true); }); var validateForm = function() { - var validName = /^[a-zA-Z0-9\-_]+$/.test(keyNameInput.val()); - var passphrase = passphraseInput.val(); - var validPassphrase = passphrase.length === 0 || passphrase.length >= 8; + var valid = /^[a-zA-Z0-9\-_]+$/.test(keyNameInput.val()); + keyNameInput.toggleClass('input-error',keyNameInputChanged&&!valid); - saveButton.attr('disabled',!validName || !validPassphrase); - keyNameInput.toggleClass('input-error',keyNameInputChanged&&!validName); - passphraseInput.toggleClass('input-error',!validPassphrase); - if (!validPassphrase) { - passphraseInputSubLabel.text("Passphrase too short"); - } else if (passphrase.length === 0) { - passphraseInputSubLabel.text("Optional"); - } else { - passphraseInputSubLabel.text(""); - } + // var selectedButton = bg.find(".selected"); + // if (selectedButton[0] === addLocalButton[0]) { + // valid = valid && localPublicKeyPathInput.val().length > 0 && localPrivateKeyPathInput.val().length > 0; + // } else if (selectedButton[0] === uploadButton[0]) { + // valid = valid && publicKeyInput.val().length > 0 && privateKeyInput.val().length > 0; + // } else if (selectedButton[0] === generateButton[0]) { + var passphrase = passphraseInput.val(); + var validPassphrase = passphrase.length === 0 || passphrase.length >= 8; + passphraseInput.toggleClass('input-error',!validPassphrase); + if (!validPassphrase) { + passphraseInputSubLabel.text("Passphrase too short"); + } else if (passphrase.length === 0) { + passphraseInputSubLabel.text("Optional"); + } else { + passphraseInputSubLabel.text(""); + } + valid = valid && validPassphrase; + // } + + saveButton.attr('disabled',!valid); if (popover) { popover.close(); @@ -79,27 +91,88 @@ RED.projects.userSettings = (function() { var row = $('').appendTo(container); var addKeyDialog = $('').hide().appendTo(row); - $('