From cf34716a571f762110dae4e8332c4ffd4ec0ea4c Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 23 Jan 2018 11:26:05 +0000 Subject: [PATCH] Tidy up project first-run experience --- editor/js/ui/projects/projects.js | 50 ++++++++++--------- .../localfilesystem/projects/Project.js | 5 ++ 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/editor/js/ui/projects/projects.js b/editor/js/ui/projects/projects.js index 45663e852..52acb1cb5 100644 --- a/editor/js/ui/projects/projects.js +++ b/editor/js/ui/projects/projects.js @@ -198,25 +198,27 @@ RED.projects = (function() { },50); return container; }, - buttons: [ - { - text: "Back", - click: function() { - show('git-config'); + buttons: function(options) { + return [ + { + text: "Back", + click: function() { + show('git-config'); + } + }, + { + id: "projects-dialog-create-name", + disabled: true, + text: "Next", // TODO: nls + class: "primary disabled", + click: function() { + createProjectOptions.name = projectNameInput.val(); + createProjectOptions.summary = projectSummaryInput.val(); + show('default-files', options); + } } - }, - { - id: "projects-dialog-create-name", - disabled: true, - text: "Next", // TODO: nls - class: "primary disabled", - click: function() { - createProjectOptions.name = projectNameInput.val(); - createProjectOptions.summary = projectSummaryInput.val(); - show('default-files'); - } - } - ] + ] + } }; })(), 'default-files': (function() { @@ -341,9 +343,9 @@ RED.projects = (function() { if (RED.settings.flowEncryptionType === 'user') { $('

').text("Your flow credentials file is currently encrypted using the credentialSecret property from your settings file as the key.").appendTo(body); } else if (RED.settings.flowEncryptionType === 'system') { - $('

').text("Your flow credentials file is currently encrypted using a system-generated secret as the key. You should provide a new secret key for this project.").appendTo(body); + $('

').text("Your flow credentials file is currently encrypted using a system-generated key. You should provide a new secret key for this project.").appendTo(body); } - $('

').text("The secret will be copied into the settings for your new project. You can then manage the secret within the editor.").appendTo(body); + $('

').text("The key will be stored separately from your project files. You will need to provide the key to use this project in another instance of Node-RED.").appendTo(body); } } @@ -523,7 +525,9 @@ RED.projects = (function() { } } },createProjectOptions).always(function() { - RED.deploy.setDeployInflight(false); + setTimeout(function() { + RED.deploy.setDeployInflight(false); + },500); }) } } @@ -1160,12 +1164,12 @@ RED.projects = (function() { RED.projects.init(); } var screen = screens[s]; - var container = screen.content(options); + var container = screen.content(options||{}); dialogBody.empty(); var buttons = screen.buttons; if (typeof buttons === 'function') { - buttons = buttons(options); + buttons = buttons(options||{}); } dialog.dialog('option','buttons',buttons); dialogBody.append(container); diff --git a/red/runtime/storage/localfilesystem/projects/Project.js b/red/runtime/storage/localfilesystem/projects/Project.js index c801d0085..ed2120dd5 100644 --- a/red/runtime/storage/localfilesystem/projects/Project.js +++ b/red/runtime/storage/localfilesystem/projects/Project.js @@ -862,6 +862,11 @@ function createProject(user, metadata) { } createProjectDirectory(project).then(function() { var projects = settings.get('projects'); + if (!projects) { + projects = { + projects:{} + } + } projects.projects[project] = {}; if (metadata.hasOwnProperty('credentialSecret')) { projects.projects[project].credentialSecret = metadata.credentialSecret;