From d35784ec612f956814db72d8a751b8f28b68481b Mon Sep 17 00:00:00 2001 From: Hideki Nakamura Date: Mon, 18 Dec 2017 20:46:07 +0900 Subject: [PATCH] Delete unnecessary comment & Add a logic of the error case --- editor/js/ui/projects.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/editor/js/ui/projects.js b/editor/js/ui/projects.js index 4ea645fb8..5810cc1a0 100644 --- a/editor/js/ui/projects.js +++ b/editor/js/ui/projects.js @@ -165,7 +165,7 @@ RED.projects = (function() { } } } - + $("#projects-dialog-create").prop('disabled',!valid).toggleClass('disabled ui-button-disabled ui-state-disabled',!valid); } @@ -417,15 +417,22 @@ RED.projects = (function() { var repoUrl = projectRepoInput.val(); var metaData = {}; if (/^(?:ssh|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?/.test(repoUrl)) { - projectData.git = { - remotes: { - 'origin': { - url: repoUrl, - key_file: getSelectedSSHKey(projectRepoSSHKeySelect).name, - passphrase: projectRepoPassphrase.val() + var selected = getSelectedSSHKey(projectRepoSSHKeySelect); + if ( selected && selected.name ) { + projectData.git = { + remotes: { + 'origin': { + url: repoUrl, + key_file: selected.name, + passphrase: projectRepoPassphrase.val() + } } - } - }; + }; + } + else { + console.log("Error! Can't get selected SSH key path."); + return; + } } else { projectData.git = { @@ -735,10 +742,8 @@ RED.projects = (function() { options = options || {}; var minHeight = "33px"; var maxHeight = options.height || "120px"; - // var container = $('
',{style:"min-height: "+height+"; height: "+height+";"}); var container = $('
',{style:"max-height: "+maxHeight+";"}); - // var sshkeyList = $('
    ',{class:"projects-dialog-sshkey-list", style:"height:"+height}).appendTo(container).editableList({ var sshkeyList = $('
      ',{class:"projects-dialog-sshkey-list", style:"max-height:"+maxHeight+";min-height:"+minHeight+";"}).appendTo(container).editableList({ addButton: false, scrollOnAdd: false,