From bb168d35a859a34122fb46077c8098314a8b195c Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 11 Jan 2018 12:56:49 +0000 Subject: [PATCH] Add warning if no sshkeys configured when cloning --- editor/js/ui/projects/projectUserSettings.js | 3 +-- editor/js/ui/projects/projects.js | 22 ++++++++++++++++++-- editor/sass/projects.scss | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/editor/js/ui/projects/projectUserSettings.js b/editor/js/ui/projects/projectUserSettings.js index a4501bb0f..6b6db3eaf 100644 --- a/editor/js/ui/projects/projectUserSettings.js +++ b/editor/js/ui/projects/projectUserSettings.js @@ -47,7 +47,7 @@ RED.projects.userSettings = (function() { var title = $('

').text("SSH Keys").appendTo(container); var subtitle = $('
').appendTo(container).text("Allows you to create secure connections to remote git repositories."); - var addKeyButton = $('') + var addKeyButton = $('') .appendTo(subtitle) .click(function(evt) { addKeyButton.attr('disabled',true); @@ -410,7 +410,6 @@ RED.projects.userSettings = (function() { RED.settings.set('git', currentGitSettings); } }); - } return { diff --git a/editor/js/ui/projects/projects.js b/editor/js/ui/projects/projects.js index c1a82bc03..a559c798a 100644 --- a/editor/js/ui/projects/projects.js +++ b/editor/js/ui/projects/projects.js @@ -869,7 +869,13 @@ RED.projects = (function() { count++; }); if (count === 0) { - // projectRepoSSHKeySelect + projectRepoSSHKeySelect.addClass("input-error"); + projectRepoSSHKeySelect.attr("disabled",true); + sshwarningRow.show(); + } else { + projectRepoSSHKeySelect.removeClass("input-error"); + projectRepoSSHKeySelect.attr("disabled",false); + sshwarningRow.hide(); } }); @@ -878,6 +884,18 @@ RED.projects = (function() { $('').appendTo(subrow); projectRepoPassphrase = $('').appendTo(subrow); + var sshwarningRow = $('
').hide().appendTo(row); + $('
Before you can clone a repository over ssh you must add an SSH key to access it.
').appendTo(sshwarningRow); + subrow = $('
').appendTo(sshwarningRow); + $('').appendTo(subrow).click(function(e) { + e.preventDefault(); + $('#projects-dialog-cancel').click(); + RED.userSettings.show('gitconfig'); + setTimeout(function() { + $("#user-settings-gitconfig-add-key").click(); + },500); + }); + // // Secret - clone // row = $('
').appendTo(container); // $('').appendTo(row); @@ -892,7 +910,7 @@ RED.projects = (function() { }, buttons: [ { - // id: "clipboard-dialog-cancel", + id: "projects-dialog-cancel", text: RED._("common.label.cancel"), click: function() { $( this ).dialog( "close" ); diff --git a/editor/sass/projects.scss b/editor/sass/projects.scss index bae399898..7829ef516 100644 --- a/editor/sass/projects.scss +++ b/editor/sass/projects.scss @@ -153,7 +153,7 @@ } .projects-dialog-screen-create { min-height: 500px; - button.editor-button { + button.projects-dialog-screen-create-type { height: auto; padding: 10px;