1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add warning if no sshkeys configured when cloning

This commit is contained in:
Nick O'Leary 2018-01-11 12:56:49 +00:00
parent 3306d30094
commit bb168d35a8
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 22 additions and 5 deletions

View File

@ -47,7 +47,7 @@ RED.projects.userSettings = (function() {
var title = $('<h3></h3>').text("SSH Keys").appendTo(container); var title = $('<h3></h3>').text("SSH Keys").appendTo(container);
var subtitle = $('<div style="color:#aaa;"></div>').appendTo(container).text("Allows you to create secure connections to remote git repositories."); var subtitle = $('<div style="color:#aaa;"></div>').appendTo(container).text("Allows you to create secure connections to remote git repositories.");
var addKeyButton = $('<button class="editor-button editor-button-small" style="float: right; margin-right: 10px;">add key</button>') var addKeyButton = $('<button id="user-settings-gitconfig-add-key" class="editor-button editor-button-small" style="float: right; margin-right: 10px;">add key</button>')
.appendTo(subtitle) .appendTo(subtitle)
.click(function(evt) { .click(function(evt) {
addKeyButton.attr('disabled',true); addKeyButton.attr('disabled',true);
@ -410,7 +410,6 @@ RED.projects.userSettings = (function() {
RED.settings.set('git', currentGitSettings); RED.settings.set('git', currentGitSettings);
} }
}); });
} }
return { return {

View File

@ -869,7 +869,13 @@ RED.projects = (function() {
count++; count++;
}); });
if (count === 0) { 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() {
$('<label for="projects-dialog-screen-create-project-repo-passphrase">Passphrase</label>').appendTo(subrow); $('<label for="projects-dialog-screen-create-project-repo-passphrase">Passphrase</label>').appendTo(subrow);
projectRepoPassphrase = $('<input id="projects-dialog-screen-create-project-repo-passphrase" type="password"></input>').appendTo(subrow); projectRepoPassphrase = $('<input id="projects-dialog-screen-create-project-repo-passphrase" type="password"></input>').appendTo(subrow);
var sshwarningRow = $('<div style="padding: 20px"></div>').hide().appendTo(row);
$('<div class="form-row"><i class="fa fa-warning"></i> Before you can clone a repository over ssh you must add an SSH key to access it.</div>').appendTo(sshwarningRow);
subrow = $('<div style="text-align: center">').appendTo(sshwarningRow);
$('<button class="editor-button">Add an ssh key</button>').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 // // Secret - clone
// row = $('<div class="hide form-row projects-dialog-screen-create-row projects-dialog-screen-create-row-clone"></div>').appendTo(container); // row = $('<div class="hide form-row projects-dialog-screen-create-row projects-dialog-screen-create-row-clone"></div>').appendTo(container);
// $('<label>Credentials encryption key</label>').appendTo(row); // $('<label>Credentials encryption key</label>').appendTo(row);
@ -892,7 +910,7 @@ RED.projects = (function() {
}, },
buttons: [ buttons: [
{ {
// id: "clipboard-dialog-cancel", id: "projects-dialog-cancel",
text: RED._("common.label.cancel"), text: RED._("common.label.cancel"),
click: function() { click: function() {
$( this ).dialog( "close" ); $( this ).dialog( "close" );

View File

@ -153,7 +153,7 @@
} }
.projects-dialog-screen-create { .projects-dialog-screen-create {
min-height: 500px; min-height: 500px;
button.editor-button { button.projects-dialog-screen-create-type {
height: auto; height: auto;
padding: 10px; padding: 10px;